1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-02 12:20:51 +00:00

Add an interface to pass an argument to the resource parsing functions.

This is just groundwork for changing sysresource behavior.

PR:
Submitted by:
Reviewed by:
Approved by:
Obtained from:
MFC after:
This commit is contained in:
Nate Lawson 2004-03-31 17:23:46 +00:00
parent 247648affb
commit 72ad60ada4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=127679
3 changed files with 9 additions and 7 deletions

View File

@ -1211,7 +1211,7 @@ acpi_probe_child(ACPI_HANDLE handle, UINT32 level, void *context, void **status)
* device. Ignore the return value here; it's OK for the * device. Ignore the return value here; it's OK for the
* device not to have any resources. * device not to have any resources.
*/ */
acpi_parse_resources(child, handle, &acpi_res_parse_set); acpi_parse_resources(child, handle, &acpi_res_parse_set, NULL);
/* If we're debugging, probe/attach now rather than later */ /* If we're debugging, probe/attach now rather than later */
ACPI_DEBUG_EXEC(device_probe_and_attach(child)); ACPI_DEBUG_EXEC(device_probe_and_attach(child));

View File

@ -56,7 +56,7 @@ ACPI_MODULE_NAME("RESOURCE")
*/ */
ACPI_STATUS ACPI_STATUS
acpi_parse_resources(device_t dev, ACPI_HANDLE handle, acpi_parse_resources(device_t dev, ACPI_HANDLE handle,
struct acpi_parse_resource_set *set) struct acpi_parse_resource_set *set, void *arg)
{ {
ACPI_BUFFER buf; ACPI_BUFFER buf;
ACPI_RESOURCE *res; ACPI_RESOURCE *res;
@ -86,7 +86,7 @@ acpi_parse_resources(device_t dev, ACPI_HANDLE handle,
} }
ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "%s - got %ld bytes of resources\n", ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "%s - got %ld bytes of resources\n",
acpi_name(handle), (long)buf.Length)); acpi_name(handle), (long)buf.Length));
set->set_init(dev, &context); set->set_init(dev, arg, &context);
/* Iterate through the resources */ /* Iterate through the resources */
curr = buf.Pointer; curr = buf.Pointer;
@ -373,7 +373,7 @@ acpi_parse_resources(device_t dev, ACPI_HANDLE handle,
* Resource-set vectors used to attach _CRS-derived resources * Resource-set vectors used to attach _CRS-derived resources
* to an ACPI device. * to an ACPI device.
*/ */
static void acpi_res_set_init(device_t dev, void **context); static void acpi_res_set_init(device_t dev, void *arg, void **context);
static void acpi_res_set_done(device_t dev, void *context); static void acpi_res_set_done(device_t dev, void *context);
static void acpi_res_set_ioport(device_t dev, void *context, static void acpi_res_set_ioport(device_t dev, void *context,
u_int32_t base, u_int32_t length); u_int32_t base, u_int32_t length);
@ -411,15 +411,17 @@ struct acpi_res_context {
int ar_nmem; int ar_nmem;
int ar_nirq; int ar_nirq;
int ar_ndrq; int ar_ndrq;
void *ar_parent;
}; };
static void static void
acpi_res_set_init(device_t dev, void **context) acpi_res_set_init(device_t dev, void *arg, void **context)
{ {
struct acpi_res_context *cp; struct acpi_res_context *cp;
if ((cp = AcpiOsAllocate(sizeof(*cp))) != NULL) { if ((cp = AcpiOsAllocate(sizeof(*cp))) != NULL) {
bzero(cp, sizeof(*cp)); bzero(cp, sizeof(*cp));
cp->ar_parent = arg;
*context = cp; *context = cp;
} }
} }

View File

@ -198,7 +198,7 @@ extern void acpi_UserNotify(const char *subsystem, ACPI_HANDLE h,
uint8_t notify); uint8_t notify);
struct acpi_parse_resource_set { struct acpi_parse_resource_set {
void (*set_init)(device_t dev, void **context); void (*set_init)(device_t dev, void *arg, void **context);
void (*set_done)(device_t dev, void *context); void (*set_done)(device_t dev, void *context);
void (*set_ioport)(device_t dev, void *context, u_int32_t base, void (*set_ioport)(device_t dev, void *context, u_int32_t base,
u_int32_t length); u_int32_t length);
@ -221,7 +221,7 @@ struct acpi_parse_resource_set {
extern struct acpi_parse_resource_set acpi_res_parse_set; extern struct acpi_parse_resource_set acpi_res_parse_set;
extern ACPI_STATUS acpi_parse_resources(device_t dev, ACPI_HANDLE handle, extern ACPI_STATUS acpi_parse_resources(device_t dev, ACPI_HANDLE handle,
struct acpi_parse_resource_set *set); struct acpi_parse_resource_set *set, void *arg);
/* ACPI event handling */ /* ACPI event handling */
extern UINT32 acpi_event_power_button_sleep(void *context); extern UINT32 acpi_event_power_button_sleep(void *context);