summaryrefslogtreecommitdiff
path: root/sys/arch/sgi/pci
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-10-13 21:17:14 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-10-13 21:17:14 +0000
commit37c48ece580d4aeacd2f905999d656ff184ffb9c (patch)
treefb5985dba703d03691046068d458f692b44cdb9d /sys/arch/sgi/pci
parent36559ce0b2c164d1ca60a5f34ce82c27545cfb1e (diff)
Make iof(4) pass its bus speed to children, this in turn allows com(4) to
pick the right clock if the PCI bus the I/O board is on degrades to 33MHz.
Diffstat (limited to 'sys/arch/sgi/pci')
-rw-r--r--sys/arch/sgi/pci/iof.c7
-rw-r--r--sys/arch/sgi/pci/iofreg.h5
-rw-r--r--sys/arch/sgi/pci/iofvar.h3
3 files changed, 12 insertions, 3 deletions
diff --git a/sys/arch/sgi/pci/iof.c b/sys/arch/sgi/pci/iof.c
index 8da9e4b409b..7d6a6631f7a 100644
--- a/sys/arch/sgi/pci/iof.c
+++ b/sys/arch/sgi/pci/iof.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iof.c,v 1.3 2009/10/07 20:39:45 miod Exp $ */
+/* $OpenBSD: iof.c,v 1.4 2009/10/13 21:17:13 miod Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
@@ -64,6 +64,8 @@ struct iof_softc {
bus_dma_tag_t sc_dmat;
pci_chipset_tag_t sc_pc;
+ uint32_t sc_mcr;
+
void *sc_ih;
struct iof_intr *sc_intr[IOC4_NDEVS];
};
@@ -153,6 +155,8 @@ iof_attach(struct device *parent, struct device *self, void *aux)
sc->sc_memt = sc->sc_mem_bus_space;
sc->sc_memh = memh;
+ sc->sc_mcr = bus_space_read_4(sc->sc_memt, sc->sc_memh, IOC4_MCR);
+
/*
* Acknowledge all pending interrupts, and disable them.
*/
@@ -211,6 +215,7 @@ iof_attach_child(struct device *iof, const char *name, bus_addr_t base,
iaa.iaa_dmat = sc->sc_dmat;
iaa.iaa_base = base;
iaa.iaa_dev = dev;
+ iaa.iaa_clock = sc->sc_mcr & IOC4_MCR_PCI_66MHZ ? 66666667 : 33333333;
config_found_sm(iof, &iaa, iof_print, iof_search);
}
diff --git a/sys/arch/sgi/pci/iofreg.h b/sys/arch/sgi/pci/iofreg.h
index 45a325cbbc4..ac170d2c6a8 100644
--- a/sys/arch/sgi/pci/iofreg.h
+++ b/sys/arch/sgi/pci/iofreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iofreg.h,v 1.2 2009/10/07 20:39:45 miod Exp $ */
+/* $OpenBSD: iofreg.h,v 1.3 2009/10/13 21:17:13 miod Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
@@ -49,6 +49,9 @@
#define IOC4_OIRQ_ATAPI 0x00000001 /* ATAPI passthrough */
#define IOC4_OIRQ_KBC 0x00000040 /* keyboard controller */
+/* bits in the MCR register */
+#define IOC4_MCR_PCI_66MHZ 0x00000001
+
#define IOC4_ATAPI_BASE 0x00000100
#define IOC4_ATAPI_SIZE 0x00000100
diff --git a/sys/arch/sgi/pci/iofvar.h b/sys/arch/sgi/pci/iofvar.h
index 1a5dc93a62d..5e8d7a09c93 100644
--- a/sys/arch/sgi/pci/iofvar.h
+++ b/sys/arch/sgi/pci/iofvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iofvar.h,v 1.1 2009/08/18 19:34:17 miod Exp $ */
+/* $OpenBSD: iofvar.h,v 1.2 2009/10/13 21:17:13 miod Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
@@ -25,6 +25,7 @@ struct iof_attach_args {
bus_addr_t iaa_base;
uint iaa_dev;
+ uint iaa_clock;
};
void *iof_intr_establish(void *, uint, int, int (*)(void *), void *, char *);