Module Name: src
Committed By: jmcneill
Date: Sun Oct 21 11:04:26 UTC 2018
Modified Files:
src/sys/dev/acpi: acpi_pci.c acpi_pci.h
Log Message:
Add a function to report whether the operating system may ignore the boot
configuration of PCI resources for a given bus.
To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/acpi/acpi_pci.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/acpi/acpi_pci.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/acpi/acpi_pci.c
diff -u src/sys/dev/acpi/acpi_pci.c:1.23 src/sys/dev/acpi/acpi_pci.c:1.24
--- src/sys/dev/acpi/acpi_pci.c:1.23 Mon Oct 15 10:00:30 2018
+++ src/sys/dev/acpi/acpi_pci.c Sun Oct 21 11:04:26 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci.c,v 1.23 2018/10/15 10:00:30 jmcneill Exp $ */
+/* $NetBSD: acpi_pci.c,v 1.24 2018/10/21 11:04:26 jmcneill Exp $ */
/*
* Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.23 2018/10/15 10:00:30 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.24 2018/10/21 11:04:26 jmcneill Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -58,6 +58,14 @@ static ACPI_STATUS acpi_pcidev_pciroot
void *);
/*
+ * UUID for _DSM control method, from PCI Firmware Specification.
+ */
+static UINT8 acpi_pci_dsm_uuid[ACPI_UUID_LENGTH] = {
+ 0xd0, 0x37, 0xc9, 0xe5, 0x53, 0x35, 0x7a, 0x4d,
+ 0x91, 0x17, 0xea, 0x4d, 0x19, 0xc3, 0x43, 0x4d
+};
+
+/*
* Regarding PCI Segment Groups (ACPI 4.0, p. 277):
*
* "The optional _SEG object is located under a PCI host bridge and
@@ -459,3 +467,54 @@ acpi_pcidev_find_dev(struct acpi_devnode
return dv;
}
+
+/*
+ * acpi_pci_ignore_boot_config:
+ *
+ * Returns 1 if the operating system may ignore the boot configuration
+ * of PCI resources.
+ */
+ACPI_INTEGER
+acpi_pci_ignore_boot_config(ACPI_HANDLE handle)
+{
+ ACPI_OBJECT_LIST objs;
+ ACPI_OBJECT obj[4], *pobj;
+ ACPI_BUFFER buf;
+ ACPI_INTEGER ret;
+
+ objs.Count = 4;
+ objs.Pointer = obj;
+ obj[0].Type = ACPI_TYPE_BUFFER;
+ obj[0].Buffer.Length = ACPI_UUID_LENGTH;
+ obj[0].Buffer.Pointer = acpi_pci_dsm_uuid;
+ obj[1].Type = ACPI_TYPE_INTEGER;
+ obj[1].Integer.Value = 1;
+ obj[2].Type = ACPI_TYPE_INTEGER;
+ obj[2].Integer.Value = 5;
+ obj[3].Type = ACPI_TYPE_PACKAGE;
+ obj[3].Package.Count = 0;
+ obj[3].Package.Elements = NULL;
+
+ buf.Pointer = NULL;
+ buf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+
+ if (ACPI_FAILURE(AcpiEvaluateObject(handle, "_DSM", &objs, &buf)) || buf.Pointer == NULL)
+ return 0;
+
+ ret = 0;
+
+ pobj = buf.Pointer;
+ switch (pobj->Type) {
+ case ACPI_TYPE_INTEGER:
+ ret = pobj->Integer.Value;
+ break;
+ case ACPI_TYPE_PACKAGE:
+ if (pobj->Package.Count == 1 && pobj->Package.Elements[0].Type == ACPI_TYPE_INTEGER)
+ ret = pobj->Package.Elements[0].Integer.Value;
+ break;
+ }
+
+ ACPI_FREE(buf.Pointer);
+
+ return ret;
+}
Index: src/sys/dev/acpi/acpi_pci.h
diff -u src/sys/dev/acpi/acpi_pci.h:1.9 src/sys/dev/acpi/acpi_pci.h:1.10
--- src/sys/dev/acpi/acpi_pci.h:1.9 Mon Oct 15 10:00:30 2018
+++ src/sys/dev/acpi/acpi_pci.h Sun Oct 21 11:04:26 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci.h,v 1.9 2018/10/15 10:00:30 jmcneill Exp $ */
+/* $NetBSD: acpi_pci.h,v 1.10 2018/10/21 11:04:26 jmcneill Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -38,5 +38,6 @@ struct acpi_devnode *acpi_pcidev_find(ui
uint16_t, uint16_t);
device_t acpi_pcidev_find_dev(struct acpi_devnode *);
struct acpi_devnode *acpi_pciroot_find(uint16_t, uint16_t);
+ACPI_INTEGER acpi_pci_ignore_boot_config(ACPI_HANDLE);
#endif /* !_SYS_DEV_ACPI_ACPI_PCI_H */