diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -1770,13 +1770,13 @@ /* Allocate an IO port or memory resource, given its GAS. */ int -acpi_bus_alloc_gas(device_t dev, int *type, int *rid, ACPI_GENERIC_ADDRESS *gas, +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; error = ENOMEM; - if (type == NULL || rid == NULL || gas == NULL || res == NULL) + if (type == NULL || gas == NULL || res == NULL) return (EINVAL); /* We only support memory and IO spaces. */ @@ -1802,14 +1802,14 @@ if (gas->Address == 0 || gas->BitWidth == 0) return (EINVAL); - bus_set_resource(dev, res_type, *rid, gas->Address, + bus_set_resource(dev, res_type, rid, gas->Address, gas->BitWidth / 8); *res = bus_alloc_resource_any(dev, res_type, rid, RF_ACTIVE | flags); if (*res != NULL) { *type = res_type; error = 0; } else - bus_delete_resource(dev, res_type, *rid); + bus_delete_resource(dev, res_type, rid); return (error); } diff --git a/sys/dev/acpica/acpi_apei.c b/sys/dev/acpica/acpi_apei.c --- a/sys/dev/acpica/acpi_apei.c +++ b/sys/dev/acpica/acpi_apei.c @@ -700,7 +700,7 @@ rid = 0; TAILQ_FOREACH(ge, &sc->ges, link) { ge->res_rid = rid++; - acpi_bus_alloc_gas(dev, &ge->res_type, &ge->res_rid, + acpi_bus_alloc_gas(dev, &ge->res_type, ge->res_rid, &ge->v1.ErrorStatusAddress, &ge->res, 0); if (ge->res) { ge->buf = pmap_mapdev_attr(READ8(ge->res, 0), @@ -710,7 +710,7 @@ } 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, + acpi_bus_alloc_gas(dev, &ge->res2_type, ge->res2_rid, &ge->v2.ReadAckRegister, &ge->res2, RF_SHAREABLE); if (ge->res2 == NULL) device_printf(dev, "Can't allocate ack resource.\n"); diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -732,7 +732,7 @@ if (AcpiGbl_FADT.C2Latency <= 100) { gas.Address = sc->cpu_p_blk + 4; cx_ptr->res_rid = 0; - acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &cx_ptr->res_rid, + acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, cx_ptr->res_rid, &gas, &cx_ptr->p_lvlx, RF_SHAREABLE); if (cx_ptr->p_lvlx != NULL) { cx_ptr->type = ACPI_STATE_C2; @@ -749,7 +749,7 @@ if (AcpiGbl_FADT.C3Latency <= 1000 && !(cpu_quirks & CPU_QUIRK_NO_C3)) { gas.Address = sc->cpu_p_blk + 5; cx_ptr->res_rid = 1; - acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &cx_ptr->res_rid, + acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, cx_ptr->res_rid, &gas, &cx_ptr->p_lvlx, RF_SHAREABLE); if (cx_ptr->p_lvlx != NULL) { cx_ptr->type = ACPI_STATE_C3; diff --git a/sys/dev/acpica/acpi_package.c b/sys/dev/acpica/acpi_package.c --- a/sys/dev/acpica/acpi_package.c +++ b/sys/dev/acpica/acpi_package.c @@ -126,7 +126,7 @@ memcpy(&gas, obj->Buffer.Pointer + 3, sizeof(gas)); - return (acpi_bus_alloc_gas(dev, type, rid, &gas, dst, flags)); + return (acpi_bus_alloc_gas(dev, type, *rid, &gas, dst, flags)); } int diff --git a/sys/dev/acpica/acpi_throttle.c b/sys/dev/acpica/acpi_throttle.c --- a/sys/dev/acpica/acpi_throttle.c +++ b/sys/dev/acpica/acpi_throttle.c @@ -275,7 +275,7 @@ return (ENXIO); } memcpy(&gas, obj.Buffer.Pointer + 3, sizeof(gas)); - acpi_bus_alloc_gas(sc->cpu_dev, &sc->cpu_p_type, &thr_rid, + acpi_bus_alloc_gas(sc->cpu_dev, &sc->cpu_p_type, thr_rid, &gas, &sc->cpu_p_cnt, 0); if (sc->cpu_p_cnt != NULL && bootverbose) { device_printf(sc->cpu_dev, "P_CNT from _PTC %#jx\n", @@ -295,7 +295,7 @@ gas.Address = sc->cpu_p_blk; gas.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO; gas.BitWidth = 32; - acpi_bus_alloc_gas(sc->cpu_dev, &sc->cpu_p_type, &thr_rid, + acpi_bus_alloc_gas(sc->cpu_dev, &sc->cpu_p_type, thr_rid, &gas, &sc->cpu_p_cnt, 0); if (sc->cpu_p_cnt != NULL) { if (bootverbose) diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -419,7 +419,7 @@ ACPI_STATUS acpi_Startup(void); void acpi_UserNotify(const char *subsystem, ACPI_HANDLE h, uint8_t notify); -int acpi_bus_alloc_gas(device_t dev, int *type, int *rid, +int acpi_bus_alloc_gas(device_t dev, int *type, int rid, ACPI_GENERIC_ADDRESS *gas, struct resource **res, u_int flags); void acpi_walk_subtables(void *first, void *end, diff --git a/sys/dev/wdatwd/wdatwd.c b/sys/dev/wdatwd/wdatwd.c --- a/sys/dev/wdatwd/wdatwd.c +++ b/sys/dev/wdatwd/wdatwd.c @@ -612,7 +612,7 @@ int type, rid = 0; struct resource *res; - if (acpi_bus_alloc_gas(dev, &type, &rid, + if (acpi_bus_alloc_gas(dev, &type, rid, &((ACPI_WDAT_ENTRY *)(wdat + 1))->RegisterRegion, &res, 0)) return (ENXIO);