Module Name: src Committed By: thorpej Date: Fri Jun 25 03:45:59 UTC 2021
Modified Files: src/sys/arch/alpha/pci: apecs_pci.c cia_pci.c irongate_pci.c tsp_pci.c Log Message: Use the default implementations of attach_hook(), bus_maxdevs(), make_tag(), and decompose_tag(). To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/arch/alpha/pci/apecs_pci.c cvs rdiff -u -r1.34 -r1.35 src/sys/arch/alpha/pci/cia_pci.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/alpha/pci/irongate_pci.c \ src/sys/arch/alpha/pci/tsp_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/alpha/pci/apecs_pci.c diff -u src/sys/arch/alpha/pci/apecs_pci.c:1.27 src/sys/arch/alpha/pci/apecs_pci.c:1.28 --- src/sys/arch/alpha/pci/apecs_pci.c:1.27 Fri May 7 16:58:34 2021 +++ src/sys/arch/alpha/pci/apecs_pci.c Fri Jun 25 03:45:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: apecs_pci.c,v 1.27 2021/05/07 16:58:34 thorpej Exp $ */ +/* $NetBSD: apecs_pci.c,v 1.28 2021/06/25 03:45:59 thorpej Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -29,7 +29,7 @@ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: apecs_pci.c,v 1.27 2021/05/07 16:58:34 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: apecs_pci.c,v 1.28 2021/06/25 03:45:59 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -41,11 +41,6 @@ __KERNEL_RCSID(0, "$NetBSD: apecs_pci.c, #include <alpha/pci/apecsreg.h> #include <alpha/pci/apecsvar.h> -static void apecs_attach_hook(device_t, device_t, - struct pcibus_attach_args *); -static int apecs_bus_maxdevs(void *, int); -static pcitag_t apecs_make_tag(void *, int, int, int); -static void apecs_decompose_tag(void *, pcitag_t, int *, int *, int *); static pcireg_t apecs_conf_read(void *, pcitag_t, int); static void apecs_conf_write(void *, pcitag_t, int, pcireg_t); @@ -54,45 +49,10 @@ apecs_pci_init(pci_chipset_tag_t pc, voi { pc->pc_conf_v = v; - pc->pc_attach_hook = apecs_attach_hook; - pc->pc_bus_maxdevs = apecs_bus_maxdevs; - pc->pc_make_tag = apecs_make_tag; - pc->pc_decompose_tag = apecs_decompose_tag; pc->pc_conf_read = apecs_conf_read; pc->pc_conf_write = apecs_conf_write; } -static void -apecs_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) -{ -} - -static int -apecs_bus_maxdevs(void *cpv, int busno) -{ - - return 32; -} - -static pcitag_t -apecs_make_tag(void *cpv, int b, int d, int f) -{ - - return (b << 16) | (d << 11) | (f << 8); -} - -static void -apecs_decompose_tag(void *cpv, pcitag_t tag, int *bp, int *dp, int *fp) -{ - - if (bp != NULL) - *bp = (tag >> 16) & 0xff; - if (dp != NULL) - *dp = (tag >> 11) & 0x1f; - if (fp != NULL) - *fp = (tag >> 8) & 0x7; -} - static pcireg_t apecs_conf_read(void *cpv, pcitag_t tag, int offset) { Index: src/sys/arch/alpha/pci/cia_pci.c diff -u src/sys/arch/alpha/pci/cia_pci.c:1.34 src/sys/arch/alpha/pci/cia_pci.c:1.35 --- src/sys/arch/alpha/pci/cia_pci.c:1.34 Fri May 7 16:58:34 2021 +++ src/sys/arch/alpha/pci/cia_pci.c Fri Jun 25 03:45:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cia_pci.c,v 1.34 2021/05/07 16:58:34 thorpej Exp $ */ +/* $NetBSD: cia_pci.c,v 1.35 2021/06/25 03:45:59 thorpej Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -29,7 +29,7 @@ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: cia_pci.c,v 1.34 2021/05/07 16:58:34 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cia_pci.c,v 1.35 2021/06/25 03:45:59 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -41,11 +41,6 @@ __KERNEL_RCSID(0, "$NetBSD: cia_pci.c,v #include <alpha/pci/ciareg.h> #include <alpha/pci/ciavar.h> -static void cia_attach_hook(device_t, device_t, - struct pcibus_attach_args *); -static int cia_bus_maxdevs(void *, int); -static pcitag_t cia_make_tag(void *, int, int, int); -static void cia_decompose_tag(void *, pcitag_t, int *, int *, int *); static pcireg_t cia_conf_read(void *, pcitag_t, int); static void cia_conf_write(void *, pcitag_t, int, pcireg_t); @@ -54,45 +49,10 @@ cia_pci_init(pci_chipset_tag_t pc, void { pc->pc_conf_v = v; - pc->pc_attach_hook = cia_attach_hook; - pc->pc_bus_maxdevs = cia_bus_maxdevs; - pc->pc_make_tag = cia_make_tag; - pc->pc_decompose_tag = cia_decompose_tag; pc->pc_conf_read = cia_conf_read; pc->pc_conf_write = cia_conf_write; } -static void -cia_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) -{ -} - -static int -cia_bus_maxdevs(void *cpv, int busno) -{ - - return 32; -} - -static pcitag_t -cia_make_tag(void *cpv, int b, int d, int f) -{ - - return (b << 16) | (d << 11) | (f << 8); -} - -static void -cia_decompose_tag(void *cpv, pcitag_t tag, int *bp, int *dp, int *fp) -{ - - if (bp != NULL) - *bp = (tag >> 16) & 0xff; - if (dp != NULL) - *dp = (tag >> 11) & 0x1f; - if (fp != NULL) - *fp = (tag >> 8) & 0x7; -} - static pcireg_t cia_conf_read(void *cpv, pcitag_t tag, int offset) { Index: src/sys/arch/alpha/pci/irongate_pci.c diff -u src/sys/arch/alpha/pci/irongate_pci.c:1.11 src/sys/arch/alpha/pci/irongate_pci.c:1.12 --- src/sys/arch/alpha/pci/irongate_pci.c:1.11 Fri May 7 16:58:34 2021 +++ src/sys/arch/alpha/pci/irongate_pci.c Fri Jun 25 03:45:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: irongate_pci.c,v 1.11 2021/05/07 16:58:34 thorpej Exp $ */ +/* $NetBSD: irongate_pci.c,v 1.12 2021/06/25 03:45:59 thorpej Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: irongate_pci.c,v 1.11 2021/05/07 16:58:34 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: irongate_pci.c,v 1.12 2021/06/25 03:45:59 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -48,12 +48,6 @@ __KERNEL_RCSID(0, "$NetBSD: irongate_pci #include <alpha/pci/irongatereg.h> #include <alpha/pci/irongatevar.h> -static void irongate_attach_hook(device_t, device_t, - struct pcibus_attach_args *); -static int irongate_bus_maxdevs(void *, int); -static pcitag_t irongate_make_tag(void *, int, int, int); -static void irongate_decompose_tag(void *, pcitag_t, int *, int *, - int *); static pcireg_t irongate_conf_read(void *, pcitag_t, int); static void irongate_conf_write(void *, pcitag_t, int, pcireg_t); @@ -71,54 +65,20 @@ irongate_pci_init(pci_chipset_tag_t pc, { pc->pc_conf_v = v; - pc->pc_attach_hook = irongate_attach_hook; - pc->pc_bus_maxdevs = irongate_bus_maxdevs; - pc->pc_make_tag = irongate_make_tag; - pc->pc_decompose_tag = irongate_decompose_tag; pc->pc_conf_read = irongate_conf_read; pc->pc_conf_write = irongate_conf_write; } -static void -irongate_attach_hook(device_t parent, device_t self, - struct pcibus_attach_args *pba) -{ -} - -static int -irongate_bus_maxdevs(void *ipv, int busno) -{ - - return 32; -} - -static pcitag_t -irongate_make_tag(void *ipv, int b, int d, int f) -{ - - return (b << 16) | (d << 11) | (f << 8); -} - -static void -irongate_decompose_tag(void *ipv, pcitag_t tag, int *bp, int *dp, int *fp) -{ - - if (bp != NULL) - *bp = (tag >> 16) & 0xff; - if (dp != NULL) - *dp = (tag >> 11) & 0x1f; - if (fp != NULL) - *fp = (tag >> 8) & 0x7; -} - static pcireg_t irongate_conf_read(void *ipv, pcitag_t tag, int offset) { - int d; + int b, d; if ((unsigned int)offset >= PCI_CONF_SIZE) return (pcireg_t) -1; + struct irongate_config * const icp = ipv; + /* * The AMD 751 appears in PCI configuration space, but * that is ... counter-intuitive to the way we normally @@ -126,8 +86,8 @@ irongate_conf_read(void *ipv, pcitag_t t * the AMD 751 device here. We provide a private entry * point for getting at it from machdep code. */ - irongate_decompose_tag(ipv, tag, NULL, &d, NULL); - if (d == IRONGATE_PCIHOST_DEV && offset == PCI_ID_REG) + pci_decompose_tag(&icp->ic_pc, tag, &b, &d, NULL); + if (b == 0 && d == IRONGATE_PCIHOST_DEV && offset == PCI_ID_REG) return ((pcireg_t) -1); return (irongate_conf_read0(ipv, tag, offset)); Index: src/sys/arch/alpha/pci/tsp_pci.c diff -u src/sys/arch/alpha/pci/tsp_pci.c:1.11 src/sys/arch/alpha/pci/tsp_pci.c:1.12 --- src/sys/arch/alpha/pci/tsp_pci.c:1.11 Fri May 7 16:58:34 2021 +++ src/sys/arch/alpha/pci/tsp_pci.c Fri Jun 25 03:45:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tsp_pci.c,v 1.11 2021/05/07 16:58:34 thorpej Exp $ */ +/* $NetBSD: tsp_pci.c,v 1.12 2021/06/25 03:45:59 thorpej Exp $ */ /*- * Copyright (c) 1999 by Ross Harvey. All rights reserved. @@ -32,7 +32,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tsp_pci.c,v 1.11 2021/05/07 16:58:34 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tsp_pci.c,v 1.12 2021/06/25 03:45:59 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -50,12 +50,6 @@ __KERNEL_RCSID(0, "$NetBSD: tsp_pci.c,v #define tsp_pci() { Generate ctags(1) key. } -static void tsp_attach_hook(device_t, device_t, - struct pcibus_attach_args *); -static int tsp_bus_maxdevs(void *, int); -static pcitag_t tsp_make_tag(void *, int, int, int); -static void tsp_decompose_tag(void *, pcitag_t, int *, int *, - int *); static pcireg_t tsp_conf_read(void *, pcitag_t, int); static void tsp_conf_write(void *, pcitag_t, int, pcireg_t); @@ -63,42 +57,10 @@ void tsp_pci_init(pci_chipset_tag_t pc, void *v) { pc->pc_conf_v = v; - pc->pc_attach_hook = tsp_attach_hook; - pc->pc_bus_maxdevs = tsp_bus_maxdevs; - pc->pc_make_tag = tsp_make_tag; - pc->pc_decompose_tag = tsp_decompose_tag; pc->pc_conf_read = tsp_conf_read; pc->pc_conf_write = tsp_conf_write; } -static void -tsp_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) -{ -} - -static int -tsp_bus_maxdevs(void *cpv, int busno) -{ - return 32; -} - -static pcitag_t -tsp_make_tag(void *cpv, int b, int d, int f) -{ - return b << 16 | d << 11 | f << 8; -} - -static void -tsp_decompose_tag(void *cpv, pcitag_t tag, int *bp, int *dp, int *fp) -{ - if (bp != NULL) - *bp = (tag >> 16) & 0xff; - if (dp != NULL) - *dp = (tag >> 11) & 0x1f; - if (fp != NULL) - *fp = (tag >> 8) & 0x7; -} - /* * Tsunami makes this a lot easier than it used to be, automatically * generating type 0 or type 1 cycles, and quietly returning -1 with