From owner-svn-src-all@freebsd.org Wed Apr 20 20:58:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3DC0B16B40; Wed, 20 Apr 2016 20:58:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B4CDC1709; Wed, 20 Apr 2016 20:58:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3KKwUGO084714; Wed, 20 Apr 2016 20:58:30 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3KKwU4F084713; Wed, 20 Apr 2016 20:58:30 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201604202058.u3KKwU4F084713@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 20 Apr 2016 20:58:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298372 - head/sys/dev/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2016 20:58:32 -0000 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.