summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/sgi/dev/com_iof.c7
-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
4 files changed, 14 insertions, 8 deletions
diff --git a/sys/arch/sgi/dev/com_iof.c b/sys/arch/sgi/dev/com_iof.c
index 4a0190ffe23..1b3240c7817 100644
--- a/sys/arch/sgi/dev/com_iof.c
+++ b/sys/arch/sgi/dev/com_iof.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com_iof.c,v 1.3 2009/10/11 19:36:25 miod Exp $ */
+/* $OpenBSD: com_iof.c,v 1.4 2009/10/13 21:17:11 miod Exp $ */
/*
* Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -92,10 +92,7 @@ com_iof_attach(struct device *parent, struct device *self, void *aux)
sc->sc_hwflags = 0;
sc->sc_swflags = 0;
- /* XXX need to get PCI bus speed from parent */
- sc->sc_frequency = 66666667;
- if (0)
- sc->sc_frequency >>= 1;
+ sc->sc_frequency = iaa->iaa_clock;
/* if it's in use as console, it's there. */
if (!(console && !comconsattached)) {
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 *);