mptable.c revision 215009
11870Siignatyev/*- 21870Siignatyev * Copyright (c) 2003 John Baldwin <jhb@FreeBSD.org> 31870Siignatyev * Copyright (c) 1996, by Steve Passe 41870Siignatyev * All rights reserved. 51870Siignatyev * 61870Siignatyev * Redistribution and use in source and binary forms, with or without 71870Siignatyev * modification, are permitted provided that the following conditions 81870Siignatyev * are met: 91870Siignatyev * 1. Redistributions of source code must retain the above copyright 101870Siignatyev * notice, this list of conditions and the following disclaimer. 111870Siignatyev * 2. The name of the developer may NOT be used to endorse or promote products 121870Siignatyev * derived from this software without specific prior written permission. 131870Siignatyev * 141870Siignatyev * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 151870Siignatyev * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 161870Siignatyev * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 171870Siignatyev * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 181870Siignatyev * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 191870Siignatyev * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 201870Siignatyev * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 211870Siignatyev * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 221870Siignatyev * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 231870Siignatyev * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 241870Siignatyev * SUCH DAMAGE. 251870Siignatyev */ 261870Siignatyev 271870Siignatyev#include <sys/cdefs.h> 281870Siignatyev__FBSDID("$FreeBSD: head/sys/i386/xen/mptable.c 215009 2010-11-08 20:35:09Z jhb $"); 291870Siignatyev 301870Siignatyev#include <sys/param.h> 311870Siignatyev#include <sys/systm.h> 321870Siignatyev#include <sys/bus.h> 331870Siignatyev#include <sys/kernel.h> 341870Siignatyev#include <sys/malloc.h> 351870Siignatyev 36#include <vm/vm.h> 37#include <vm/vm_param.h> 38#include <vm/pmap.h> 39 40#include <x86/apicreg.h> 41#include <machine/frame.h> 42#include <machine/intr_machdep.h> 43#include <machine/apicvar.h> 44#include <machine/md_var.h> 45#include <machine/mptable.h> 46#include <machine/specialreg.h> 47 48#include <xen/hypervisor.h> 49#include <machine/xen/xen-os.h> 50#include <machine/smp.h> 51#include <xen/interface/vcpu.h> 52 53 54static int mptable_probe(void); 55static int mptable_probe_cpus(void); 56static void mptable_register(void *dummy); 57static int mptable_setup_local(void); 58static int mptable_setup_io(void); 59 60static struct apic_enumerator mptable_enumerator = { 61 "MPTable", 62 mptable_probe, 63 mptable_probe_cpus, 64 mptable_setup_local, 65 mptable_setup_io 66}; 67 68static int 69mptable_probe(void) 70{ 71 72 return (-100); 73} 74 75static int 76mptable_probe_cpus(void) 77{ 78 int i, rc; 79 80 for (i = 0; i < MAXCPU; i++) { 81 rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL); 82 if (rc >= 0) 83 cpu_add(i, (i == 0)); 84 } 85 86 return (0); 87} 88 89/* 90 * Initialize the local APIC on the BSP. 91 */ 92static int 93mptable_setup_local(void) 94{ 95 96 return (0); 97} 98 99static int 100mptable_setup_io(void) 101{ 102 103 return (0); 104} 105 106static void 107mptable_register(void *dummy __unused) 108{ 109 110 apic_register_enumerator(&mptable_enumerator); 111} 112SYSINIT(mptable_register, SI_SUB_TUNABLES - 1, SI_ORDER_FIRST, mptable_register, 113 NULL); 114 115 116 117int 118mptable_pci_probe_table(int bus) 119{ 120 121 return (0); 122} 123 124int 125mptable_pci_route_interrupt(device_t pcib, device_t dev, int pin) 126{ 127 128 return (0); 129} 130 131