summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjchandra <jchandra@FreeBSD.org>2010-10-06 15:37:55 +0000
committerjchandra <jchandra@FreeBSD.org>2010-10-06 15:37:55 +0000
commit0ec5ea82890bcfadf0ab42368ce8bef795a5d2d0 (patch)
tree6836258d28dfc5d9f03aeb696849e81574b064cc
parent4223f1b04f139a5ff1c964339271254c70f26f5e (diff)
downloadFreeBSD-src-0ec5ea82890bcfadf0ab42368ce8bef795a5d2d0.zip
FreeBSD-src-0ec5ea82890bcfadf0ab42368ce8bef795a5d2d0.tar.gz
PCI fix for XLR C revision chips, limit DMA address to the first 2GB
physical address. Adds a dma tag to the XLR/XLS pci bus with the lowaddr if the CPU happens to be a XLR C rev. Submitted by: Sreekanth M. S. (kanthms at netlogicmicro dot com))
-rw-r--r--sys/mips/rmi/board.h29
-rw-r--r--sys/mips/rmi/xlr_pci.c26
2 files changed, 53 insertions, 2 deletions
diff --git a/sys/mips/rmi/board.h b/sys/mips/rmi/board.h
index 62f7283..35ce7e1 100644
--- a/sys/mips/rmi/board.h
+++ b/sys/mips/rmi/board.h
@@ -117,6 +117,35 @@ xlr_processor_id(void)
}
/*
+ * The processor is XLR and C-Series
+ */
+static __inline unsigned int
+xlr_is_c_revision(void)
+{
+ int processor_id = xlr_processor_id();
+ int revision_id = xlr_revision();
+
+ switch (processor_id) {
+ /*
+ * These are the relevant PIDs for XLR
+ * steppings (hawk and above). For these,
+ * PIDs, Rev-Ids of [5-9] indicate 'C'.
+ */
+ case RMI_CHIP_XLR308_C:
+ case RMI_CHIP_XLR508_C:
+ case RMI_CHIP_XLR516_C:
+ case RMI_CHIP_XLR532_C:
+ case RMI_CHIP_XLR716:
+ case RMI_CHIP_XLR732:
+ if (revision_id >= 5 && revision_id <= 9)
+ return (1);
+ default:
+ return (0);
+ }
+ return (0);
+}
+
+/*
* RMI Engineering boards which are PCI cards
* These should come up in PCI device mode (not yet)
*/
diff --git a/sys/mips/rmi/xlr_pci.c b/sys/mips/rmi/xlr_pci.c
index b324aec..3204691 100644
--- a/sys/mips/rmi/xlr_pci.c
+++ b/sys/mips/rmi/xlr_pci.c
@@ -113,7 +113,7 @@ __FBSDID("$FreeBSD$");
#endif
struct xlr_pcib_softc {
- int junk; /* no softc */
+ bus_dma_tag_t sc_pci_dmat; /* PCI DMA tag pointer */
};
static devclass_t pcib_devclass;
@@ -300,7 +300,19 @@ xlr_pcib_write_config(device_t dev, u_int b, u_int s, u_int f,
static int
xlr_pcib_attach(device_t dev)
{
-
+ struct xlr_pcib_softc *sc;
+ sc = device_get_softc(dev);
+
+ /*
+ * XLR C revision chips cannot do DMA above 2G physical address
+ * create a parent tag with this lowaddr
+ */
+ if (xlr_is_c_revision()) {
+ if (bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0,
+ 0x7fffffff, ~0, NULL, NULL, 0x7fffffff,
+ 0xff, 0x7fffffff, 0, NULL, NULL, &sc->sc_pci_dmat) != 0)
+ panic("%s: bus_dma_tag_create failed", __func__);
+ }
device_add_child(dev, "pci", 0);
bus_generic_attach(dev);
return (0);
@@ -566,6 +578,15 @@ xlr_pci_release_resource(device_t bus, device_t child, int type, int rid,
return (rman_release_resource(r));
}
+static bus_dma_tag_t
+xlr_pci_get_dma_tag(device_t bus, device_t child)
+{
+ struct xlr_pcib_softc *sc;
+
+ sc = device_get_softc(bus);
+ return (sc->sc_pci_dmat);
+}
+
static int
xlr_pci_activate_resource(device_t bus, device_t child, int type, int rid,
struct resource *r)
@@ -618,6 +639,7 @@ static device_method_t xlr_pcib_methods[] = {
DEVMETHOD(bus_write_ivar, xlr_pcib_write_ivar),
DEVMETHOD(bus_alloc_resource, xlr_pci_alloc_resource),
DEVMETHOD(bus_release_resource, xlr_pci_release_resource),
+ DEVMETHOD(bus_get_dma_tag, xlr_pci_get_dma_tag),
DEVMETHOD(bus_activate_resource, xlr_pci_activate_resource),
DEVMETHOD(bus_deactivate_resource, xlr_pci_deactivate_resource),
DEVMETHOD(bus_setup_intr, mips_platform_pci_setup_intr),
OpenPOWER on IntegriCloud