From owner-svn-src-stable-8@FreeBSD.ORG Fri Jan 15 15:38:49 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8530810656AA; Fri, 15 Jan 2010 15:38:49 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 725088FC32; Fri, 15 Jan 2010 15:38:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0FFcn98014697; Fri, 15 Jan 2010 15:38:49 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0FFcnBr014695; Fri, 15 Jan 2010 15:38:49 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201001151538.o0FFcnBr014695@svn.freebsd.org> From: Marius Strobl Date: Fri, 15 Jan 2010 15:38:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r202377 - stable/8/sys/sparc64/pci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jan 2010 15:38:49 -0000 Author: marius Date: Fri Jan 15 15:38:49 2010 New Revision: 202377 URL: http://svn.freebsd.org/changeset/base/202377 Log: - 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. Modified: stable/8/sys/sparc64/pci/ofw_pcib.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/sparc64/pci/ofw_pcib.c ============================================================================== --- stable/8/sys/sparc64/pci/ofw_pcib.c Fri Jan 15 15:38:31 2010 (r202376) +++ stable/8/sys/sparc64/pci/ofw_pcib.c Fri Jan 15 15:38:49 2010 (r202377) @@ -3,6 +3,7 @@ * Copyright (c) 2000 Michael Smith * Copyright (c) 2000 BSDi * Copyright (c) 2001 - 2003 Thomas Moestl + * Copyright (c) 2009 by Marius Strobl * 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 -#include #include +#include +#include #include #include @@ -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);