diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2009-11-11 15:56:43 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2009-11-11 15:56:43 +0000 |
commit | 8ee5c2d8be6e5d9f68d15addc9137af7a16b5db6 (patch) | |
tree | c4fd8d6df510ecae51a978d23957f025cfbdd2e4 /sys | |
parent | fdc324b442a5abfb30c5fb71dd0e0523b7eb0516 (diff) |
Let ioc(4) pass the information whether it is an onboard device or not, to its
subdevices; use this on iockbc to only perform the fuel workaround on the
onboard ioc.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/sgi/dev/iockbc.c | 8 | ||||
-rw-r--r-- | sys/arch/sgi/pci/ioc.c | 37 | ||||
-rw-r--r-- | sys/arch/sgi/pci/iocvar.h | 5 |
3 files changed, 29 insertions, 21 deletions
diff --git a/sys/arch/sgi/dev/iockbc.c b/sys/arch/sgi/dev/iockbc.c index 8c1bc2d4cb2..366c861b6c6 100644 --- a/sys/arch/sgi/dev/iockbc.c +++ b/sys/arch/sgi/dev/iockbc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iockbc.c,v 1.2 2009/11/11 15:54:24 miod Exp $ */ +/* $OpenBSD: iockbc.c,v 1.3 2009/11/11 15:56:41 miod Exp $ */ /* * Copyright (c) 2006, 2007, 2009 Joel Sing <jsing@openbsd.org> * @@ -231,11 +231,11 @@ iockbc_attach(struct device *parent, struct device *self, void *aux) uint32_t csr; /* - * For some reason keyboard and mouse ports are inverted on - * Fuel (and probably Origin 300 as well). + * For some reason keyboard and mouse ports are inverted on Fuel. */ - if (sys_config.system_type == SGI_IP35) { + if (ISSET(iaa->iaa_flags, IOC_FLAGS_OBIO) && + sys_config.system_type == SGI_IP35) { isc->rx[PCKBC_KBD_SLOT] = IOC3_KBC_AUX_RX; isc->rx[PCKBC_AUX_SLOT] = IOC3_KBC_KBD_RX; isc->tx[PCKBC_KBD_SLOT] = IOC3_KBC_AUX_TX; diff --git a/sys/arch/sgi/pci/ioc.c b/sys/arch/sgi/pci/ioc.c index 3f7d67cee21..24f64f2adaa 100644 --- a/sys/arch/sgi/pci/ioc.c +++ b/sys/arch/sgi/pci/ioc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ioc.c,v 1.30 2009/11/11 15:29:29 miod Exp $ */ +/* $OpenBSD: ioc.c,v 1.31 2009/11/11 15:56:42 miod Exp $ */ /* * Copyright (c) 2008 Joel Sing. @@ -53,11 +53,6 @@ int ioc_match(struct device *, void *, void *); void ioc_attach(struct device *, struct device *, void *); -struct device * - ioc_attach_child(struct device *, const char *, bus_addr_t, int); -int ioc_search_onewire(struct device *, void *, void *); -int ioc_search_mundane(struct device *, void *, void *); -int ioc_print(void *, const char *); struct ioc_intr { struct ioc_softc *ii_ioc; @@ -87,6 +82,8 @@ struct ioc_softc { struct owmac_softc *sc_owmac; struct owserial_softc *sc_owserial; + + int sc_attach_flags; }; struct cfattach ioc_ca = { @@ -97,6 +94,11 @@ struct cfdriver ioc_cd = { NULL, "ioc", DV_DULL, }; +void ioc_attach_child(struct ioc_softc *, const char *, bus_addr_t, int); +int ioc_search_onewire(struct device *, void *, void *); +int ioc_search_mundane(struct device *, void *, void *); +int ioc_print(void *, const char *); + int ioc_intr_dispatch(struct ioc_softc *, int); int ioc_intr_ethernet(void *); int ioc_intr_shared(void *); @@ -396,6 +398,8 @@ unknown: * Attach other sub-devices. */ + sc->sc_attach_flags = is_obio ? IOC_FLAGS_OBIO : 0; + if (ISSET(subdevice_mask, 1 << IOCDEV_SERIAL_A)) { /* * Put serial ports in passthrough mode, @@ -409,17 +413,17 @@ unknown: bus_space_write_4(sc->sc_memt, sc->sc_memh, IOC3_UARTB_SHADOW, 0); - ioc_attach_child(self, "com", IOC3_UARTA_BASE, IOCDEV_SERIAL_A); - ioc_attach_child(self, "com", IOC3_UARTB_BASE, IOCDEV_SERIAL_B); + ioc_attach_child(sc, "com", IOC3_UARTA_BASE, IOCDEV_SERIAL_A); + ioc_attach_child(sc, "com", IOC3_UARTB_BASE, IOCDEV_SERIAL_B); } if (ISSET(subdevice_mask, 1 << IOCDEV_KBC)) - ioc_attach_child(self, "iockbc", 0, IOCDEV_KBC); + ioc_attach_child(sc, "iockbc", 0, IOCDEV_KBC); if (ISSET(subdevice_mask, 1 << IOCDEV_EF)) - ioc_attach_child(self, "iec", 0, IOCDEV_EF); + ioc_attach_child(sc, "iec", 0, IOCDEV_EF); if (ISSET(subdevice_mask, 1 << IOCDEV_LPT)) - ioc_attach_child(self, "lpt", 0, IOCDEV_LPT); + ioc_attach_child(sc, "lpt", 0, IOCDEV_LPT); if (ISSET(subdevice_mask, 1 << IOCDEV_RTC)) - ioc_attach_child(self, "dsrtc", rtcbase, IOCDEV_RTC); + ioc_attach_child(sc, "dsrtc", rtcbase, IOCDEV_RTC); return; @@ -430,10 +434,10 @@ unmap: bus_space_unmap(memt, memh, memsize); } -struct device * -ioc_attach_child(struct device *ioc, const char *name, bus_addr_t base, int dev) +void +ioc_attach_child(struct ioc_softc *sc, const char *name, bus_addr_t base, + int dev) { - struct ioc_softc *sc = (struct ioc_softc *)ioc; struct ioc_attach_args iaa; memset(&iaa, 0, sizeof iaa); @@ -444,6 +448,7 @@ ioc_attach_child(struct device *ioc, const char *name, bus_addr_t base, int dev) iaa.iaa_dmat = sc->sc_dmat; iaa.iaa_base = base; iaa.iaa_dev = dev; + iaa.iaa_flags = sc->sc_attach_flags; if (dev == IOCDEV_EF) { if (sc->sc_owmac != NULL) @@ -465,7 +470,7 @@ ioc_attach_child(struct device *ioc, const char *name, bus_addr_t base, int dev) } } - return config_found_sm(ioc, &iaa, ioc_print, ioc_search_mundane); + config_found_sm(&sc->sc_dev, &iaa, ioc_print, ioc_search_mundane); } int diff --git a/sys/arch/sgi/pci/iocvar.h b/sys/arch/sgi/pci/iocvar.h index a5c314f6084..172e533e54e 100644 --- a/sys/arch/sgi/pci/iocvar.h +++ b/sys/arch/sgi/pci/iocvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: iocvar.h,v 1.3 2009/07/26 19:58:51 miod Exp $ */ +/* $OpenBSD: iocvar.h,v 1.4 2009/11/11 15:56:42 miod Exp $ */ /* * Copyright (c) 2008 Miodrag Vallat. @@ -27,6 +27,9 @@ struct ioc_attach_args { int iaa_dev; uint8_t iaa_enaddr[6]; + + int iaa_flags; +#define IOC_FLAGS_OBIO 0x00000001 }; void *ioc_intr_establish(void *, u_long, int, int (*)(void *), |