svn commit: r332014 - head/sys/arm/mv

Marcin Wojtas mw at FreeBSD.org
Wed Apr 4 12:36:56 UTC 2018


Author: mw
Date: Wed Apr  4 12:36:55 2018
New Revision: 332014
URL: https://svnweb.freebsd.org/changeset/base/332014

Log:
  Add support of PCI_RES_BUS to Marvell PCI driver
  
  GENERIC ARM config use NEW_PCIB driver (https://wiki.freebsd.org/NEW_PCIB).
  To satisfy it, allocation and deallocation of PCI_RES_BUS is necessary.
  Conditional compilation is added for backward compatibility with ARMv5
  configs.
  
  Submitted by: Rafal Kozik <rk at semihalf.com>
  Reviewed by: jhb
  Obtained from: Semihalf
  Sponsored by: Stormshield
  Differential Revision: https://reviews.freebsd.org/D14748

Modified:
  head/sys/arm/mv/mv_pci.c

Modified: head/sys/arm/mv/mv_pci.c
==============================================================================
--- head/sys/arm/mv/mv_pci.c	Wed Apr  4 12:35:28 2018	(r332013)
+++ head/sys/arm/mv/mv_pci.c	Wed Apr  4 12:36:55 2018	(r332014)
@@ -312,6 +312,8 @@ struct mv_pcib_softc {
 	int		sc_skip_enable_procedure;
 	int		sc_enable_find_root_slot;
 	struct ofw_bus_iinfo	sc_pci_iinfo;
+
+	int		ap_segment;		/* PCI domain */
 };
 
 /* Local forward prototypes */
@@ -441,6 +443,8 @@ mv_pcib_attach(device_t self)
 			return(ENXIO);
 	}
 
+	sc->ap_segment = port_id;
+
 	if (ofw_bus_node_is_compatible(node, "mrvl,pcie")) {
 		sc->sc_type = MV_TYPE_PCIE;
 		if (ofw_bus_node_is_compatible(parnode, "marvell,armada-370-pcie")) {
@@ -879,6 +883,11 @@ mv_pcib_alloc_resource(device_t dev, device_t child, i
 	case SYS_RES_MEMORY:
 		rm = &sc->sc_mem_rman;
 		break;
+#ifdef PCI_RES_BUS
+	case PCI_RES_BUS:
+		return (pci_domain_alloc_bus(sc->ap_segment, child, rid, start,
+		    end, count, flags));
+#endif
 	default:
 		return (BUS_ALLOC_RESOURCE(device_get_parent(dev), dev,
 		    type, rid, start, end, count, flags));
@@ -915,7 +924,12 @@ static int
 mv_pcib_release_resource(device_t dev, device_t child, int type, int rid,
     struct resource *res)
 {
+#ifdef PCI_RES_BUS
+	struct mv_pcib_softc *sc = device_get_softc(dev);
 
+	if (type == PCI_RES_BUS)
+		return (pci_domain_release_bus(sc->ap_segment, child, rid, res));
+#endif
 	if (type != SYS_RES_IOPORT && type != SYS_RES_MEMORY)
 		return (BUS_RELEASE_RESOURCE(device_get_parent(dev), child,
 		    type, rid, res));


More information about the svn-src-all mailing list