Page MenuHomeFreeBSD

D32749.id97727.diff
No OneTemporary

D32749.id97727.diff

Index: sys/dev/acpica/acpi.c
===================================================================
--- sys/dev/acpica/acpi.c
+++ sys/dev/acpica/acpi.c
@@ -942,7 +942,45 @@
}
return (0);
}
-
+ if (strcmp(locator, BUS_LOCATOR_UEFI) == 0) {
+ ACPI_DEVICE_INFO *adinfo;
+ if (!ACPI_FAILURE(AcpiGetObjectInfo(dinfo->ad_handle, &adinfo)) &&
+ dinfo->ad_handle != 0 && (adinfo->Valid & ACPI_VALID_HID)) {
+ const char *hid = adinfo->HardwareId.String;
+ u_long uid = (adinfo->Valid & ACPI_VALID_UID) ?
+ strtoul(adinfo->UniqueId.String, NULL, 10) : 0UL;
+ u_long hidval;
+
+ if (strncmp("PNP", hid, 3) != 0)
+ goto nomatch;
+ hidval = strtoul(hid + 3, NULL, 16);
+ switch (hidval) {
+ case 0x0301:
+ sbuf_printf(sb, "Keyboard(%lx)", uid);
+ break;
+ case 0x0401:
+ sbuf_printf(sb, "ParallelPort(%lx)", uid);
+ break;
+ case 0x0501:
+ sbuf_printf(sb, "Serial(%lx)", uid);
+ break;
+ case 0x0604:
+ sbuf_printf(sb, "Floppy(%lx)", uid);
+ break;
+ case 0x0a03:
+ sbuf_printf(sb, "PciRoot(%lx)", uid);
+ break;
+ case 0x0a08:
+ sbuf_printf(sb, "PcieRoot(%lx)", uid);
+ break;
+ default: /* Everything else gets a generic encode */
+ nomatch:
+ sbuf_printf(sb, "Acpi(%s,%ld)", hid, uid);
+ break;
+ }
+ }
+ /* Not handled: AcpiAdr... unsure how to know it's one */
+ }
/* For the rest, punt to the default handler */
return (bus_generic_get_device_path(bus, child, locator, sb));
}
Index: sys/dev/acpica/acpi_pci.c
===================================================================
--- sys/dev/acpica/acpi_pci.c
+++ sys/dev/acpica/acpi_pci.c
@@ -210,6 +210,10 @@
}
return (0);
}
+ if (strcmp(locator, BUS_LOCATOR_UEFI) == 0) {
+ /* UEFI is the same as the PCI base class */
+ return (pci_get_device_path_method(bus, child, locator, sb));
+ }
/* For the rest, punt to the default handler */
return (bus_generic_get_device_path(bus, child, locator, sb));
Index: sys/dev/pci/pci.c
===================================================================
--- sys/dev/pci/pci.c
+++ sys/dev/pci/pci.c
@@ -138,7 +138,6 @@
static int pci_get_id_method(device_t dev, device_t child,
enum pci_id_type type, uintptr_t *rid);
-
static struct pci_devinfo * pci_fill_devinfo(device_t pcib, device_t bus, int d,
int b, int s, int f, uint16_t vid, uint16_t did);
@@ -177,6 +176,7 @@
DEVMETHOD(bus_child_detached, pci_child_detached),
DEVMETHOD(bus_child_pnpinfo, pci_child_pnpinfo_method),
DEVMETHOD(bus_child_location, pci_child_location_method),
+ DEVMETHOD(bus_get_device_path, pci_get_device_path_method),
DEVMETHOD(bus_hint_device_unit, pci_hint_device_unit),
DEVMETHOD(bus_remap_intr, pci_remap_intr_method),
DEVMETHOD(bus_suspend_child, pci_suspend_child),
@@ -5872,6 +5872,24 @@
return (0);
}
+int
+pci_get_device_path_method(device_t bus, device_t child, const char *locator,
+ struct sbuf *sb)
+{
+ device_t parent = device_get_parent(bus);
+ int rv;
+
+ if (strcmp(locator, BUS_LOCATOR_UEFI) == 0) {
+ rv = bus_generic_get_device_path(parent, bus, locator, sb);
+ if (rv == 0) {
+ sbuf_printf(sb, "/Pci(0x%x,0x%x)", pci_get_slot(child),
+ pci_get_function(child));
+ }
+ return (0);
+ }
+ return (bus_generic_get_device_path(bus, child, locator, sb));
+}
+
int
pci_assign_interrupt_method(device_t dev, device_t child)
{
Index: sys/dev/pci/pci_private.h
===================================================================
--- sys/dev/pci/pci_private.h
+++ sys/dev/pci/pci_private.h
@@ -138,6 +138,8 @@
struct sbuf *sb);
int pci_child_pnpinfo_method(device_t cbdev, device_t child,
struct sbuf *sb);
+int pci_get_device_path_method(device_t dev, device_t child,
+ const char *locator, struct sbuf *sb);
int pci_assign_interrupt_method(device_t dev, device_t child);
int pci_resume(device_t dev);
int pci_resume_child(device_t dev, device_t child);

File Metadata

Mime Type
text/plain
Expires
Tue, Sep 1, 7:11 PM (15 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37849971
Default Alt Text
D32749.id97727.diff (3 KB)

Event Timeline