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/i386/autoconf.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) 1990 The Regents of the University of California.
    3  * All rights reserved.
    4  *
    5  * This code is derived from software contributed to Berkeley by
    6  * William Jolitz.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  * 3. All advertising materials mentioning features or use of this software
   17  *    must display the following acknowledgement:
   18  *      This product includes software developed by the University of
   19  *      California, Berkeley and its contributors.
   20  * 4. Neither the name of the University nor the names of its contributors
   21  *    may be used to endorse or promote products derived from this software
   22  *    without specific prior written permission.
   23  *
   24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   34  * SUCH DAMAGE.
   35  *
   36  *      from: @(#)autoconf.c    7.1 (Berkeley) 5/9/91
   37  * $FreeBSD: releng/5.1/sys/i386/i386/autoconf.c 114293 2003-04-30 12:57:40Z markm $
   38  */
   39 
   40 /*
   41  * Setup the system to run on the current machine.
   42  *
   43  * Configure() is called at boot time and initializes the vba
   44  * device tables and the memory controller monitoring.  Available
   45  * devices are determined (from possibilities mentioned in ioconf.c),
   46  * and the drivers are initialized.
   47  */
   48 #include "opt_bootp.h"
   49 #include "opt_isa.h"
   50 #include "opt_nfs.h"
   51 #include "opt_nfsroot.h"
   52 #include "opt_bus.h"
   53 
   54 #include <sys/param.h>
   55 #include <sys/systm.h>
   56 #include <sys/bus.h>
   57 #include <sys/conf.h>
   58 #include <sys/reboot.h>
   59 #include <sys/kernel.h>
   60 #include <sys/malloc.h>
   61 #include <sys/mount.h>
   62 #include <sys/cons.h>
   63 
   64 #include <sys/socket.h>
   65 #include <net/if.h>
   66 #include <net/if_dl.h>
   67 #include <net/if_types.h>
   68 #include <net/if_var.h>
   69 #include <net/ethernet.h>
   70 #include <netinet/in.h>
   71 #include <nfs/rpcv2.h>
   72 #include <nfs/nfsproto.h>
   73 #include <nfsclient/nfs.h>
   74 #include <nfsclient/nfsdiskless.h>
   75 
   76 #include <machine/bootinfo.h>
   77 #include <machine/md_var.h>
   78 #ifdef APIC_IO
   79 #include <machine/smp.h>
   80 #else
   81 #include <i386/isa/icu.h>
   82 #endif /* APIC_IO */
   83 
   84 #ifdef DEV_ISA
   85 #include <isa/isavar.h>
   86 
   87 device_t isa_bus_device = 0;
   88 #endif
   89 
   90 static void     configure_first(void *);
   91 static void     configure(void *);
   92 static void     configure_final(void *);
   93 
   94 SYSINIT(configure1, SI_SUB_CONFIGURE, SI_ORDER_FIRST, configure_first, NULL);
   95 /* SI_ORDER_SECOND is hookable */
   96 SYSINIT(configure2, SI_SUB_CONFIGURE, SI_ORDER_THIRD, configure, NULL);
   97 /* SI_ORDER_MIDDLE is hookable */
   98 SYSINIT(configure3, SI_SUB_CONFIGURE, SI_ORDER_ANY, configure_final, NULL);
   99 
  100 /*
  101  * Determine i/o configuration for a machine.
  102  */
  103 static void
  104 configure_first(dummy)
  105         void *dummy;
  106 {
  107 }
  108 
  109 static void
  110 configure(dummy)
  111         void *dummy;
  112 {
  113 
  114         /*
  115          * Activate the ICU's.  Note that we are explicitly at splhigh()
  116          * at present as we have no way to disable stray PCI level triggered
  117          * interrupts until the devices have had a driver attached.  This
  118          * is particularly a problem when the interrupts are shared.  For
  119          * example, if IRQ 10 is shared between a disk and network device
  120          * and the disk device generates an interrupt, if we "activate"
  121          * IRQ 10 when the network driver is set up, then we will get
  122          * recursive interrupt 10's as nothing will know how to turn off
  123          * the disk device's interrupt.
  124          *
  125          * Having the ICU's active means we can probe interrupt routing to
  126          * see if a device causes the corresponding pending bit to be set.
  127          *
  128          * This is all rather inconvenient.
  129          */
  130 #ifdef APIC_IO
  131         bsp_apic_configure();
  132         enable_intr();
  133 #else
  134         enable_intr();
  135         INTREN(IRQ_SLAVE);
  136 #endif /* APIC_IO */
  137 
  138         /* nexus0 is the top of the i386 device tree */
  139         device_add_child(root_bus, "nexus", 0);
  140 
  141         /* initialize new bus architecture */
  142         root_bus_configure();
  143 
  144 #ifdef DEV_ISA
  145         /*
  146          * Explicitly probe and attach ISA last.  The isa bus saves
  147          * it's device node at attach time for us here.
  148          */
  149         if (isa_bus_device)
  150                 isa_probe_children(isa_bus_device);
  151 #endif
  152 
  153         /*
  154          * Now we're ready to handle (pending) interrupts.
  155          * XXX this is slightly misplaced.
  156          */
  157         spl0();
  158 }
  159 
  160 static void
  161 configure_final(dummy)
  162         void *dummy;
  163 {
  164 
  165         cninit_finish(); 
  166 
  167         if (bootverbose) {
  168 
  169 #ifdef APIC_IO
  170                 imen_dump();
  171 #endif /* APIC_IO */
  172 
  173 #ifdef PC98
  174                 {
  175                 int i;
  176                 /*
  177                  * Print out the BIOS's idea of the disk geometries.
  178                  */
  179                 printf("BIOS Geometries:\n");
  180                 for (i = 0; i < N_BIOS_GEOM; i++) {
  181                         unsigned long bios_geom;
  182                         int max_cylinder, max_head, max_sector;
  183 
  184                         bios_geom = bootinfo.bi_bios_geom[i];
  185 
  186                         /*
  187                          * XXX the bootstrap punts a 1200K floppy geometry
  188                          * when the get-disk-geometry interrupt fails.  Skip
  189                          * drives that have this geometry.
  190                          */
  191                         if (bios_geom == 0x4f010f)
  192                                 continue;
  193 
  194                         printf(" %x:%08lx ", i, bios_geom);
  195                         max_cylinder = bios_geom >> 16;
  196                         max_head = (bios_geom >> 8) & 0xff;
  197                         max_sector = bios_geom & 0xff;
  198                         printf(
  199                 "0..%d=%d cylinders, 0..%d=%d heads, 1..%d=%d sectors\n",
  200                                max_cylinder, max_cylinder + 1,
  201                                max_head, max_head + 1,
  202                                max_sector, max_sector);
  203                 }
  204                 printf(" %d accounted for\n", bootinfo.bi_n_bios_used);
  205                 }
  206 #endif
  207 
  208                 printf("Device configuration finished.\n");
  209         }
  210         cold = 0;
  211 }
  212 
  213 /*
  214  * Do legacy root filesystem discovery.
  215  */
  216 void
  217 cpu_rootconf()
  218 {
  219 #ifdef BOOTP
  220         bootpc_init();
  221 #endif
  222 #if defined(NFSCLIENT) && defined(NFS_ROOT)
  223 #if !defined(BOOTP_NFSROOT)
  224         nfs_setup_diskless();
  225         if (nfs_diskless_valid)
  226 #endif
  227                 rootdevnames[0] = "nfs:";
  228 #endif
  229 }
  230 SYSINIT(cpu_rootconf, SI_SUB_ROOT_CONF, SI_ORDER_FIRST, cpu_rootconf, NULL)

Cache object: 880ab250aa7616f4abbe10150b6bbfaa


[ 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.