diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2011-10-10 19:42:38 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2011-10-10 19:42:38 +0000 |
commit | 3cc4d3c11a835610eaf5ce6c13389352149848c1 (patch) | |
tree | b6ff787b8bae84fe3b0c21b7f0378c2d7459fad8 /sys/arch/sgi/pci | |
parent | f01ca6aed7de84c5098370e7359ed9043e29b16c (diff) |
Introduce pci_probe_device_hook(pci_chipset_tag_t, struct pci_attach_args *).
This mandatory function will get invoked in pci_probe_device(), and allows
a pci host driver to alter the pci_attach_args passed to a device when
attaching.
This function will also, if returning non-zero, cause the device to be
skipped completely during all the phases of the PCI device discovery
(i.e. ressource enumeration, ressource assignment, and actual attachment).
This particular feature is experimental and might be reverted in the future
(or the scope narrowed to device attachment only).
A dummy #define pci_probe_device_hook() 0 is added to all platforms except
sgi, where real functions (currently only returning 0) are added; real meat
will be added shortly.
Discussed at s2k11, no objection from the usual suspects.
Diffstat (limited to 'sys/arch/sgi/pci')
-rw-r--r-- | sys/arch/sgi/pci/macepcibridge.c | 10 | ||||
-rw-r--r-- | sys/arch/sgi/pci/pci_machdep.h | 25 |
2 files changed, 27 insertions, 8 deletions
diff --git a/sys/arch/sgi/pci/macepcibridge.c b/sys/arch/sgi/pci/macepcibridge.c index 0dde121fd35..99ac177f89c 100644 --- a/sys/arch/sgi/pci/macepcibridge.c +++ b/sys/arch/sgi/pci/macepcibridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: macepcibridge.c,v 1.41 2010/12/04 17:06:31 miod Exp $ */ +/* $OpenBSD: macepcibridge.c,v 1.42 2011/10/10 19:42:36 miod Exp $ */ /* * Copyright (c) 2009 Miodrag Vallat. @@ -85,6 +85,7 @@ void mace_pcibr_decompose_tag(void *, pcitag_t, int *, int *, int *); int mace_pcibr_conf_size(void *, pcitag_t); pcireg_t mace_pcibr_conf_read(void *, pcitag_t, int); void mace_pcibr_conf_write(void *, pcitag_t, int, pcireg_t); +int mace_pcibr_probe_device_hook(void *, struct pci_attach_args *); int mace_pcibr_get_widget(void *); int mace_pcibr_get_dl(void *, pcitag_t, struct sgi_device_location *); int mace_pcibr_intr_map(struct pci_attach_args *, pci_intr_handle_t *); @@ -244,6 +245,7 @@ mace_pcibrattach(struct device *parent, struct device *self, void *aux) sc->sc_pc.pc_conf_read = mace_pcibr_conf_read; sc->sc_pc.pc_conf_write = mace_pcibr_conf_write; sc->sc_pc.pc_get_widget = mace_pcibr_get_widget; + sc->sc_pc.pc_probe_device_hook = mace_pcibr_probe_device_hook; sc->sc_pc.pc_get_dl = mace_pcibr_get_dl; sc->sc_pc.pc_intr_v = NULL; sc->sc_pc.pc_intr_map = mace_pcibr_intr_map; @@ -429,6 +431,12 @@ mace_pcibr_conf_write(void *cpv, pcitag_t tag, int offset, pcireg_t data) } int +mace_pcibr_probe_device_hook(void *unused, struct pci_attach_args *notused) +{ + return 0; +} + +int mace_pcibr_get_widget(void *unused) { return 0; diff --git a/sys/arch/sgi/pci/pci_machdep.h b/sys/arch/sgi/pci/pci_machdep.h index 58f2ae3d747..9bd17e04569 100644 --- a/sys/arch/sgi/pci/pci_machdep.h +++ b/sys/arch/sgi/pci/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.13 2011/05/21 21:36:40 kettenis Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.14 2011/10/10 19:42:36 miod Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -47,6 +47,8 @@ struct mips_pci_chipset { int (*pc_conf_size)(void *, pcitag_t); pcireg_t (*pc_conf_read)(void *, pcitag_t, int); void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t); + int (*pc_probe_device_hook)(void *, struct pci_attach_args *); + int (*pc_get_widget)(void *); int (*pc_get_dl)(void *, pcitag_t, struct sgi_device_location *); @@ -82,10 +84,6 @@ struct mips_pci_chipset { (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r)) #define pci_conf_write(c, t, r, v) \ (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v)) -#define pci_get_widget(c) \ - (*(c)->pc_get_widget)((c)->pc_conf_v) -#define pci_get_device_location(c,t,l) \ - (*(c)->pc_get_dl)((c)->pc_conf_v, (t), (l)) #define pci_intr_map(c, ihp) \ (*(c)->pa_pc->pc_intr_map)((c), (ihp)) #define pci_intr_map_msi(c, ihp) (-1) @@ -97,6 +95,21 @@ struct mips_pci_chipset { (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv)) #define pci_intr_line(c, ih) \ (*(c)->pc_intr_line)((c)->pc_intr_v, (ih)) +#define pci_probe_device_hook(c, a) \ + (*(c)->pc_probe_device_hook)((c)->pc_conf_v, (a)) +#define pci_dev_postattach(a, b) do { } while (0) + +/* + * Functions provided to machine-dependent PCI code. + */ +#define pci_get_widget(c) \ + (*(c)->pc_get_widget)((c)->pc_conf_v) +#define pci_get_device_location(c,t,l) \ + (*(c)->pc_get_dl)((c)->pc_conf_v, (t), (l)) + +/* + * Functions provided to machine-independent rbus code. + */ #define rbus_pccbb_parent_io(dev, pa) \ (rbus_tag_t)((*(pa)->pa_pc->pc_rbus_parent_io)(pa)) #define rbus_pccbb_parent_mem(dev, pa) \ @@ -104,5 +117,3 @@ struct mips_pci_chipset { void pccbb_initialize(pci_chipset_tag_t, pcitag_t, uint, uint, uint); void ppb_initialize(pci_chipset_tag_t, pcitag_t, uint, uint, uint); - -#define pci_dev_postattach(a, b) |