The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/i386/xen/mptable.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2003 John Baldwin <jhb@FreeBSD.org>
    3  * Copyright (c) 1996, by Steve Passe
    4  * All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
   10  *    notice, this list of conditions and the following disclaimer.
   11  * 2. The name of the developer may NOT be used to endorse or promote products
   12  *    derived from this software without specific prior written permission.
   13  *
   14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   24  * SUCH DAMAGE.
   25  */
   26 
   27 #include <sys/cdefs.h>
   28 __FBSDID("$FreeBSD: releng/10.0/sys/i386/xen/mptable.c 256073 2013-10-05 23:11:01Z gibbs $");
   29 
   30 #include <sys/param.h>
   31 #include <sys/bus.h>
   32 #include <sys/kernel.h>
   33 
   34 #include <vm/vm.h>
   35 #include <vm/vm_param.h>
   36 #include <vm/pmap.h>
   37 
   38 #include <machine/frame.h>
   39 #include <machine/intr_machdep.h>
   40 #include <machine/apicvar.h>
   41 
   42 #include <xen/hypervisor.h>
   43 #include <xen/xen-os.h>
   44 #include <machine/smp.h>
   45 #include <xen/interface/vcpu.h>
   46 
   47 
   48 static int      mptable_probe(void);
   49 static int      mptable_probe_cpus(void);
   50 static void     mptable_register(void *dummy);
   51 static int      mptable_setup_local(void);
   52 static int      mptable_setup_io(void);
   53 
   54 static struct apic_enumerator mptable_enumerator = {
   55         "MPTable",
   56         mptable_probe,
   57         mptable_probe_cpus,
   58         mptable_setup_local,
   59         mptable_setup_io
   60 };
   61 
   62 static int
   63 mptable_probe(void)
   64 {
   65 
   66         return (-100);
   67 }
   68 
   69 static int
   70 mptable_probe_cpus(void)
   71 {
   72         int i, rc;
   73 
   74         for (i = 0; i < MAXCPU; i++) {
   75                 rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL);
   76                 if (rc >= 0)
   77                         cpu_add(i, (i == 0));
   78         }
   79 
   80         return (0);
   81 }
   82 
   83 /*
   84  * Initialize the local APIC on the BSP.
   85  */
   86 static int
   87 mptable_setup_local(void)
   88 {
   89 
   90         PCPU_SET(apic_id, 0);
   91         PCPU_SET(vcpu_id, 0);
   92         return (0);
   93 }
   94 
   95 static int
   96 mptable_setup_io(void)
   97 {
   98 
   99         return (0);
  100 }
  101 
  102 static void
  103 mptable_register(void *dummy __unused)
  104 {
  105 
  106         apic_register_enumerator(&mptable_enumerator);
  107 }
  108 SYSINIT(mptable_register, SI_SUB_TUNABLES - 1, SI_ORDER_FIRST, mptable_register,
  109     NULL);

Cache object: dec3e740964dd7a32c7be9bf25983df0


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.