summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2010-01-15 15:38:49 +0000
committermarius <marius@FreeBSD.org>2010-01-15 15:38:49 +0000
commita1e7859878b4e494b5e89d4e4c7b886ebb6e43bc (patch)
tree70d744992df39263265836205bdcb2729af71f8d /sys/sparc64
parent729d47e449667e8358c956217ac41d7c5470aed3 (diff)
downloadFreeBSD-src-a1e7859878b4e494b5e89d4e4c7b886ebb6e43bc.zip
FreeBSD-src-a1e7859878b4e494b5e89d4e4c7b886ebb6e43bc.tar.gz
- Hook up the default implementations of the MSI/MSI-X pcib_if methods
so requests may bubble up to a host-PCI bridge driver. - Distinguish between PCI and PCIe bridges in the device description so it's a bit easier to follow what hangs off of what in the dmesg. Unfortunately we can't also tell PCI and PCI-X apart based on the information provided in the OFW device tree. - Add quirk handling for the ALi M5249 found in Fire-based machines which are used as a PCIe-PCIe bridge there. These are obviously subtractive decoding as as they have a PCI-ISA bridge on their secondary side (and likewise don't include the ISA I/O range in their bridge decode) but don't indicate this via the class code. Given that this quirk isn't likely to apply to all ALi M5249 and I have no datasheet for these chips so I could implement a check using the chip specific bits enabling subtractive decoding this quirk handling is added to the MD code rather than the MI one.
Diffstat (limited to 'sys/sparc64')
-rw-r--r--sys/sparc64/pci/ofw_pcib.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/sys/sparc64/pci/ofw_pcib.c b/sys/sparc64/pci/ofw_pcib.c
index 1988561..c18d7c0 100644
--- a/sys/sparc64/pci/ofw_pcib.c
+++ b/sys/sparc64/pci/ofw_pcib.c
@@ -3,6 +3,7 @@
* Copyright (c) 2000 Michael Smith <msmith@freebsd.org>
* Copyright (c) 2000 BSDi
* Copyright (c) 2001 - 2003 Thomas Moestl <tmm@FreeBSD.org>
+ * Copyright (c) 2009 by Marius Strobl <marius@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,8 +38,9 @@ __FBSDID("$FreeBSD$");
#include "opt_ofw_pci.h"
#include <sys/param.h>
-#include <sys/kernel.h>
#include <sys/bus.h>
+#include <sys/kernel.h>
+#include <sys/libkern.h>
#include <sys/module.h>
#include <dev/ofw/ofw_bus.h>
@@ -82,6 +84,11 @@ static device_method_t ofw_pcib_methods[] = {
DEVMETHOD(pcib_read_config, pcib_read_config),
DEVMETHOD(pcib_write_config, pcib_write_config),
DEVMETHOD(pcib_route_interrupt, ofw_pcib_gen_route_interrupt),
+ DEVMETHOD(pcib_alloc_msi, pcib_alloc_msi),
+ DEVMETHOD(pcib_release_msi, pcib_release_msi),
+ DEVMETHOD(pcib_alloc_msix, pcib_alloc_msix),
+ DEVMETHOD(pcib_release_msix, pcib_release_msix),
+ DEVMETHOD(pcib_map_msi, pcib_map_msi),
/* ofw_bus interface */
DEVMETHOD(ofw_bus_get_node, ofw_pcib_gen_get_node),
@@ -100,19 +107,49 @@ MODULE_DEPEND(ofw_pcib, pci, 1, 1, 1);
static int
ofw_pcib_probe(device_t dev)
{
+ char desc[sizeof("OFW PCIe-PCIe bridge")];
+ const char *dtype, *pbdtype;
+
+#define ISDTYPE(dtype, type) \
+ (((dtype) != NULL) && strcmp((dtype), (type)) == 0)
if ((pci_get_class(dev) == PCIC_BRIDGE) &&
(pci_get_subclass(dev) == PCIS_BRIDGE_PCI) &&
ofw_bus_get_node(dev) != 0) {
- device_set_desc(dev, "OFW PCI-PCI bridge");
+ dtype = ofw_bus_get_type(dev);
+ pbdtype = ofw_bus_get_type(device_get_parent(
+ device_get_parent(dev)));
+ snprintf(desc, sizeof(desc), "OFW PCI%s-PCI%s bridge",
+ ISDTYPE(pbdtype, OFW_TYPE_PCIE) ? "e" : "",
+ ISDTYPE(dtype, OFW_TYPE_PCIE) ? "e" : "");
+ device_set_desc_copy(dev, desc);
return (0);
}
+
+#undef ISDTYPE
+
return (ENXIO);
}
static int
ofw_pcib_attach(device_t dev)
{
+ struct ofw_pcib_gen_softc *sc;
+
+ sc = device_get_softc(dev);
+
+ /* Quirk handling */
+ switch (pci_get_devid(dev)) {
+ /*
+ * The ALi M5249 found in Fire-based machines by definition must me
+ * subtractive as they have a ISA bridge on their secondary side but
+ * don't indicate this in the class code although the ISA I/O range
+ * isn't included in their bridge decode.
+ */
+ case 0x524910b9:
+ sc->ops_pcib_sc.flags |= PCIB_SUBTRACTIVE;
+ break;
+ }
ofw_pcib_gen_setup(dev);
pcib_attach_common(dev);
OpenPOWER on IntegriCloud