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/dev/pci/fixup_pci.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) 1994,1995 Stefan Esser, Wolfgang StanglMeier
    3  * Copyright (c) 2000 Michael Smith <msmith@freebsd.org>
    4  * Copyright (c) 2000 BSDi
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. The name of the author may not be used to endorse or promote products
   16  *    derived from this software without specific prior written permission.
   17  *
   18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   28  * SUCH DAMAGE.
   29  */
   30 
   31 #include <sys/cdefs.h>
   32 __FBSDID("$FreeBSD$");
   33 
   34 #include <sys/param.h>
   35 #include <sys/kernel.h>
   36 #include <sys/malloc.h>
   37 #include <sys/module.h>
   38 #include <sys/systm.h>
   39 #include <sys/bus.h>
   40 
   41 #include <dev/pci/pcivar.h>
   42 #include <dev/pci/pcireg.h>
   43 
   44 /*
   45  * Chipset fixups.
   46  *
   47  * These routines are invoked during the probe phase for devices which
   48  * typically don't have specific device drivers, but which require
   49  * some cleaning up.
   50  */
   51 
   52 static int      fixup_pci_probe(device_t dev);
   53 static void     fixwsc_natoma(device_t dev);
   54 
   55 static device_method_t fixup_pci_methods[] = {
   56     /* Device interface */
   57     DEVMETHOD(device_probe,             fixup_pci_probe),
   58     DEVMETHOD(device_attach,            bus_generic_attach),
   59     { 0, 0 }
   60 };
   61 
   62 static driver_t fixup_pci_driver = {
   63     "fixup_pci",
   64     fixup_pci_methods,
   65     0,
   66 };
   67 
   68 static devclass_t fixup_pci_devclass;
   69 
   70 DRIVER_MODULE(fixup_pci, pci, fixup_pci_driver, fixup_pci_devclass, 0, 0);
   71 
   72 static int
   73 fixup_pci_probe(device_t dev)
   74 {
   75     switch (pci_get_devid(dev)) {
   76     case 0x12378086:            /* Intel 82440FX (Natoma) */
   77         fixwsc_natoma(dev);
   78         break;
   79     }
   80     return(ENXIO);
   81 }
   82 
   83 static void
   84 fixwsc_natoma(device_t dev)
   85 {
   86     int         pmccfg;
   87 
   88     pmccfg = pci_read_config(dev, 0x50, 2);
   89 #if defined(SMP)
   90     if (pmccfg & 0x8000) {
   91         printf("Correcting Natoma config for SMP\n");
   92         pmccfg &= ~0x8000;
   93         pci_write_config(dev, 0x50, pmccfg, 2);
   94     }
   95 #else
   96     if ((pmccfg & 0x8000) == 0) {
   97         printf("Correcting Natoma config for non-SMP\n");
   98         pmccfg |= 0x8000;
   99         pci_write_config(dev, 0x50, pmccfg, 2);
  100     }
  101 #endif
  102 }

Cache object: 908af6367428a3ed025489649517ed9f


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