summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2010-04-06 19:12:35 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2010-04-06 19:12:35 +0000
commit09e8efc0c49a6be063bc81a0f97257ba897e5dea (patch)
treefc49ea6513f23b3755cc10f76216ea119f299add
parent883df95ae052284f135dab080cce056e38ee3d6d (diff)
Obtain struct sgi_device_location for the console input and output devices,
and compare against them when attaching potential console drivers, to figure out whether they indeed are acting are console devices or not.
-rw-r--r--sys/arch/sgi/dev/iockbc.c49
-rw-r--r--sys/arch/sgi/dev/iockbcvar.h4
-rw-r--r--sys/arch/sgi/pci/ioc.c10
-rw-r--r--sys/arch/sgi/pci/iocvar.h26
-rw-r--r--sys/arch/sgi/pci/iof.c10
-rw-r--r--sys/arch/sgi/pci/iofvar.h22
-rw-r--r--sys/arch/sgi/pci/macepcibridge.c22
-rw-r--r--sys/arch/sgi/pci/pci_machdep.h11
-rw-r--r--sys/arch/sgi/sgi/wscons_machdep.c44
-rw-r--r--sys/arch/sgi/xbow/impact.c22
-rw-r--r--sys/arch/sgi/xbow/impactvar.h6
-rw-r--r--sys/arch/sgi/xbow/odyssey.c21
-rw-r--r--sys/arch/sgi/xbow/odysseyvar.h6
-rw-r--r--sys/arch/sgi/xbow/xbridge.c28
14 files changed, 129 insertions, 152 deletions
diff --git a/sys/arch/sgi/dev/iockbc.c b/sys/arch/sgi/dev/iockbc.c
index 14dbafbf3a7..c25c2fe909c 100644
--- a/sys/arch/sgi/dev/iockbc.c
+++ b/sys/arch/sgi/dev/iockbc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iockbc.c,v 1.5 2010/03/07 13:44:24 miod Exp $ */
+/* $OpenBSD: iockbc.c,v 1.6 2010/04/06 19:12:26 miod Exp $ */
/*
* Copyright (c) 2006, 2007, 2009 Joel Sing <jsing@openbsd.org>
*
@@ -967,22 +967,13 @@ pckbc_set_poll(pckbc_tag_t self, pckbc_slot_t slot, int on)
/*
* Console support.
- *
- * There might multiple IOC3 and/or IOC4 devices in the system; the kernel
- * will currently only use the one the debug serial console would be attached
- * to as the console input device, regardless of the ConsoleIn variable.
*/
-static int16_t iockbc_console_nasid;
-static int iockbc_console_widget;
-static int iockbc_console_npci;
-static uint32_t iockbc_console_type;
-
static struct pckbc_slotdata iockbc_cons_slotdata;
+static int iockbc_console;
int
-iockbc_cnattach(int16_t nasid, int widget, int npci, uint32_t type,
- pckbc_slot_t slot)
+iockbc_cnattach(pckbc_slot_t slot)
{
bus_space_tag_t iot = &sys_config.console_io;
bus_space_handle_t ioh = (bus_space_handle_t)iot->bus_base;
@@ -992,7 +983,8 @@ iockbc_cnattach(int16_t nasid, int widget, int npci, uint32_t type,
int is_ioc;
int rc;
- is_ioc = type == PCI_ID_CODE(PCI_VENDOR_SGI, PCI_PRODUCT_SGI_IOC3);
+ is_ioc = console_input.specific ==
+ PCI_ID_CODE(PCI_VENDOR_SGI, PCI_PRODUCT_SGI_IOC3);
if (is_ioc) {
#if NIOCKBC_IOC > 0
if (sys_config.system_type == SGI_IP35)
@@ -1033,17 +1025,8 @@ iockbc_cnattach(int16_t nasid, int widget, int npci, uint32_t type,
t->t_slotdata[slot] = &iockbc_cons_slotdata;
rc = pckbd_cnattach(t, slot);
-
- /*
- * Upon success, remember our configuration to be able to
- * recognize the console input device during autoconf.
- */
- if (rc == 0) {
- iockbc_console_nasid = nasid;
- iockbc_console_widget = widget;
- iockbc_console_npci = npci;
- iockbc_console_type = type;
- }
+ if (rc == 0)
+ iockbc_console = 1;
return rc;
}
@@ -1052,11 +1035,10 @@ iockbc_cnattach(int16_t nasid, int widget, int npci, uint32_t type,
int
iockbc_is_ioc_console(struct ioc_attach_args *iaa)
{
- return iaa->iaa_nasid == iockbc_console_nasid &&
- iaa->iaa_widget == iockbc_console_widget &&
- iaa->iaa_npci == iockbc_console_npci &&
- iockbc_console_type ==
- PCI_ID_CODE(PCI_VENDOR_SGI, PCI_PRODUCT_SGI_IOC3);
+ if (iockbc_console == 0)
+ return 0;
+
+ return location_match(&iaa->iaa_location, &console_input);
}
#endif
@@ -1064,10 +1046,9 @@ iockbc_is_ioc_console(struct ioc_attach_args *iaa)
int
iockbc_is_iof_console(struct iof_attach_args *iaa)
{
- return iaa->iaa_nasid == iockbc_console_nasid &&
- iaa->iaa_widget == iockbc_console_widget &&
- iaa->iaa_npci == iockbc_console_npci &&
- iockbc_console_type ==
- PCI_ID_CODE(PCI_VENDOR_SGI, PCI_PRODUCT_SGI_IOC4);
+ if (iockbc_console == 0)
+ return 0;
+
+ return location_match(&iaa->iaa_location, &console_input);
}
#endif
diff --git a/sys/arch/sgi/dev/iockbcvar.h b/sys/arch/sgi/dev/iockbcvar.h
index e0a8ecc2910..57ca79fea69 100644
--- a/sys/arch/sgi/dev/iockbcvar.h
+++ b/sys/arch/sgi/dev/iockbcvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iockbcvar.h,v 1.1 2010/03/07 13:44:24 miod Exp $ */
+/* $OpenBSD: iockbcvar.h,v 1.2 2010/04/06 19:12:26 miod Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
@@ -16,4 +16,4 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-int iockbc_cnattach(int16_t, int, int, uint32_t, pckbc_slot_t);
+int iockbc_cnattach(pckbc_slot_t);
diff --git a/sys/arch/sgi/pci/ioc.c b/sys/arch/sgi/pci/ioc.c
index c19fc82b88e..e1f9a00707e 100644
--- a/sys/arch/sgi/pci/ioc.c
+++ b/sys/arch/sgi/pci/ioc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ioc.c,v 1.33 2010/03/20 16:22:53 miod Exp $ */
+/* $OpenBSD: ioc.c,v 1.34 2010/04/06 19:12:34 miod Exp $ */
/*
* Copyright (c) 2008 Joel Sing.
@@ -66,7 +66,6 @@ struct ioc_intr {
struct ioc_softc {
struct device sc_dev;
- int sc_npci;
struct mips_bus_space *sc_mem_bus_space;
@@ -74,6 +73,7 @@ struct ioc_softc {
bus_space_handle_t sc_memh;
bus_dma_tag_t sc_dmat;
pci_chipset_tag_t sc_pc;
+ pcitag_t sc_tag;
void *sc_ih_enet; /* Ethernet interrupt */
void *sc_ih_superio; /* SuperIO interrupt */
@@ -171,7 +171,7 @@ ioc_attach(struct device *parent, struct device *self, void *aux)
}
sc->sc_pc = pa->pa_pc;
- sc->sc_npci = pa->pa_device;
+ sc->sc_tag = pa->pa_tag;
sc->sc_dmat = pa->pa_dmat;
/*
@@ -508,9 +508,7 @@ ioc_attach_child(struct ioc_softc *sc, const char *name, bus_addr_t base,
memset(&iaa, 0, sizeof iaa);
iaa.iaa_name = name;
- iaa.iaa_nasid = pci_get_nasid(sc->sc_pc);
- iaa.iaa_widget = pci_get_widget(sc->sc_pc);
- iaa.iaa_npci = sc->sc_npci;
+ pci_get_device_location(sc->sc_pc, sc->sc_tag, &iaa.iaa_location);
iaa.iaa_memt = sc->sc_memt;
iaa.iaa_memh = sc->sc_memh;
iaa.iaa_dmat = sc->sc_dmat;
diff --git a/sys/arch/sgi/pci/iocvar.h b/sys/arch/sgi/pci/iocvar.h
index 6071e2bd24f..12db7f144a6 100644
--- a/sys/arch/sgi/pci/iocvar.h
+++ b/sys/arch/sgi/pci/iocvar.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: iocvar.h,v 1.5 2010/03/07 13:44:26 miod Exp $ */
+/* $OpenBSD: iocvar.h,v 1.6 2010/04/06 19:12:34 miod Exp $ */
/*
- * Copyright (c) 2008 Miodrag Vallat.
+ * Copyright (c) 2008, 2010 Miodrag Vallat.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -17,23 +17,21 @@
*/
struct ioc_attach_args {
- const char *iaa_name;
+ const char *iaa_name;
- int16_t iaa_nasid;
- int iaa_widget;
- int iaa_npci;
+ bus_space_tag_t iaa_memt;
+ bus_space_handle_t iaa_memh;
+ bus_dma_tag_t iaa_dmat;
- bus_space_tag_t iaa_memt;
- bus_space_handle_t iaa_memh;
- bus_dma_tag_t iaa_dmat;
+ bus_addr_t iaa_base;
+ int iaa_dev;
- bus_addr_t iaa_base;
- int iaa_dev;
+ uint8_t iaa_enaddr[6];
- uint8_t iaa_enaddr[6];
+ int iaa_flags;
+#define IOC_FLAGS_OBIO 0x00000001
- int iaa_flags;
-#define IOC_FLAGS_OBIO 0x00000001
+ struct sgi_device_location iaa_location;
};
void *ioc_intr_establish(void *, u_long, int, int (*)(void *),
diff --git a/sys/arch/sgi/pci/iof.c b/sys/arch/sgi/pci/iof.c
index bf95cddb66d..ba03717eb02 100644
--- a/sys/arch/sgi/pci/iof.c
+++ b/sys/arch/sgi/pci/iof.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iof.c,v 1.5 2010/03/07 13:44:26 miod Exp $ */
+/* $OpenBSD: iof.c,v 1.6 2010/04/06 19:12:34 miod Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
@@ -56,7 +56,6 @@ struct iof_intr {
struct iof_softc {
struct device sc_dev;
- int sc_npci;
struct mips_bus_space *sc_mem_bus_space;
@@ -64,6 +63,7 @@ struct iof_softc {
bus_space_handle_t sc_memh;
bus_dma_tag_t sc_dmat;
pci_chipset_tag_t sc_pc;
+ pcitag_t sc_tag;
uint32_t sc_mcr;
@@ -127,7 +127,7 @@ iof_attach(struct device *parent, struct device *self, void *aux)
}
sc->sc_pc = pa->pa_pc;
- sc->sc_npci = pa->pa_device;
+ sc->sc_tag = pa->pa_tag;
sc->sc_dmat = pa->pa_dmat;
/*
@@ -212,9 +212,7 @@ iof_attach_child(struct device *iof, const char *name, bus_addr_t base,
struct iof_attach_args iaa;
iaa.iaa_name = name;
- iaa.iaa_nasid = pci_get_nasid(sc->sc_pc);
- iaa.iaa_widget = pci_get_widget(sc->sc_pc);
- iaa.iaa_npci = sc->sc_npci;
+ pci_get_device_location(sc->sc_pc, sc->sc_tag, &iaa.iaa_location);
iaa.iaa_memt = sc->sc_memt;
iaa.iaa_memh = sc->sc_memh;
iaa.iaa_dmat = sc->sc_dmat;
diff --git a/sys/arch/sgi/pci/iofvar.h b/sys/arch/sgi/pci/iofvar.h
index 97a3d00598f..a6dc905e05d 100644
--- a/sys/arch/sgi/pci/iofvar.h
+++ b/sys/arch/sgi/pci/iofvar.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: iofvar.h,v 1.3 2010/03/07 13:44:26 miod Exp $ */
+/* $OpenBSD: iofvar.h,v 1.4 2010/04/06 19:12:34 miod Exp $ */
/*
- * Copyright (c) 2009 Miodrag Vallat.
+ * Copyright (c) 2009, 2010 Miodrag Vallat.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -17,19 +17,17 @@
*/
struct iof_attach_args {
- const char *iaa_name;
+ const char *iaa_name;
- int16_t iaa_nasid;
- int iaa_widget;
- int iaa_npci;
+ bus_space_tag_t iaa_memt;
+ bus_space_handle_t iaa_memh;
+ bus_dma_tag_t iaa_dmat;
- bus_space_tag_t iaa_memt;
- bus_space_handle_t iaa_memh;
- bus_dma_tag_t iaa_dmat;
+ bus_addr_t iaa_base;
+ uint iaa_dev;
+ uint iaa_clock;
- bus_addr_t iaa_base;
- uint iaa_dev;
- uint iaa_clock;
+ struct sgi_device_location iaa_location;
};
void *iof_intr_establish(void *, uint, int, int (*)(void *), void *, char *);
diff --git a/sys/arch/sgi/pci/macepcibridge.c b/sys/arch/sgi/pci/macepcibridge.c
index db0a8f141a7..5feaa065973 100644
--- a/sys/arch/sgi/pci/macepcibridge.c
+++ b/sys/arch/sgi/pci/macepcibridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: macepcibridge.c,v 1.37 2010/03/07 13:38:58 miod Exp $ */
+/* $OpenBSD: macepcibridge.c,v 1.38 2010/04/06 19:12:34 miod Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
@@ -84,8 +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_get_dl(void *, pcitag_t, struct sgi_device_location *);
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,
@@ -239,8 +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_get_dl = mace_pcibr_get_dl;
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;
@@ -418,16 +418,24 @@ mace_pcibr_conf_write(void *cpv, pcitag_t tag, int offset, pcireg_t data)
splx(s);
}
-int16_t
-mace_pcibr_get_nasid(void *unused)
+int
+mace_pcibr_get_widget(void *unused)
{
return 0;
}
int
-mace_pcibr_get_widget(void *unused)
+mace_pcibr_get_dl(void *cpv, pcitag_t tag, struct sgi_device_location *sdl)
{
- return 0;
+ int bus, device, fn;
+
+ memset(sdl, 0, sizeof *sdl);
+ mace_pcibr_decompose_tag(cpv, tag, &bus, &device, &fn);
+ if (bus != 0)
+ return 0;
+ sdl->device = device;
+ sdl->fn = fn;
+ return 1;
}
int
diff --git a/sys/arch/sgi/pci/pci_machdep.h b/sys/arch/sgi/pci/pci_machdep.h
index 011b17385ec..2d7467b851e 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.9 2010/03/07 13:38:58 miod Exp $ */
+/* $OpenBSD: pci_machdep.h,v 1.10 2010/04/06 19:12:34 miod Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -30,6 +30,7 @@ typedef u_long pcitag_t;
typedef u_long pci_intr_handle_t;
struct pci_attach_args;
+struct sgi_device_location;
/*
* mips-specific PCI structure and type definitions.
@@ -45,8 +46,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 *);
+ int (*pc_get_dl)(void *, pcitag_t, struct sgi_device_location *);
void *pc_intr_v;
int (*pc_intr_map)(struct pci_attach_args *, pci_intr_handle_t *);
@@ -78,11 +79,11 @@ 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) \
+#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_string(c, ih) \
(*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
diff --git a/sys/arch/sgi/sgi/wscons_machdep.c b/sys/arch/sgi/sgi/wscons_machdep.c
index e4ac54023c8..c30af9b0dbc 100644
--- a/sys/arch/sgi/sgi/wscons_machdep.c
+++ b/sys/arch/sgi/sgi/wscons_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wscons_machdep.c,v 1.7 2010/04/06 19:06:07 miod Exp $ */
+/* $OpenBSD: wscons_machdep.c,v 1.8 2010/04/06 19:12:34 miod Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
@@ -93,14 +93,7 @@ extern bus_addr_t comconsaddr;
#if defined(TGT_OCTANE) || defined(TGT_ORIGIN)
struct sgi_device_location console_output;
struct sgi_device_location console_input;
-int16_t output_widget_nasid;
-int output_widget_id;
-int (*output_widget_cninit)(int16_t, int) = NULL;
-
-int16_t input_widget_nasid;
-int input_widget_id;
-int input_widget_npci;
-uint32_t input_widget_type;
+int (*output_widget_cninit)(void) = NULL;
int widget_cnprobe(void);
void widget_cnattach(void);
@@ -258,27 +251,25 @@ widget_cnprobe()
*/
if (kl_glass_console == NULL)
return 0;
- output_widget_nasid = kl_glass_console->nasid;
- output_widget_id = kl_glass_console->widid;
+ kl_get_location(kl_glass_console, &console_output);
cons = kl_get_console();
- input_widget_nasid = cons->nasid;
- input_widget_id = cons->wid;
- input_widget_npci = cons->npci;
- input_widget_type = (uint32_t)cons->type;
+ kl_get_console_location(cons, &console_input);
break;
#endif
#ifdef TGT_OCTANE
case SGI_OCTANE:
- output_widget_nasid = masternasid;
- output_widget_id = ip30_find_video();
- if (output_widget_id == 0)
+ console_output.nasid = masternasid;
+ console_output.widget = ip30_find_video();
+ if (console_output.widget == 0)
return 0;
- input_widget_nasid = masternasid;
- input_widget_id = IP30_BRIDGE_WIDGET;
- input_widget_npci = IP30_IOC_SLOTNO;
- input_widget_type =
+ console_input.nasid = masternasid;
+ console_input.widget = IP30_BRIDGE_WIDGET;
+ console_input.bus = 0;
+ console_input.device = IP30_IOC_SLOTNO;
+ console_input.fn = -1;
+ console_input.specific =
PCI_ID_CODE(PCI_VENDOR_SGI, PCI_PRODUCT_SGI_IOC3);
break;
#endif
@@ -291,13 +282,13 @@ widget_cnprobe()
*/
#if NIMPACT > 0
- if (impact_cnprobe(output_widget_nasid, output_widget_id) != 0) {
+ if (impact_cnprobe() != 0) {
output_widget_cninit = impact_cnattach;
goto success;
}
#endif
#if NODYSSEY > 0
- if (odyssey_cnprobe(output_widget_nasid, output_widget_id) != 0) {
+ if (odyssey_cnprobe() != 0) {
output_widget_cninit = odyssey_cnattach;
goto success;
}
@@ -322,12 +313,11 @@ widget_cnattach()
if (output_widget_cninit == NULL)
return;
- if ((*output_widget_cninit)(output_widget_nasid, output_widget_id) != 0)
+ if ((*output_widget_cninit)() != 0)
return;
#if NIOCKBC > 0
- if (iockbc_cnattach(input_widget_nasid, input_widget_id,
- input_widget_npci, input_widget_type, PCKBC_KBD_SLOT) == 0)
+ if (iockbc_cnattach(PCKBC_KBD_SLOT) == 0)
return; /* console keyboard found */
#endif
#if NUKBD > 0
diff --git a/sys/arch/sgi/xbow/impact.c b/sys/arch/sgi/xbow/impact.c
index 6976d21dc8f..a6ac28908da 100644
--- a/sys/arch/sgi/xbow/impact.c
+++ b/sys/arch/sgi/xbow/impact.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: impact.c,v 1.5 2010/04/06 19:02:57 miod Exp $ */
+/* $OpenBSD: impact.c,v 1.6 2010/04/06 19:12:34 miod Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
@@ -776,19 +776,17 @@ impact_eraserows(void *cookie, int row, int num, long attr)
* Console support.
*/
-static int16_t impact_console_nasid;
-static int impact_console_widget;
-
/* console backing store, worst case font selection */
static struct wsdisplay_charcell
impact_cons_bs[(IMPACT_WIDTH / 8) * (IMPACT_HEIGHT / 16)];
int
-impact_cnprobe(int16_t nasid, int widget)
+impact_cnprobe()
{
u_int32_t wid, vendor, product;
- if (xbow_widget_id(nasid, widget, &wid) != 0)
+ if (xbow_widget_id(console_output.nasid, console_output.widget,
+ &wid) != 0)
return 0;
vendor = WIDGET_ID_VENDOR(wid);
@@ -804,14 +802,15 @@ impact_cnprobe(int16_t nasid, int widget)
}
int
-impact_cnattach(int16_t nasid, int widget)
+impact_cnattach()
{
struct impact_screen *scr = &impact_cons;
struct rasops_info *ri = &scr->ri;
int rc;
/* Build bus space accessor. */
- xbow_build_bus_space(&scr->iot_store, nasid, widget);
+ xbow_build_bus_space(&scr->iot_store, console_output.nasid,
+ console_output.widget);
scr->iot = &scr->iot_store;
rc = bus_space_map(scr->iot, IMPACTSR_REG_OFFSET, IMPACTSR_REG_SIZE,
@@ -830,15 +829,12 @@ impact_cnattach(int16_t nasid, int widget)
ri->ri_ops.alloc_attr(ri, 0, 0, 0, &scr->defattr);
wsdisplay_cnattach(&scr->wsd, ri, 0, 0, scr->defattr);
- impact_console_nasid = nasid;
- impact_console_widget = widget;
-
return 0;
}
int
impact_is_console(struct xbow_attach_args *xaa)
{
- return xaa->xaa_nasid == impact_console_nasid &&
- xaa->xaa_widget == impact_console_widget;
+ return xaa->xaa_nasid == console_output.nasid &&
+ xaa->xaa_widget == console_output.widget;
}
diff --git a/sys/arch/sgi/xbow/impactvar.h b/sys/arch/sgi/xbow/impactvar.h
index 59acddc3d39..a7a7fb723fd 100644
--- a/sys/arch/sgi/xbow/impactvar.h
+++ b/sys/arch/sgi/xbow/impactvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: impactvar.h,v 1.1 2010/03/07 21:26:24 miod Exp $ */
+/* $OpenBSD: impactvar.h,v 1.2 2010/04/06 19:12:34 miod Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
@@ -16,5 +16,5 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-int impact_cnprobe(int16_t, int);
-int impact_cnattach(int16_t, int);
+int impact_cnprobe(void);
+int impact_cnattach(void);
diff --git a/sys/arch/sgi/xbow/odyssey.c b/sys/arch/sgi/xbow/odyssey.c
index f94fc104e5d..7b85701650e 100644
--- a/sys/arch/sgi/xbow/odyssey.c
+++ b/sys/arch/sgi/xbow/odyssey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: odyssey.c,v 1.4 2010/04/06 19:02:57 miod Exp $ */
+/* $OpenBSD: odyssey.c,v 1.5 2010/04/06 19:12:34 miod Exp $ */
/*
* Copyright (c) 2009, 2010 Joel Sing <jsing@openbsd.org>
*
@@ -1070,16 +1070,14 @@ ieee754_sp(int32_t v)
* Console support.
*/
-static int16_t odyssey_console_nasid;
-static int odyssey_console_widget;
-
int
-odyssey_cnprobe(int16_t nasid, int widget)
+odyssey_cnprobe()
{
u_int32_t wid, vendor, product;
/* Probe for Odyssey graphics card. */
- if (xbow_widget_id(nasid, widget, &wid) != 0)
+ if (xbow_widget_id(console_output.nasid, console_output.widget,
+ &wid) != 0)
return 0;
vendor = WIDGET_ID_VENDOR(wid);
@@ -1095,7 +1093,7 @@ odyssey_cnprobe(int16_t nasid, int widget)
}
int
-odyssey_cnattach(int16_t nasid, int widget)
+odyssey_cnattach()
{
struct odyssey_softc *sc;
struct odyssey_screen *screen;
@@ -1108,7 +1106,8 @@ odyssey_cnattach(int16_t nasid, int widget)
sc->curscr->sc = (void *)sc;
/* Build bus space accessor. */
- xbow_build_bus_space(&sc->iot_store, nasid, widget);
+ xbow_build_bus_space(&sc->iot_store, console_output.nasid,
+ console_output.widget);
sc->iot = &sc->iot_store;
/* Setup bus space mappings. */
@@ -1137,8 +1136,6 @@ odyssey_cnattach(int16_t nasid, int widget)
0, 0, 0, &attr);
wsdisplay_cnattach(&odyssey_stdscreen, &odyssey_consdata.ri,
0, 0, attr);
- odyssey_console_nasid = nasid;
- odyssey_console_widget = widget;
return 0;
}
@@ -1146,6 +1143,6 @@ odyssey_cnattach(int16_t nasid, int widget)
int
odyssey_is_console(struct xbow_attach_args *xaa)
{
- return xaa->xaa_nasid == odyssey_console_nasid &&
- xaa->xaa_widget == odyssey_console_widget;
+ return xaa->xaa_nasid == console_output.nasid &&
+ xaa->xaa_widget == console_output.widget;
}
diff --git a/sys/arch/sgi/xbow/odysseyvar.h b/sys/arch/sgi/xbow/odysseyvar.h
index f11567a12a9..7e331156442 100644
--- a/sys/arch/sgi/xbow/odysseyvar.h
+++ b/sys/arch/sgi/xbow/odysseyvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: odysseyvar.h,v 1.1 2010/03/07 13:44:26 miod Exp $ */
+/* $OpenBSD: odysseyvar.h,v 1.2 2010/04/06 19:12:34 miod Exp $ */
/*
* Copyright (c) 2010 Joel Sing <jsing@openbsd.org>
*
@@ -15,5 +15,5 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-int odyssey_cnprobe(int16_t, int);
-int odyssey_cnattach(int16_t, int);
+int odyssey_cnprobe(void);
+int odyssey_cnattach(void);
diff --git a/sys/arch/sgi/xbow/xbridge.c b/sys/arch/sgi/xbow/xbridge.c
index a6f6dc56474..b2d9bc22741 100644
--- a/sys/arch/sgi/xbow/xbridge.c
+++ b/sys/arch/sgi/xbow/xbridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xbridge.c,v 1.69 2010/04/02 12:11:55 jsg Exp $ */
+/* $OpenBSD: xbridge.c,v 1.70 2010/04/06 19:12:34 miod Exp $ */
/*
* Copyright (c) 2008, 2009 Miodrag Vallat.
@@ -215,8 +215,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_get_dl(void *, pcitag_t, struct sgi_device_location *);
int xbridge_pci_intr_handler(void *);
int xbridge_err_intr_handler(void *);
@@ -576,8 +576,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_get_dl = xbridge_get_dl;
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;
@@ -845,20 +845,32 @@ 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)
+int
+xbridge_get_widget(void *cookie)
{
struct xbpci_softc *xb = cookie;
- return xb->xb_nasid;
+ return xb->xb_widget;
}
int
-xbridge_get_widget(void *cookie)
+xbridge_get_dl(void *cookie, pcitag_t tag, struct sgi_device_location *sdl)
{
+ int bus, device, fn;
struct xbpci_softc *xb = cookie;
- return xb->xb_widget;
+ xbridge_decompose_tag(cookie, tag, &bus, &device, &fn);
+ if (bus != 0)
+ return 0;
+
+ sdl->nasid = xb->xb_nasid;
+ sdl->widget = xb->xb_widget;
+
+ sdl->bus = xb->xb_busno;
+ sdl->device = device;
+ sdl->fn = fn;
+
+ return 1;
}
/*