Page MenuHomeFreeBSD
Paste P621

Command-Line Input
ActivePublic

Authored by jhb on Jan 9 2024, 6:21 PM.
Tags
None
Referenced Files
F74547937: Command-Line Input
Jan 9 2024, 6:21 PM
Subscribers
None
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 22d2b10ff905..0f4c48b3bb2f 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -1502,14 +1502,6 @@ acpi_set_resource(device_t dev, device_t child, int type, int rid,
if (type == SYS_RES_IRQ)
return (0);
- /*
- * Don't reserve resources for CPU devices. Some of these
- * resources need to be allocated as shareable, but reservations
- * are always non-shareable.
- */
- if (device_get_devclass(child) == devclass_find("cpu"))
- return (0);
-
/*
* Reserve the resource.
*
@@ -1703,7 +1695,7 @@ int
acpi_bus_alloc_gas(device_t dev, int *type, int *rid, ACPI_GENERIC_ADDRESS *gas,
struct resource **res, u_int flags)
{
- int error, res_type;
+ int error, old, res_type;
error = ENOMEM;
if (type == NULL || rid == NULL || gas == NULL || res == NULL)
@@ -1732,6 +1724,10 @@ acpi_bus_alloc_gas(device_t dev, int *type, int *rid, ACPI_GENERIC_ADDRESS *gas,
if (gas->Address == 0 || gas->BitWidth == 0)
return (EINVAL);
+ /* Temporarily disable reserving resources in acpi_set_resource. */
+ old = sc->acpi_resources_reserved;
+ sc->acpi_resources_reserved = 0;
+
bus_set_resource(dev, res_type, *rid, gas->Address,
gas->BitWidth / 8);
*res = bus_alloc_resource_any(dev, res_type, rid, RF_ACTIVE | flags);
@@ -1741,6 +1737,8 @@ acpi_bus_alloc_gas(device_t dev, int *type, int *rid, ACPI_GENERIC_ADDRESS *gas,
} else
bus_delete_resource(dev, res_type, *rid);
+ sc->acpi_resources_reserved = old;
+
return (error);
}
diff --git a/sys/dev/acpica/acpi_apei.c b/sys/dev/acpica/acpi_apei.c
index 6a3d9d10edd4..9cfd46c97430 100644
--- a/sys/dev/acpica/acpi_apei.c
+++ b/sys/dev/acpica/acpi_apei.c
@@ -711,7 +711,7 @@ apei_attach(device_t dev)
if (ge->v1.Header.Type == ACPI_HEST_TYPE_GENERIC_ERROR_V2) {
ge->res2_rid = rid++;
acpi_bus_alloc_gas(dev, &ge->res2_type, &ge->res2_rid,
- &ge->v2.ReadAckRegister, &ge->res2, 0);
+ &ge->v2.ReadAckRegister, &ge->res2, RF_SHAREABLE);
if (ge->res2 == NULL)
device_printf(dev, "Can't allocate ack resource.\n");
}

Event Timeline