diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2010-03-07 13:39:01 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2010-03-07 13:39:01 +0000 |
commit | 84e2fa4836d32b3ef6fbe493dc152fb85a683405 (patch) | |
tree | ad3806282f0277b9d84e5a0a304b19f7dac347a1 | |
parent | 1af91b772f2c789fe8ed9840569e5af842f3f939 (diff) |
Add an MD interface for PCI drivers to be able to retrieve the node and widget
number the PCI bus they are on is connected to. Will be used shortly to help
the console device selection logic.
-rw-r--r-- | sys/arch/sgi/pci/macepcibridge.c | 18 | ||||
-rw-r--r-- | sys/arch/sgi/pci/pci_machdep.h | 8 | ||||
-rw-r--r-- | sys/arch/sgi/xbow/xbridge.c | 22 |
3 files changed, 45 insertions, 3 deletions
diff --git a/sys/arch/sgi/pci/macepcibridge.c b/sys/arch/sgi/pci/macepcibridge.c index 36a9e50dd8b..db0a8f141a7 100644 --- a/sys/arch/sgi/pci/macepcibridge.c +++ b/sys/arch/sgi/pci/macepcibridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: macepcibridge.c,v 1.36 2009/10/26 18:00:06 miod Exp $ */ +/* $OpenBSD: macepcibridge.c,v 1.37 2010/03/07 13:38:58 miod Exp $ */ /* * Copyright (c) 2009 Miodrag Vallat. @@ -84,6 +84,8 @@ pcitag_t mace_pcibr_make_tag(void *, int, int, int); void mace_pcibr_decompose_tag(void *, pcitag_t, int *, int *, int *); pcireg_t mace_pcibr_conf_read(void *, pcitag_t, int); void mace_pcibr_conf_write(void *, pcitag_t, int, pcireg_t); +int16_t mace_pcibr_get_nasid(void *); +int mace_pcibr_get_widget(void *); int mace_pcibr_intr_map(struct pci_attach_args *, pci_intr_handle_t *); const char *mace_pcibr_intr_string(void *, pci_intr_handle_t); void *mace_pcibr_intr_establish(void *, pci_intr_handle_t, int, @@ -237,6 +239,8 @@ mace_pcibrattach(struct device *parent, struct device *self, void *aux) sc->sc_pc.pc_bus_maxdevs = mace_pcibr_bus_maxdevs; 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_nasid = mace_pcibr_get_nasid; + sc->sc_pc.pc_get_widget = mace_pcibr_get_widget; sc->sc_pc.pc_intr_v = NULL; sc->sc_pc.pc_intr_map = mace_pcibr_intr_map; sc->sc_pc.pc_intr_string = mace_pcibr_intr_string; @@ -414,6 +418,18 @@ mace_pcibr_conf_write(void *cpv, pcitag_t tag, int offset, pcireg_t data) splx(s); } +int16_t +mace_pcibr_get_nasid(void *unused) +{ + return 0; +} + +int +mace_pcibr_get_widget(void *unused) +{ + return 0; +} + int mace_pcibr_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp) { diff --git a/sys/arch/sgi/pci/pci_machdep.h b/sys/arch/sgi/pci/pci_machdep.h index 68aa9694742..011b17385ec 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.8 2009/08/22 02:54:51 mk Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.9 2010/03/07 13:38:58 miod Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -45,6 +45,8 @@ struct mips_pci_chipset { int *, int *); pcireg_t (*pc_conf_read)(void *, pcitag_t, int); void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t); + int16_t (*pc_get_nasid)(void *); + int (*pc_get_widget)(void *); void *pc_intr_v; int (*pc_intr_map)(struct pci_attach_args *, pci_intr_handle_t *); @@ -76,6 +78,10 @@ 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_nasid(c) \ + (*(c)->pc_get_nasid)((c)->pc_conf_v) +#define pci_get_widget(c) \ + (*(c)->pc_get_widget)((c)->pc_conf_v) #define pci_intr_map(c, ihp) \ (*(c)->pa_pc->pc_intr_map)((c), (ihp)) #define pci_intr_string(c, ih) \ diff --git a/sys/arch/sgi/xbow/xbridge.c b/sys/arch/sgi/xbow/xbridge.c index 1dcbf83d8a6..68d81d8fed9 100644 --- a/sys/arch/sgi/xbow/xbridge.c +++ b/sys/arch/sgi/xbow/xbridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xbridge.c,v 1.66 2009/12/26 20:16:19 miod Exp $ */ +/* $OpenBSD: xbridge.c,v 1.67 2010/03/07 13:39:00 miod Exp $ */ /* * Copyright (c) 2008, 2009 Miodrag Vallat. @@ -214,6 +214,8 @@ int xbridge_ppb_setup(void *, pcitag_t, bus_addr_t *, bus_addr_t *, bus_addr_t *, bus_addr_t *); void *xbridge_rbus_parent_io(struct pci_attach_args *); void *xbridge_rbus_parent_mem(struct pci_attach_args *); +int16_t xbridge_get_nasid(void *); +int xbridge_get_widget(void *); int xbridge_pci_intr_handler(void *); int xbridge_err_intr_handler(void *); @@ -573,6 +575,8 @@ xbpci_attach(struct device *parent, struct device *self, void *aux) xb->xb_pc.pc_bus_maxdevs = xbridge_bus_maxdevs; xb->xb_pc.pc_conf_read = xbridge_conf_read; xb->xb_pc.pc_conf_write = xbridge_conf_write; + xb->xb_pc.pc_get_nasid = xbridge_get_nasid; + xb->xb_pc.pc_get_widget = xbridge_get_widget; xb->xb_pc.pc_intr_v = xb; xb->xb_pc.pc_intr_map = xbridge_intr_map; xb->xb_pc.pc_intr_string = xbridge_intr_string; @@ -840,6 +844,22 @@ xbridge_conf_write(void *cookie, pcitag_t tag, int offset, pcireg_t data) (void)xbridge_read_reg(xb, WIDGET_TFLUSH); } +int16_t +xbridge_get_nasid(void *cookie) +{ + struct xbpci_softc *xb = cookie; + + return xb->xb_nasid; +} + +int +xbridge_get_widget(void *cookie) +{ + struct xbpci_softc *xb = cookie; + + return xb->xb_widget; +} + /* ********************* Interrupt handling. */ |