svn commit: r298372 - head/sys/dev/acpica

John Baldwin jhb at FreeBSD.org
Wed Apr 20 20:58:32 UTC 2016


Author: jhb
Date: Wed Apr 20 20:58:30 2016
New Revision: 298372
URL: https://svnweb.freebsd.org/changeset/base/298372

Log:
  Invoke _OSC on Host-PCI bridges.
  
  Tell the firmware that we support PCI-express config space access
  and MSI.
  
  Reviewed by:	jkim
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D6023

Modified:
  head/sys/dev/acpica/acpi_pcib_acpi.c

Modified: head/sys/dev/acpica/acpi_pcib_acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi_pcib_acpi.c	Wed Apr 20 20:56:06 2016	(r298371)
+++ head/sys/dev/acpica/acpi_pcib_acpi.c	Wed Apr 20 20:58:30 2016	(r298372)
@@ -295,6 +295,40 @@ first_decoded_bus(struct acpi_hpcib_soft
 }
 #endif
 
+static void
+acpi_pcib_osc(struct acpi_hpcib_softc *sc)
+{
+	ACPI_STATUS status;
+	uint32_t cap_set[3];
+
+	static uint8_t pci_host_bridge_uuid[ACPI_UUID_LENGTH] = {
+		0x5b, 0x4d, 0xdb, 0x33, 0xf7, 0x1f, 0x1c, 0x40,
+		0x96, 0x57, 0x74, 0x41, 0xc0, 0x3d, 0xd7, 0x66
+	};
+
+	/* Support Field: Extended PCI Config Space, MSI */
+	cap_set[1] = 0x11;
+
+	/* Control Field */
+	cap_set[2] = 0;
+
+	status = acpi_EvaluateOSC(sc->ap_handle, pci_host_bridge_uuid, 1,
+	    nitems(cap_set), cap_set, false);
+	if (ACPI_FAILURE(status)) {
+		if (status == AE_NOT_FOUND)
+			return;
+		device_printf(sc->ap_dev, "_OSC failed: %s\n",
+		    AcpiFormatException(status));
+		return;
+	}
+
+	if (cap_set[0] != 0) {
+		device_printf(sc->ap_dev, "_OSC returned error %#x\n",
+		    cap_set[0]);
+		return;
+	}
+}
+
 static int
 acpi_pcib_acpi_attach(device_t dev)
 {
@@ -321,6 +355,8 @@ acpi_pcib_acpi_attach(device_t dev)
     if (!acpi_DeviceIsPresent(dev))
 	return (ENXIO);
 
+    acpi_pcib_osc(sc);
+
     /*
      * Get our segment number by evaluating _SEG.
      * It's OK for this to not exist.


More information about the svn-src-head mailing list