From 27c23c6b11f063071fad4cb460585c58c3dffd31 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Wed, 14 Jan 2004 18:20:19 +0000 Subject: [PATCH] Drop chip driver and merge the functionality into pci_probe_nomatch. Adjust return value of pcib_probe to -1000 for conformance to other default matches. Do some general cleanup. --- sys/bus/pci/pci.c | 3 +- sys/bus/pci/pcisupport.c | 79 ++++++++++++---------------------------- sys/bus/pci/pcivar.h | 11 ++++-- 3 files changed, 33 insertions(+), 60 deletions(-) diff --git a/sys/bus/pci/pci.c b/sys/bus/pci/pci.c index 1bec26d5b7..6ce6346961 100644 --- a/sys/bus/pci/pci.c +++ b/sys/bus/pci/pci.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/pci.c,v 1.141.2.15 2002/04/30 17:48:18 tmm Exp $ - * $DragonFly: src/sys/bus/pci/pci.c,v 1.8 2004/01/08 18:48:07 asmodai Exp $ + * $DragonFly: src/sys/bus/pci/pci.c,v 1.9 2004/01/14 18:20:18 joerg Exp $ * */ @@ -1401,6 +1401,7 @@ pci_probe_nomatch(device_t dev, device_t child) desc = pci_ata_match(child); if (!desc) desc = pci_usb_match(child); if (!desc) desc = pci_vga_match(child); + if (!desc) desc = pci_chip_match(child); if (!desc) { desc = "unknown card"; unknown++; diff --git a/sys/bus/pci/pcisupport.c b/sys/bus/pci/pcisupport.c index 24b7a788c9..8c7917b256 100644 --- a/sys/bus/pci/pcisupport.c +++ b/sys/bus/pci/pcisupport.c @@ -1,7 +1,7 @@ /************************************************************************** ** ** $FreeBSD: src/sys/pci/pcisupport.c,v 1.154.2.15 2003/04/29 15:55:06 simokawa Exp $ -** $DragonFly: src/sys/bus/pci/pcisupport.c,v 1.6 2003/10/31 22:00:13 asmodai Exp $ +** $DragonFly: src/sys/bus/pci/pcisupport.c,v 1.7 2004/01/14 18:20:19 joerg Exp $ ** ** Device driver for DEC/INTEL PCI chipsets. ** @@ -768,7 +768,7 @@ static int pcib_probe(device_t dev) desc = pcib_match(dev); if (desc) { device_set_desc_copy(dev, desc); - return 0; + return -1000; } return ENXIO; @@ -1166,8 +1166,8 @@ pci_ata_match(device_t dev) } -static const char* -chip_match(device_t dev) +const char* +pci_chip_match(device_t dev) { unsigned rev; @@ -1369,53 +1369,6 @@ chip_match(device_t dev) return NULL; } -static int chip_probe(device_t dev) -{ - const char *desc; - - desc = chip_match(dev); - if (desc) { - if (pci_get_class(dev) == PCIC_BRIDGE - && pci_get_subclass(dev) == PCIS_BRIDGE_HOST) { - /* - * Suppress printing this device since the nexus - * has already described it. - */ - device_quiet(dev); - } - - device_set_desc_copy(dev, desc); - return -10000; /* Low match priority */ - } - - return ENXIO; -} - -static int chip_attach(device_t dev) -{ - chipset_attach(dev, device_get_unit(dev)); - - return 0; -} - -static device_method_t chip_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, chip_probe), - DEVMETHOD(device_attach, chip_attach), - - { 0, 0 } -}; - -static driver_t chip_driver = { - "chip", - chip_methods, - 1, -}; - -static devclass_t chip_devclass; - -DRIVER_MODULE(chip, pci, chip_driver, chip_devclass, 0, 0); - /*--------------------------------------------------------- ** ** Catchall driver for VGA devices @@ -1932,20 +1885,34 @@ const char* pci_vga_match(device_t dev) **--------------------------------------------------------- */ -static int -ign_probe (device_t dev) +static const char* +ign_match(device_t dev) { switch (pci_get_devid(dev)) { case 0x10001042ul: /* wd */ - return 0; -/* return ("SMC FDC 37c665");*/ + return ("SMC FDC 37c665"); }; + + return NULL; +} + +static int +ign_probe(device_t dev) +{ + const char *s; + + s = ign_match(dev); + if (s) { + device_set_desc(dev, s); + device_quiet(dev); + return -1000; + } return ENXIO; } static int -ign_attach (device_t dev) +ign_attach(device_t dev) { return 0; } diff --git a/sys/bus/pci/pcivar.h b/sys/bus/pci/pcivar.h index 96d415dc78..49dce8962e 100644 --- a/sys/bus/pci/pcivar.h +++ b/sys/bus/pci/pcivar.h @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/pcivar.h,v 1.41.2.2 2002/01/10 12:08:22 mdodd Exp $ - * $DragonFly: src/sys/bus/pci/pcivar.h,v 1.3 2004/01/07 18:13:19 joerg Exp $ + * $DragonFly: src/sys/bus/pci/pcivar.h,v 1.4 2004/01/14 18:20:19 joerg Exp $ * */ @@ -156,6 +156,7 @@ struct pci_devinfo { const char *pci_ata_match(struct device *dev); const char *pci_usb_match(struct device *dev); const char *pci_vga_match(struct device *dev); +const char *pci_chip_match(struct device *dev); /* low level PCI config register functions provided by pcibus.c */ @@ -214,7 +215,7 @@ static __inline T pci_get_ ## A(device_t dev) \ \ static __inline void pci_set_ ## A(device_t dev, T t) \ { \ - u_long v = (u_long) t; \ + uintptr_t v = (uintptr_t) t; \ BUS_WRITE_IVAR(device_get_parent(dev), dev, PCI_IVAR_ ## B, v); \ } @@ -236,6 +237,8 @@ PCI_ACCESSOR(secondarybus, SECONDARYBUS, u_int8_t) PCI_ACCESSOR(subordinatebus, SUBORDINATEBUS, u_int8_t) PCI_ACCESSOR(hose, HOSE, u_int32_t) +#undef PCI_ACCESSOR + static __inline u_int32_t pci_read_config(device_t dev, int reg, int width) { @@ -331,12 +334,14 @@ static __inline T pcib_get_ ## A(device_t dev) \ \ static __inline void pcib_set_ ## A(device_t dev, T t) \ { \ - u_long v = (u_long) t; \ + uintptr_t v = (uintptr_t) t; \ BUS_WRITE_IVAR(device_get_parent(dev), dev, PCIB_IVAR_ ## B, v); \ } PCIB_ACCESSOR(hose, HOSE, u_int32_t) +#undef PCIB_ACCESSOR + device_t pci_find_bsf(u_int8_t, u_int8_t, u_int8_t); device_t pci_find_device(u_int16_t, u_int16_t); #endif -- 2.41.0