diff options
103 files changed, 6500 insertions, 6613 deletions
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c index 447fa9e33ffb..1f378df14f34 100644 --- a/arch/i386/kernel/acpi/boot.c +++ b/arch/i386/kernel/acpi/boot.c | |||
@@ -464,7 +464,7 @@ int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) | |||
464 | * success: return IRQ number (>=0) | 464 | * success: return IRQ number (>=0) |
465 | * failure: return < 0 | 465 | * failure: return < 0 |
466 | */ | 466 | */ |
467 | int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) | 467 | int acpi_register_gsi(u32 gsi, int triggering, int polarity) |
468 | { | 468 | { |
469 | unsigned int irq; | 469 | unsigned int irq; |
470 | unsigned int plat_gsi = gsi; | 470 | unsigned int plat_gsi = gsi; |
@@ -476,14 +476,14 @@ int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) | |||
476 | if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) { | 476 | if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) { |
477 | extern void eisa_set_level_irq(unsigned int irq); | 477 | extern void eisa_set_level_irq(unsigned int irq); |
478 | 478 | ||
479 | if (edge_level == ACPI_LEVEL_SENSITIVE) | 479 | if (triggering == ACPI_LEVEL_SENSITIVE) |
480 | eisa_set_level_irq(gsi); | 480 | eisa_set_level_irq(gsi); |
481 | } | 481 | } |
482 | #endif | 482 | #endif |
483 | 483 | ||
484 | #ifdef CONFIG_X86_IO_APIC | 484 | #ifdef CONFIG_X86_IO_APIC |
485 | if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) { | 485 | if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) { |
486 | plat_gsi = mp_register_gsi(gsi, edge_level, active_high_low); | 486 | plat_gsi = mp_register_gsi(gsi, triggering, polarity); |
487 | } | 487 | } |
488 | #endif | 488 | #endif |
489 | acpi_gsi_to_irq(plat_gsi, &irq); | 489 | acpi_gsi_to_irq(plat_gsi, &irq); |
diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c index 91a64016956e..0102f3d50e57 100644 --- a/arch/i386/kernel/mpparse.c +++ b/arch/i386/kernel/mpparse.c | |||
@@ -1080,7 +1080,7 @@ void __init mp_config_acpi_legacy_irqs (void) | |||
1080 | 1080 | ||
1081 | #define MAX_GSI_NUM 4096 | 1081 | #define MAX_GSI_NUM 4096 |
1082 | 1082 | ||
1083 | int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) | 1083 | int mp_register_gsi (u32 gsi, int triggering, int polarity) |
1084 | { | 1084 | { |
1085 | int ioapic = -1; | 1085 | int ioapic = -1; |
1086 | int ioapic_pin = 0; | 1086 | int ioapic_pin = 0; |
@@ -1129,7 +1129,7 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) | |||
1129 | 1129 | ||
1130 | mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); | 1130 | mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); |
1131 | 1131 | ||
1132 | if (edge_level) { | 1132 | if (triggering == ACPI_LEVEL_SENSITIVE) { |
1133 | /* | 1133 | /* |
1134 | * For PCI devices assign IRQs in order, avoiding gaps | 1134 | * For PCI devices assign IRQs in order, avoiding gaps |
1135 | * due to unused I/O APIC pins. | 1135 | * due to unused I/O APIC pins. |
@@ -1151,8 +1151,8 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) | |||
1151 | } | 1151 | } |
1152 | 1152 | ||
1153 | io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, | 1153 | io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, |
1154 | edge_level == ACPI_EDGE_SENSITIVE ? 0 : 1, | 1154 | triggering == ACPI_EDGE_SENSITIVE ? 0 : 1, |
1155 | active_high_low == ACPI_ACTIVE_HIGH ? 0 : 1); | 1155 | polarity == ACPI_ACTIVE_HIGH ? 0 : 1); |
1156 | return gsi; | 1156 | return gsi; |
1157 | } | 1157 | } |
1158 | 1158 | ||
diff --git a/arch/ia64/kernel/acpi-ext.c b/arch/ia64/kernel/acpi-ext.c index 13a5b3b49bf8..4a5574ff007b 100644 --- a/arch/ia64/kernel/acpi-ext.c +++ b/arch/ia64/kernel/acpi-ext.c | |||
@@ -33,33 +33,33 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context) | |||
33 | struct acpi_vendor_info *info = (struct acpi_vendor_info *)context; | 33 | struct acpi_vendor_info *info = (struct acpi_vendor_info *)context; |
34 | struct acpi_resource_vendor *vendor; | 34 | struct acpi_resource_vendor *vendor; |
35 | struct acpi_vendor_descriptor *descriptor; | 35 | struct acpi_vendor_descriptor *descriptor; |
36 | u32 length; | 36 | u32 byte_length; |
37 | 37 | ||
38 | if (resource->id != ACPI_RSTYPE_VENDOR) | 38 | if (resource->type != ACPI_RESOURCE_TYPE_VENDOR) |
39 | return AE_OK; | 39 | return AE_OK; |
40 | 40 | ||
41 | vendor = (struct acpi_resource_vendor *)&resource->data; | 41 | vendor = (struct acpi_resource_vendor *)&resource->data; |
42 | descriptor = (struct acpi_vendor_descriptor *)vendor->reserved; | 42 | descriptor = (struct acpi_vendor_descriptor *)vendor->byte_data; |
43 | if (vendor->length <= sizeof(*info->descriptor) || | 43 | if (vendor->byte_length <= sizeof(*info->descriptor) || |
44 | descriptor->guid_id != info->descriptor->guid_id || | 44 | descriptor->guid_id != info->descriptor->guid_id || |
45 | efi_guidcmp(descriptor->guid, info->descriptor->guid)) | 45 | efi_guidcmp(descriptor->guid, info->descriptor->guid)) |
46 | return AE_OK; | 46 | return AE_OK; |
47 | 47 | ||
48 | length = vendor->length - sizeof(struct acpi_vendor_descriptor); | 48 | byte_length = vendor->byte_length - sizeof(struct acpi_vendor_descriptor); |
49 | info->data = acpi_os_allocate(length); | 49 | info->data = acpi_os_allocate(byte_length); |
50 | if (!info->data) | 50 | if (!info->data) |
51 | return AE_NO_MEMORY; | 51 | return AE_NO_MEMORY; |
52 | 52 | ||
53 | memcpy(info->data, | 53 | memcpy(info->data, |
54 | vendor->reserved + sizeof(struct acpi_vendor_descriptor), | 54 | vendor->byte_data + sizeof(struct acpi_vendor_descriptor), |
55 | length); | 55 | byte_length); |
56 | info->length = length; | 56 | info->length = byte_length; |
57 | return AE_CTRL_TERMINATE; | 57 | return AE_CTRL_TERMINATE; |
58 | } | 58 | } |
59 | 59 | ||
60 | acpi_status | 60 | acpi_status |
61 | acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id, | 61 | acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id, |
62 | u8 ** data, u32 * length) | 62 | u8 ** data, u32 * byte_length) |
63 | { | 63 | { |
64 | struct acpi_vendor_info info; | 64 | struct acpi_vendor_info info; |
65 | 65 | ||
@@ -72,7 +72,7 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id, | |||
72 | return AE_NOT_FOUND; | 72 | return AE_NOT_FOUND; |
73 | 73 | ||
74 | *data = info.data; | 74 | *data = info.data; |
75 | *length = info.length; | 75 | *byte_length = info.length; |
76 | return AE_OK; | 76 | return AE_OK; |
77 | } | 77 | } |
78 | 78 | ||
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index 9ad94ddf6687..d2702c419cf8 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c | |||
@@ -567,16 +567,16 @@ void __init acpi_numa_arch_fixup(void) | |||
567 | * success: return IRQ number (>=0) | 567 | * success: return IRQ number (>=0) |
568 | * failure: return < 0 | 568 | * failure: return < 0 |
569 | */ | 569 | */ |
570 | int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) | 570 | int acpi_register_gsi(u32 gsi, int triggering, int polarity) |
571 | { | 571 | { |
572 | if (has_8259 && gsi < 16) | 572 | if (has_8259 && gsi < 16) |
573 | return isa_irq_to_vector(gsi); | 573 | return isa_irq_to_vector(gsi); |
574 | 574 | ||
575 | return iosapic_register_intr(gsi, | 575 | return iosapic_register_intr(gsi, |
576 | (active_high_low == | 576 | (polarity == |
577 | ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : | 577 | ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : |
578 | IOSAPIC_POL_LOW, | 578 | IOSAPIC_POL_LOW, |
579 | (edge_level == | 579 | (triggering == |
580 | ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : | 580 | ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : |
581 | IOSAPIC_LEVEL); | 581 | IOSAPIC_LEVEL); |
582 | } | 582 | } |
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 30dbc98bf0b3..337abd50c6ea 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c | |||
@@ -193,12 +193,12 @@ add_io_space (struct pci_root_info *info, struct acpi_resource_address64 *addr) | |||
193 | goto free_resource; | 193 | goto free_resource; |
194 | } | 194 | } |
195 | 195 | ||
196 | min = addr->min_address_range; | 196 | min = addr->minimum; |
197 | max = min + addr->address_length - 1; | 197 | max = min + addr->address_length - 1; |
198 | if (addr->attribute.io.translation_attribute == ACPI_SPARSE_TRANSLATION) | 198 | if (addr->info.io.translation_type == ACPI_SPARSE_TRANSLATION) |
199 | sparse = 1; | 199 | sparse = 1; |
200 | 200 | ||
201 | space_nr = new_space(addr->address_translation_offset, sparse); | 201 | space_nr = new_space(addr->translation_offset, sparse); |
202 | if (space_nr == ~0) | 202 | if (space_nr == ~0) |
203 | goto free_name; | 203 | goto free_name; |
204 | 204 | ||
@@ -285,7 +285,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data) | |||
285 | if (addr.resource_type == ACPI_MEMORY_RANGE) { | 285 | if (addr.resource_type == ACPI_MEMORY_RANGE) { |
286 | flags = IORESOURCE_MEM; | 286 | flags = IORESOURCE_MEM; |
287 | root = &iomem_resource; | 287 | root = &iomem_resource; |
288 | offset = addr.address_translation_offset; | 288 | offset = addr.translation_offset; |
289 | } else if (addr.resource_type == ACPI_IO_RANGE) { | 289 | } else if (addr.resource_type == ACPI_IO_RANGE) { |
290 | flags = IORESOURCE_IO; | 290 | flags = IORESOURCE_IO; |
291 | root = &ioport_resource; | 291 | root = &ioport_resource; |
@@ -298,7 +298,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data) | |||
298 | window = &info->controller->window[info->controller->windows++]; | 298 | window = &info->controller->window[info->controller->windows++]; |
299 | window->resource.name = info->name; | 299 | window->resource.name = info->name; |
300 | window->resource.flags = flags; | 300 | window->resource.flags = flags; |
301 | window->resource.start = addr.min_address_range + offset; | 301 | window->resource.start = addr.minimum + offset; |
302 | window->resource.end = window->resource.start + addr.address_length - 1; | 302 | window->resource.end = window->resource.start + addr.address_length - 1; |
303 | window->resource.child = NULL; | 303 | window->resource.child = NULL; |
304 | window->offset = offset; | 304 | window->offset = offset; |
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c index 97154ab058b4..619767d3ea2b 100644 --- a/arch/x86_64/kernel/io_apic.c +++ b/arch/x86_64/kernel/io_apic.c | |||
@@ -1956,7 +1956,7 @@ int __init io_apic_get_redir_entries (int ioapic) | |||
1956 | } | 1956 | } |
1957 | 1957 | ||
1958 | 1958 | ||
1959 | int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low) | 1959 | int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int polarity) |
1960 | { | 1960 | { |
1961 | struct IO_APIC_route_entry entry; | 1961 | struct IO_APIC_route_entry entry; |
1962 | unsigned long flags; | 1962 | unsigned long flags; |
@@ -1978,8 +1978,8 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a | |||
1978 | entry.delivery_mode = INT_DELIVERY_MODE; | 1978 | entry.delivery_mode = INT_DELIVERY_MODE; |
1979 | entry.dest_mode = INT_DEST_MODE; | 1979 | entry.dest_mode = INT_DEST_MODE; |
1980 | entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS); | 1980 | entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS); |
1981 | entry.trigger = edge_level; | 1981 | entry.trigger = triggering; |
1982 | entry.polarity = active_high_low; | 1982 | entry.polarity = polarity; |
1983 | entry.mask = 1; /* Disabled (masked) */ | 1983 | entry.mask = 1; /* Disabled (masked) */ |
1984 | 1984 | ||
1985 | irq = gsi_irq_sharing(irq); | 1985 | irq = gsi_irq_sharing(irq); |
@@ -1994,9 +1994,9 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a | |||
1994 | apic_printk(APIC_VERBOSE,KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> " | 1994 | apic_printk(APIC_VERBOSE,KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> " |
1995 | "IRQ %d Mode:%i Active:%i)\n", ioapic, | 1995 | "IRQ %d Mode:%i Active:%i)\n", ioapic, |
1996 | mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq, | 1996 | mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq, |
1997 | edge_level, active_high_low); | 1997 | triggering, polarity); |
1998 | 1998 | ||
1999 | ioapic_register_intr(irq, entry.vector, edge_level); | 1999 | ioapic_register_intr(irq, entry.vector, triggering); |
2000 | 2000 | ||
2001 | if (!ioapic && (irq < 16)) | 2001 | if (!ioapic && (irq < 16)) |
2002 | disable_8259A_irq(irq); | 2002 | disable_8259A_irq(irq); |
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c index 1105250bf02c..dc49bfb6db0a 100644 --- a/arch/x86_64/kernel/mpparse.c +++ b/arch/x86_64/kernel/mpparse.c | |||
@@ -915,7 +915,7 @@ void __init mp_config_acpi_legacy_irqs (void) | |||
915 | 915 | ||
916 | #define MAX_GSI_NUM 4096 | 916 | #define MAX_GSI_NUM 4096 |
917 | 917 | ||
918 | int mp_register_gsi(u32 gsi, int edge_level, int active_high_low) | 918 | int mp_register_gsi(u32 gsi, int triggering, int polarity) |
919 | { | 919 | { |
920 | int ioapic = -1; | 920 | int ioapic = -1; |
921 | int ioapic_pin = 0; | 921 | int ioapic_pin = 0; |
@@ -964,7 +964,7 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low) | |||
964 | 964 | ||
965 | mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); | 965 | mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); |
966 | 966 | ||
967 | if (edge_level) { | 967 | if (triggering == ACPI_LEVEL_SENSITIVE) { |
968 | /* | 968 | /* |
969 | * For PCI devices assign IRQs in order, avoiding gaps | 969 | * For PCI devices assign IRQs in order, avoiding gaps |
970 | * due to unused I/O APIC pins. | 970 | * due to unused I/O APIC pins. |
@@ -986,8 +986,8 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low) | |||
986 | } | 986 | } |
987 | 987 | ||
988 | io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, | 988 | io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, |
989 | edge_level == ACPI_EDGE_SENSITIVE ? 0 : 1, | 989 | triggering == ACPI_EDGE_SENSITIVE ? 0 : 1, |
990 | active_high_low == ACPI_ACTIVE_HIGH ? 0 : 1); | 990 | polarity == ACPI_ACTIVE_HIGH ? 0 : 1); |
991 | return gsi; | 991 | return gsi; |
992 | } | 992 | } |
993 | 993 | ||
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 2143609d2936..b12946ccd135 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
@@ -101,8 +101,8 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) | |||
101 | address64.attribute.memory.cache_attribute; | 101 | address64.attribute.memory.cache_attribute; |
102 | mem_device->read_write_attribute = | 102 | mem_device->read_write_attribute = |
103 | address64.attribute.memory.read_write_attribute; | 103 | address64.attribute.memory.read_write_attribute; |
104 | mem_device->start_addr = address64.min_address_range; | 104 | mem_device->start_addr = address64.minimum; |
105 | mem_device->end_addr = address64.max_address_range; | 105 | mem_device->end_addr = address64.maximum; |
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 | ||
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index 8693c704aea6..4fa80abfe6c0 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c | |||
@@ -118,14 +118,6 @@ acpi_ds_init_one_object(acpi_handle obj_handle, | |||
118 | case ACPI_TYPE_METHOD: | 118 | case ACPI_TYPE_METHOD: |
119 | 119 | ||
120 | /* | 120 | /* |
121 | * Print a dot for each method unless we are going to print | ||
122 | * the entire pathname | ||
123 | */ | ||
124 | if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { | ||
125 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); | ||
126 | } | ||
127 | |||
128 | /* | ||
129 | * Set the execution data width (32 or 64) based upon the | 121 | * Set the execution data width (32 or 64) based upon the |
130 | * revision number of the parent ACPI table. | 122 | * revision number of the parent ACPI table. |
131 | * TBD: This is really for possible future support of integer width | 123 | * TBD: This is really for possible future support of integer width |
@@ -134,6 +126,21 @@ acpi_ds_init_one_object(acpi_handle obj_handle, | |||
134 | if (info->table_desc->pointer->revision == 1) { | 126 | if (info->table_desc->pointer->revision == 1) { |
135 | node->flags |= ANOBJ_DATA_WIDTH_32; | 127 | node->flags |= ANOBJ_DATA_WIDTH_32; |
136 | } | 128 | } |
129 | #ifdef ACPI_INIT_PARSE_METHODS | ||
130 | /* | ||
131 | * Note 11/2005: Removed this code to parse all methods during table | ||
132 | * load because it causes problems if there are any errors during the | ||
133 | * parse. Also, it seems like overkill and we probably don't want to | ||
134 | * abort a table load because of an issue with a single method. | ||
135 | */ | ||
136 | |||
137 | /* | ||
138 | * Print a dot for each method unless we are going to print | ||
139 | * the entire pathname | ||
140 | */ | ||
141 | if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { | ||
142 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); | ||
143 | } | ||
137 | 144 | ||
138 | /* | 145 | /* |
139 | * Always parse methods to detect errors, we will delete | 146 | * Always parse methods to detect errors, we will delete |
@@ -149,7 +156,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle, | |||
149 | 156 | ||
150 | /* This parse failed, but we will continue parsing more methods */ | 157 | /* This parse failed, but we will continue parsing more methods */ |
151 | } | 158 | } |
152 | 159 | #endif | |
153 | info->method_count++; | 160 | info->method_count++; |
154 | break; | 161 | break; |
155 | 162 | ||
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 36c1ca0b9adb..e7ce86b8d954 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -47,135 +47,66 @@ | |||
47 | #include <acpi/acdispat.h> | 47 | #include <acpi/acdispat.h> |
48 | #include <acpi/acinterp.h> | 48 | #include <acpi/acinterp.h> |
49 | #include <acpi/acnamesp.h> | 49 | #include <acpi/acnamesp.h> |
50 | #include <acpi/acdisasm.h> | ||
50 | 51 | ||
51 | #define _COMPONENT ACPI_DISPATCHER | 52 | #define _COMPONENT ACPI_DISPATCHER |
52 | ACPI_MODULE_NAME("dsmethod") | 53 | ACPI_MODULE_NAME("dsmethod") |
53 | 54 | ||
54 | /******************************************************************************* | 55 | /******************************************************************************* |
55 | * | 56 | * |
56 | * FUNCTION: acpi_ds_parse_method | 57 | * FUNCTION: acpi_ds_method_error |
57 | * | 58 | * |
58 | * PARAMETERS: Node - Method node | 59 | * PARAMETERS: Status - Execution status |
60 | * walk_state - Current state | ||
59 | * | 61 | * |
60 | * RETURN: Status | 62 | * RETURN: Status |
61 | * | 63 | * |
62 | * DESCRIPTION: Parse the AML that is associated with the method. | 64 | * DESCRIPTION: Called on method error. Invoke the global exception handler if |
65 | * present, dump the method data if the disassembler is configured | ||
63 | * | 66 | * |
64 | * MUTEX: Assumes parser is locked | 67 | * Note: Allows the exception handler to change the status code |
65 | * | 68 | * |
66 | ******************************************************************************/ | 69 | ******************************************************************************/ |
67 | acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) | 70 | acpi_status |
71 | acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) | ||
68 | { | 72 | { |
69 | acpi_status status; | 73 | ACPI_FUNCTION_ENTRY(); |
70 | union acpi_operand_object *obj_desc; | ||
71 | union acpi_parse_object *op; | ||
72 | struct acpi_walk_state *walk_state; | ||
73 | |||
74 | ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node); | ||
75 | 74 | ||
76 | /* Parameter Validation */ | 75 | /* Ignore AE_OK and control exception codes */ |
77 | 76 | ||
78 | if (!node) { | 77 | if (ACPI_SUCCESS(status) || (status & AE_CODE_CONTROL)) { |
79 | return_ACPI_STATUS(AE_NULL_ENTRY); | 78 | return (status); |
80 | } | 79 | } |
81 | 80 | ||
82 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 81 | /* Invoke the global exception handler */ |
83 | "**** Parsing [%4.4s] **** named_obj=%p\n", | ||
84 | acpi_ut_get_node_name(node), node)); | ||
85 | |||
86 | /* Extract the method object from the method Node */ | ||
87 | 82 | ||
88 | obj_desc = acpi_ns_get_attached_object(node); | 83 | if (acpi_gbl_exception_handler) { |
89 | if (!obj_desc) { | 84 | /* Exit the interpreter, allow handler to execute methods */ |
90 | return_ACPI_STATUS(AE_NULL_OBJECT); | ||
91 | } | ||
92 | 85 | ||
93 | /* Create a mutex for the method if there is a concurrency limit */ | 86 | acpi_ex_exit_interpreter(); |
94 | 87 | ||
95 | if ((obj_desc->method.concurrency != ACPI_INFINITE_CONCURRENCY) && | 88 | /* |
96 | (!obj_desc->method.semaphore)) { | 89 | * Handler can map the exception code to anything it wants, including |
97 | status = acpi_os_create_semaphore(obj_desc->method.concurrency, | 90 | * AE_OK, in which case the executing method will not be aborted. |
98 | obj_desc->method.concurrency, | 91 | */ |
99 | &obj_desc->method.semaphore); | 92 | status = acpi_gbl_exception_handler(status, |
100 | if (ACPI_FAILURE(status)) { | 93 | walk_state->method_node ? |
101 | return_ACPI_STATUS(status); | 94 | walk_state->method_node-> |
102 | } | 95 | name.integer : 0, |
103 | } | 96 | walk_state->opcode, |
104 | 97 | walk_state->aml_offset, | |
105 | /* | 98 | NULL); |
106 | * Allocate a new parser op to be the root of the parsed | 99 | (void)acpi_ex_enter_interpreter(); |
107 | * method tree | ||
108 | */ | ||
109 | op = acpi_ps_alloc_op(AML_METHOD_OP); | ||
110 | if (!op) { | ||
111 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
112 | } | ||
113 | |||
114 | /* Init new op with the method name and pointer back to the Node */ | ||
115 | |||
116 | acpi_ps_set_name(op, node->name.integer); | ||
117 | op->common.node = node; | ||
118 | |||
119 | /* | ||
120 | * Get a new owner_id for objects created by this method. Namespace | ||
121 | * objects (such as Operation Regions) can be created during the | ||
122 | * first pass parse. | ||
123 | */ | ||
124 | status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); | ||
125 | if (ACPI_FAILURE(status)) { | ||
126 | goto cleanup; | ||
127 | } | ||
128 | |||
129 | /* Create and initialize a new walk state */ | ||
130 | |||
131 | walk_state = | ||
132 | acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, NULL, | ||
133 | NULL); | ||
134 | if (!walk_state) { | ||
135 | status = AE_NO_MEMORY; | ||
136 | goto cleanup2; | ||
137 | } | 100 | } |
138 | 101 | #ifdef ACPI_DISASSEMBLER | |
139 | status = acpi_ds_init_aml_walk(walk_state, op, node, | ||
140 | obj_desc->method.aml_start, | ||
141 | obj_desc->method.aml_length, NULL, 1); | ||
142 | if (ACPI_FAILURE(status)) { | 102 | if (ACPI_FAILURE(status)) { |
143 | acpi_ds_delete_walk_state(walk_state); | 103 | /* Display method locals/args if disassembler is present */ |
144 | goto cleanup2; | ||
145 | } | ||
146 | 104 | ||
147 | /* | 105 | acpi_dm_dump_method_info(status, walk_state, walk_state->op); |
148 | * Parse the method, first pass | ||
149 | * | ||
150 | * The first pass load is where newly declared named objects are added into | ||
151 | * the namespace. Actual evaluation of the named objects (what would be | ||
152 | * called a "second pass") happens during the actual execution of the | ||
153 | * method so that operands to the named objects can take on dynamic | ||
154 | * run-time values. | ||
155 | */ | ||
156 | status = acpi_ps_parse_aml(walk_state); | ||
157 | if (ACPI_FAILURE(status)) { | ||
158 | goto cleanup2; | ||
159 | } | 106 | } |
107 | #endif | ||
160 | 108 | ||
161 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 109 | return (status); |
162 | "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", | ||
163 | acpi_ut_get_node_name(node), node, op)); | ||
164 | |||
165 | /* | ||
166 | * Delete the parse tree. We simply re-parse the method for every | ||
167 | * execution since there isn't much overhead (compared to keeping lots | ||
168 | * of parse trees around) | ||
169 | */ | ||
170 | acpi_ns_delete_namespace_subtree(node); | ||
171 | acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id); | ||
172 | |||
173 | cleanup2: | ||
174 | acpi_ut_release_owner_id(&obj_desc->method.owner_id); | ||
175 | |||
176 | cleanup: | ||
177 | acpi_ps_delete_parse_tree(op); | ||
178 | return_ACPI_STATUS(status); | ||
179 | } | 110 | } |
180 | 111 | ||
181 | /******************************************************************************* | 112 | /******************************************************************************* |
@@ -195,9 +126,9 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) | |||
195 | ******************************************************************************/ | 126 | ******************************************************************************/ |
196 | 127 | ||
197 | acpi_status | 128 | acpi_status |
198 | acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | 129 | acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, |
199 | union acpi_operand_object *obj_desc, | 130 | union acpi_operand_object * obj_desc, |
200 | struct acpi_namespace_node *calling_method_node) | 131 | struct acpi_namespace_node * calling_method_node) |
201 | { | 132 | { |
202 | acpi_status status = AE_OK; | 133 | acpi_status status = AE_OK; |
203 | 134 | ||
@@ -545,16 +476,54 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
545 | } | 476 | } |
546 | } | 477 | } |
547 | 478 | ||
479 | /* | ||
480 | * There are no more threads executing this method. Perform | ||
481 | * additional cleanup. | ||
482 | * | ||
483 | * The method Node is stored in the walk state | ||
484 | */ | ||
485 | method_node = walk_state->method_node; | ||
486 | |||
487 | /* Lock namespace for possible update */ | ||
488 | |||
489 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
490 | if (ACPI_FAILURE(status)) { | ||
491 | goto exit; | ||
492 | } | ||
493 | |||
494 | /* | ||
495 | * Delete any namespace entries created immediately underneath | ||
496 | * the method | ||
497 | */ | ||
498 | if (method_node->child) { | ||
499 | acpi_ns_delete_namespace_subtree(method_node); | ||
500 | } | ||
501 | |||
502 | /* | ||
503 | * Delete any namespace entries created anywhere else within | ||
504 | * the namespace by the execution of this method | ||
505 | */ | ||
506 | acpi_ns_delete_namespace_by_owner(walk_state->method_desc->method. | ||
507 | owner_id); | ||
508 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
509 | |||
510 | /* Are there any other threads currently executing this method? */ | ||
511 | |||
548 | if (walk_state->method_desc->method.thread_count) { | 512 | if (walk_state->method_desc->method.thread_count) { |
513 | /* | ||
514 | * Additional threads. Do not release the owner_id in this case, | ||
515 | * we immediately reuse it for the next thread executing this method | ||
516 | */ | ||
549 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 517 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
550 | "*** Not deleting method namespace, there are still %d threads\n", | 518 | "*** Completed execution of one thread, %d threads remaining\n", |
551 | walk_state->method_desc->method. | 519 | walk_state->method_desc->method. |
552 | thread_count)); | 520 | thread_count)); |
553 | } else { /* This is the last executing thread */ | 521 | } else { |
522 | /* This is the only executing thread for this method */ | ||
554 | 523 | ||
555 | /* | 524 | /* |
556 | * Support to dynamically change a method from not_serialized to | 525 | * Support to dynamically change a method from not_serialized to |
557 | * Serialized if it appears that the method is written foolishly and | 526 | * Serialized if it appears that the method is incorrectly written and |
558 | * does not support multiple thread execution. The best example of this | 527 | * does not support multiple thread execution. The best example of this |
559 | * is if such a method creates namespace objects and blocks. A second | 528 | * is if such a method creates namespace objects and blocks. A second |
560 | * thread will fail with an AE_ALREADY_EXISTS exception | 529 | * thread will fail with an AE_ALREADY_EXISTS exception |
@@ -570,34 +539,8 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
570 | semaphore); | 539 | semaphore); |
571 | } | 540 | } |
572 | 541 | ||
573 | /* | 542 | /* No more threads, we can free the owner_id */ |
574 | * There are no more threads executing this method. Perform | ||
575 | * additional cleanup. | ||
576 | * | ||
577 | * The method Node is stored in the walk state | ||
578 | */ | ||
579 | method_node = walk_state->method_node; | ||
580 | |||
581 | /* | ||
582 | * Delete any namespace entries created immediately underneath | ||
583 | * the method | ||
584 | */ | ||
585 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
586 | if (ACPI_FAILURE(status)) { | ||
587 | goto exit; | ||
588 | } | ||
589 | |||
590 | if (method_node->child) { | ||
591 | acpi_ns_delete_namespace_subtree(method_node); | ||
592 | } | ||
593 | 543 | ||
594 | /* | ||
595 | * Delete any namespace entries created anywhere else within | ||
596 | * the namespace | ||
597 | */ | ||
598 | acpi_ns_delete_namespace_by_owner(walk_state->method_desc-> | ||
599 | method.owner_id); | ||
600 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
601 | acpi_ut_release_owner_id(&walk_state->method_desc->method. | 544 | acpi_ut_release_owner_id(&walk_state->method_desc->method. |
602 | owner_id); | 545 | owner_id); |
603 | } | 546 | } |
@@ -606,3 +549,140 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
606 | (void)acpi_ut_release_mutex(ACPI_MTX_PARSER); | 549 | (void)acpi_ut_release_mutex(ACPI_MTX_PARSER); |
607 | return_VOID; | 550 | return_VOID; |
608 | } | 551 | } |
552 | |||
553 | #ifdef ACPI_INIT_PARSE_METHODS | ||
554 | /* | ||
555 | * Note 11/2005: Removed this code to parse all methods during table | ||
556 | * load because it causes problems if there are any errors during the | ||
557 | * parse. Also, it seems like overkill and we probably don't want to | ||
558 | * abort a table load because of an issue with a single method. | ||
559 | */ | ||
560 | |||
561 | /******************************************************************************* | ||
562 | * | ||
563 | * FUNCTION: acpi_ds_parse_method | ||
564 | * | ||
565 | * PARAMETERS: Node - Method node | ||
566 | * | ||
567 | * RETURN: Status | ||
568 | * | ||
569 | * DESCRIPTION: Parse the AML that is associated with the method. | ||
570 | * | ||
571 | * MUTEX: Assumes parser is locked | ||
572 | * | ||
573 | ******************************************************************************/ | ||
574 | |||
575 | acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) | ||
576 | { | ||
577 | acpi_status status; | ||
578 | union acpi_operand_object *obj_desc; | ||
579 | union acpi_parse_object *op; | ||
580 | struct acpi_walk_state *walk_state; | ||
581 | |||
582 | ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node); | ||
583 | |||
584 | /* Parameter Validation */ | ||
585 | |||
586 | if (!node) { | ||
587 | return_ACPI_STATUS(AE_NULL_ENTRY); | ||
588 | } | ||
589 | |||
590 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | ||
591 | "**** Parsing [%4.4s] **** named_obj=%p\n", | ||
592 | acpi_ut_get_node_name(node), node)); | ||
593 | |||
594 | /* Extract the method object from the method Node */ | ||
595 | |||
596 | obj_desc = acpi_ns_get_attached_object(node); | ||
597 | if (!obj_desc) { | ||
598 | return_ACPI_STATUS(AE_NULL_OBJECT); | ||
599 | } | ||
600 | |||
601 | /* Create a mutex for the method if there is a concurrency limit */ | ||
602 | |||
603 | if ((obj_desc->method.concurrency != ACPI_INFINITE_CONCURRENCY) && | ||
604 | (!obj_desc->method.semaphore)) { | ||
605 | status = acpi_os_create_semaphore(obj_desc->method.concurrency, | ||
606 | obj_desc->method.concurrency, | ||
607 | &obj_desc->method.semaphore); | ||
608 | if (ACPI_FAILURE(status)) { | ||
609 | return_ACPI_STATUS(status); | ||
610 | } | ||
611 | } | ||
612 | |||
613 | /* | ||
614 | * Allocate a new parser op to be the root of the parsed | ||
615 | * method tree | ||
616 | */ | ||
617 | op = acpi_ps_alloc_op(AML_METHOD_OP); | ||
618 | if (!op) { | ||
619 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
620 | } | ||
621 | |||
622 | /* Init new op with the method name and pointer back to the Node */ | ||
623 | |||
624 | acpi_ps_set_name(op, node->name.integer); | ||
625 | op->common.node = node; | ||
626 | |||
627 | /* | ||
628 | * Get a new owner_id for objects created by this method. Namespace | ||
629 | * objects (such as Operation Regions) can be created during the | ||
630 | * first pass parse. | ||
631 | */ | ||
632 | status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); | ||
633 | if (ACPI_FAILURE(status)) { | ||
634 | goto cleanup; | ||
635 | } | ||
636 | |||
637 | /* Create and initialize a new walk state */ | ||
638 | |||
639 | walk_state = | ||
640 | acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, NULL, | ||
641 | NULL); | ||
642 | if (!walk_state) { | ||
643 | status = AE_NO_MEMORY; | ||
644 | goto cleanup2; | ||
645 | } | ||
646 | |||
647 | status = acpi_ds_init_aml_walk(walk_state, op, node, | ||
648 | obj_desc->method.aml_start, | ||
649 | obj_desc->method.aml_length, NULL, 1); | ||
650 | if (ACPI_FAILURE(status)) { | ||
651 | acpi_ds_delete_walk_state(walk_state); | ||
652 | goto cleanup2; | ||
653 | } | ||
654 | |||
655 | /* | ||
656 | * Parse the method, first pass | ||
657 | * | ||
658 | * The first pass load is where newly declared named objects are added into | ||
659 | * the namespace. Actual evaluation of the named objects (what would be | ||
660 | * called a "second pass") happens during the actual execution of the | ||
661 | * method so that operands to the named objects can take on dynamic | ||
662 | * run-time values. | ||
663 | */ | ||
664 | status = acpi_ps_parse_aml(walk_state); | ||
665 | if (ACPI_FAILURE(status)) { | ||
666 | goto cleanup2; | ||
667 | } | ||
668 | |||
669 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | ||
670 | "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", | ||
671 | acpi_ut_get_node_name(node), node, op)); | ||
672 | |||
673 | /* | ||
674 | * Delete the parse tree. We simply re-parse the method for every | ||
675 | * execution since there isn't much overhead (compared to keeping lots | ||
676 | * of parse trees around) | ||
677 | */ | ||
678 | acpi_ns_delete_namespace_subtree(node); | ||
679 | acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id); | ||
680 | |||
681 | cleanup2: | ||
682 | acpi_ut_release_owner_id(&obj_desc->method.owner_id); | ||
683 | |||
684 | cleanup: | ||
685 | acpi_ps_delete_parse_tree(op); | ||
686 | return_ACPI_STATUS(status); | ||
687 | } | ||
688 | #endif | ||
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index 8ac0cd93adb5..905a84e4b145 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #define _COMPONENT ACPI_DISPATCHER | 51 | #define _COMPONENT ACPI_DISPATCHER |
52 | ACPI_MODULE_NAME("dsobject") | 52 | ACPI_MODULE_NAME("dsobject") |
53 | 53 | ||
54 | /* Local prototypes */ | ||
54 | static acpi_status | 55 | static acpi_status |
55 | acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | 56 | acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, |
56 | union acpi_parse_object *op, | 57 | union acpi_parse_object *op, |
@@ -85,7 +86,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
85 | *obj_desc_ptr = NULL; | 86 | *obj_desc_ptr = NULL; |
86 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { | 87 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { |
87 | /* | 88 | /* |
88 | * This is an named object reference. If this name was | 89 | * This is a named object reference. If this name was |
89 | * previously looked up in the namespace, it was stored in this op. | 90 | * previously looked up in the namespace, it was stored in this op. |
90 | * Otherwise, go ahead and look it up now | 91 | * Otherwise, go ahead and look it up now |
91 | */ | 92 | */ |
@@ -96,18 +97,48 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
96 | ACPI_IMODE_EXECUTE, | 97 | ACPI_IMODE_EXECUTE, |
97 | ACPI_NS_SEARCH_PARENT | | 98 | ACPI_NS_SEARCH_PARENT | |
98 | ACPI_NS_DONT_OPEN_SCOPE, NULL, | 99 | ACPI_NS_DONT_OPEN_SCOPE, NULL, |
99 | (struct acpi_namespace_node **) | 100 | ACPI_CAST_INDIRECT_PTR(struct |
100 | &(op->common.node)); | 101 | acpi_namespace_node, |
101 | 102 | &(op-> | |
103 | common. | ||
104 | node))); | ||
102 | if (ACPI_FAILURE(status)) { | 105 | if (ACPI_FAILURE(status)) { |
103 | ACPI_REPORT_NSERROR(op->common.value.string, | 106 | /* Check if we are resolving a named reference within a package */ |
104 | status); | 107 | |
108 | if ((status == AE_NOT_FOUND) | ||
109 | && (acpi_gbl_enable_interpreter_slack) | ||
110 | && | ||
111 | ((op->common.parent->common.aml_opcode == | ||
112 | AML_PACKAGE_OP) | ||
113 | || (op->common.parent->common.aml_opcode == | ||
114 | AML_VAR_PACKAGE_OP))) { | ||
115 | /* | ||
116 | * We didn't find the target and we are populating elements | ||
117 | * of a package - ignore if slack enabled. Some ASL code | ||
118 | * contains dangling invalid references in packages and | ||
119 | * expects that no exception will be issued. Leave the | ||
120 | * element as a null element. It cannot be used, but it | ||
121 | * can be overwritten by subsequent ASL code - this is | ||
122 | * typically the case. | ||
123 | */ | ||
124 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
125 | "Ignoring unresolved reference in package [%4.4s]\n", | ||
126 | walk_state-> | ||
127 | scope_info->scope. | ||
128 | node->name.ascii)); | ||
129 | |||
130 | return_ACPI_STATUS(AE_OK); | ||
131 | } else { | ||
132 | ACPI_REPORT_NSERROR(op->common.value. | ||
133 | string, status); | ||
134 | } | ||
135 | |||
105 | return_ACPI_STATUS(status); | 136 | return_ACPI_STATUS(status); |
106 | } | 137 | } |
107 | } | 138 | } |
108 | } | 139 | } |
109 | 140 | ||
110 | /* Create and init the internal ACPI object */ | 141 | /* Create and init a new internal ACPI object */ |
111 | 142 | ||
112 | obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info | 143 | obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info |
113 | (op->common.aml_opcode))-> | 144 | (op->common.aml_opcode))-> |
@@ -157,13 +188,13 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, | |||
157 | 188 | ||
158 | ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj"); | 189 | ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj"); |
159 | 190 | ||
191 | /* | ||
192 | * If we are evaluating a Named buffer object "Name (xxxx, Buffer)". | ||
193 | * The buffer object already exists (from the NS node), otherwise it must | ||
194 | * be created. | ||
195 | */ | ||
160 | obj_desc = *obj_desc_ptr; | 196 | obj_desc = *obj_desc_ptr; |
161 | if (obj_desc) { | 197 | if (!obj_desc) { |
162 | /* | ||
163 | * We are evaluating a Named buffer object "Name (xxxx, Buffer)". | ||
164 | * The buffer object already exists (from the NS node) | ||
165 | */ | ||
166 | } else { | ||
167 | /* Create a new buffer object */ | 198 | /* Create a new buffer object */ |
168 | 199 | ||
169 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); | 200 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); |
@@ -259,7 +290,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
259 | union acpi_operand_object *obj_desc = NULL; | 290 | union acpi_operand_object *obj_desc = NULL; |
260 | u32 package_list_length; | 291 | u32 package_list_length; |
261 | acpi_status status = AE_OK; | 292 | acpi_status status = AE_OK; |
262 | u32 i; | 293 | acpi_native_uint i; |
263 | 294 | ||
264 | ACPI_FUNCTION_TRACE("ds_build_internal_package_obj"); | 295 | ACPI_FUNCTION_TRACE("ds_build_internal_package_obj"); |
265 | 296 | ||
@@ -271,13 +302,12 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
271 | parent = parent->common.parent; | 302 | parent = parent->common.parent; |
272 | } | 303 | } |
273 | 304 | ||
305 | /* | ||
306 | * If we are evaluating a Named package object "Name (xxxx, Package)", | ||
307 | * the package object already exists, otherwise it must be created. | ||
308 | */ | ||
274 | obj_desc = *obj_desc_ptr; | 309 | obj_desc = *obj_desc_ptr; |
275 | if (obj_desc) { | 310 | if (!obj_desc) { |
276 | /* | ||
277 | * We are evaluating a Named package object "Name (xxxx, Package)". | ||
278 | * Get the existing package object from the NS node | ||
279 | */ | ||
280 | } else { | ||
281 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE); | 311 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE); |
282 | *obj_desc_ptr = obj_desc; | 312 | *obj_desc_ptr = obj_desc; |
283 | if (!obj_desc) { | 313 | if (!obj_desc) { |
@@ -291,11 +321,9 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
291 | 321 | ||
292 | /* Count the number of items in the package list */ | 322 | /* Count the number of items in the package list */ |
293 | 323 | ||
294 | package_list_length = 0; | ||
295 | arg = op->common.value.arg; | 324 | arg = op->common.value.arg; |
296 | arg = arg->common.next; | 325 | arg = arg->common.next; |
297 | while (arg) { | 326 | for (package_list_length = 0; arg; package_list_length++) { |
298 | package_list_length++; | ||
299 | arg = arg->common.next; | 327 | arg = arg->common.next; |
300 | } | 328 | } |
301 | 329 | ||
@@ -322,12 +350,11 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
322 | } | 350 | } |
323 | 351 | ||
324 | /* | 352 | /* |
325 | * Now init the elements of the package | 353 | * Initialize all elements of the package |
326 | */ | 354 | */ |
327 | i = 0; | ||
328 | arg = op->common.value.arg; | 355 | arg = op->common.value.arg; |
329 | arg = arg->common.next; | 356 | arg = arg->common.next; |
330 | while (arg) { | 357 | for (i = 0; arg; i++) { |
331 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { | 358 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { |
332 | /* Object (package or buffer) is already built */ | 359 | /* Object (package or buffer) is already built */ |
333 | 360 | ||
@@ -340,8 +367,6 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
340 | package. | 367 | package. |
341 | elements[i]); | 368 | elements[i]); |
342 | } | 369 | } |
343 | |||
344 | i++; | ||
345 | arg = arg->common.next; | 370 | arg = arg->common.next; |
346 | } | 371 | } |
347 | 372 | ||
diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index 83ae1c1aa286..2cc53da5c0bd 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c | |||
@@ -177,7 +177,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
177 | 177 | ||
178 | if (!op) { | 178 | if (!op) { |
179 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n")); | 179 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n")); |
180 | return_VALUE(TRUE); | 180 | return_UINT8(TRUE); |
181 | } | 181 | } |
182 | 182 | ||
183 | /* | 183 | /* |
@@ -208,7 +208,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
208 | "At Method level, result of [%s] not used\n", | 208 | "At Method level, result of [%s] not used\n", |
209 | acpi_ps_get_opcode_name(op->common. | 209 | acpi_ps_get_opcode_name(op->common. |
210 | aml_opcode))); | 210 | aml_opcode))); |
211 | return_VALUE(FALSE); | 211 | return_UINT8(FALSE); |
212 | } | 212 | } |
213 | 213 | ||
214 | /* Get info on the parent. The root_op is AML_SCOPE */ | 214 | /* Get info on the parent. The root_op is AML_SCOPE */ |
@@ -218,7 +218,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
218 | if (parent_info->class == AML_CLASS_UNKNOWN) { | 218 | if (parent_info->class == AML_CLASS_UNKNOWN) { |
219 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 219 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
220 | "Unknown parent opcode. Op=%p\n", op)); | 220 | "Unknown parent opcode. Op=%p\n", op)); |
221 | return_VALUE(FALSE); | 221 | return_UINT8(FALSE); |
222 | } | 222 | } |
223 | 223 | ||
224 | /* | 224 | /* |
@@ -304,7 +304,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
304 | acpi_ps_get_opcode_name(op->common.parent->common. | 304 | acpi_ps_get_opcode_name(op->common.parent->common. |
305 | aml_opcode), op)); | 305 | aml_opcode), op)); |
306 | 306 | ||
307 | return_VALUE(TRUE); | 307 | return_UINT8(TRUE); |
308 | 308 | ||
309 | result_not_used: | 309 | result_not_used: |
310 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 310 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
@@ -313,7 +313,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
313 | acpi_ps_get_opcode_name(op->common.parent->common. | 313 | acpi_ps_get_opcode_name(op->common.parent->common. |
314 | aml_opcode), op)); | 314 | aml_opcode), op)); |
315 | 315 | ||
316 | return_VALUE(FALSE); | 316 | return_UINT8(FALSE); |
317 | } | 317 | } |
318 | 318 | ||
319 | /******************************************************************************* | 319 | /******************************************************************************* |
@@ -616,7 +616,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
616 | 616 | ||
617 | if (op_info->flags & AML_HAS_RETVAL) { | 617 | if (op_info->flags & AML_HAS_RETVAL) { |
618 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 618 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
619 | "Argument previously created, already stacked \n")); | 619 | "Argument previously created, already stacked\n")); |
620 | 620 | ||
621 | ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object | 621 | ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object |
622 | (walk_state-> | 622 | (walk_state-> |
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index e522763bb692..74f6996db2d7 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c | |||
@@ -314,12 +314,13 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, | |||
314 | 314 | ||
315 | case AML_CLASS_EXECUTE: | 315 | case AML_CLASS_EXECUTE: |
316 | case AML_CLASS_CREATE: | 316 | case AML_CLASS_CREATE: |
317 | |||
318 | /* | 317 | /* |
319 | * Most operators with arguments. | 318 | * Most operators with arguments. |
320 | * Start a new result/operand state | 319 | * Start a new result/operand state |
321 | */ | 320 | */ |
322 | status = acpi_ds_result_stack_push(walk_state); | 321 | if (walk_state->opcode != AML_CREATE_FIELD_OP) { |
322 | status = acpi_ds_result_stack_push(walk_state); | ||
323 | } | ||
323 | break; | 324 | break; |
324 | 325 | ||
325 | default: | 326 | default: |
@@ -723,20 +724,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
723 | 724 | ||
724 | cleanup: | 725 | cleanup: |
725 | 726 | ||
726 | /* Invoke exception handler on error */ | ||
727 | |||
728 | if (ACPI_FAILURE(status) && | ||
729 | acpi_gbl_exception_handler && !(status & AE_CODE_CONTROL)) { | ||
730 | acpi_ex_exit_interpreter(); | ||
731 | status = acpi_gbl_exception_handler(status, | ||
732 | walk_state->method_node-> | ||
733 | name.integer, | ||
734 | walk_state->opcode, | ||
735 | walk_state->aml_offset, | ||
736 | NULL); | ||
737 | (void)acpi_ex_enter_interpreter(); | ||
738 | } | ||
739 | |||
740 | if (walk_state->result_obj) { | 727 | if (walk_state->result_obj) { |
741 | /* Break to debugger to display result */ | 728 | /* Break to debugger to display result */ |
742 | 729 | ||
@@ -758,18 +745,14 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
758 | } | 745 | } |
759 | #endif | 746 | #endif |
760 | 747 | ||
761 | /* Always clear the object stack */ | 748 | /* Invoke exception handler on error */ |
762 | |||
763 | walk_state->num_operands = 0; | ||
764 | |||
765 | #ifdef ACPI_DISASSEMBLER | ||
766 | |||
767 | /* On error, display method locals/args */ | ||
768 | 749 | ||
769 | if (ACPI_FAILURE(status)) { | 750 | if (ACPI_FAILURE(status)) { |
770 | acpi_dm_dump_method_info(status, walk_state, op); | 751 | status = acpi_ds_method_error(status, walk_state); |
771 | } | 752 | } |
772 | #endif | ||
773 | 753 | ||
754 | /* Always clear the object stack */ | ||
755 | |||
756 | walk_state->num_operands = 0; | ||
774 | return_ACPI_STATUS(status); | 757 | return_ACPI_STATUS(status); |
775 | } | 758 | } |
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 411731261c29..441931cab08a 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c | |||
@@ -127,7 +127,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
127 | char *path; | 127 | char *path; |
128 | u32 flags; | 128 | u32 flags; |
129 | 129 | ||
130 | ACPI_FUNCTION_NAME("ds_load1_begin_op"); | 130 | ACPI_FUNCTION_TRACE("ds_load1_begin_op"); |
131 | 131 | ||
132 | op = walk_state->op; | 132 | op = walk_state->op; |
133 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, | 133 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, |
@@ -138,14 +138,14 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
138 | if (op) { | 138 | if (op) { |
139 | if (!(walk_state->op_info->flags & AML_NAMED)) { | 139 | if (!(walk_state->op_info->flags & AML_NAMED)) { |
140 | *out_op = op; | 140 | *out_op = op; |
141 | return (AE_OK); | 141 | return_ACPI_STATUS(AE_OK); |
142 | } | 142 | } |
143 | 143 | ||
144 | /* Check if this object has already been installed in the namespace */ | 144 | /* Check if this object has already been installed in the namespace */ |
145 | 145 | ||
146 | if (op->common.node) { | 146 | if (op->common.node) { |
147 | *out_op = op; | 147 | *out_op = op; |
148 | return (AE_OK); | 148 | return_ACPI_STATUS(AE_OK); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | 151 | ||
@@ -188,7 +188,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
188 | #endif | 188 | #endif |
189 | if (ACPI_FAILURE(status)) { | 189 | if (ACPI_FAILURE(status)) { |
190 | ACPI_REPORT_NSERROR(path, status); | 190 | ACPI_REPORT_NSERROR(path, status); |
191 | return (status); | 191 | return_ACPI_STATUS(status); |
192 | } | 192 | } |
193 | 193 | ||
194 | /* | 194 | /* |
@@ -235,7 +235,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
235 | 235 | ||
236 | ACPI_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", acpi_ut_get_type_name(node->type), path)); | 236 | ACPI_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", acpi_ut_get_type_name(node->type), path)); |
237 | 237 | ||
238 | return (AE_AML_OPERAND_TYPE); | 238 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
239 | } | 239 | } |
240 | break; | 240 | break; |
241 | 241 | ||
@@ -257,6 +257,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
257 | * buffer_field, or Package), the name of the object is already | 257 | * buffer_field, or Package), the name of the object is already |
258 | * in the namespace. | 258 | * in the namespace. |
259 | */ | 259 | */ |
260 | |||
260 | if (walk_state->deferred_node) { | 261 | if (walk_state->deferred_node) { |
261 | /* This name is already in the namespace, get the node */ | 262 | /* This name is already in the namespace, get the node */ |
262 | 263 | ||
@@ -265,6 +266,16 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
265 | break; | 266 | break; |
266 | } | 267 | } |
267 | 268 | ||
269 | /* | ||
270 | * If we are executing a method, do not create any namespace objects | ||
271 | * during the load phase, only during execution. | ||
272 | */ | ||
273 | if (walk_state->method_node) { | ||
274 | node = NULL; | ||
275 | status = AE_OK; | ||
276 | break; | ||
277 | } | ||
278 | |||
268 | flags = ACPI_NS_NO_UPSEARCH; | 279 | flags = ACPI_NS_NO_UPSEARCH; |
269 | if ((walk_state->opcode != AML_SCOPE_OP) && | 280 | if ((walk_state->opcode != AML_SCOPE_OP) && |
270 | (!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) { | 281 | (!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) { |
@@ -290,7 +301,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
290 | &(node)); | 301 | &(node)); |
291 | if (ACPI_FAILURE(status)) { | 302 | if (ACPI_FAILURE(status)) { |
292 | ACPI_REPORT_NSERROR(path, status); | 303 | ACPI_REPORT_NSERROR(path, status); |
293 | return (status); | 304 | return_ACPI_STATUS(status); |
294 | } | 305 | } |
295 | break; | 306 | break; |
296 | } | 307 | } |
@@ -302,28 +313,29 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
302 | 313 | ||
303 | op = acpi_ps_alloc_op(walk_state->opcode); | 314 | op = acpi_ps_alloc_op(walk_state->opcode); |
304 | if (!op) { | 315 | if (!op) { |
305 | return (AE_NO_MEMORY); | 316 | return_ACPI_STATUS(AE_NO_MEMORY); |
306 | } | 317 | } |
307 | } | 318 | } |
308 | 319 | ||
309 | /* Initialize */ | 320 | /* Initialize the op */ |
310 | |||
311 | op->named.name = node->name.integer; | ||
312 | 321 | ||
313 | #if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)) | 322 | #if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)) |
314 | op->named.path = (u8 *) path; | 323 | op->named.path = ACPI_CAST_PTR(u8, path); |
315 | #endif | 324 | #endif |
316 | 325 | ||
317 | /* | 326 | if (node) { |
318 | * Put the Node in the "op" object that the parser uses, so we | 327 | /* |
319 | * can get it again quickly when this scope is closed | 328 | * Put the Node in the "op" object that the parser uses, so we |
320 | */ | 329 | * can get it again quickly when this scope is closed |
321 | op->common.node = node; | 330 | */ |
331 | op->common.node = node; | ||
332 | op->named.name = node->name.integer; | ||
333 | } | ||
334 | |||
322 | acpi_ps_append_arg(acpi_ps_get_parent_scope(&walk_state->parser_state), | 335 | acpi_ps_append_arg(acpi_ps_get_parent_scope(&walk_state->parser_state), |
323 | op); | 336 | op); |
324 | |||
325 | *out_op = op; | 337 | *out_op = op; |
326 | return (status); | 338 | return_ACPI_STATUS(status); |
327 | } | 339 | } |
328 | 340 | ||
329 | /******************************************************************************* | 341 | /******************************************************************************* |
@@ -339,13 +351,13 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
339 | * | 351 | * |
340 | ******************************************************************************/ | 352 | ******************************************************************************/ |
341 | 353 | ||
342 | acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state) | 354 | acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) |
343 | { | 355 | { |
344 | union acpi_parse_object *op; | 356 | union acpi_parse_object *op; |
345 | acpi_object_type object_type; | 357 | acpi_object_type object_type; |
346 | acpi_status status = AE_OK; | 358 | acpi_status status = AE_OK; |
347 | 359 | ||
348 | ACPI_FUNCTION_NAME("ds_load1_end_op"); | 360 | ACPI_FUNCTION_TRACE("ds_load1_end_op"); |
349 | 361 | ||
350 | op = walk_state->op; | 362 | op = walk_state->op; |
351 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, | 363 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, |
@@ -354,7 +366,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state) | |||
354 | /* We are only interested in opcodes that have an associated name */ | 366 | /* We are only interested in opcodes that have an associated name */ |
355 | 367 | ||
356 | if (!(walk_state->op_info->flags & (AML_NAMED | AML_FIELD))) { | 368 | if (!(walk_state->op_info->flags & (AML_NAMED | AML_FIELD))) { |
357 | return (AE_OK); | 369 | return_ACPI_STATUS(AE_OK); |
358 | } | 370 | } |
359 | 371 | ||
360 | /* Get the object type to determine if we should pop the scope */ | 372 | /* Get the object type to determine if we should pop the scope */ |
@@ -363,21 +375,37 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state) | |||
363 | 375 | ||
364 | #ifndef ACPI_NO_METHOD_EXECUTION | 376 | #ifndef ACPI_NO_METHOD_EXECUTION |
365 | if (walk_state->op_info->flags & AML_FIELD) { | 377 | if (walk_state->op_info->flags & AML_FIELD) { |
366 | if (walk_state->opcode == AML_FIELD_OP || | 378 | /* |
367 | walk_state->opcode == AML_BANK_FIELD_OP || | 379 | * If we are executing a method, do not create any namespace objects |
368 | walk_state->opcode == AML_INDEX_FIELD_OP) { | 380 | * during the load phase, only during execution. |
369 | status = acpi_ds_init_field_objects(op, walk_state); | 381 | */ |
382 | if (!walk_state->method_node) { | ||
383 | if (walk_state->opcode == AML_FIELD_OP || | ||
384 | walk_state->opcode == AML_BANK_FIELD_OP || | ||
385 | walk_state->opcode == AML_INDEX_FIELD_OP) { | ||
386 | status = | ||
387 | acpi_ds_init_field_objects(op, walk_state); | ||
388 | } | ||
370 | } | 389 | } |
371 | return (status); | 390 | return_ACPI_STATUS(status); |
372 | } | 391 | } |
373 | 392 | ||
374 | if (op->common.aml_opcode == AML_REGION_OP) { | 393 | /* |
375 | status = acpi_ex_create_region(op->named.data, op->named.length, | 394 | * If we are executing a method, do not create any namespace objects |
376 | (acpi_adr_space_type) | 395 | * during the load phase, only during execution. |
377 | ((op->common.value.arg)->common. | 396 | */ |
378 | value.integer), walk_state); | 397 | if (!walk_state->method_node) { |
379 | if (ACPI_FAILURE(status)) { | 398 | if (op->common.aml_opcode == AML_REGION_OP) { |
380 | return (status); | 399 | status = |
400 | acpi_ex_create_region(op->named.data, | ||
401 | op->named.length, | ||
402 | (acpi_adr_space_type) | ||
403 | ((op->common.value.arg)-> | ||
404 | common.value.integer), | ||
405 | walk_state); | ||
406 | if (ACPI_FAILURE(status)) { | ||
407 | return_ACPI_STATUS(status); | ||
408 | } | ||
381 | } | 409 | } |
382 | } | 410 | } |
383 | #endif | 411 | #endif |
@@ -391,47 +419,63 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state) | |||
391 | common. | 419 | common. |
392 | aml_opcode))-> | 420 | aml_opcode))-> |
393 | object_type; | 421 | object_type; |
394 | op->common.node->type = (u8) object_type; | 422 | |
423 | /* Set node type if we have a namespace node */ | ||
424 | |||
425 | if (op->common.node) { | ||
426 | op->common.node->type = (u8) object_type; | ||
427 | } | ||
395 | } | 428 | } |
396 | } | 429 | } |
397 | 430 | ||
398 | if (op->common.aml_opcode == AML_METHOD_OP) { | 431 | /* |
399 | /* | 432 | * If we are executing a method, do not create any namespace objects |
400 | * method_op pkg_length name_string method_flags term_list | 433 | * during the load phase, only during execution. |
401 | * | 434 | */ |
402 | * Note: We must create the method node/object pair as soon as we | 435 | if (!walk_state->method_node) { |
403 | * see the method declaration. This allows later pass1 parsing | 436 | if (op->common.aml_opcode == AML_METHOD_OP) { |
404 | * of invocations of the method (need to know the number of | 437 | /* |
405 | * arguments.) | 438 | * method_op pkg_length name_string method_flags term_list |
406 | */ | 439 | * |
407 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 440 | * Note: We must create the method node/object pair as soon as we |
408 | "LOADING-Method: State=%p Op=%p named_obj=%p\n", | 441 | * see the method declaration. This allows later pass1 parsing |
409 | walk_state, op, op->named.node)); | 442 | * of invocations of the method (need to know the number of |
443 | * arguments.) | ||
444 | */ | ||
445 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
446 | "LOADING-Method: State=%p Op=%p named_obj=%p\n", | ||
447 | walk_state, op, op->named.node)); | ||
410 | 448 | ||
411 | if (!acpi_ns_get_attached_object(op->named.node)) { | 449 | if (!acpi_ns_get_attached_object(op->named.node)) { |
412 | walk_state->operands[0] = (void *)op->named.node; | 450 | walk_state->operands[0] = |
413 | walk_state->num_operands = 1; | 451 | ACPI_CAST_PTR(void, op->named.node); |
452 | walk_state->num_operands = 1; | ||
414 | 453 | ||
415 | status = | 454 | status = |
416 | acpi_ds_create_operands(walk_state, | 455 | acpi_ds_create_operands(walk_state, |
417 | op->common.value.arg); | 456 | op->common.value. |
418 | if (ACPI_SUCCESS(status)) { | 457 | arg); |
419 | status = acpi_ex_create_method(op->named.data, | 458 | if (ACPI_SUCCESS(status)) { |
420 | op->named.length, | 459 | status = |
421 | walk_state); | 460 | acpi_ex_create_method(op->named. |
422 | } | 461 | data, |
423 | walk_state->operands[0] = NULL; | 462 | op->named. |
424 | walk_state->num_operands = 0; | 463 | length, |
464 | walk_state); | ||
465 | } | ||
466 | walk_state->operands[0] = NULL; | ||
467 | walk_state->num_operands = 0; | ||
425 | 468 | ||
426 | if (ACPI_FAILURE(status)) { | 469 | if (ACPI_FAILURE(status)) { |
427 | return (status); | 470 | return_ACPI_STATUS(status); |
471 | } | ||
428 | } | 472 | } |
429 | } | 473 | } |
430 | } | 474 | } |
431 | 475 | ||
432 | /* Pop the scope stack */ | 476 | /* Pop the scope stack (only if loading a table) */ |
433 | 477 | ||
434 | if (acpi_ns_opens_scope(object_type)) { | 478 | if (!walk_state->method_node && acpi_ns_opens_scope(object_type)) { |
435 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 479 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
436 | "(%s): Popping scope for Op %p\n", | 480 | "(%s): Popping scope for Op %p\n", |
437 | acpi_ut_get_type_name(object_type), op)); | 481 | acpi_ut_get_type_name(object_type), op)); |
@@ -439,7 +483,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state) | |||
439 | status = acpi_ds_scope_stack_pop(walk_state); | 483 | status = acpi_ds_scope_stack_pop(walk_state); |
440 | } | 484 | } |
441 | 485 | ||
442 | return (status); | 486 | return_ACPI_STATUS(status); |
443 | } | 487 | } |
444 | 488 | ||
445 | /******************************************************************************* | 489 | /******************************************************************************* |
@@ -456,8 +500,8 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state) | |||
456 | ******************************************************************************/ | 500 | ******************************************************************************/ |
457 | 501 | ||
458 | acpi_status | 502 | acpi_status |
459 | acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state, | 503 | acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, |
460 | union acpi_parse_object ** out_op) | 504 | union acpi_parse_object **out_op) |
461 | { | 505 | { |
462 | union acpi_parse_object *op; | 506 | union acpi_parse_object *op; |
463 | struct acpi_namespace_node *node; | 507 | struct acpi_namespace_node *node; |
@@ -840,6 +884,13 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
840 | 884 | ||
841 | case AML_TYPE_NAMED_FIELD: | 885 | case AML_TYPE_NAMED_FIELD: |
842 | 886 | ||
887 | /* | ||
888 | * If we are executing a method, initialize the field | ||
889 | */ | ||
890 | if (walk_state->method_node) { | ||
891 | status = acpi_ds_init_field_objects(op, walk_state); | ||
892 | } | ||
893 | |||
843 | switch (op->common.aml_opcode) { | 894 | switch (op->common.aml_opcode) { |
844 | case AML_INDEX_FIELD_OP: | 895 | case AML_INDEX_FIELD_OP: |
845 | 896 | ||
@@ -929,6 +980,24 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
929 | switch (op->common.aml_opcode) { | 980 | switch (op->common.aml_opcode) { |
930 | #ifndef ACPI_NO_METHOD_EXECUTION | 981 | #ifndef ACPI_NO_METHOD_EXECUTION |
931 | case AML_REGION_OP: | 982 | case AML_REGION_OP: |
983 | |||
984 | /* | ||
985 | * If we are executing a method, initialize the region | ||
986 | */ | ||
987 | if (walk_state->method_node) { | ||
988 | status = | ||
989 | acpi_ex_create_region(op->named.data, | ||
990 | op->named.length, | ||
991 | (acpi_adr_space_type) | ||
992 | ((op->common.value. | ||
993 | arg)->common.value. | ||
994 | integer), | ||
995 | walk_state); | ||
996 | if (ACPI_FAILURE(status)) { | ||
997 | return (status); | ||
998 | } | ||
999 | } | ||
1000 | |||
932 | /* | 1001 | /* |
933 | * The op_region is not fully parsed at this time. Only valid | 1002 | * The op_region is not fully parsed at this time. Only valid |
934 | * argument is the space_id. (We must save the address of the | 1003 | * argument is the space_id. (We must save the address of the |
@@ -957,11 +1026,50 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
957 | 1026 | ||
958 | status = acpi_ds_create_node(walk_state, node, op); | 1027 | status = acpi_ds_create_node(walk_state, node, op); |
959 | break; | 1028 | break; |
1029 | |||
1030 | case AML_METHOD_OP: | ||
1031 | /* | ||
1032 | * method_op pkg_length name_string method_flags term_list | ||
1033 | * | ||
1034 | * Note: We must create the method node/object pair as soon as we | ||
1035 | * see the method declaration. This allows later pass1 parsing | ||
1036 | * of invocations of the method (need to know the number of | ||
1037 | * arguments.) | ||
1038 | */ | ||
1039 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
1040 | "LOADING-Method: State=%p Op=%p named_obj=%p\n", | ||
1041 | walk_state, op, op->named.node)); | ||
1042 | |||
1043 | if (!acpi_ns_get_attached_object(op->named.node)) { | ||
1044 | walk_state->operands[0] = | ||
1045 | ACPI_CAST_PTR(void, op->named.node); | ||
1046 | walk_state->num_operands = 1; | ||
1047 | |||
1048 | status = | ||
1049 | acpi_ds_create_operands(walk_state, | ||
1050 | op->common.value. | ||
1051 | arg); | ||
1052 | if (ACPI_SUCCESS(status)) { | ||
1053 | status = | ||
1054 | acpi_ex_create_method(op->named. | ||
1055 | data, | ||
1056 | op->named. | ||
1057 | length, | ||
1058 | walk_state); | ||
1059 | } | ||
1060 | walk_state->operands[0] = NULL; | ||
1061 | walk_state->num_operands = 0; | ||
1062 | |||
1063 | if (ACPI_FAILURE(status)) { | ||
1064 | return_ACPI_STATUS(status); | ||
1065 | } | ||
1066 | } | ||
1067 | break; | ||
1068 | |||
960 | #endif /* ACPI_NO_METHOD_EXECUTION */ | 1069 | #endif /* ACPI_NO_METHOD_EXECUTION */ |
961 | 1070 | ||
962 | default: | 1071 | default: |
963 | /* All NAMED_COMPLEX opcodes must be handled above */ | 1072 | /* All NAMED_COMPLEX opcodes must be handled above */ |
964 | /* Note: Method objects were already created in Pass 1 */ | ||
965 | break; | 1073 | break; |
966 | } | 1074 | } |
967 | break; | 1075 | break; |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 7e1a445955bc..0ecbfa5db1ba 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -1151,7 +1151,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context) | |||
1151 | union acpi_ec *ec = (union acpi_ec *)context; | 1151 | union acpi_ec *ec = (union acpi_ec *)context; |
1152 | struct acpi_generic_address *addr; | 1152 | struct acpi_generic_address *addr; |
1153 | 1153 | ||
1154 | if (resource->id != ACPI_RSTYPE_IO) { | 1154 | if (resource->type != ACPI_RESOURCE_TYPE_IO) { |
1155 | return AE_OK; | 1155 | return AE_OK; |
1156 | } | 1156 | } |
1157 | 1157 | ||
@@ -1171,7 +1171,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context) | |||
1171 | addr->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO; | 1171 | addr->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO; |
1172 | addr->register_bit_width = 8; | 1172 | addr->register_bit_width = 8; |
1173 | addr->register_bit_offset = 0; | 1173 | addr->register_bit_offset = 0; |
1174 | addr->address = resource->data.io.min_base_address; | 1174 | addr->address = resource->data.io.minimum; |
1175 | 1175 | ||
1176 | return AE_OK; | 1176 | return AE_OK; |
1177 | } | 1177 | } |
diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c index 842d1e3fb37b..9522c643b88b 100644 --- a/drivers/acpi/events/evevent.c +++ b/drivers/acpi/events/evevent.c | |||
@@ -100,6 +100,48 @@ acpi_status acpi_ev_initialize_events(void) | |||
100 | 100 | ||
101 | /******************************************************************************* | 101 | /******************************************************************************* |
102 | * | 102 | * |
103 | * FUNCTION: acpi_ev_install_fadt_gpes | ||
104 | * | ||
105 | * PARAMETERS: None | ||
106 | * | ||
107 | * RETURN: Status | ||
108 | * | ||
109 | * DESCRIPTION: Completes initialization of the FADT-defined GPE blocks | ||
110 | * (0 and 1). This causes the _PRW methods to be run, so the HW | ||
111 | * must be fully initialized at this point, including global lock | ||
112 | * support. | ||
113 | * | ||
114 | ******************************************************************************/ | ||
115 | |||
116 | acpi_status acpi_ev_install_fadt_gpes(void) | ||
117 | { | ||
118 | acpi_status status; | ||
119 | |||
120 | ACPI_FUNCTION_TRACE("ev_install_fadt_gpes"); | ||
121 | |||
122 | /* Namespace must be locked */ | ||
123 | |||
124 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
125 | if (ACPI_FAILURE(status)) { | ||
126 | return (status); | ||
127 | } | ||
128 | |||
129 | /* FADT GPE Block 0 */ | ||
130 | |||
131 | (void)acpi_ev_initialize_gpe_block(acpi_gbl_fadt_gpe_device, | ||
132 | acpi_gbl_gpe_fadt_blocks[0]); | ||
133 | |||
134 | /* FADT GPE Block 1 */ | ||
135 | |||
136 | (void)acpi_ev_initialize_gpe_block(acpi_gbl_fadt_gpe_device, | ||
137 | acpi_gbl_gpe_fadt_blocks[1]); | ||
138 | |||
139 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
140 | return_ACPI_STATUS(AE_OK); | ||
141 | } | ||
142 | |||
143 | /******************************************************************************* | ||
144 | * | ||
103 | * FUNCTION: acpi_ev_install_xrupt_handlers | 145 | * FUNCTION: acpi_ev_install_xrupt_handlers |
104 | * | 146 | * |
105 | * PARAMETERS: None | 147 | * PARAMETERS: None |
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index b2f232df13d8..bdd86537738e 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c | |||
@@ -372,14 +372,14 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, | |||
372 | 372 | ||
373 | u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | 373 | u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) |
374 | { | 374 | { |
375 | acpi_status status; | ||
376 | struct acpi_gpe_block_info *gpe_block; | ||
377 | struct acpi_gpe_register_info *gpe_register_info; | ||
375 | u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; | 378 | u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; |
376 | u8 enabled_status_byte; | 379 | u8 enabled_status_byte; |
377 | struct acpi_gpe_register_info *gpe_register_info; | ||
378 | u32 status_reg; | 380 | u32 status_reg; |
379 | u32 enable_reg; | 381 | u32 enable_reg; |
380 | u32 flags; | 382 | acpi_native_uint flags; |
381 | acpi_status status; | ||
382 | struct acpi_gpe_block_info *gpe_block; | ||
383 | acpi_native_uint i; | 383 | acpi_native_uint i; |
384 | acpi_native_uint j; | 384 | acpi_native_uint j; |
385 | 385 | ||
@@ -600,7 +600,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
600 | status = acpi_hw_clear_gpe(gpe_event_info); | 600 | status = acpi_hw_clear_gpe(gpe_event_info); |
601 | if (ACPI_FAILURE(status)) { | 601 | if (ACPI_FAILURE(status)) { |
602 | ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); | 602 | ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); |
603 | return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); | 603 | return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); |
604 | } | 604 | } |
605 | } | 605 | } |
606 | 606 | ||
@@ -638,7 +638,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
638 | status = acpi_hw_clear_gpe(gpe_event_info); | 638 | status = acpi_hw_clear_gpe(gpe_event_info); |
639 | if (ACPI_FAILURE(status)) { | 639 | if (ACPI_FAILURE(status)) { |
640 | ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); | 640 | ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); |
641 | return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); | 641 | return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); |
642 | } | 642 | } |
643 | } | 643 | } |
644 | break; | 644 | break; |
@@ -652,7 +652,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
652 | status = acpi_ev_disable_gpe(gpe_event_info); | 652 | status = acpi_ev_disable_gpe(gpe_event_info); |
653 | if (ACPI_FAILURE(status)) { | 653 | if (ACPI_FAILURE(status)) { |
654 | ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number)); | 654 | ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number)); |
655 | return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); | 655 | return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); |
656 | } | 656 | } |
657 | 657 | ||
658 | /* | 658 | /* |
@@ -680,12 +680,12 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
680 | status = acpi_ev_disable_gpe(gpe_event_info); | 680 | status = acpi_ev_disable_gpe(gpe_event_info); |
681 | if (ACPI_FAILURE(status)) { | 681 | if (ACPI_FAILURE(status)) { |
682 | ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number)); | 682 | ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number)); |
683 | return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); | 683 | return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); |
684 | } | 684 | } |
685 | break; | 685 | break; |
686 | } | 686 | } |
687 | 687 | ||
688 | return_VALUE(ACPI_INTERRUPT_HANDLED); | 688 | return_UINT32(ACPI_INTERRUPT_HANDLED); |
689 | } | 689 | } |
690 | 690 | ||
691 | #ifdef ACPI_GPE_NOTIFY_CHECK | 691 | #ifdef ACPI_GPE_NOTIFY_CHECK |
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index b312eb33c43e..8efca2eac27e 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c | |||
@@ -78,7 +78,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block); | |||
78 | * | 78 | * |
79 | * RETURN: TRUE if the gpe_event is valid | 79 | * RETURN: TRUE if the gpe_event is valid |
80 | * | 80 | * |
81 | * DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL. | 81 | * DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL. |
82 | * Should be called only when the GPE lists are semaphore locked | 82 | * Should be called only when the GPE lists are semaphore locked |
83 | * and not subject to change. | 83 | * and not subject to change. |
84 | * | 84 | * |
@@ -136,7 +136,7 @@ acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback) | |||
136 | struct acpi_gpe_block_info *gpe_block; | 136 | struct acpi_gpe_block_info *gpe_block; |
137 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; | 137 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; |
138 | acpi_status status = AE_OK; | 138 | acpi_status status = AE_OK; |
139 | u32 flags; | 139 | acpi_native_uint flags; |
140 | 140 | ||
141 | ACPI_FUNCTION_TRACE("ev_walk_gpe_list"); | 141 | ACPI_FUNCTION_TRACE("ev_walk_gpe_list"); |
142 | 142 | ||
@@ -264,7 +264,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
264 | * 2) Edge/Level determination is based on the 2nd character | 264 | * 2) Edge/Level determination is based on the 2nd character |
265 | * of the method name | 265 | * of the method name |
266 | * | 266 | * |
267 | * NOTE: Default GPE type is RUNTIME. May be changed later to WAKE | 267 | * NOTE: Default GPE type is RUNTIME. May be changed later to WAKE |
268 | * if a _PRW object is found that points to this GPE. | 268 | * if a _PRW object is found that points to this GPE. |
269 | */ | 269 | */ |
270 | switch (name[1]) { | 270 | switch (name[1]) { |
@@ -313,14 +313,14 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
313 | 313 | ||
314 | /* | 314 | /* |
315 | * Now we can add this information to the gpe_event_info block | 315 | * Now we can add this information to the gpe_event_info block |
316 | * for use during dispatch of this GPE. Default type is RUNTIME, although | 316 | * for use during dispatch of this GPE. Default type is RUNTIME, although |
317 | * this may change when the _PRW methods are executed later. | 317 | * this may change when the _PRW methods are executed later. |
318 | */ | 318 | */ |
319 | gpe_event_info = | 319 | gpe_event_info = |
320 | &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; | 320 | &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; |
321 | 321 | ||
322 | gpe_event_info->flags = (u8) (type | ACPI_GPE_DISPATCH_METHOD | | 322 | gpe_event_info->flags = (u8) |
323 | ACPI_GPE_TYPE_RUNTIME); | 323 | (type | ACPI_GPE_DISPATCH_METHOD | ACPI_GPE_TYPE_RUNTIME); |
324 | 324 | ||
325 | gpe_event_info->dispatch.method_node = | 325 | gpe_event_info->dispatch.method_node = |
326 | (struct acpi_namespace_node *)obj_handle; | 326 | (struct acpi_namespace_node *)obj_handle; |
@@ -341,11 +341,11 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
341 | * | 341 | * |
342 | * PARAMETERS: Callback from walk_namespace | 342 | * PARAMETERS: Callback from walk_namespace |
343 | * | 343 | * |
344 | * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is | 344 | * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is |
345 | * not aborted on a single _PRW failure. | 345 | * not aborted on a single _PRW failure. |
346 | * | 346 | * |
347 | * DESCRIPTION: Called from acpi_walk_namespace. Expects each object to be a | 347 | * DESCRIPTION: Called from acpi_walk_namespace. Expects each object to be a |
348 | * Device. Run the _PRW method. If present, extract the GPE | 348 | * Device. Run the _PRW method. If present, extract the GPE |
349 | * number and mark the GPE as a WAKE GPE. | 349 | * number and mark the GPE as a WAKE GPE. |
350 | * | 350 | * |
351 | ******************************************************************************/ | 351 | ******************************************************************************/ |
@@ -443,6 +443,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | |||
443 | 443 | ||
444 | gpe_event_info->flags &= | 444 | gpe_event_info->flags &= |
445 | ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED); | 445 | ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED); |
446 | |||
446 | status = | 447 | status = |
447 | acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE); | 448 | acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE); |
448 | if (ACPI_FAILURE(status)) { | 449 | if (ACPI_FAILURE(status)) { |
@@ -466,7 +467,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | |||
466 | * | 467 | * |
467 | * RETURN: A GPE interrupt block | 468 | * RETURN: A GPE interrupt block |
468 | * | 469 | * |
469 | * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt | 470 | * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt |
470 | * block per unique interrupt level used for GPEs. | 471 | * block per unique interrupt level used for GPEs. |
471 | * Should be called only when the GPE lists are semaphore locked | 472 | * Should be called only when the GPE lists are semaphore locked |
472 | * and not subject to change. | 473 | * and not subject to change. |
@@ -479,7 +480,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 | |||
479 | struct acpi_gpe_xrupt_info *next_gpe_xrupt; | 480 | struct acpi_gpe_xrupt_info *next_gpe_xrupt; |
480 | struct acpi_gpe_xrupt_info *gpe_xrupt; | 481 | struct acpi_gpe_xrupt_info *gpe_xrupt; |
481 | acpi_status status; | 482 | acpi_status status; |
482 | u32 flags; | 483 | acpi_native_uint flags; |
483 | 484 | ||
484 | ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block"); | 485 | ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block"); |
485 | 486 | ||
@@ -553,7 +554,7 @@ static acpi_status | |||
553 | acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) | 554 | acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) |
554 | { | 555 | { |
555 | acpi_status status; | 556 | acpi_status status; |
556 | u32 flags; | 557 | acpi_native_uint flags; |
557 | 558 | ||
558 | ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt"); | 559 | ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt"); |
559 | 560 | ||
@@ -566,8 +567,9 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) | |||
566 | 567 | ||
567 | /* Disable this interrupt */ | 568 | /* Disable this interrupt */ |
568 | 569 | ||
569 | status = acpi_os_remove_interrupt_handler(gpe_xrupt->interrupt_number, | 570 | status = |
570 | acpi_ev_gpe_xrupt_handler); | 571 | acpi_os_remove_interrupt_handler(gpe_xrupt->interrupt_number, |
572 | acpi_ev_gpe_xrupt_handler); | ||
571 | if (ACPI_FAILURE(status)) { | 573 | if (ACPI_FAILURE(status)) { |
572 | return_ACPI_STATUS(status); | 574 | return_ACPI_STATUS(status); |
573 | } | 575 | } |
@@ -610,7 +612,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, | |||
610 | struct acpi_gpe_block_info *next_gpe_block; | 612 | struct acpi_gpe_block_info *next_gpe_block; |
611 | struct acpi_gpe_xrupt_info *gpe_xrupt_block; | 613 | struct acpi_gpe_xrupt_info *gpe_xrupt_block; |
612 | acpi_status status; | 614 | acpi_status status; |
613 | u32 flags; | 615 | acpi_native_uint flags; |
614 | 616 | ||
615 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); | 617 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); |
616 | 618 | ||
@@ -663,7 +665,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, | |||
663 | acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) | 665 | acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) |
664 | { | 666 | { |
665 | acpi_status status; | 667 | acpi_status status; |
666 | u32 flags; | 668 | acpi_native_uint flags; |
667 | 669 | ||
668 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); | 670 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); |
669 | 671 | ||
@@ -750,7 +752,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
750 | 752 | ||
751 | /* | 753 | /* |
752 | * Allocate the GPE event_info block. There are eight distinct GPEs | 754 | * Allocate the GPE event_info block. There are eight distinct GPEs |
753 | * per register. Initialization to zeros is sufficient. | 755 | * per register. Initialization to zeros is sufficient. |
754 | */ | 756 | */ |
755 | gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block-> | 757 | gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block-> |
756 | register_count * | 758 | register_count * |
@@ -769,9 +771,9 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
769 | gpe_block->event_info = gpe_event_info; | 771 | gpe_block->event_info = gpe_event_info; |
770 | 772 | ||
771 | /* | 773 | /* |
772 | * Initialize the GPE Register and Event structures. A goal of these | 774 | * Initialize the GPE Register and Event structures. A goal of these |
773 | * tables is to hide the fact that there are two separate GPE register sets | 775 | * tables is to hide the fact that there are two separate GPE register sets |
774 | * in a given gpe hardware block, the status registers occupy the first half, | 776 | * in a given GPE hardware block, the status registers occupy the first half, |
775 | * and the enable registers occupy the second half. | 777 | * and the enable registers occupy the second half. |
776 | */ | 778 | */ |
777 | this_register = gpe_register_info; | 779 | this_register = gpe_register_info; |
@@ -812,11 +814,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
812 | this_event++; | 814 | this_event++; |
813 | } | 815 | } |
814 | 816 | ||
815 | /* | 817 | /* Disable all GPEs within this register */ |
816 | * Clear the status/enable registers. Note that status registers | 818 | |
817 | * are cleared by writing a '1', while enable registers are cleared | ||
818 | * by writing a '0'. | ||
819 | */ | ||
820 | status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00, | 819 | status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00, |
821 | &this_register-> | 820 | &this_register-> |
822 | enable_address); | 821 | enable_address); |
@@ -824,6 +823,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
824 | goto error_exit; | 823 | goto error_exit; |
825 | } | 824 | } |
826 | 825 | ||
826 | /* Clear any pending GPE events within this register */ | ||
827 | |||
827 | status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0xFF, | 828 | status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0xFF, |
828 | &this_register-> | 829 | &this_register-> |
829 | status_address); | 830 | status_address); |
@@ -860,7 +861,9 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
860 | * | 861 | * |
861 | * RETURN: Status | 862 | * RETURN: Status |
862 | * | 863 | * |
863 | * DESCRIPTION: Create and Install a block of GPE registers | 864 | * DESCRIPTION: Create and Install a block of GPE registers. All GPEs within |
865 | * the block are disabled at exit. | ||
866 | * Note: Assumes namespace is locked. | ||
864 | * | 867 | * |
865 | ******************************************************************************/ | 868 | ******************************************************************************/ |
866 | 869 | ||
@@ -872,14 +875,8 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
872 | u32 interrupt_number, | 875 | u32 interrupt_number, |
873 | struct acpi_gpe_block_info **return_gpe_block) | 876 | struct acpi_gpe_block_info **return_gpe_block) |
874 | { | 877 | { |
875 | struct acpi_gpe_block_info *gpe_block; | ||
876 | struct acpi_gpe_event_info *gpe_event_info; | ||
877 | acpi_native_uint i; | ||
878 | acpi_native_uint j; | ||
879 | u32 wake_gpe_count; | ||
880 | u32 gpe_enabled_count; | ||
881 | acpi_status status; | 878 | acpi_status status; |
882 | struct acpi_gpe_walk_info gpe_info; | 879 | struct acpi_gpe_block_info *gpe_block; |
883 | 880 | ||
884 | ACPI_FUNCTION_TRACE("ev_create_gpe_block"); | 881 | ACPI_FUNCTION_TRACE("ev_create_gpe_block"); |
885 | 882 | ||
@@ -896,22 +893,24 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
896 | 893 | ||
897 | /* Initialize the new GPE block */ | 894 | /* Initialize the new GPE block */ |
898 | 895 | ||
896 | gpe_block->node = gpe_device; | ||
899 | gpe_block->register_count = register_count; | 897 | gpe_block->register_count = register_count; |
900 | gpe_block->block_base_number = gpe_block_base_number; | 898 | gpe_block->block_base_number = gpe_block_base_number; |
901 | gpe_block->node = gpe_device; | ||
902 | 899 | ||
903 | ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address, | 900 | ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address, |
904 | sizeof(struct acpi_generic_address)); | 901 | sizeof(struct acpi_generic_address)); |
905 | 902 | ||
906 | /* Create the register_info and event_info sub-structures */ | 903 | /* |
907 | 904 | * Create the register_info and event_info sub-structures | |
905 | * Note: disables and clears all GPEs in the block | ||
906 | */ | ||
908 | status = acpi_ev_create_gpe_info_blocks(gpe_block); | 907 | status = acpi_ev_create_gpe_info_blocks(gpe_block); |
909 | if (ACPI_FAILURE(status)) { | 908 | if (ACPI_FAILURE(status)) { |
910 | ACPI_MEM_FREE(gpe_block); | 909 | ACPI_MEM_FREE(gpe_block); |
911 | return_ACPI_STATUS(status); | 910 | return_ACPI_STATUS(status); |
912 | } | 911 | } |
913 | 912 | ||
914 | /* Install the new block in the global list(s) */ | 913 | /* Install the new block in the global lists */ |
915 | 914 | ||
916 | status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); | 915 | status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); |
917 | if (ACPI_FAILURE(status)) { | 916 | if (ACPI_FAILURE(status)) { |
@@ -926,16 +925,70 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
926 | acpi_ev_save_method_info, gpe_block, | 925 | acpi_ev_save_method_info, gpe_block, |
927 | NULL); | 926 | NULL); |
928 | 927 | ||
928 | /* Return the new block */ | ||
929 | |||
930 | if (return_gpe_block) { | ||
931 | (*return_gpe_block) = gpe_block; | ||
932 | } | ||
933 | |||
934 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, | ||
935 | "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n", | ||
936 | (u32) gpe_block->block_base_number, | ||
937 | (u32) (gpe_block->block_base_number + | ||
938 | ((gpe_block->register_count * | ||
939 | ACPI_GPE_REGISTER_WIDTH) - 1)), | ||
940 | gpe_device->name.ascii, gpe_block->register_count, | ||
941 | interrupt_number)); | ||
942 | |||
943 | return_ACPI_STATUS(AE_OK); | ||
944 | } | ||
945 | |||
946 | /******************************************************************************* | ||
947 | * | ||
948 | * FUNCTION: acpi_ev_initialize_gpe_block | ||
949 | * | ||
950 | * PARAMETERS: gpe_device - Handle to the parent GPE block | ||
951 | * gpe_block - Gpe Block info | ||
952 | * | ||
953 | * RETURN: Status | ||
954 | * | ||
955 | * DESCRIPTION: Initialize and enable a GPE block. First find and run any | ||
956 | * _PRT methods associated with the block, then enable the | ||
957 | * appropriate GPEs. | ||
958 | * Note: Assumes namespace is locked. | ||
959 | * | ||
960 | ******************************************************************************/ | ||
961 | |||
962 | acpi_status | ||
963 | acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | ||
964 | struct acpi_gpe_block_info *gpe_block) | ||
965 | { | ||
966 | acpi_status status; | ||
967 | struct acpi_gpe_event_info *gpe_event_info; | ||
968 | struct acpi_gpe_walk_info gpe_info; | ||
969 | u32 wake_gpe_count; | ||
970 | u32 gpe_enabled_count; | ||
971 | acpi_native_uint i; | ||
972 | acpi_native_uint j; | ||
973 | |||
974 | ACPI_FUNCTION_TRACE("ev_initialize_gpe_block"); | ||
975 | |||
976 | /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */ | ||
977 | |||
978 | if (!gpe_block) { | ||
979 | return_ACPI_STATUS(AE_OK); | ||
980 | } | ||
981 | |||
929 | /* | 982 | /* |
930 | * Runtime option: Should Wake GPEs be enabled at runtime? The default | 983 | * Runtime option: Should wake GPEs be enabled at runtime? The default |
931 | * is No, they should only be enabled just as the machine goes to sleep. | 984 | * is no, they should only be enabled just as the machine goes to sleep. |
932 | */ | 985 | */ |
933 | if (acpi_gbl_leave_wake_gpes_disabled) { | 986 | if (acpi_gbl_leave_wake_gpes_disabled) { |
934 | /* | 987 | /* |
935 | * Differentiate RUNTIME vs WAKE GPEs, via the _PRW control methods. | 988 | * Differentiate runtime vs wake GPEs, via the _PRW control methods. |
936 | * (Each GPE that has one or more _PRWs that reference it is by | 989 | * Each GPE that has one or more _PRWs that reference it is by |
937 | * definition a WAKE GPE and will not be enabled while the machine | 990 | * definition a wake GPE and will not be enabled while the machine |
938 | * is running.) | 991 | * is running. |
939 | */ | 992 | */ |
940 | gpe_info.gpe_block = gpe_block; | 993 | gpe_info.gpe_block = gpe_block; |
941 | gpe_info.gpe_device = gpe_device; | 994 | gpe_info.gpe_device = gpe_device; |
@@ -948,9 +1001,12 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
948 | } | 1001 | } |
949 | 1002 | ||
950 | /* | 1003 | /* |
951 | * Enable all GPEs in this block that are 1) "runtime" or "run/wake" GPEs, | 1004 | * Enable all GPEs in this block that have these attributes: |
952 | * and 2) have a corresponding _Lxx or _Exx method. All other GPEs must | 1005 | * 1) are "runtime" or "run/wake" GPEs, and |
953 | * be enabled via the acpi_enable_gpe() external interface. | 1006 | * 2) have a corresponding _Lxx or _Exx method |
1007 | * | ||
1008 | * Any other GPEs within this block must be enabled via the acpi_enable_gpe() | ||
1009 | * external interface. | ||
954 | */ | 1010 | */ |
955 | wake_gpe_count = 0; | 1011 | wake_gpe_count = 0; |
956 | gpe_enabled_count = 0; | 1012 | gpe_enabled_count = 0; |
@@ -976,32 +1032,19 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
976 | } | 1032 | } |
977 | } | 1033 | } |
978 | 1034 | ||
979 | /* Dump info about this GPE block */ | ||
980 | |||
981 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, | ||
982 | "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n", | ||
983 | (u32) gpe_block->block_base_number, | ||
984 | (u32) (gpe_block->block_base_number + | ||
985 | ((gpe_block->register_count * | ||
986 | ACPI_GPE_REGISTER_WIDTH) - 1)), | ||
987 | gpe_device->name.ascii, gpe_block->register_count, | ||
988 | interrupt_number)); | ||
989 | |||
990 | /* Enable all valid GPEs found above */ | ||
991 | |||
992 | status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); | ||
993 | |||
994 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, | 1035 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, |
995 | "Found %u Wake, Enabled %u Runtime GPEs in this block\n", | 1036 | "Found %u Wake, Enabled %u Runtime GPEs in this block\n", |
996 | wake_gpe_count, gpe_enabled_count)); | 1037 | wake_gpe_count, gpe_enabled_count)); |
997 | 1038 | ||
998 | /* Return the new block */ | 1039 | /* Enable all valid runtime GPEs found above */ |
999 | 1040 | ||
1000 | if (return_gpe_block) { | 1041 | status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); |
1001 | (*return_gpe_block) = gpe_block; | 1042 | if (ACPI_FAILURE(status)) { |
1043 | ACPI_REPORT_ERROR(("Could not enable GPEs in gpe_block %p\n", | ||
1044 | gpe_block)); | ||
1002 | } | 1045 | } |
1003 | 1046 | ||
1004 | return_ACPI_STATUS(AE_OK); | 1047 | return_ACPI_STATUS(status); |
1005 | } | 1048 | } |
1006 | 1049 | ||
1007 | /******************************************************************************* | 1050 | /******************************************************************************* |
diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c index 141835977002..e2c0b48a7e9f 100644 --- a/drivers/acpi/events/evsci.c +++ b/drivers/acpi/events/evsci.c | |||
@@ -88,7 +88,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context) | |||
88 | */ | 88 | */ |
89 | interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); | 89 | interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); |
90 | 90 | ||
91 | return_VALUE(interrupt_handled); | 91 | return_UINT32(interrupt_handled); |
92 | } | 92 | } |
93 | 93 | ||
94 | /******************************************************************************* | 94 | /******************************************************************************* |
@@ -121,7 +121,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context) | |||
121 | */ | 121 | */ |
122 | interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); | 122 | interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); |
123 | 123 | ||
124 | return_VALUE(interrupt_handled); | 124 | return_UINT32(interrupt_handled); |
125 | } | 125 | } |
126 | 126 | ||
127 | /****************************************************************************** | 127 | /****************************************************************************** |
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index 43b33d19cdf9..57d73299298e 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c | |||
@@ -562,7 +562,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
562 | struct acpi_gpe_event_info *gpe_event_info; | 562 | struct acpi_gpe_event_info *gpe_event_info; |
563 | struct acpi_handler_info *handler; | 563 | struct acpi_handler_info *handler; |
564 | acpi_status status; | 564 | acpi_status status; |
565 | u32 flags; | 565 | acpi_native_uint flags; |
566 | 566 | ||
567 | ACPI_FUNCTION_TRACE("acpi_install_gpe_handler"); | 567 | ACPI_FUNCTION_TRACE("acpi_install_gpe_handler"); |
568 | 568 | ||
@@ -653,7 +653,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, | |||
653 | struct acpi_gpe_event_info *gpe_event_info; | 653 | struct acpi_gpe_event_info *gpe_event_info; |
654 | struct acpi_handler_info *handler; | 654 | struct acpi_handler_info *handler; |
655 | acpi_status status; | 655 | acpi_status status; |
656 | u32 flags; | 656 | acpi_native_uint flags; |
657 | 657 | ||
658 | ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler"); | 658 | ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler"); |
659 | 659 | ||
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index 887ff9f28a0d..c1b898928256 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c | |||
@@ -626,6 +626,13 @@ acpi_install_gpe_block(acpi_handle gpe_device, | |||
626 | goto unlock_and_exit; | 626 | goto unlock_and_exit; |
627 | } | 627 | } |
628 | 628 | ||
629 | /* Run the _PRW methods and enable the GPEs */ | ||
630 | |||
631 | status = acpi_ev_initialize_gpe_block(node, gpe_block); | ||
632 | if (ACPI_FAILURE(status)) { | ||
633 | goto unlock_and_exit; | ||
634 | } | ||
635 | |||
629 | /* Get the device_object attached to the node */ | 636 | /* Get the device_object attached to the node */ |
630 | 637 | ||
631 | obj_desc = acpi_ns_get_attached_object(node); | 638 | obj_desc = acpi_ns_get_attached_object(node); |
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index 04e5194989a6..fa9e75d4ec65 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c | |||
@@ -504,18 +504,12 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, | |||
504 | } | 504 | } |
505 | 505 | ||
506 | /* | 506 | /* |
507 | * Perform the conversion. | 507 | * Create a new string object and string buffer |
508 | * (-1 because of extra separator included in string_length from above) | 508 | * (-1 because of extra separator included in string_length from above) |
509 | */ | 509 | */ |
510 | string_length--; | ||
511 | if (string_length > ACPI_MAX_STRING_CONVERSION) { /* ACPI limit */ | ||
512 | return_ACPI_STATUS(AE_AML_STRING_LIMIT); | ||
513 | } | ||
514 | |||
515 | /* Create a new string object and string buffer */ | ||
516 | |||
517 | return_desc = | 510 | return_desc = |
518 | acpi_ut_create_string_object((acpi_size) string_length); | 511 | acpi_ut_create_string_object((acpi_size) |
512 | (string_length - 1)); | ||
519 | if (!return_desc) { | 513 | if (!return_desc) { |
520 | return_ACPI_STATUS(AE_NO_MEMORY); | 514 | return_ACPI_STATUS(AE_NO_MEMORY); |
521 | } | 515 | } |
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index bc2fa996047e..17c79cd91b31 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c | |||
@@ -55,20 +55,386 @@ ACPI_MODULE_NAME("exdump") | |||
55 | */ | 55 | */ |
56 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 56 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
57 | /* Local prototypes */ | 57 | /* Local prototypes */ |
58 | #ifdef ACPI_FUTURE_USAGE | ||
59 | static void acpi_ex_out_string(char *title, char *value); | 58 | static void acpi_ex_out_string(char *title, char *value); |
60 | 59 | ||
61 | static void acpi_ex_out_pointer(char *title, void *value); | 60 | static void acpi_ex_out_pointer(char *title, void *value); |
62 | 61 | ||
63 | static void acpi_ex_out_integer(char *title, u32 value); | ||
64 | |||
65 | static void acpi_ex_out_address(char *title, acpi_physical_address value); | 62 | static void acpi_ex_out_address(char *title, acpi_physical_address value); |
66 | 63 | ||
67 | static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc); | 64 | static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc); |
68 | 65 | ||
69 | static void | 66 | static void |
70 | acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index); | 67 | acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, |
71 | #endif /* ACPI_FUTURE_USAGE */ | 68 | u32 level, u32 index); |
69 | |||
70 | /******************************************************************************* | ||
71 | * | ||
72 | * Object Descriptor info tables | ||
73 | * | ||
74 | * Note: The first table entry must be an INIT opcode and must contain | ||
75 | * the table length (number of table entries) | ||
76 | * | ||
77 | ******************************************************************************/ | ||
78 | |||
79 | static struct acpi_exdump_info acpi_ex_dump_integer[2] = { | ||
80 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_integer), NULL}, | ||
81 | {ACPI_EXD_UINT64, ACPI_EXD_OFFSET(integer.value), "Value"} | ||
82 | }; | ||
83 | |||
84 | static struct acpi_exdump_info acpi_ex_dump_string[4] = { | ||
85 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_string), NULL}, | ||
86 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(string.length), "Length"}, | ||
87 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(string.pointer), "Pointer"}, | ||
88 | {ACPI_EXD_STRING, 0, NULL} | ||
89 | }; | ||
90 | |||
91 | static struct acpi_exdump_info acpi_ex_dump_buffer[4] = { | ||
92 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_buffer), NULL}, | ||
93 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(buffer.length), "Length"}, | ||
94 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer.pointer), "Pointer"}, | ||
95 | {ACPI_EXD_BUFFER, 0, NULL} | ||
96 | }; | ||
97 | |||
98 | static struct acpi_exdump_info acpi_ex_dump_package[5] = { | ||
99 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_package), NULL}, | ||
100 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(package.flags), "Flags"}, | ||
101 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(package.count), "Elements"}, | ||
102 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(package.elements), "Element List"}, | ||
103 | {ACPI_EXD_PACKAGE, 0, NULL} | ||
104 | }; | ||
105 | |||
106 | static struct acpi_exdump_info acpi_ex_dump_device[4] = { | ||
107 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_device), NULL}, | ||
108 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.handler), "Handler"}, | ||
109 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.system_notify), | ||
110 | "System Notify"}, | ||
111 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.device_notify), | ||
112 | "Device Notify"} | ||
113 | }; | ||
114 | |||
115 | static struct acpi_exdump_info acpi_ex_dump_event[2] = { | ||
116 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_event), NULL}, | ||
117 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(event.semaphore), "Semaphore"} | ||
118 | }; | ||
119 | |||
120 | static struct acpi_exdump_info acpi_ex_dump_method[8] = { | ||
121 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, | ||
122 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "param_count"}, | ||
123 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"}, | ||
124 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"}, | ||
125 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"}, | ||
126 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.thread_count), "Thread Count"}, | ||
127 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(method.aml_length), "Aml Length"}, | ||
128 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.aml_start), "Aml Start"} | ||
129 | }; | ||
130 | |||
131 | static struct acpi_exdump_info acpi_ex_dump_mutex[5] = { | ||
132 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_mutex), NULL}, | ||
133 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(mutex.sync_level), "Sync Level"}, | ||
134 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.owner_thread), "Owner Thread"}, | ||
135 | {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(mutex.acquisition_depth), | ||
136 | "Acquire Depth"}, | ||
137 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.semaphore), "Semaphore"} | ||
138 | }; | ||
139 | |||
140 | static struct acpi_exdump_info acpi_ex_dump_region[7] = { | ||
141 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region), NULL}, | ||
142 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.space_id), "Space Id"}, | ||
143 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.flags), "Flags"}, | ||
144 | {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(region.address), "Address"}, | ||
145 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(region.length), "Length"}, | ||
146 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(region.handler), "Handler"}, | ||
147 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(region.next), "Next"} | ||
148 | }; | ||
149 | |||
150 | static struct acpi_exdump_info acpi_ex_dump_power[5] = { | ||
151 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_power), NULL}, | ||
152 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.system_level), | ||
153 | "System Level"}, | ||
154 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.resource_order), | ||
155 | "Resource Order"}, | ||
156 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.system_notify), | ||
157 | "System Notify"}, | ||
158 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.device_notify), | ||
159 | "Device Notify"} | ||
160 | }; | ||
161 | |||
162 | static struct acpi_exdump_info acpi_ex_dump_processor[7] = { | ||
163 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_processor), NULL}, | ||
164 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(processor.proc_id), "Processor ID"}, | ||
165 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(processor.length), "Length"}, | ||
166 | {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(processor.address), "Address"}, | ||
167 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.system_notify), | ||
168 | "System Notify"}, | ||
169 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.device_notify), | ||
170 | "Device Notify"}, | ||
171 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.handler), "Handler"} | ||
172 | }; | ||
173 | |||
174 | static struct acpi_exdump_info acpi_ex_dump_thermal[4] = { | ||
175 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_thermal), NULL}, | ||
176 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.system_notify), | ||
177 | "System Notify"}, | ||
178 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.device_notify), | ||
179 | "Device Notify"}, | ||
180 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.handler), "Handler"} | ||
181 | }; | ||
182 | |||
183 | static struct acpi_exdump_info acpi_ex_dump_buffer_field[3] = { | ||
184 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_buffer_field), NULL}, | ||
185 | {ACPI_EXD_FIELD, 0, NULL}, | ||
186 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer_field.buffer_obj), | ||
187 | "Buffer Object"} | ||
188 | }; | ||
189 | |||
190 | static struct acpi_exdump_info acpi_ex_dump_region_field[3] = { | ||
191 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region_field), NULL}, | ||
192 | {ACPI_EXD_FIELD, 0, NULL}, | ||
193 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(field.region_obj), "Region Object"} | ||
194 | }; | ||
195 | |||
196 | static struct acpi_exdump_info acpi_ex_dump_bank_field[5] = { | ||
197 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_bank_field), NULL}, | ||
198 | {ACPI_EXD_FIELD, 0, NULL}, | ||
199 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(bank_field.value), "Value"}, | ||
200 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(bank_field.region_obj), | ||
201 | "Region Object"}, | ||
202 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(bank_field.bank_obj), "Bank Object"} | ||
203 | }; | ||
204 | |||
205 | static struct acpi_exdump_info acpi_ex_dump_index_field[5] = { | ||
206 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_bank_field), NULL}, | ||
207 | {ACPI_EXD_FIELD, 0, NULL}, | ||
208 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(index_field.value), "Value"}, | ||
209 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.index_obj), | ||
210 | "Index Object"}, | ||
211 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.data_obj), "Data Object"} | ||
212 | }; | ||
213 | |||
214 | static struct acpi_exdump_info acpi_ex_dump_reference[7] = { | ||
215 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_reference), NULL}, | ||
216 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.target_type), "Target Type"}, | ||
217 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(reference.offset), "Offset"}, | ||
218 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.object), "Object Desc"}, | ||
219 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.node), "Node"}, | ||
220 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.where), "Where"}, | ||
221 | {ACPI_EXD_REFERENCE, 0, NULL} | ||
222 | }; | ||
223 | |||
224 | static struct acpi_exdump_info acpi_ex_dump_address_handler[6] = { | ||
225 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_address_handler), | ||
226 | NULL}, | ||
227 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(address_space.space_id), "Space Id"}, | ||
228 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.next), "Next"}, | ||
229 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.region_list), | ||
230 | "Region List"}, | ||
231 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.node), "Node"}, | ||
232 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.context), "Context"} | ||
233 | }; | ||
234 | |||
235 | static struct acpi_exdump_info acpi_ex_dump_notify[3] = { | ||
236 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_notify), NULL}, | ||
237 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.node), "Node"}, | ||
238 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.context), "Context"} | ||
239 | }; | ||
240 | |||
241 | /* Miscellaneous tables */ | ||
242 | |||
243 | static struct acpi_exdump_info acpi_ex_dump_common[4] = { | ||
244 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_common), NULL}, | ||
245 | {ACPI_EXD_TYPE, 0, NULL}, | ||
246 | {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(common.reference_count), | ||
247 | "Reference Count"}, | ||
248 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common.flags), "Flags"} | ||
249 | }; | ||
250 | |||
251 | static struct acpi_exdump_info acpi_ex_dump_field_common[7] = { | ||
252 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_field_common), NULL}, | ||
253 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.field_flags), | ||
254 | "Field Flags"}, | ||
255 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.access_byte_width), | ||
256 | "Access Byte Width"}, | ||
257 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(common_field.bit_length), | ||
258 | "Bit Length"}, | ||
259 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.start_field_bit_offset), | ||
260 | "Field Bit Offset"}, | ||
261 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(common_field.base_byte_offset), | ||
262 | "Base Byte Offset"}, | ||
263 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"} | ||
264 | }; | ||
265 | |||
266 | static struct acpi_exdump_info acpi_ex_dump_node[6] = { | ||
267 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL}, | ||
268 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"}, | ||
269 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"}, | ||
270 | {ACPI_EXD_UINT16, ACPI_EXD_NSOFFSET(reference_count), | ||
271 | "Reference Count"}, | ||
272 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(child), "Child List"}, | ||
273 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"} | ||
274 | }; | ||
275 | |||
276 | /* Dispatch table, indexed by object type */ | ||
277 | |||
278 | static struct acpi_exdump_info *acpi_ex_dump_info[] = { | ||
279 | NULL, | ||
280 | acpi_ex_dump_integer, | ||
281 | acpi_ex_dump_string, | ||
282 | acpi_ex_dump_buffer, | ||
283 | acpi_ex_dump_package, | ||
284 | NULL, | ||
285 | acpi_ex_dump_device, | ||
286 | acpi_ex_dump_event, | ||
287 | acpi_ex_dump_method, | ||
288 | acpi_ex_dump_mutex, | ||
289 | acpi_ex_dump_region, | ||
290 | acpi_ex_dump_power, | ||
291 | acpi_ex_dump_processor, | ||
292 | acpi_ex_dump_thermal, | ||
293 | acpi_ex_dump_buffer_field, | ||
294 | NULL, | ||
295 | NULL, | ||
296 | acpi_ex_dump_region_field, | ||
297 | acpi_ex_dump_bank_field, | ||
298 | acpi_ex_dump_index_field, | ||
299 | acpi_ex_dump_reference, | ||
300 | NULL, | ||
301 | NULL, | ||
302 | acpi_ex_dump_notify, | ||
303 | acpi_ex_dump_address_handler, | ||
304 | NULL, | ||
305 | NULL, | ||
306 | NULL | ||
307 | }; | ||
308 | |||
309 | /******************************************************************************* | ||
310 | * | ||
311 | * FUNCTION: acpi_ex_dump_object | ||
312 | * | ||
313 | * PARAMETERS: obj_desc - Descriptor to dump | ||
314 | * Info - Info table corresponding to this object | ||
315 | * type | ||
316 | * | ||
317 | * RETURN: None | ||
318 | * | ||
319 | * DESCRIPTION: Walk the info table for this object | ||
320 | * | ||
321 | ******************************************************************************/ | ||
322 | |||
323 | static void | ||
324 | acpi_ex_dump_object(union acpi_operand_object *obj_desc, | ||
325 | struct acpi_exdump_info *info) | ||
326 | { | ||
327 | u8 *target; | ||
328 | char *name; | ||
329 | u8 count; | ||
330 | |||
331 | if (!info) { | ||
332 | acpi_os_printf | ||
333 | ("ex_dump_object: Display not implemented for object type %s\n", | ||
334 | acpi_ut_get_object_type_name(obj_desc)); | ||
335 | return; | ||
336 | } | ||
337 | |||
338 | /* First table entry must contain the table length (# of table entries) */ | ||
339 | |||
340 | count = info->offset; | ||
341 | |||
342 | while (count) { | ||
343 | target = ACPI_ADD_PTR(u8, obj_desc, info->offset); | ||
344 | name = info->name; | ||
345 | |||
346 | switch (info->opcode) { | ||
347 | case ACPI_EXD_INIT: | ||
348 | break; | ||
349 | |||
350 | case ACPI_EXD_TYPE: | ||
351 | acpi_ex_out_string("Type", | ||
352 | acpi_ut_get_object_type_name | ||
353 | (obj_desc)); | ||
354 | break; | ||
355 | |||
356 | case ACPI_EXD_UINT8: | ||
357 | |||
358 | acpi_os_printf("%20s : %2.2X\n", name, *target); | ||
359 | break; | ||
360 | |||
361 | case ACPI_EXD_UINT16: | ||
362 | |||
363 | acpi_os_printf("%20s : %4.4X\n", name, | ||
364 | ACPI_GET16(target)); | ||
365 | break; | ||
366 | |||
367 | case ACPI_EXD_UINT32: | ||
368 | |||
369 | acpi_os_printf("%20s : %8.8X\n", name, | ||
370 | ACPI_GET32(target)); | ||
371 | break; | ||
372 | |||
373 | case ACPI_EXD_UINT64: | ||
374 | |||
375 | acpi_os_printf("%20s : %8.8X%8.8X\n", "Value", | ||
376 | ACPI_FORMAT_UINT64(ACPI_GET64(target))); | ||
377 | break; | ||
378 | |||
379 | case ACPI_EXD_POINTER: | ||
380 | |||
381 | acpi_ex_out_pointer(name, | ||
382 | *ACPI_CAST_PTR(void *, target)); | ||
383 | break; | ||
384 | |||
385 | case ACPI_EXD_ADDRESS: | ||
386 | |||
387 | acpi_ex_out_address(name, | ||
388 | *ACPI_CAST_PTR | ||
389 | (acpi_physical_address, target)); | ||
390 | break; | ||
391 | |||
392 | case ACPI_EXD_STRING: | ||
393 | |||
394 | acpi_ut_print_string(obj_desc->string.pointer, | ||
395 | ACPI_UINT8_MAX); | ||
396 | acpi_os_printf("\n"); | ||
397 | break; | ||
398 | |||
399 | case ACPI_EXD_BUFFER: | ||
400 | |||
401 | ACPI_DUMP_BUFFER(obj_desc->buffer.pointer, | ||
402 | obj_desc->buffer.length); | ||
403 | break; | ||
404 | |||
405 | case ACPI_EXD_PACKAGE: | ||
406 | |||
407 | /* Dump the package contents */ | ||
408 | |||
409 | acpi_os_printf("\nPackage Contents:\n"); | ||
410 | acpi_ex_dump_package_obj(obj_desc, 0, 0); | ||
411 | break; | ||
412 | |||
413 | case ACPI_EXD_FIELD: | ||
414 | |||
415 | acpi_ex_dump_object(obj_desc, | ||
416 | acpi_ex_dump_field_common); | ||
417 | break; | ||
418 | |||
419 | case ACPI_EXD_REFERENCE: | ||
420 | |||
421 | acpi_ex_out_string("Opcode", | ||
422 | (acpi_ps_get_opcode_info | ||
423 | (obj_desc->reference.opcode))-> | ||
424 | name); | ||
425 | acpi_ex_dump_reference_obj(obj_desc); | ||
426 | break; | ||
427 | |||
428 | default: | ||
429 | acpi_os_printf("**** Invalid table opcode [%X] ****\n", | ||
430 | info->opcode); | ||
431 | return; | ||
432 | } | ||
433 | |||
434 | info++; | ||
435 | count--; | ||
436 | } | ||
437 | } | ||
72 | 438 | ||
73 | /******************************************************************************* | 439 | /******************************************************************************* |
74 | * | 440 | * |
@@ -214,7 +580,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
214 | 580 | ||
215 | case ACPI_TYPE_BUFFER: | 581 | case ACPI_TYPE_BUFFER: |
216 | 582 | ||
217 | acpi_os_printf("Buffer len %X @ %p \n", | 583 | acpi_os_printf("Buffer len %X @ %p\n", |
218 | obj_desc->buffer.length, | 584 | obj_desc->buffer.length, |
219 | obj_desc->buffer.pointer); | 585 | obj_desc->buffer.pointer); |
220 | 586 | ||
@@ -320,17 +686,17 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
320 | 686 | ||
321 | case ACPI_TYPE_BUFFER_FIELD: | 687 | case ACPI_TYPE_BUFFER_FIELD: |
322 | 688 | ||
323 | acpi_os_printf("buffer_field: %X bits at byte %X bit %X of \n", | 689 | acpi_os_printf("buffer_field: %X bits at byte %X bit %X of\n", |
324 | obj_desc->buffer_field.bit_length, | 690 | obj_desc->buffer_field.bit_length, |
325 | obj_desc->buffer_field.base_byte_offset, | 691 | obj_desc->buffer_field.base_byte_offset, |
326 | obj_desc->buffer_field.start_field_bit_offset); | 692 | obj_desc->buffer_field.start_field_bit_offset); |
327 | 693 | ||
328 | if (!obj_desc->buffer_field.buffer_obj) { | 694 | if (!obj_desc->buffer_field.buffer_obj) { |
329 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL* \n")); | 695 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL*\n")); |
330 | } else | 696 | } else |
331 | if (ACPI_GET_OBJECT_TYPE(obj_desc->buffer_field.buffer_obj) | 697 | if (ACPI_GET_OBJECT_TYPE(obj_desc->buffer_field.buffer_obj) |
332 | != ACPI_TYPE_BUFFER) { | 698 | != ACPI_TYPE_BUFFER) { |
333 | acpi_os_printf("*not a Buffer* \n"); | 699 | acpi_os_printf("*not a Buffer*\n"); |
334 | } else { | 700 | } else { |
335 | acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj, | 701 | acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj, |
336 | depth + 1); | 702 | depth + 1); |
@@ -441,7 +807,6 @@ acpi_ex_dump_operands(union acpi_operand_object **operands, | |||
441 | return; | 807 | return; |
442 | } | 808 | } |
443 | 809 | ||
444 | #ifdef ACPI_FUTURE_USAGE | ||
445 | /******************************************************************************* | 810 | /******************************************************************************* |
446 | * | 811 | * |
447 | * FUNCTION: acpi_ex_out* functions | 812 | * FUNCTION: acpi_ex_out* functions |
@@ -465,11 +830,6 @@ static void acpi_ex_out_pointer(char *title, void *value) | |||
465 | acpi_os_printf("%20s : %p\n", title, value); | 830 | acpi_os_printf("%20s : %p\n", title, value); |
466 | } | 831 | } |
467 | 832 | ||
468 | static void acpi_ex_out_integer(char *title, u32 value) | ||
469 | { | ||
470 | acpi_os_printf("%20s : %.2X\n", title, value); | ||
471 | } | ||
472 | |||
473 | static void acpi_ex_out_address(char *title, acpi_physical_address value) | 833 | static void acpi_ex_out_address(char *title, acpi_physical_address value) |
474 | { | 834 | { |
475 | 835 | ||
@@ -482,16 +842,16 @@ static void acpi_ex_out_address(char *title, acpi_physical_address value) | |||
482 | 842 | ||
483 | /******************************************************************************* | 843 | /******************************************************************************* |
484 | * | 844 | * |
485 | * FUNCTION: acpi_ex_dump_node | 845 | * FUNCTION: acpi_ex_dump_namespace_node |
486 | * | 846 | * |
487 | * PARAMETERS: *Node - Descriptor to dump | 847 | * PARAMETERS: Node - Descriptor to dump |
488 | * Flags - Force display if TRUE | 848 | * Flags - Force display if TRUE |
489 | * | 849 | * |
490 | * DESCRIPTION: Dumps the members of the given.Node | 850 | * DESCRIPTION: Dumps the members of the given.Node |
491 | * | 851 | * |
492 | ******************************************************************************/ | 852 | ******************************************************************************/ |
493 | 853 | ||
494 | void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags) | 854 | void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags) |
495 | { | 855 | { |
496 | 856 | ||
497 | ACPI_FUNCTION_ENTRY(); | 857 | ACPI_FUNCTION_ENTRY(); |
@@ -506,19 +866,17 @@ void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags) | |||
506 | 866 | ||
507 | acpi_os_printf("%20s : %4.4s\n", "Name", acpi_ut_get_node_name(node)); | 867 | acpi_os_printf("%20s : %4.4s\n", "Name", acpi_ut_get_node_name(node)); |
508 | acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type)); | 868 | acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type)); |
509 | acpi_ex_out_integer("Flags", node->flags); | ||
510 | acpi_ex_out_integer("Owner Id", node->owner_id); | ||
511 | acpi_ex_out_integer("Reference Count", node->reference_count); | ||
512 | acpi_ex_out_pointer("Attached Object", | 869 | acpi_ex_out_pointer("Attached Object", |
513 | acpi_ns_get_attached_object(node)); | 870 | acpi_ns_get_attached_object(node)); |
514 | acpi_ex_out_pointer("child_list", node->child); | ||
515 | acpi_ex_out_pointer("next_peer", node->peer); | ||
516 | acpi_ex_out_pointer("Parent", acpi_ns_get_parent_node(node)); | 871 | acpi_ex_out_pointer("Parent", acpi_ns_get_parent_node(node)); |
872 | |||
873 | acpi_ex_dump_object(ACPI_CAST_PTR(union acpi_operand_object, node), | ||
874 | acpi_ex_dump_node); | ||
517 | } | 875 | } |
518 | 876 | ||
519 | /******************************************************************************* | 877 | /******************************************************************************* |
520 | * | 878 | * |
521 | * FUNCTION: acpi_ex_dump_reference | 879 | * FUNCTION: acpi_ex_dump_reference_obj |
522 | * | 880 | * |
523 | * PARAMETERS: Object - Descriptor to dump | 881 | * PARAMETERS: Object - Descriptor to dump |
524 | * | 882 | * |
@@ -526,14 +884,16 @@ void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags) | |||
526 | * | 884 | * |
527 | ******************************************************************************/ | 885 | ******************************************************************************/ |
528 | 886 | ||
529 | static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc) | 887 | static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc) |
530 | { | 888 | { |
531 | struct acpi_buffer ret_buf; | 889 | struct acpi_buffer ret_buf; |
532 | acpi_status status; | 890 | acpi_status status; |
533 | 891 | ||
892 | ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; | ||
893 | |||
534 | if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { | 894 | if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { |
535 | acpi_os_printf("Named Object %p ", obj_desc->reference.node); | 895 | acpi_os_printf("Named Object %p ", obj_desc->reference.node); |
536 | ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 896 | |
537 | status = | 897 | status = |
538 | acpi_ns_handle_to_pathname(obj_desc->reference.node, | 898 | acpi_ns_handle_to_pathname(obj_desc->reference.node, |
539 | &ret_buf); | 899 | &ret_buf); |
@@ -551,9 +911,9 @@ static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc) | |||
551 | 911 | ||
552 | /******************************************************************************* | 912 | /******************************************************************************* |
553 | * | 913 | * |
554 | * FUNCTION: acpi_ex_dump_package | 914 | * FUNCTION: acpi_ex_dump_package_obj |
555 | * | 915 | * |
556 | * PARAMETERS: Object - Descriptor to dump | 916 | * PARAMETERS: obj_desc - Descriptor to dump |
557 | * Level - Indentation Level | 917 | * Level - Indentation Level |
558 | * Index - Package index for this object | 918 | * Index - Package index for this object |
559 | * | 919 | * |
@@ -562,7 +922,8 @@ static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc) | |||
562 | ******************************************************************************/ | 922 | ******************************************************************************/ |
563 | 923 | ||
564 | static void | 924 | static void |
565 | acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index) | 925 | acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, |
926 | u32 level, u32 index) | ||
566 | { | 927 | { |
567 | u32 i; | 928 | u32 i; |
568 | 929 | ||
@@ -608,7 +969,8 @@ acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index) | |||
608 | acpi_os_printf("[Buffer] Length %.2X = ", | 969 | acpi_os_printf("[Buffer] Length %.2X = ", |
609 | obj_desc->buffer.length); | 970 | obj_desc->buffer.length); |
610 | if (obj_desc->buffer.length) { | 971 | if (obj_desc->buffer.length) { |
611 | acpi_ut_dump_buffer((u8 *) obj_desc->buffer.pointer, | 972 | acpi_ut_dump_buffer(ACPI_CAST_PTR |
973 | (u8, obj_desc->buffer.pointer), | ||
612 | obj_desc->buffer.length, | 974 | obj_desc->buffer.length, |
613 | DB_DWORD_DISPLAY, _COMPONENT); | 975 | DB_DWORD_DISPLAY, _COMPONENT); |
614 | } else { | 976 | } else { |
@@ -618,19 +980,19 @@ acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index) | |||
618 | 980 | ||
619 | case ACPI_TYPE_PACKAGE: | 981 | case ACPI_TYPE_PACKAGE: |
620 | 982 | ||
621 | acpi_os_printf("[Package] Contains %d Elements: \n", | 983 | acpi_os_printf("[Package] Contains %d Elements:\n", |
622 | obj_desc->package.count); | 984 | obj_desc->package.count); |
623 | 985 | ||
624 | for (i = 0; i < obj_desc->package.count; i++) { | 986 | for (i = 0; i < obj_desc->package.count; i++) { |
625 | acpi_ex_dump_package(obj_desc->package.elements[i], | 987 | acpi_ex_dump_package_obj(obj_desc->package.elements[i], |
626 | level + 1, i); | 988 | level + 1, i); |
627 | } | 989 | } |
628 | break; | 990 | break; |
629 | 991 | ||
630 | case ACPI_TYPE_LOCAL_REFERENCE: | 992 | case ACPI_TYPE_LOCAL_REFERENCE: |
631 | 993 | ||
632 | acpi_os_printf("[Object Reference] "); | 994 | acpi_os_printf("[Object Reference] "); |
633 | acpi_ex_dump_reference(obj_desc); | 995 | acpi_ex_dump_reference_obj(obj_desc); |
634 | break; | 996 | break; |
635 | 997 | ||
636 | default: | 998 | default: |
@@ -645,7 +1007,7 @@ acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index) | |||
645 | * | 1007 | * |
646 | * FUNCTION: acpi_ex_dump_object_descriptor | 1008 | * FUNCTION: acpi_ex_dump_object_descriptor |
647 | * | 1009 | * |
648 | * PARAMETERS: Object - Descriptor to dump | 1010 | * PARAMETERS: obj_desc - Descriptor to dump |
649 | * Flags - Force display if TRUE | 1011 | * Flags - Force display if TRUE |
650 | * | 1012 | * |
651 | * DESCRIPTION: Dumps the members of the object descriptor given. | 1013 | * DESCRIPTION: Dumps the members of the object descriptor given. |
@@ -670,11 +1032,13 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) | |||
670 | } | 1032 | } |
671 | 1033 | ||
672 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) { | 1034 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) { |
673 | acpi_ex_dump_node((struct acpi_namespace_node *)obj_desc, | 1035 | acpi_ex_dump_namespace_node((struct acpi_namespace_node *) |
674 | flags); | 1036 | obj_desc, flags); |
1037 | |||
675 | acpi_os_printf("\nAttached Object (%p):\n", | 1038 | acpi_os_printf("\nAttached Object (%p):\n", |
676 | ((struct acpi_namespace_node *)obj_desc)-> | 1039 | ((struct acpi_namespace_node *)obj_desc)-> |
677 | object); | 1040 | object); |
1041 | |||
678 | acpi_ex_dump_object_descriptor(((struct acpi_namespace_node *) | 1042 | acpi_ex_dump_object_descriptor(((struct acpi_namespace_node *) |
679 | obj_desc)->object, flags); | 1043 | obj_desc)->object, flags); |
680 | return_VOID; | 1044 | return_VOID; |
@@ -687,233 +1051,18 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) | |||
687 | return_VOID; | 1051 | return_VOID; |
688 | } | 1052 | } |
689 | 1053 | ||
690 | /* Common Fields */ | 1054 | if (obj_desc->common.type > ACPI_TYPE_NS_NODE_MAX) { |
691 | 1055 | return_VOID; | |
692 | acpi_ex_out_string("Type", acpi_ut_get_object_type_name(obj_desc)); | 1056 | } |
693 | acpi_ex_out_integer("Reference Count", | ||
694 | obj_desc->common.reference_count); | ||
695 | acpi_ex_out_integer("Flags", obj_desc->common.flags); | ||
696 | |||
697 | /* Object-specific Fields */ | ||
698 | |||
699 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | ||
700 | case ACPI_TYPE_INTEGER: | ||
701 | |||
702 | acpi_os_printf("%20s : %8.8X%8.8X\n", "Value", | ||
703 | ACPI_FORMAT_UINT64(obj_desc->integer.value)); | ||
704 | break; | ||
705 | |||
706 | case ACPI_TYPE_STRING: | ||
707 | |||
708 | acpi_ex_out_integer("Length", obj_desc->string.length); | ||
709 | |||
710 | acpi_os_printf("%20s : %p ", "Pointer", | ||
711 | obj_desc->string.pointer); | ||
712 | acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX); | ||
713 | acpi_os_printf("\n"); | ||
714 | break; | ||
715 | |||
716 | case ACPI_TYPE_BUFFER: | ||
717 | |||
718 | acpi_ex_out_integer("Length", obj_desc->buffer.length); | ||
719 | acpi_ex_out_pointer("Pointer", obj_desc->buffer.pointer); | ||
720 | ACPI_DUMP_BUFFER(obj_desc->buffer.pointer, | ||
721 | obj_desc->buffer.length); | ||
722 | break; | ||
723 | |||
724 | case ACPI_TYPE_PACKAGE: | ||
725 | |||
726 | acpi_ex_out_integer("Flags", obj_desc->package.flags); | ||
727 | acpi_ex_out_integer("Elements", obj_desc->package.count); | ||
728 | acpi_ex_out_pointer("Element List", obj_desc->package.elements); | ||
729 | |||
730 | /* Dump the package contents */ | ||
731 | |||
732 | acpi_os_printf("\nPackage Contents:\n"); | ||
733 | acpi_ex_dump_package(obj_desc, 0, 0); | ||
734 | break; | ||
735 | |||
736 | case ACPI_TYPE_DEVICE: | ||
737 | |||
738 | acpi_ex_out_pointer("Handler", obj_desc->device.handler); | ||
739 | acpi_ex_out_pointer("system_notify", | ||
740 | obj_desc->device.system_notify); | ||
741 | acpi_ex_out_pointer("device_notify", | ||
742 | obj_desc->device.device_notify); | ||
743 | break; | ||
744 | |||
745 | case ACPI_TYPE_EVENT: | ||
746 | |||
747 | acpi_ex_out_pointer("Semaphore", obj_desc->event.semaphore); | ||
748 | break; | ||
749 | |||
750 | case ACPI_TYPE_METHOD: | ||
751 | |||
752 | acpi_ex_out_integer("param_count", | ||
753 | obj_desc->method.param_count); | ||
754 | acpi_ex_out_integer("Concurrency", | ||
755 | obj_desc->method.concurrency); | ||
756 | acpi_ex_out_pointer("Semaphore", obj_desc->method.semaphore); | ||
757 | acpi_ex_out_integer("owner_id", obj_desc->method.owner_id); | ||
758 | acpi_ex_out_integer("aml_length", obj_desc->method.aml_length); | ||
759 | acpi_ex_out_pointer("aml_start", obj_desc->method.aml_start); | ||
760 | break; | ||
761 | |||
762 | case ACPI_TYPE_MUTEX: | ||
763 | |||
764 | acpi_ex_out_integer("sync_level", obj_desc->mutex.sync_level); | ||
765 | acpi_ex_out_pointer("owner_thread", | ||
766 | obj_desc->mutex.owner_thread); | ||
767 | acpi_ex_out_integer("acquire_depth", | ||
768 | obj_desc->mutex.acquisition_depth); | ||
769 | acpi_ex_out_pointer("Semaphore", obj_desc->mutex.semaphore); | ||
770 | break; | ||
771 | |||
772 | case ACPI_TYPE_REGION: | ||
773 | |||
774 | acpi_ex_out_integer("space_id", obj_desc->region.space_id); | ||
775 | acpi_ex_out_integer("Flags", obj_desc->region.flags); | ||
776 | acpi_ex_out_address("Address", obj_desc->region.address); | ||
777 | acpi_ex_out_integer("Length", obj_desc->region.length); | ||
778 | acpi_ex_out_pointer("Handler", obj_desc->region.handler); | ||
779 | acpi_ex_out_pointer("Next", obj_desc->region.next); | ||
780 | break; | ||
781 | |||
782 | case ACPI_TYPE_POWER: | ||
783 | |||
784 | acpi_ex_out_integer("system_level", | ||
785 | obj_desc->power_resource.system_level); | ||
786 | acpi_ex_out_integer("resource_order", | ||
787 | obj_desc->power_resource.resource_order); | ||
788 | acpi_ex_out_pointer("system_notify", | ||
789 | obj_desc->power_resource.system_notify); | ||
790 | acpi_ex_out_pointer("device_notify", | ||
791 | obj_desc->power_resource.device_notify); | ||
792 | break; | ||
793 | |||
794 | case ACPI_TYPE_PROCESSOR: | ||
795 | |||
796 | acpi_ex_out_integer("Processor ID", | ||
797 | obj_desc->processor.proc_id); | ||
798 | acpi_ex_out_integer("Length", obj_desc->processor.length); | ||
799 | acpi_ex_out_address("Address", | ||
800 | (acpi_physical_address) obj_desc->processor. | ||
801 | address); | ||
802 | acpi_ex_out_pointer("system_notify", | ||
803 | obj_desc->processor.system_notify); | ||
804 | acpi_ex_out_pointer("device_notify", | ||
805 | obj_desc->processor.device_notify); | ||
806 | acpi_ex_out_pointer("Handler", obj_desc->processor.handler); | ||
807 | break; | ||
808 | |||
809 | case ACPI_TYPE_THERMAL: | ||
810 | |||
811 | acpi_ex_out_pointer("system_notify", | ||
812 | obj_desc->thermal_zone.system_notify); | ||
813 | acpi_ex_out_pointer("device_notify", | ||
814 | obj_desc->thermal_zone.device_notify); | ||
815 | acpi_ex_out_pointer("Handler", obj_desc->thermal_zone.handler); | ||
816 | break; | ||
817 | |||
818 | case ACPI_TYPE_BUFFER_FIELD: | ||
819 | case ACPI_TYPE_LOCAL_REGION_FIELD: | ||
820 | case ACPI_TYPE_LOCAL_BANK_FIELD: | ||
821 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | ||
822 | |||
823 | acpi_ex_out_integer("field_flags", | ||
824 | obj_desc->common_field.field_flags); | ||
825 | acpi_ex_out_integer("access_byte_width", | ||
826 | obj_desc->common_field.access_byte_width); | ||
827 | acpi_ex_out_integer("bit_length", | ||
828 | obj_desc->common_field.bit_length); | ||
829 | acpi_ex_out_integer("fld_bit_offset", | ||
830 | obj_desc->common_field. | ||
831 | start_field_bit_offset); | ||
832 | acpi_ex_out_integer("base_byte_offset", | ||
833 | obj_desc->common_field.base_byte_offset); | ||
834 | acpi_ex_out_pointer("parent_node", obj_desc->common_field.node); | ||
835 | |||
836 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | ||
837 | case ACPI_TYPE_BUFFER_FIELD: | ||
838 | acpi_ex_out_pointer("buffer_obj", | ||
839 | obj_desc->buffer_field.buffer_obj); | ||
840 | break; | ||
841 | |||
842 | case ACPI_TYPE_LOCAL_REGION_FIELD: | ||
843 | acpi_ex_out_pointer("region_obj", | ||
844 | obj_desc->field.region_obj); | ||
845 | break; | ||
846 | |||
847 | case ACPI_TYPE_LOCAL_BANK_FIELD: | ||
848 | acpi_ex_out_integer("Value", | ||
849 | obj_desc->bank_field.value); | ||
850 | acpi_ex_out_pointer("region_obj", | ||
851 | obj_desc->bank_field.region_obj); | ||
852 | acpi_ex_out_pointer("bank_obj", | ||
853 | obj_desc->bank_field.bank_obj); | ||
854 | break; | ||
855 | |||
856 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | ||
857 | acpi_ex_out_integer("Value", | ||
858 | obj_desc->index_field.value); | ||
859 | acpi_ex_out_pointer("Index", | ||
860 | obj_desc->index_field.index_obj); | ||
861 | acpi_ex_out_pointer("Data", | ||
862 | obj_desc->index_field.data_obj); | ||
863 | break; | ||
864 | |||
865 | default: | ||
866 | /* All object types covered above */ | ||
867 | break; | ||
868 | } | ||
869 | break; | ||
870 | |||
871 | case ACPI_TYPE_LOCAL_REFERENCE: | ||
872 | |||
873 | acpi_ex_out_integer("target_type", | ||
874 | obj_desc->reference.target_type); | ||
875 | acpi_ex_out_string("Opcode", | ||
876 | (acpi_ps_get_opcode_info | ||
877 | (obj_desc->reference.opcode))->name); | ||
878 | acpi_ex_out_integer("Offset", obj_desc->reference.offset); | ||
879 | acpi_ex_out_pointer("obj_desc", obj_desc->reference.object); | ||
880 | acpi_ex_out_pointer("Node", obj_desc->reference.node); | ||
881 | acpi_ex_out_pointer("Where", obj_desc->reference.where); | ||
882 | |||
883 | acpi_ex_dump_reference(obj_desc); | ||
884 | break; | ||
885 | |||
886 | case ACPI_TYPE_LOCAL_ADDRESS_HANDLER: | ||
887 | |||
888 | acpi_ex_out_integer("space_id", | ||
889 | obj_desc->address_space.space_id); | ||
890 | acpi_ex_out_pointer("Next", obj_desc->address_space.next); | ||
891 | acpi_ex_out_pointer("region_list", | ||
892 | obj_desc->address_space.region_list); | ||
893 | acpi_ex_out_pointer("Node", obj_desc->address_space.node); | ||
894 | acpi_ex_out_pointer("Context", obj_desc->address_space.context); | ||
895 | break; | ||
896 | 1057 | ||
897 | case ACPI_TYPE_LOCAL_NOTIFY: | 1058 | /* Common Fields */ |
898 | 1059 | ||
899 | acpi_ex_out_pointer("Node", obj_desc->notify.node); | 1060 | acpi_ex_dump_object(obj_desc, acpi_ex_dump_common); |
900 | acpi_ex_out_pointer("Context", obj_desc->notify.context); | ||
901 | break; | ||
902 | 1061 | ||
903 | case ACPI_TYPE_LOCAL_ALIAS: | 1062 | /* Object-specific fields */ |
904 | case ACPI_TYPE_LOCAL_METHOD_ALIAS: | ||
905 | case ACPI_TYPE_LOCAL_EXTRA: | ||
906 | case ACPI_TYPE_LOCAL_DATA: | ||
907 | default: | ||
908 | |||
909 | acpi_os_printf | ||
910 | ("ex_dump_object_descriptor: Display not implemented for object type %s\n", | ||
911 | acpi_ut_get_object_type_name(obj_desc)); | ||
912 | break; | ||
913 | } | ||
914 | 1063 | ||
1064 | acpi_ex_dump_object(obj_desc, acpi_ex_dump_info[obj_desc->common.type]); | ||
915 | return_VOID; | 1065 | return_VOID; |
916 | } | 1066 | } |
917 | 1067 | ||
918 | #endif /* ACPI_FUTURE_USAGE */ | ||
919 | #endif | 1068 | #endif |
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index a3f4d72bedc9..0778bff632bf 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 46 | #include <acpi/acinterp.h> |
47 | #include <acpi/amlcode.h> | 47 | #include <acpi/amlcode.h> |
48 | #include <acpi/amlresrc.h> | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
50 | ACPI_MODULE_NAME("exmisc") | 51 | ACPI_MODULE_NAME("exmisc") |
@@ -157,48 +158,58 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, | |||
157 | union acpi_operand_object **actual_return_desc, | 158 | union acpi_operand_object **actual_return_desc, |
158 | struct acpi_walk_state *walk_state) | 159 | struct acpi_walk_state *walk_state) |
159 | { | 160 | { |
161 | acpi_status status; | ||
160 | union acpi_operand_object *return_desc; | 162 | union acpi_operand_object *return_desc; |
161 | u8 *new_buf; | 163 | u8 *new_buf; |
162 | u8 *end_tag1; | 164 | u8 *end_tag; |
163 | u8 *end_tag2; | 165 | acpi_size length0; |
164 | acpi_size length1; | 166 | acpi_size length1; |
165 | acpi_size length2; | ||
166 | 167 | ||
167 | ACPI_FUNCTION_TRACE("ex_concat_template"); | 168 | ACPI_FUNCTION_TRACE("ex_concat_template"); |
168 | 169 | ||
169 | /* Find the end_tags in each resource template */ | 170 | /* |
171 | * Find the end_tag descriptor in each resource template. | ||
172 | * Note: returned pointers point TO the end_tag, not past it. | ||
173 | * | ||
174 | * Compute the length of each resource template | ||
175 | */ | ||
176 | status = acpi_ut_get_resource_end_tag(operand0, &end_tag); | ||
177 | if (ACPI_FAILURE(status)) { | ||
178 | return_ACPI_STATUS(status); | ||
179 | } | ||
180 | |||
181 | length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer); | ||
170 | 182 | ||
171 | end_tag1 = acpi_ut_get_resource_end_tag(operand0); | 183 | status = acpi_ut_get_resource_end_tag(operand1, &end_tag); |
172 | end_tag2 = acpi_ut_get_resource_end_tag(operand1); | 184 | if (ACPI_FAILURE(status)) { |
173 | if (!end_tag1 || !end_tag2) { | 185 | return_ACPI_STATUS(status); |
174 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | ||
175 | } | 186 | } |
176 | 187 | ||
177 | /* Compute the length of each part */ | 188 | /* Include the end_tag in the second template length */ |
178 | 189 | ||
179 | length1 = ACPI_PTR_DIFF(end_tag1, operand0->buffer.pointer); | 190 | length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer) + |
180 | length2 = ACPI_PTR_DIFF(end_tag2, operand1->buffer.pointer) + 2; /* Size of END_TAG */ | 191 | sizeof(struct aml_resource_end_tag); |
181 | 192 | ||
182 | /* Create a new buffer object for the result */ | 193 | /* Create a new buffer object for the result */ |
183 | 194 | ||
184 | return_desc = acpi_ut_create_buffer_object(length1 + length2); | 195 | return_desc = acpi_ut_create_buffer_object(length0 + length1); |
185 | if (!return_desc) { | 196 | if (!return_desc) { |
186 | return_ACPI_STATUS(AE_NO_MEMORY); | 197 | return_ACPI_STATUS(AE_NO_MEMORY); |
187 | } | 198 | } |
188 | 199 | ||
189 | /* Copy the templates to the new descriptor */ | 200 | /* |
190 | 201 | * Copy the templates to the new buffer, 0 first, then 1 follows. One | |
202 | * end_tag descriptor is copied from Operand1. | ||
203 | */ | ||
191 | new_buf = return_desc->buffer.pointer; | 204 | new_buf = return_desc->buffer.pointer; |
192 | ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length1); | 205 | ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length0); |
193 | ACPI_MEMCPY(new_buf + length1, operand1->buffer.pointer, length2); | 206 | ACPI_MEMCPY(new_buf + length0, operand1->buffer.pointer, length1); |
194 | 207 | ||
195 | /* Compute the new checksum */ | 208 | /* Set the end_tag checksum to zero, means "ignore checksum" */ |
196 | 209 | ||
197 | new_buf[return_desc->buffer.length - 1] = | 210 | new_buf[return_desc->buffer.length - 1] = 0; |
198 | acpi_ut_generate_checksum(return_desc->buffer.pointer, | ||
199 | (return_desc->buffer.length - 1)); | ||
200 | 211 | ||
201 | /* Return the completed template descriptor */ | 212 | /* Return the completed resource template */ |
202 | 213 | ||
203 | *actual_return_desc = return_desc; | 214 | *actual_return_desc = return_desc; |
204 | return_ACPI_STATUS(AE_OK); | 215 | return_ACPI_STATUS(AE_OK); |
@@ -229,7 +240,6 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
229 | union acpi_operand_object *return_desc; | 240 | union acpi_operand_object *return_desc; |
230 | char *new_buf; | 241 | char *new_buf; |
231 | acpi_status status; | 242 | acpi_status status; |
232 | acpi_size new_length; | ||
233 | 243 | ||
234 | ACPI_FUNCTION_TRACE("ex_do_concatenate"); | 244 | ACPI_FUNCTION_TRACE("ex_do_concatenate"); |
235 | 245 | ||
@@ -256,7 +266,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
256 | break; | 266 | break; |
257 | 267 | ||
258 | default: | 268 | default: |
259 | ACPI_REPORT_ERROR(("Concat - invalid obj type: %X\n", | 269 | ACPI_REPORT_ERROR(("Concatanate - invalid object type: %X\n", |
260 | ACPI_GET_OBJECT_TYPE(operand0))); | 270 | ACPI_GET_OBJECT_TYPE(operand0))); |
261 | status = AE_AML_INTERNAL; | 271 | status = AE_AML_INTERNAL; |
262 | } | 272 | } |
@@ -296,8 +306,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
296 | 306 | ||
297 | /* Copy the first integer, LSB first */ | 307 | /* Copy the first integer, LSB first */ |
298 | 308 | ||
299 | ACPI_MEMCPY(new_buf, | 309 | ACPI_MEMCPY(new_buf, &operand0->integer.value, |
300 | &operand0->integer.value, | ||
301 | acpi_gbl_integer_byte_width); | 310 | acpi_gbl_integer_byte_width); |
302 | 311 | ||
303 | /* Copy the second integer (LSB first) after the first */ | 312 | /* Copy the second integer (LSB first) after the first */ |
@@ -311,14 +320,11 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
311 | 320 | ||
312 | /* Result of two Strings is a String */ | 321 | /* Result of two Strings is a String */ |
313 | 322 | ||
314 | new_length = (acpi_size) operand0->string.length + | 323 | return_desc = acpi_ut_create_string_object((acpi_size) |
315 | (acpi_size) local_operand1->string.length; | 324 | (operand0->string. |
316 | if (new_length > ACPI_MAX_STRING_CONVERSION) { | 325 | length + |
317 | status = AE_AML_STRING_LIMIT; | 326 | local_operand1-> |
318 | goto cleanup; | 327 | string.length)); |
319 | } | ||
320 | |||
321 | return_desc = acpi_ut_create_string_object(new_length); | ||
322 | if (!return_desc) { | 328 | if (!return_desc) { |
323 | status = AE_NO_MEMORY; | 329 | status = AE_NO_MEMORY; |
324 | goto cleanup; | 330 | goto cleanup; |
@@ -338,11 +344,10 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
338 | /* Result of two Buffers is a Buffer */ | 344 | /* Result of two Buffers is a Buffer */ |
339 | 345 | ||
340 | return_desc = acpi_ut_create_buffer_object((acpi_size) | 346 | return_desc = acpi_ut_create_buffer_object((acpi_size) |
341 | operand0->buffer. | 347 | (operand0->buffer. |
342 | length + | 348 | length + |
343 | (acpi_size) | 349 | local_operand1-> |
344 | local_operand1-> | 350 | buffer.length)); |
345 | buffer.length); | ||
346 | if (!return_desc) { | 351 | if (!return_desc) { |
347 | status = AE_NO_MEMORY; | 352 | status = AE_NO_MEMORY; |
348 | goto cleanup; | 353 | goto cleanup; |
@@ -352,8 +357,8 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
352 | 357 | ||
353 | /* Concatenate the buffers */ | 358 | /* Concatenate the buffers */ |
354 | 359 | ||
355 | ACPI_MEMCPY(new_buf, | 360 | ACPI_MEMCPY(new_buf, operand0->buffer.pointer, |
356 | operand0->buffer.pointer, operand0->buffer.length); | 361 | operand0->buffer.length); |
357 | ACPI_MEMCPY(new_buf + operand0->buffer.length, | 362 | ACPI_MEMCPY(new_buf + operand0->buffer.length, |
358 | local_operand1->buffer.pointer, | 363 | local_operand1->buffer.pointer, |
359 | local_operand1->buffer.length); | 364 | local_operand1->buffer.length); |
@@ -625,9 +630,8 @@ acpi_ex_do_logical_op(u16 opcode, | |||
625 | 630 | ||
626 | /* Lexicographic compare: compare the data bytes */ | 631 | /* Lexicographic compare: compare the data bytes */ |
627 | 632 | ||
628 | compare = ACPI_MEMCMP((const char *)operand0->buffer.pointer, | 633 | compare = ACPI_MEMCMP(operand0->buffer.pointer, |
629 | (const char *)local_operand1->buffer. | 634 | local_operand1->buffer.pointer, |
630 | pointer, | ||
631 | (length0 > length1) ? length1 : length0); | 635 | (length0 > length1) ? length1 : length0); |
632 | 636 | ||
633 | switch (opcode) { | 637 | switch (opcode) { |
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index 239d8473e9a5..7bb5e17b5680 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c | |||
@@ -191,10 +191,10 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) | |||
191 | if (name_string) { | 191 | if (name_string) { |
192 | ACPI_STRCAT(name_string, char_buf); | 192 | ACPI_STRCAT(name_string, char_buf); |
193 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 193 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
194 | "Appended to - %s \n", name_string)); | 194 | "Appended to - %s\n", name_string)); |
195 | } else { | 195 | } else { |
196 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 196 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
197 | "No Name string - %s \n", char_buf)); | 197 | "No Name string - %s\n", char_buf)); |
198 | } | 198 | } |
199 | } else if (index == 0) { | 199 | } else if (index == 0) { |
200 | /* | 200 | /* |
@@ -216,7 +216,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) | |||
216 | *aml_address, aml_address)); | 216 | *aml_address, aml_address)); |
217 | } | 217 | } |
218 | 218 | ||
219 | *in_aml_address = (u8 *) aml_address; | 219 | *in_aml_address = ACPI_CAST_PTR(u8, aml_address); |
220 | return_ACPI_STATUS(status); | 220 | return_ACPI_STATUS(status); |
221 | } | 221 | } |
222 | 222 | ||
diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index 8d70c6beef00..d8472842c1fd 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c | |||
@@ -344,10 +344,6 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
344 | (length < operand[1]->integer.value) && | 344 | (length < operand[1]->integer.value) && |
345 | (operand[0]->buffer.pointer[length])) { | 345 | (operand[0]->buffer.pointer[length])) { |
346 | length++; | 346 | length++; |
347 | if (length > ACPI_MAX_STRING_CONVERSION) { | ||
348 | status = AE_AML_STRING_LIMIT; | ||
349 | goto cleanup; | ||
350 | } | ||
351 | } | 347 | } |
352 | 348 | ||
353 | /* Allocate a new string object */ | 349 | /* Allocate a new string object */ |
@@ -358,8 +354,10 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
358 | goto cleanup; | 354 | goto cleanup; |
359 | } | 355 | } |
360 | 356 | ||
361 | /* Copy the raw buffer data with no transform. NULL terminated already */ | 357 | /* |
362 | 358 | * Copy the raw buffer data with no transform. | |
359 | * (NULL terminated already) | ||
360 | */ | ||
363 | ACPI_MEMCPY(return_desc->string.pointer, | 361 | ACPI_MEMCPY(return_desc->string.pointer, |
364 | operand[0]->buffer.pointer, length); | 362 | operand[0]->buffer.pointer, length); |
365 | break; | 363 | break; |
diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c index 483365777670..2ea1c322970b 100644 --- a/drivers/acpi/executer/exoparg3.c +++ b/drivers/acpi/executer/exoparg3.c | |||
@@ -223,8 +223,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
223 | goto cleanup; | 223 | goto cleanup; |
224 | } | 224 | } |
225 | 225 | ||
226 | if (length > 0) { | 226 | if (buffer) { |
227 | /* Copy the portion requested */ | 227 | /* We have a buffer, copy the portion requested */ |
228 | 228 | ||
229 | ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, | 229 | ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, |
230 | length); | 230 | length); |
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c index 7476c363e407..88ccbf3b29d0 100644 --- a/drivers/acpi/executer/exprep.c +++ b/drivers/acpi/executer/exprep.c | |||
@@ -276,7 +276,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, | |||
276 | 276 | ||
277 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 277 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
278 | "Unknown field access type %X\n", access)); | 278 | "Unknown field access type %X\n", access)); |
279 | return_VALUE(0); | 279 | return_UINT32(0); |
280 | } | 280 | } |
281 | 281 | ||
282 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) { | 282 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) { |
@@ -289,7 +289,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, | |||
289 | } | 289 | } |
290 | 290 | ||
291 | *return_byte_alignment = byte_alignment; | 291 | *return_byte_alignment = byte_alignment; |
292 | return_VALUE(bit_length); | 292 | return_UINT32(bit_length); |
293 | } | 293 | } |
294 | 294 | ||
295 | /******************************************************************************* | 295 | /******************************************************************************* |
diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 9a2f5bea3afe..80118be3f544 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c | |||
@@ -77,7 +77,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
77 | struct acpi_mem_space_context *mem_info = region_context; | 77 | struct acpi_mem_space_context *mem_info = region_context; |
78 | u32 length; | 78 | u32 length; |
79 | acpi_size window_size; | 79 | acpi_size window_size; |
80 | #ifndef ACPI_MISALIGNED_TRANSFERS | 80 | #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED |
81 | u32 remainder; | 81 | u32 remainder; |
82 | #endif | 82 | #endif |
83 | 83 | ||
@@ -109,7 +109,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
109 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); | 109 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); |
110 | } | 110 | } |
111 | 111 | ||
112 | #ifndef ACPI_MISALIGNED_TRANSFERS | 112 | #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED |
113 | /* | 113 | /* |
114 | * Hardware does not support non-aligned data transfers, we must verify | 114 | * Hardware does not support non-aligned data transfers, we must verify |
115 | * the request. | 115 | * the request. |
@@ -199,20 +199,20 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
199 | *value = 0; | 199 | *value = 0; |
200 | switch (bit_width) { | 200 | switch (bit_width) { |
201 | case 8: | 201 | case 8: |
202 | *value = (acpi_integer) * ((u8 *) logical_addr_ptr); | 202 | *value = (acpi_integer) ACPI_GET8(logical_addr_ptr); |
203 | break; | 203 | break; |
204 | 204 | ||
205 | case 16: | 205 | case 16: |
206 | *value = (acpi_integer) * ((u16 *) logical_addr_ptr); | 206 | *value = (acpi_integer) ACPI_GET16(logical_addr_ptr); |
207 | break; | 207 | break; |
208 | 208 | ||
209 | case 32: | 209 | case 32: |
210 | *value = (acpi_integer) * ((u32 *) logical_addr_ptr); | 210 | *value = (acpi_integer) ACPI_GET32(logical_addr_ptr); |
211 | break; | 211 | break; |
212 | 212 | ||
213 | #if ACPI_MACHINE_WIDTH != 16 | 213 | #if ACPI_MACHINE_WIDTH != 16 |
214 | case 64: | 214 | case 64: |
215 | *value = (acpi_integer) * ((u64 *) logical_addr_ptr); | 215 | *value = (acpi_integer) ACPI_GET64(logical_addr_ptr); |
216 | break; | 216 | break; |
217 | #endif | 217 | #endif |
218 | default: | 218 | default: |
@@ -225,20 +225,20 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
225 | 225 | ||
226 | switch (bit_width) { | 226 | switch (bit_width) { |
227 | case 8: | 227 | case 8: |
228 | *(u8 *) logical_addr_ptr = (u8) * value; | 228 | ACPI_SET8(logical_addr_ptr) = (u8) * value; |
229 | break; | 229 | break; |
230 | 230 | ||
231 | case 16: | 231 | case 16: |
232 | *(u16 *) logical_addr_ptr = (u16) * value; | 232 | ACPI_SET16(logical_addr_ptr) = (u16) * value; |
233 | break; | 233 | break; |
234 | 234 | ||
235 | case 32: | 235 | case 32: |
236 | *(u32 *) logical_addr_ptr = (u32) * value; | 236 | ACPI_SET32(logical_addr_ptr) = (u32) * value; |
237 | break; | 237 | break; |
238 | 238 | ||
239 | #if ACPI_MACHINE_WIDTH != 16 | 239 | #if ACPI_MACHINE_WIDTH != 16 |
240 | case 64: | 240 | case 64: |
241 | *(u64 *) logical_addr_ptr = (u64) * value; | 241 | ACPI_SET64(logical_addr_ptr) = (u64) * value; |
242 | break; | 242 | break; |
243 | #endif | 243 | #endif |
244 | 244 | ||
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index ff064e79ab90..b04e4a3707a1 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c | |||
@@ -157,7 +157,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
157 | } | 157 | } |
158 | 158 | ||
159 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 159 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
160 | "Opcode %X [%s] required_operand_types=%8.8X \n", | 160 | "Opcode %X [%s] required_operand_types=%8.8X\n", |
161 | opcode, op_info->name, arg_types)); | 161 | opcode, op_info->name, arg_types)); |
162 | 162 | ||
163 | /* | 163 | /* |
diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c index c4ff654a6697..855db7130751 100644 --- a/drivers/acpi/executer/exstorob.c +++ b/drivers/acpi/executer/exstorob.c | |||
@@ -71,7 +71,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, | |||
71 | 71 | ||
72 | /* We know that source_desc is a buffer by now */ | 72 | /* We know that source_desc is a buffer by now */ |
73 | 73 | ||
74 | buffer = (u8 *) source_desc->buffer.pointer; | 74 | buffer = ACPI_CAST_PTR(u8, source_desc->buffer.pointer); |
75 | length = source_desc->buffer.length; | 75 | length = source_desc->buffer.length; |
76 | 76 | ||
77 | /* | 77 | /* |
@@ -160,7 +160,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, | |||
160 | 160 | ||
161 | /* We know that source_desc is a string by now */ | 161 | /* We know that source_desc is a string by now */ |
162 | 162 | ||
163 | buffer = (u8 *) source_desc->string.pointer; | 163 | buffer = ACPI_CAST_PTR(u8, source_desc->string.pointer); |
164 | length = source_desc->string.length; | 164 | length = source_desc->string.length; |
165 | 165 | ||
166 | /* | 166 | /* |
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index 1ee79d8c8f88..9f4e547d7734 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c | |||
@@ -206,7 +206,7 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags) | |||
206 | } | 206 | } |
207 | } | 207 | } |
208 | 208 | ||
209 | return_VALUE(locked); | 209 | return_UINT8(locked); |
210 | } | 210 | } |
211 | 211 | ||
212 | /******************************************************************************* | 212 | /******************************************************************************* |
@@ -268,7 +268,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) | |||
268 | /* acpi_integer is unsigned, so we don't worry about a '-' prefix */ | 268 | /* acpi_integer is unsigned, so we don't worry about a '-' prefix */ |
269 | 269 | ||
270 | if (value == 0) { | 270 | if (value == 0) { |
271 | return_VALUE(1); | 271 | return_UINT32(1); |
272 | } | 272 | } |
273 | 273 | ||
274 | current_value = value; | 274 | current_value = value; |
@@ -282,7 +282,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) | |||
282 | num_digits++; | 282 | num_digits++; |
283 | } | 283 | } |
284 | 284 | ||
285 | return_VALUE(num_digits); | 285 | return_UINT32(num_digits); |
286 | } | 286 | } |
287 | 287 | ||
288 | /******************************************************************************* | 288 | /******************************************************************************* |
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index aa993715d644..8daef57b994c 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -99,15 +99,15 @@ do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) | |||
99 | unsigned long *busnr = (unsigned long *)data; | 99 | unsigned long *busnr = (unsigned long *)data; |
100 | struct acpi_resource_address64 address; | 100 | struct acpi_resource_address64 address; |
101 | 101 | ||
102 | if (resource->id != ACPI_RSTYPE_ADDRESS16 && | 102 | if (resource->type != ACPI_RESOURCE_TYPE_ADDRESS16 && |
103 | resource->id != ACPI_RSTYPE_ADDRESS32 && | 103 | resource->type != ACPI_RESOURCE_TYPE_ADDRESS32 && |
104 | resource->id != ACPI_RSTYPE_ADDRESS64) | 104 | resource->type != ACPI_RESOURCE_TYPE_ADDRESS64) |
105 | return AE_OK; | 105 | return AE_OK; |
106 | 106 | ||
107 | acpi_resource_to_address64(resource, &address); | 107 | acpi_resource_to_address64(resource, &address); |
108 | if ((address.address_length > 0) && | 108 | if ((address.address_length > 0) && |
109 | (address.resource_type == ACPI_BUS_NUMBER_RANGE)) | 109 | (address.resource_type == ACPI_BUS_NUMBER_RANGE)) |
110 | *busnr = address.min_address_range; | 110 | *busnr = address.minimum; |
111 | 111 | ||
112 | return AE_OK; | 112 | return AE_OK; |
113 | } | 113 | } |
diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c index 1bb3463d7040..20a335cc9bea 100644 --- a/drivers/acpi/hardware/hwacpi.c +++ b/drivers/acpi/hardware/hwacpi.c | |||
@@ -204,18 +204,18 @@ u32 acpi_hw_get_mode(void) | |||
204 | * system does not support mode transition. | 204 | * system does not support mode transition. |
205 | */ | 205 | */ |
206 | if (!acpi_gbl_FADT->smi_cmd) { | 206 | if (!acpi_gbl_FADT->smi_cmd) { |
207 | return_VALUE(ACPI_SYS_MODE_ACPI); | 207 | return_UINT32(ACPI_SYS_MODE_ACPI); |
208 | } | 208 | } |
209 | 209 | ||
210 | status = | 210 | status = |
211 | acpi_get_register(ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK); | 211 | acpi_get_register(ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK); |
212 | if (ACPI_FAILURE(status)) { | 212 | if (ACPI_FAILURE(status)) { |
213 | return_VALUE(ACPI_SYS_MODE_LEGACY); | 213 | return_UINT32(ACPI_SYS_MODE_LEGACY); |
214 | } | 214 | } |
215 | 215 | ||
216 | if (value) { | 216 | if (value) { |
217 | return_VALUE(ACPI_SYS_MODE_ACPI); | 217 | return_UINT32(ACPI_SYS_MODE_ACPI); |
218 | } else { | 218 | } else { |
219 | return_VALUE(ACPI_SYS_MODE_LEGACY); | 219 | return_UINT32(ACPI_SYS_MODE_LEGACY); |
220 | } | 220 | } |
221 | } | 221 | } |
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index 536a7aea80c9..b243f20708b7 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c | |||
@@ -144,7 +144,8 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) | |||
144 | 144 | ||
145 | info.parameters = NULL; | 145 | info.parameters = NULL; |
146 | info.return_object = NULL; | 146 | info.return_object = NULL; |
147 | sleep_state_name = (char *)acpi_gbl_sleep_state_names[sleep_state]; | 147 | sleep_state_name = |
148 | ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); | ||
148 | 149 | ||
149 | status = acpi_ns_evaluate_by_name(sleep_state_name, &info); | 150 | status = acpi_ns_evaluate_by_name(sleep_state_name, &info); |
150 | if (ACPI_FAILURE(status)) { | 151 | if (ACPI_FAILURE(status)) { |
diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c index e928e8c2c6ec..468244147ec1 100644 --- a/drivers/acpi/motherboard.c +++ b/drivers/acpi/motherboard.c | |||
@@ -54,36 +54,36 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) | |||
54 | 54 | ||
55 | ACPI_FUNCTION_TRACE("acpi_reserve_io_ranges"); | 55 | ACPI_FUNCTION_TRACE("acpi_reserve_io_ranges"); |
56 | 56 | ||
57 | if (res->id == ACPI_RSTYPE_IO) { | 57 | if (res->type == ACPI_RESOURCE_TYPE_IO) { |
58 | struct acpi_resource_io *io_res = &res->data.io; | 58 | struct acpi_resource_io *io_res = &res->data.io; |
59 | 59 | ||
60 | if (io_res->min_base_address != io_res->max_base_address) | 60 | if (io_res->minimum != io_res->maximum) |
61 | return_VALUE(AE_OK); | 61 | return_VALUE(AE_OK); |
62 | if (IS_RESERVED_ADDR | 62 | if (IS_RESERVED_ADDR |
63 | (io_res->min_base_address, io_res->range_length)) { | 63 | (io_res->minimum, io_res->address_length)) { |
64 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 64 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
65 | "Motherboard resources 0x%08x - 0x%08x\n", | 65 | "Motherboard resources 0x%08x - 0x%08x\n", |
66 | io_res->min_base_address, | 66 | io_res->minimum, |
67 | io_res->min_base_address + | 67 | io_res->minimum + |
68 | io_res->range_length)); | 68 | io_res->address_length)); |
69 | requested_res = | 69 | requested_res = |
70 | request_region(io_res->min_base_address, | 70 | request_region(io_res->minimum, |
71 | io_res->range_length, "motherboard"); | 71 | io_res->address_length, "motherboard"); |
72 | } | 72 | } |
73 | } else if (res->id == ACPI_RSTYPE_FIXED_IO) { | 73 | } else if (res->type == ACPI_RESOURCE_TYPE_FIXED_IO) { |
74 | struct acpi_resource_fixed_io *fixed_io_res = | 74 | struct acpi_resource_fixed_io *fixed_io_res = |
75 | &res->data.fixed_io; | 75 | &res->data.fixed_io; |
76 | 76 | ||
77 | if (IS_RESERVED_ADDR | 77 | if (IS_RESERVED_ADDR |
78 | (fixed_io_res->base_address, fixed_io_res->range_length)) { | 78 | (fixed_io_res->address, fixed_io_res->address_length)) { |
79 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 79 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
80 | "Motherboard resources 0x%08x - 0x%08x\n", | 80 | "Motherboard resources 0x%08x - 0x%08x\n", |
81 | fixed_io_res->base_address, | 81 | fixed_io_res->address, |
82 | fixed_io_res->base_address + | 82 | fixed_io_res->address + |
83 | fixed_io_res->range_length)); | 83 | fixed_io_res->address_length)); |
84 | requested_res = | 84 | requested_res = |
85 | request_region(fixed_io_res->base_address, | 85 | request_region(fixed_io_res->address, |
86 | fixed_io_res->range_length, | 86 | fixed_io_res->address_length, |
87 | "motherboard"); | 87 | "motherboard"); |
88 | } | 88 | } |
89 | } else { | 89 | } else { |
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index edfbe34600f5..6923059ba3c7 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c | |||
@@ -498,7 +498,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
498 | path++; | 498 | path++; |
499 | 499 | ||
500 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 500 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
501 | "Multi Pathname (%d Segments, Flags=%X) \n", | 501 | "Multi Pathname (%d Segments, Flags=%X)\n", |
502 | num_segments, flags)); | 502 | num_segments, flags)); |
503 | break; | 503 | break; |
504 | 504 | ||
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index 9faf1d5c86ed..864c642759fa 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c | |||
@@ -212,7 +212,9 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
212 | /* | 212 | /* |
213 | * Now we can print out the pertinent information | 213 | * Now we can print out the pertinent information |
214 | */ | 214 | */ |
215 | acpi_os_printf(" %-12s %p ", acpi_ut_get_type_name(type), this_node); | 215 | acpi_os_printf(" %-12s %p %2.2X ", |
216 | acpi_ut_get_type_name(type), this_node, | ||
217 | this_node->owner_id); | ||
216 | 218 | ||
217 | dbg_level = acpi_dbg_level; | 219 | dbg_level = acpi_dbg_level; |
218 | acpi_dbg_level = 0; | 220 | acpi_dbg_level = 0; |
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index 0a08d2f04a06..efa3f4233736 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c | |||
@@ -336,23 +336,22 @@ acpi_ns_init_one_device(acpi_handle obj_handle, | |||
336 | struct acpi_parameter_info pinfo; | 336 | struct acpi_parameter_info pinfo; |
337 | u32 flags; | 337 | u32 flags; |
338 | acpi_status status; | 338 | acpi_status status; |
339 | struct acpi_namespace_node *ini_node; | ||
340 | struct acpi_namespace_node *device_node; | ||
339 | 341 | ||
340 | ACPI_FUNCTION_TRACE("ns_init_one_device"); | 342 | ACPI_FUNCTION_TRACE("ns_init_one_device"); |
341 | 343 | ||
342 | pinfo.parameters = NULL; | 344 | device_node = acpi_ns_map_handle_to_node(obj_handle); |
343 | pinfo.parameter_type = ACPI_PARAM_ARGS; | 345 | if (!device_node) { |
344 | |||
345 | pinfo.node = acpi_ns_map_handle_to_node(obj_handle); | ||
346 | if (!pinfo.node) { | ||
347 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 346 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
348 | } | 347 | } |
349 | 348 | ||
350 | /* | 349 | /* |
351 | * We will run _STA/_INI on Devices, Processors and thermal_zones only | 350 | * We will run _STA/_INI on Devices, Processors and thermal_zones only |
352 | */ | 351 | */ |
353 | if ((pinfo.node->type != ACPI_TYPE_DEVICE) && | 352 | if ((device_node->type != ACPI_TYPE_DEVICE) && |
354 | (pinfo.node->type != ACPI_TYPE_PROCESSOR) && | 353 | (device_node->type != ACPI_TYPE_PROCESSOR) && |
355 | (pinfo.node->type != ACPI_TYPE_THERMAL)) { | 354 | (device_node->type != ACPI_TYPE_THERMAL)) { |
356 | return_ACPI_STATUS(AE_OK); | 355 | return_ACPI_STATUS(AE_OK); |
357 | } | 356 | } |
358 | 357 | ||
@@ -364,57 +363,69 @@ acpi_ns_init_one_device(acpi_handle obj_handle, | |||
364 | info->device_count++; | 363 | info->device_count++; |
365 | 364 | ||
366 | /* | 365 | /* |
367 | * Run _STA to determine if we can run _INI on the device. | 366 | * Check if the _INI method exists for this device - |
367 | * if _INI does not exist, there is no need to run _STA | ||
368 | * No _INI means device requires no initialization | ||
369 | */ | ||
370 | status = acpi_ns_search_node(*ACPI_CAST_PTR(u32, METHOD_NAME__INI), | ||
371 | device_node, ACPI_TYPE_METHOD, &ini_node); | ||
372 | if (ACPI_FAILURE(status)) { | ||
373 | /* No _INI method found - move on to next device */ | ||
374 | |||
375 | return_ACPI_STATUS(AE_OK); | ||
376 | } | ||
377 | |||
378 | /* | ||
379 | * Run _STA to determine if we can run _INI on the device - | ||
380 | * the device must be present before _INI can be run. | ||
381 | * However, _STA is not required - assume device present if no _STA | ||
368 | */ | 382 | */ |
369 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, | 383 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, |
370 | pinfo.node, | 384 | device_node, |
371 | METHOD_NAME__STA)); | 385 | METHOD_NAME__STA)); |
372 | status = acpi_ut_execute_STA(pinfo.node, &flags); | ||
373 | 386 | ||
387 | pinfo.node = device_node; | ||
388 | pinfo.parameters = NULL; | ||
389 | pinfo.parameter_type = ACPI_PARAM_ARGS; | ||
390 | |||
391 | status = acpi_ut_execute_STA(pinfo.node, &flags); | ||
374 | if (ACPI_FAILURE(status)) { | 392 | if (ACPI_FAILURE(status)) { |
375 | if (pinfo.node->type == ACPI_TYPE_DEVICE) { | 393 | /* Ignore error and move on to next device */ |
376 | /* Ignore error and move on to next device */ | ||
377 | 394 | ||
378 | return_ACPI_STATUS(AE_OK); | 395 | return_ACPI_STATUS(AE_OK); |
379 | } | 396 | } |
380 | 397 | ||
381 | /* _STA is not required for Processor or thermal_zone objects */ | 398 | if (flags != ACPI_UINT32_MAX) { |
382 | } else { | ||
383 | info->num_STA++; | 399 | info->num_STA++; |
400 | } | ||
384 | 401 | ||
385 | if (!(flags & 0x01)) { | 402 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { |
386 | /* Don't look at children of a not present device */ | 403 | /* Don't look at children of a not present device */ |
387 | 404 | ||
388 | return_ACPI_STATUS(AE_CTRL_DEPTH); | 405 | return_ACPI_STATUS(AE_CTRL_DEPTH); |
389 | } | ||
390 | } | 406 | } |
391 | 407 | ||
392 | /* | 408 | /* |
393 | * The device is present. Run _INI. | 409 | * The device is present and _INI exists. Run the _INI method. |
410 | * (We already have the _INI node from above) | ||
394 | */ | 411 | */ |
395 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, | 412 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, |
396 | pinfo.node, | 413 | pinfo.node, |
397 | METHOD_NAME__INI)); | 414 | METHOD_NAME__INI)); |
398 | status = acpi_ns_evaluate_relative(METHOD_NAME__INI, &pinfo); | ||
399 | if (ACPI_FAILURE(status)) { | ||
400 | /* No _INI (AE_NOT_FOUND) means device requires no initialization */ | ||
401 | 415 | ||
402 | if (status != AE_NOT_FOUND) { | 416 | pinfo.node = ini_node; |
403 | /* Ignore error and move on to next device */ | 417 | status = acpi_ns_evaluate_by_handle(&pinfo); |
418 | if (ACPI_FAILURE(status)) { | ||
419 | /* Ignore error and move on to next device */ | ||
404 | 420 | ||
405 | #ifdef ACPI_DEBUG_OUTPUT | 421 | #ifdef ACPI_DEBUG_OUTPUT |
406 | char *scope_name = | 422 | char *scope_name = acpi_ns_get_external_pathname(ini_node); |
407 | acpi_ns_get_external_pathname(pinfo.node); | ||
408 | 423 | ||
409 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n", | 424 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n", |
410 | scope_name, | 425 | scope_name, acpi_format_exception(status))); |
411 | acpi_format_exception(status))); | ||
412 | 426 | ||
413 | ACPI_MEM_FREE(scope_name); | 427 | ACPI_MEM_FREE(scope_name); |
414 | #endif | 428 | #endif |
415 | } | ||
416 | |||
417 | status = AE_OK; | ||
418 | } else { | 429 | } else { |
419 | /* Delete any return object (especially if implicit_return is enabled) */ | 430 | /* Delete any return object (especially if implicit_return is enabled) */ |
420 | 431 | ||
@@ -434,5 +445,5 @@ acpi_ns_init_one_device(acpi_handle obj_handle, | |||
434 | acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI); | 445 | acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI); |
435 | } | 446 | } |
436 | 447 | ||
437 | return_ACPI_STATUS(status); | 448 | return_ACPI_STATUS(AE_OK); |
438 | } | 449 | } |
diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index d5e8dea61c27..5400728eb791 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c | |||
@@ -241,7 +241,7 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle, | |||
241 | 241 | ||
242 | acpi_ns_build_external_path(node, required_size, buffer->pointer); | 242 | acpi_ns_build_external_path(node, required_size, buffer->pointer); |
243 | 243 | ||
244 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X] \n", | 244 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X]\n", |
245 | (char *)buffer->pointer, (u32) required_size)); | 245 | (char *)buffer->pointer, (u32) required_size)); |
246 | return_ACPI_STATUS(AE_OK); | 246 | return_ACPI_STATUS(AE_OK); |
247 | } | 247 | } |
diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index 50a3ca5470ed..c1b1943d4670 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/namespace/nssearch.c | |||
@@ -99,8 +99,8 @@ acpi_ns_search_node(u32 target_name, | |||
99 | if (scope_name) { | 99 | if (scope_name) { |
100 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 100 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
101 | "Searching %s (%p) For [%4.4s] (%s)\n", | 101 | "Searching %s (%p) For [%4.4s] (%s)\n", |
102 | scope_name, node, | 102 | scope_name, node, ACPI_CAST_PTR(char, |
103 | (char *)&target_name, | 103 | &target_name), |
104 | acpi_ut_get_type_name(type))); | 104 | acpi_ut_get_type_name(type))); |
105 | 105 | ||
106 | ACPI_MEM_FREE(scope_name); | 106 | ACPI_MEM_FREE(scope_name); |
@@ -131,7 +131,7 @@ acpi_ns_search_node(u32 target_name, | |||
131 | */ | 131 | */ |
132 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 132 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
133 | "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", | 133 | "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", |
134 | (char *)&target_name, | 134 | ACPI_CAST_PTR(char, &target_name), |
135 | acpi_ut_get_type_name(next_node-> | 135 | acpi_ut_get_type_name(next_node-> |
136 | type), | 136 | type), |
137 | next_node, | 137 | next_node, |
@@ -160,7 +160,8 @@ acpi_ns_search_node(u32 target_name, | |||
160 | 160 | ||
161 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 161 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
162 | "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", | 162 | "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", |
163 | (char *)&target_name, acpi_ut_get_type_name(type), | 163 | ACPI_CAST_PTR(char, &target_name), |
164 | acpi_ut_get_type_name(type), | ||
164 | acpi_ut_get_node_name(node), node, node->child)); | 165 | acpi_ut_get_node_name(node), node, node->child)); |
165 | 166 | ||
166 | return_ACPI_STATUS(AE_NOT_FOUND); | 167 | return_ACPI_STATUS(AE_NOT_FOUND); |
@@ -210,14 +211,14 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
210 | */ | 211 | */ |
211 | if (!parent_node) { | 212 | if (!parent_node) { |
212 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] has no parent\n", | 213 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] has no parent\n", |
213 | (char *)&target_name)); | 214 | ACPI_CAST_PTR(char, &target_name))); |
214 | return_ACPI_STATUS(AE_NOT_FOUND); | 215 | return_ACPI_STATUS(AE_NOT_FOUND); |
215 | } | 216 | } |
216 | 217 | ||
217 | if (acpi_ns_local(type)) { | 218 | if (acpi_ns_local(type)) { |
218 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 219 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
219 | "[%4.4s] type [%s] must be local to this scope (no parent search)\n", | 220 | "[%4.4s] type [%s] must be local to this scope (no parent search)\n", |
220 | (char *)&target_name, | 221 | ACPI_CAST_PTR(char, &target_name), |
221 | acpi_ut_get_type_name(type))); | 222 | acpi_ut_get_type_name(type))); |
222 | return_ACPI_STATUS(AE_NOT_FOUND); | 223 | return_ACPI_STATUS(AE_NOT_FOUND); |
223 | } | 224 | } |
@@ -227,7 +228,7 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
227 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 228 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
228 | "Searching parent [%4.4s] for [%4.4s]\n", | 229 | "Searching parent [%4.4s] for [%4.4s]\n", |
229 | acpi_ut_get_node_name(parent_node), | 230 | acpi_ut_get_node_name(parent_node), |
230 | (char *)&target_name)); | 231 | ACPI_CAST_PTR(char, &target_name))); |
231 | 232 | ||
232 | /* | 233 | /* |
233 | * Search parents until target is found or we have backed up to the root | 234 | * Search parents until target is found or we have backed up to the root |
@@ -360,7 +361,7 @@ acpi_ns_search_and_enter(u32 target_name, | |||
360 | if (interpreter_mode == ACPI_IMODE_EXECUTE) { | 361 | if (interpreter_mode == ACPI_IMODE_EXECUTE) { |
361 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 362 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
362 | "%4.4s Not found in %p [Not adding]\n", | 363 | "%4.4s Not found in %p [Not adding]\n", |
363 | (char *)&target_name, node)); | 364 | ACPI_CAST_PTR(char, &target_name), node)); |
364 | 365 | ||
365 | return_ACPI_STATUS(AE_NOT_FOUND); | 366 | return_ACPI_STATUS(AE_NOT_FOUND); |
366 | } | 367 | } |
diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index ebec036423c9..549075fb9f88 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c | |||
@@ -249,10 +249,10 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) | |||
249 | 249 | ||
250 | if (!node) { | 250 | if (!node) { |
251 | ACPI_REPORT_WARNING(("ns_get_type: Null Node input pointer\n")); | 251 | ACPI_REPORT_WARNING(("ns_get_type: Null Node input pointer\n")); |
252 | return_VALUE(ACPI_TYPE_ANY); | 252 | return_UINT32(ACPI_TYPE_ANY); |
253 | } | 253 | } |
254 | 254 | ||
255 | return_VALUE((acpi_object_type) node->type); | 255 | return_UINT32((acpi_object_type) node->type); |
256 | } | 256 | } |
257 | 257 | ||
258 | /******************************************************************************* | 258 | /******************************************************************************* |
@@ -276,10 +276,10 @@ u32 acpi_ns_local(acpi_object_type type) | |||
276 | /* Type code out of range */ | 276 | /* Type code out of range */ |
277 | 277 | ||
278 | ACPI_REPORT_WARNING(("ns_local: Invalid Object Type\n")); | 278 | ACPI_REPORT_WARNING(("ns_local: Invalid Object Type\n")); |
279 | return_VALUE(ACPI_NS_NORMAL); | 279 | return_UINT32(ACPI_NS_NORMAL); |
280 | } | 280 | } |
281 | 281 | ||
282 | return_VALUE((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL); | 282 | return_UINT32((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL); |
283 | } | 283 | } |
284 | 284 | ||
285 | /******************************************************************************* | 285 | /******************************************************************************* |
@@ -805,10 +805,10 @@ u32 acpi_ns_opens_scope(acpi_object_type type) | |||
805 | 805 | ||
806 | ACPI_REPORT_WARNING(("ns_opens_scope: Invalid Object Type %X\n", | 806 | ACPI_REPORT_WARNING(("ns_opens_scope: Invalid Object Type %X\n", |
807 | type)); | 807 | type)); |
808 | return_VALUE(ACPI_NS_NORMAL); | 808 | return_UINT32(ACPI_NS_NORMAL); |
809 | } | 809 | } |
810 | 810 | ||
811 | return_VALUE(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE); | 811 | return_UINT32(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE); |
812 | } | 812 | } |
813 | 813 | ||
814 | /******************************************************************************* | 814 | /******************************************************************************* |
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index c07b046659ff..75b137a6a3c9 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c | |||
@@ -399,7 +399,7 @@ acpi_walk_namespace(acpi_object_type type, | |||
399 | 399 | ||
400 | /* Parameter validation */ | 400 | /* Parameter validation */ |
401 | 401 | ||
402 | if ((type > ACPI_TYPE_EXTERNAL_MAX) || (!max_depth) || (!user_function)) { | 402 | if ((type > ACPI_TYPE_LOCAL_MAX) || (!max_depth) || (!user_function)) { |
403 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 403 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
404 | } | 404 | } |
405 | 405 | ||
@@ -473,8 +473,8 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
473 | return (AE_CTRL_DEPTH); | 473 | return (AE_CTRL_DEPTH); |
474 | } | 474 | } |
475 | 475 | ||
476 | if (!(flags & 0x01)) { | 476 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { |
477 | /* Don't return at the device or children of the device if not there */ | 477 | /* Don't examine children of the device if not present */ |
478 | 478 | ||
479 | return (AE_CTRL_DEPTH); | 479 | return (AE_CTRL_DEPTH); |
480 | } | 480 | } |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index e3cd0b16031a..58e7c47354ee 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -1058,11 +1058,9 @@ EXPORT_SYMBOL(max_cstate); | |||
1058 | * Acquire a spinlock. | 1058 | * Acquire a spinlock. |
1059 | * | 1059 | * |
1060 | * handle is a pointer to the spinlock_t. | 1060 | * handle is a pointer to the spinlock_t. |
1061 | * flags is *not* the result of save_flags - it is an ACPI-specific flag variable | ||
1062 | * that indicates whether we are at interrupt level. | ||
1063 | */ | 1061 | */ |
1064 | 1062 | ||
1065 | unsigned long acpi_os_acquire_lock(acpi_handle handle) | 1063 | acpi_native_uint acpi_os_acquire_lock(acpi_handle handle) |
1066 | { | 1064 | { |
1067 | unsigned long flags; | 1065 | unsigned long flags; |
1068 | spin_lock_irqsave((spinlock_t *) handle, flags); | 1066 | spin_lock_irqsave((spinlock_t *) handle, flags); |
@@ -1073,9 +1071,9 @@ unsigned long acpi_os_acquire_lock(acpi_handle handle) | |||
1073 | * Release a spinlock. See above. | 1071 | * Release a spinlock. See above. |
1074 | */ | 1072 | */ |
1075 | 1073 | ||
1076 | void acpi_os_release_lock(acpi_handle handle, unsigned long flags) | 1074 | void acpi_os_release_lock(acpi_handle handle, acpi_native_uint flags) |
1077 | { | 1075 | { |
1078 | spin_unlock_irqrestore((spinlock_t *) handle, flags); | 1076 | spin_unlock_irqrestore((spinlock_t *) handle, (unsigned long) flags); |
1079 | } | 1077 | } |
1080 | 1078 | ||
1081 | #ifndef ACPI_USE_LOCAL_CACHE | 1079 | #ifndef ACPI_USE_LOCAL_CACHE |
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index 5858188f94a6..e6d4cb9fd303 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <acpi/acparser.h> | 45 | #include <acpi/acparser.h> |
46 | #include <acpi/amlcode.h> | 46 | #include <acpi/amlcode.h> |
47 | #include <acpi/acnamesp.h> | 47 | #include <acpi/acnamesp.h> |
48 | #include <acpi/acdispat.h> | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_PARSER | 50 | #define _COMPONENT ACPI_PARSER |
50 | ACPI_MODULE_NAME("psargs") | 51 | ACPI_MODULE_NAME("psargs") |
@@ -62,61 +63,51 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state | |||
62 | * | 63 | * |
63 | * PARAMETERS: parser_state - Current parser state object | 64 | * PARAMETERS: parser_state - Current parser state object |
64 | * | 65 | * |
65 | * RETURN: Decoded package length. On completion, the AML pointer points | 66 | * RETURN: Decoded package length. On completion, the AML pointer points |
66 | * past the length byte or bytes. | 67 | * past the length byte or bytes. |
67 | * | 68 | * |
68 | * DESCRIPTION: Decode and return a package length field | 69 | * DESCRIPTION: Decode and return a package length field. |
70 | * Note: Largest package length is 28 bits, from ACPI specification | ||
69 | * | 71 | * |
70 | ******************************************************************************/ | 72 | ******************************************************************************/ |
71 | 73 | ||
72 | static u32 | 74 | static u32 |
73 | acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) | 75 | acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) |
74 | { | 76 | { |
75 | u32 encoded_length; | 77 | u8 *aml = parser_state->aml; |
76 | u32 length = 0; | 78 | u32 package_length = 0; |
79 | acpi_native_uint byte_count; | ||
80 | u8 byte_zero_mask = 0x3F; /* Default [0:5] */ | ||
77 | 81 | ||
78 | ACPI_FUNCTION_TRACE("ps_get_next_package_length"); | 82 | ACPI_FUNCTION_TRACE("ps_get_next_package_length"); |
79 | 83 | ||
80 | encoded_length = (u32) ACPI_GET8(parser_state->aml); | 84 | /* |
81 | parser_state->aml++; | 85 | * Byte 0 bits [6:7] contain the number of additional bytes |
82 | 86 | * used to encode the package length, either 0,1,2, or 3 | |
83 | switch (encoded_length >> 6) { /* bits 6-7 contain encoding scheme */ | 87 | */ |
84 | case 0: /* 1-byte encoding (bits 0-5) */ | 88 | byte_count = (aml[0] >> 6); |
85 | 89 | parser_state->aml += (byte_count + 1); | |
86 | length = (encoded_length & 0x3F); | ||
87 | break; | ||
88 | |||
89 | case 1: /* 2-byte encoding (next byte + bits 0-3) */ | ||
90 | |||
91 | length = ((ACPI_GET8(parser_state->aml) << 04) | | ||
92 | (encoded_length & 0x0F)); | ||
93 | parser_state->aml++; | ||
94 | break; | ||
95 | |||
96 | case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */ | ||
97 | |||
98 | length = ((ACPI_GET8(parser_state->aml + 1) << 12) | | ||
99 | (ACPI_GET8(parser_state->aml) << 04) | | ||
100 | (encoded_length & 0x0F)); | ||
101 | parser_state->aml += 2; | ||
102 | break; | ||
103 | 90 | ||
104 | case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */ | 91 | /* Get bytes 3, 2, 1 as needed */ |
105 | 92 | ||
106 | length = ((ACPI_GET8(parser_state->aml + 2) << 20) | | 93 | while (byte_count) { |
107 | (ACPI_GET8(parser_state->aml + 1) << 12) | | 94 | /* |
108 | (ACPI_GET8(parser_state->aml) << 04) | | 95 | * Final bit positions for the package length bytes: |
109 | (encoded_length & 0x0F)); | 96 | * Byte3->[20:27] |
110 | parser_state->aml += 3; | 97 | * Byte2->[12:19] |
111 | break; | 98 | * Byte1->[04:11] |
112 | 99 | * Byte0->[00:03] | |
113 | default: | 100 | */ |
101 | package_length |= (aml[byte_count] << ((byte_count << 3) - 4)); | ||
114 | 102 | ||
115 | /* Can't get here, only 2 bits / 4 cases */ | 103 | byte_zero_mask = 0x0F; /* Use bits [0:3] of byte 0 */ |
116 | break; | 104 | byte_count--; |
117 | } | 105 | } |
118 | 106 | ||
119 | return_VALUE(length); | 107 | /* Byte 0 is a special case, either bits [0:3] or [0:5] are used */ |
108 | |||
109 | package_length |= (aml[0] & byte_zero_mask); | ||
110 | return_UINT32(package_length); | ||
120 | } | 111 | } |
121 | 112 | ||
122 | /******************************************************************************* | 113 | /******************************************************************************* |
@@ -135,16 +126,15 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) | |||
135 | u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state) | 126 | u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state) |
136 | { | 127 | { |
137 | u8 *start = parser_state->aml; | 128 | u8 *start = parser_state->aml; |
138 | acpi_native_uint length; | 129 | u32 package_length; |
139 | 130 | ||
140 | ACPI_FUNCTION_TRACE("ps_get_next_package_end"); | 131 | ACPI_FUNCTION_TRACE("ps_get_next_package_end"); |
141 | 132 | ||
142 | /* Function below changes parser_state->Aml */ | 133 | /* Function below updates parser_state->Aml */ |
143 | 134 | ||
144 | length = | 135 | package_length = acpi_ps_get_next_package_length(parser_state); |
145 | (acpi_native_uint) acpi_ps_get_next_package_length(parser_state); | ||
146 | 136 | ||
147 | return_PTR(start + length); /* end of package */ | 137 | return_PTR(start + package_length); /* end of package */ |
148 | } | 138 | } |
149 | 139 | ||
150 | /******************************************************************************* | 140 | /******************************************************************************* |
@@ -169,17 +159,15 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) | |||
169 | 159 | ||
170 | ACPI_FUNCTION_TRACE("ps_get_next_namestring"); | 160 | ACPI_FUNCTION_TRACE("ps_get_next_namestring"); |
171 | 161 | ||
172 | /* Handle multiple prefix characters */ | 162 | /* Point past any namestring prefix characters (backslash or carat) */ |
173 | |||
174 | while (acpi_ps_is_prefix_char(ACPI_GET8(end))) { | ||
175 | /* Include prefix '\\' or '^' */ | ||
176 | 163 | ||
164 | while (acpi_ps_is_prefix_char(*end)) { | ||
177 | end++; | 165 | end++; |
178 | } | 166 | } |
179 | 167 | ||
180 | /* Decode the path */ | 168 | /* Decode the path prefix character */ |
181 | 169 | ||
182 | switch (ACPI_GET8(end)) { | 170 | switch (*end) { |
183 | case 0: | 171 | case 0: |
184 | 172 | ||
185 | /* null_name */ | 173 | /* null_name */ |
@@ -199,9 +187,9 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) | |||
199 | 187 | ||
200 | case AML_MULTI_NAME_PREFIX_OP: | 188 | case AML_MULTI_NAME_PREFIX_OP: |
201 | 189 | ||
202 | /* Multiple name segments, 4 chars each */ | 190 | /* Multiple name segments, 4 chars each, count in next byte */ |
203 | 191 | ||
204 | end += 2 + ((acpi_size) ACPI_GET8(end + 1) * ACPI_NAME_SIZE); | 192 | end += 2 + (*(end + 1) * ACPI_NAME_SIZE); |
205 | break; | 193 | break; |
206 | 194 | ||
207 | default: | 195 | default: |
@@ -212,7 +200,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) | |||
212 | break; | 200 | break; |
213 | } | 201 | } |
214 | 202 | ||
215 | parser_state->aml = (u8 *) end; | 203 | parser_state->aml = end; |
216 | return_PTR((char *)start); | 204 | return_PTR((char *)start); |
217 | } | 205 | } |
218 | 206 | ||
@@ -224,7 +212,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) | |||
224 | * Arg - Where the namepath will be stored | 212 | * Arg - Where the namepath will be stored |
225 | * arg_count - If the namepath points to a control method | 213 | * arg_count - If the namepath points to a control method |
226 | * the method's argument is returned here. | 214 | * the method's argument is returned here. |
227 | * method_call - Whether the namepath can possibly be the | 215 | * possible_method_call - Whether the namepath can possibly be the |
228 | * start of a method call | 216 | * start of a method call |
229 | * | 217 | * |
230 | * RETURN: Status | 218 | * RETURN: Status |
@@ -240,11 +228,11 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) | |||
240 | acpi_status | 228 | acpi_status |
241 | acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | 229 | acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, |
242 | struct acpi_parse_state *parser_state, | 230 | struct acpi_parse_state *parser_state, |
243 | union acpi_parse_object *arg, u8 method_call) | 231 | union acpi_parse_object *arg, u8 possible_method_call) |
244 | { | 232 | { |
245 | char *path; | 233 | char *path; |
246 | union acpi_parse_object *name_op; | 234 | union acpi_parse_object *name_op; |
247 | acpi_status status = AE_OK; | 235 | acpi_status status; |
248 | union acpi_operand_object *method_desc; | 236 | union acpi_operand_object *method_desc; |
249 | struct acpi_namespace_node *node; | 237 | struct acpi_namespace_node *node; |
250 | union acpi_generic_state scope_info; | 238 | union acpi_generic_state scope_info; |
@@ -252,115 +240,127 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | |||
252 | ACPI_FUNCTION_TRACE("ps_get_next_namepath"); | 240 | ACPI_FUNCTION_TRACE("ps_get_next_namepath"); |
253 | 241 | ||
254 | path = acpi_ps_get_next_namestring(parser_state); | 242 | path = acpi_ps_get_next_namestring(parser_state); |
243 | acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); | ||
255 | 244 | ||
256 | /* Null path case is allowed */ | 245 | /* Null path case is allowed, just exit */ |
257 | 246 | ||
258 | if (path) { | 247 | if (!path) { |
259 | /* | 248 | arg->common.value.name = path; |
260 | * Lookup the name in the internal namespace | 249 | return_ACPI_STATUS(AE_OK); |
261 | */ | 250 | } |
262 | scope_info.scope.node = NULL; | ||
263 | node = parser_state->start_node; | ||
264 | if (node) { | ||
265 | scope_info.scope.node = node; | ||
266 | } | ||
267 | 251 | ||
268 | /* | 252 | /* Setup search scope info */ |
269 | * Lookup object. We don't want to add anything new to the namespace | ||
270 | * here, however. So we use MODE_EXECUTE. Allow searching of the | ||
271 | * parent tree, but don't open a new scope -- we just want to lookup the | ||
272 | * object (MUST BE mode EXECUTE to perform upsearch) | ||
273 | */ | ||
274 | status = acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY, | ||
275 | ACPI_IMODE_EXECUTE, | ||
276 | ACPI_NS_SEARCH_PARENT | | ||
277 | ACPI_NS_DONT_OPEN_SCOPE, NULL, &node); | ||
278 | if (ACPI_SUCCESS(status) && method_call) { | ||
279 | if (node->type == ACPI_TYPE_METHOD) { | ||
280 | /* This name is actually a control method invocation */ | ||
281 | |||
282 | method_desc = acpi_ns_get_attached_object(node); | ||
283 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | ||
284 | "Control Method - %p Desc %p Path=%p\n", | ||
285 | node, method_desc, path)); | ||
286 | |||
287 | name_op = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); | ||
288 | if (!name_op) { | ||
289 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
290 | } | ||
291 | 253 | ||
292 | /* Change arg into a METHOD CALL and attach name to it */ | 254 | scope_info.scope.node = NULL; |
255 | node = parser_state->start_node; | ||
256 | if (node) { | ||
257 | scope_info.scope.node = node; | ||
258 | } | ||
293 | 259 | ||
294 | acpi_ps_init_op(arg, AML_INT_METHODCALL_OP); | 260 | /* |
295 | name_op->common.value.name = path; | 261 | * Lookup the name in the internal namespace. We don't want to add |
262 | * anything new to the namespace here, however, so we use MODE_EXECUTE. | ||
263 | * Allow searching of the parent tree, but don't open a new scope - | ||
264 | * we just want to lookup the object (must be mode EXECUTE to perform | ||
265 | * the upsearch) | ||
266 | */ | ||
267 | status = | ||
268 | acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | ||
269 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, | ||
270 | NULL, &node); | ||
296 | 271 | ||
297 | /* Point METHODCALL/NAME to the METHOD Node */ | 272 | /* |
273 | * If this name is a control method invocation, we must | ||
274 | * setup the method call | ||
275 | */ | ||
276 | if (ACPI_SUCCESS(status) && | ||
277 | possible_method_call && (node->type == ACPI_TYPE_METHOD)) { | ||
278 | /* This name is actually a control method invocation */ | ||
298 | 279 | ||
299 | name_op->common.node = node; | 280 | method_desc = acpi_ns_get_attached_object(node); |
300 | acpi_ps_append_arg(arg, name_op); | 281 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
282 | "Control Method - %p Desc %p Path=%p\n", node, | ||
283 | method_desc, path)); | ||
301 | 284 | ||
302 | if (!method_desc) { | 285 | name_op = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); |
303 | ACPI_REPORT_ERROR(("ps_get_next_namepath: Control Method %p has no attached object\n", node)); | 286 | if (!name_op) { |
304 | return_ACPI_STATUS(AE_AML_INTERNAL); | 287 | return_ACPI_STATUS(AE_NO_MEMORY); |
305 | } | 288 | } |
306 | 289 | ||
307 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 290 | /* Change Arg into a METHOD CALL and attach name to it */ |
308 | "Control Method - %p Args %X\n", | ||
309 | node, | ||
310 | method_desc->method. | ||
311 | param_count)); | ||
312 | 291 | ||
313 | /* Get the number of arguments to expect */ | 292 | acpi_ps_init_op(arg, AML_INT_METHODCALL_OP); |
293 | name_op->common.value.name = path; | ||
314 | 294 | ||
315 | walk_state->arg_count = | 295 | /* Point METHODCALL/NAME to the METHOD Node */ |
316 | method_desc->method.param_count; | ||
317 | return_ACPI_STATUS(AE_OK); | ||
318 | } | ||
319 | 296 | ||
320 | /* | 297 | name_op->common.node = node; |
321 | * Else this is normal named object reference. | 298 | acpi_ps_append_arg(arg, name_op); |
322 | * Just init the NAMEPATH object with the pathname. | ||
323 | * (See code below) | ||
324 | */ | ||
325 | } | ||
326 | 299 | ||
327 | if (ACPI_FAILURE(status)) { | 300 | if (!method_desc) { |
328 | /* | 301 | ACPI_REPORT_ERROR(("ps_get_next_namepath: Control Method %p has no attached object\n", node)); |
329 | * 1) Any error other than NOT_FOUND is always severe | 302 | return_ACPI_STATUS(AE_AML_INTERNAL); |
330 | * 2) NOT_FOUND is only important if we are executing a method. | ||
331 | * 3) If executing a cond_ref_of opcode, NOT_FOUND is ok. | ||
332 | */ | ||
333 | if ((((walk_state-> | ||
334 | parse_flags & ACPI_PARSE_MODE_MASK) == | ||
335 | ACPI_PARSE_EXECUTE) && (status == AE_NOT_FOUND) | ||
336 | && (walk_state->op->common.aml_opcode != | ||
337 | AML_COND_REF_OF_OP)) | ||
338 | || (status != AE_NOT_FOUND)) { | ||
339 | ACPI_REPORT_NSERROR(path, status); | ||
340 | |||
341 | acpi_os_printf | ||
342 | ("search_node %p start_node %p return_node %p\n", | ||
343 | scope_info.scope.node, | ||
344 | parser_state->start_node, node); | ||
345 | |||
346 | } else { | ||
347 | /* | ||
348 | * We got a NOT_FOUND during table load or we encountered | ||
349 | * a cond_ref_of(x) where the target does not exist. | ||
350 | * Either case is ok | ||
351 | */ | ||
352 | status = AE_OK; | ||
353 | } | ||
354 | } | 303 | } |
304 | |||
305 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | ||
306 | "Control Method - %p Args %X\n", | ||
307 | node, method_desc->method.param_count)); | ||
308 | |||
309 | /* Get the number of arguments to expect */ | ||
310 | |||
311 | walk_state->arg_count = method_desc->method.param_count; | ||
312 | return_ACPI_STATUS(AE_OK); | ||
355 | } | 313 | } |
356 | 314 | ||
357 | /* | 315 | /* |
358 | * Regardless of success/failure above, | 316 | * Special handling if the name was not found during the lookup - |
359 | * Just initialize the Op with the pathname. | 317 | * some not_found cases are allowed |
360 | */ | 318 | */ |
361 | acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); | 319 | if (status == AE_NOT_FOUND) { |
362 | arg->common.value.name = path; | 320 | /* 1) not_found is ok during load pass 1/2 (allow forward references) */ |
321 | |||
322 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) != | ||
323 | ACPI_PARSE_EXECUTE) { | ||
324 | status = AE_OK; | ||
325 | } | ||
326 | |||
327 | /* 2) not_found during a cond_ref_of(x) is ok by definition */ | ||
328 | |||
329 | else if (walk_state->op->common.aml_opcode == | ||
330 | AML_COND_REF_OF_OP) { | ||
331 | status = AE_OK; | ||
332 | } | ||
333 | |||
334 | /* | ||
335 | * 3) not_found while building a Package is ok at this point, we | ||
336 | * may flag as an error later if slack mode is not enabled. | ||
337 | * (Some ASL code depends on allowing this behavior) | ||
338 | */ | ||
339 | else if ((arg->common.parent) && | ||
340 | ((arg->common.parent->common.aml_opcode == | ||
341 | AML_PACKAGE_OP) | ||
342 | || (arg->common.parent->common.aml_opcode == | ||
343 | AML_VAR_PACKAGE_OP))) { | ||
344 | status = AE_OK; | ||
345 | } | ||
346 | } | ||
347 | |||
348 | /* Final exception check (may have been changed from code above) */ | ||
363 | 349 | ||
350 | if (ACPI_FAILURE(status)) { | ||
351 | ACPI_REPORT_NSERROR(path, status); | ||
352 | |||
353 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == | ||
354 | ACPI_PARSE_EXECUTE) { | ||
355 | /* Report a control method execution error */ | ||
356 | |||
357 | status = acpi_ds_method_error(status, walk_state); | ||
358 | } | ||
359 | } | ||
360 | |||
361 | /* Save the namepath */ | ||
362 | |||
363 | arg->common.value.name = path; | ||
364 | return_ACPI_STATUS(status); | 364 | return_ACPI_STATUS(status); |
365 | } | 365 | } |
366 | 366 | ||
@@ -382,59 +382,63 @@ void | |||
382 | acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, | 382 | acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, |
383 | u32 arg_type, union acpi_parse_object *arg) | 383 | u32 arg_type, union acpi_parse_object *arg) |
384 | { | 384 | { |
385 | u32 length; | ||
386 | u16 opcode; | ||
387 | u8 *aml = parser_state->aml; | ||
385 | 388 | ||
386 | ACPI_FUNCTION_TRACE_U32("ps_get_next_simple_arg", arg_type); | 389 | ACPI_FUNCTION_TRACE_U32("ps_get_next_simple_arg", arg_type); |
387 | 390 | ||
388 | switch (arg_type) { | 391 | switch (arg_type) { |
389 | case ARGP_BYTEDATA: | 392 | case ARGP_BYTEDATA: |
390 | 393 | ||
391 | acpi_ps_init_op(arg, AML_BYTE_OP); | 394 | /* Get 1 byte from the AML stream */ |
392 | arg->common.value.integer = (u32) ACPI_GET8(parser_state->aml); | 395 | |
393 | parser_state->aml++; | 396 | opcode = AML_BYTE_OP; |
397 | arg->common.value.integer = (acpi_integer) * aml; | ||
398 | length = 1; | ||
394 | break; | 399 | break; |
395 | 400 | ||
396 | case ARGP_WORDDATA: | 401 | case ARGP_WORDDATA: |
397 | 402 | ||
398 | acpi_ps_init_op(arg, AML_WORD_OP); | ||
399 | |||
400 | /* Get 2 bytes from the AML stream */ | 403 | /* Get 2 bytes from the AML stream */ |
401 | 404 | ||
402 | ACPI_MOVE_16_TO_32(&arg->common.value.integer, | 405 | opcode = AML_WORD_OP; |
403 | parser_state->aml); | 406 | ACPI_MOVE_16_TO_64(&arg->common.value.integer, aml); |
404 | parser_state->aml += 2; | 407 | length = 2; |
405 | break; | 408 | break; |
406 | 409 | ||
407 | case ARGP_DWORDDATA: | 410 | case ARGP_DWORDDATA: |
408 | 411 | ||
409 | acpi_ps_init_op(arg, AML_DWORD_OP); | ||
410 | |||
411 | /* Get 4 bytes from the AML stream */ | 412 | /* Get 4 bytes from the AML stream */ |
412 | 413 | ||
413 | ACPI_MOVE_32_TO_32(&arg->common.value.integer, | 414 | opcode = AML_DWORD_OP; |
414 | parser_state->aml); | 415 | ACPI_MOVE_32_TO_64(&arg->common.value.integer, aml); |
415 | parser_state->aml += 4; | 416 | length = 4; |
416 | break; | 417 | break; |
417 | 418 | ||
418 | case ARGP_QWORDDATA: | 419 | case ARGP_QWORDDATA: |
419 | 420 | ||
420 | acpi_ps_init_op(arg, AML_QWORD_OP); | ||
421 | |||
422 | /* Get 8 bytes from the AML stream */ | 421 | /* Get 8 bytes from the AML stream */ |
423 | 422 | ||
424 | ACPI_MOVE_64_TO_64(&arg->common.value.integer, | 423 | opcode = AML_QWORD_OP; |
425 | parser_state->aml); | 424 | ACPI_MOVE_64_TO_64(&arg->common.value.integer, aml); |
426 | parser_state->aml += 8; | 425 | length = 8; |
427 | break; | 426 | break; |
428 | 427 | ||
429 | case ARGP_CHARLIST: | 428 | case ARGP_CHARLIST: |
430 | 429 | ||
431 | acpi_ps_init_op(arg, AML_STRING_OP); | 430 | /* Get a pointer to the string, point past the string */ |
432 | arg->common.value.string = (char *)parser_state->aml; | 431 | |
432 | opcode = AML_STRING_OP; | ||
433 | arg->common.value.string = ACPI_CAST_PTR(char, aml); | ||
433 | 434 | ||
434 | while (ACPI_GET8(parser_state->aml) != '\0') { | 435 | /* Find the null terminator */ |
435 | parser_state->aml++; | 436 | |
437 | length = 0; | ||
438 | while (aml[length]) { | ||
439 | length++; | ||
436 | } | 440 | } |
437 | parser_state->aml++; | 441 | length++; |
438 | break; | 442 | break; |
439 | 443 | ||
440 | case ARGP_NAME: | 444 | case ARGP_NAME: |
@@ -443,14 +447,16 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, | |||
443 | acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); | 447 | acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); |
444 | arg->common.value.name = | 448 | arg->common.value.name = |
445 | acpi_ps_get_next_namestring(parser_state); | 449 | acpi_ps_get_next_namestring(parser_state); |
446 | break; | 450 | return_VOID; |
447 | 451 | ||
448 | default: | 452 | default: |
449 | 453 | ||
450 | ACPI_REPORT_ERROR(("Invalid arg_type %X\n", arg_type)); | 454 | ACPI_REPORT_ERROR(("Invalid arg_type %X\n", arg_type)); |
451 | break; | 455 | return_VOID; |
452 | } | 456 | } |
453 | 457 | ||
458 | acpi_ps_init_op(arg, opcode); | ||
459 | parser_state->aml += length; | ||
454 | return_VOID; | 460 | return_VOID; |
455 | } | 461 | } |
456 | 462 | ||
@@ -540,7 +546,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state | |||
540 | * access_type is first operand, access_attribute is second | 546 | * access_type is first operand, access_attribute is second |
541 | */ | 547 | */ |
542 | field->common.value.integer = | 548 | field->common.value.integer = |
543 | (ACPI_GET8(parser_state->aml) << 8); | 549 | (((u32) ACPI_GET8(parser_state->aml) << 8)); |
544 | parser_state->aml++; | 550 | parser_state->aml++; |
545 | field->common.value.integer |= ACPI_GET8(parser_state->aml); | 551 | field->common.value.integer |= ACPI_GET8(parser_state->aml); |
546 | parser_state->aml++; | 552 | parser_state->aml++; |
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c index 088d33999d90..e81e51b8b3ae 100644 --- a/drivers/acpi/parser/psloop.c +++ b/drivers/acpi/parser/psloop.c | |||
@@ -704,6 +704,15 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
704 | acpi_ps_pop_scope(parser_state, &op, | 704 | acpi_ps_pop_scope(parser_state, &op, |
705 | &walk_state->arg_types, | 705 | &walk_state->arg_types, |
706 | &walk_state->arg_count); | 706 | &walk_state->arg_count); |
707 | |||
708 | if (op->common.aml_opcode != AML_WHILE_OP) { | ||
709 | status2 = | ||
710 | acpi_ds_result_stack_pop | ||
711 | (walk_state); | ||
712 | if (ACPI_FAILURE(status2)) { | ||
713 | return_ACPI_STATUS(status2); | ||
714 | } | ||
715 | } | ||
707 | } | 716 | } |
708 | 717 | ||
709 | /* Close this iteration of the While loop */ | 718 | /* Close this iteration of the While loop */ |
diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index 76d4d640d83c..f0979b2956f2 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c | |||
@@ -333,7 +333,6 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, | |||
333 | 333 | ||
334 | switch (callback_status) { | 334 | switch (callback_status) { |
335 | case AE_CTRL_TERMINATE: | 335 | case AE_CTRL_TERMINATE: |
336 | |||
337 | /* | 336 | /* |
338 | * A control method was terminated via a RETURN statement. | 337 | * A control method was terminated via a RETURN statement. |
339 | * The walk of this method is complete. | 338 | * The walk of this method is complete. |
@@ -346,13 +345,19 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, | |||
346 | 345 | ||
347 | parser_state->aml = walk_state->aml_last_while; | 346 | parser_state->aml = walk_state->aml_last_while; |
348 | walk_state->control_state->common.value = FALSE; | 347 | walk_state->control_state->common.value = FALSE; |
349 | status = AE_CTRL_BREAK; | 348 | status = acpi_ds_result_stack_pop(walk_state); |
349 | if (ACPI_SUCCESS(status)) { | ||
350 | status = AE_CTRL_BREAK; | ||
351 | } | ||
350 | break; | 352 | break; |
351 | 353 | ||
352 | case AE_CTRL_CONTINUE: | 354 | case AE_CTRL_CONTINUE: |
353 | 355 | ||
354 | parser_state->aml = walk_state->aml_last_while; | 356 | parser_state->aml = walk_state->aml_last_while; |
355 | status = AE_CTRL_CONTINUE; | 357 | status = acpi_ds_result_stack_pop(walk_state); |
358 | if (ACPI_SUCCESS(status)) { | ||
359 | status = AE_CTRL_CONTINUE; | ||
360 | } | ||
356 | break; | 361 | break; |
357 | 362 | ||
358 | case AE_CTRL_PENDING: | 363 | case AE_CTRL_PENDING: |
@@ -369,16 +374,18 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, | |||
369 | #endif | 374 | #endif |
370 | 375 | ||
371 | case AE_CTRL_TRUE: | 376 | case AE_CTRL_TRUE: |
372 | |||
373 | /* | 377 | /* |
374 | * Predicate of an IF was true, and we are at the matching ELSE. | 378 | * Predicate of an IF was true, and we are at the matching ELSE. |
375 | * Just close out this package | 379 | * Just close out this package |
376 | */ | 380 | */ |
377 | parser_state->aml = acpi_ps_get_next_package_end(parser_state); | 381 | parser_state->aml = acpi_ps_get_next_package_end(parser_state); |
382 | status = acpi_ds_result_stack_pop(walk_state); | ||
383 | if (ACPI_SUCCESS(status)) { | ||
384 | status = AE_CTRL_PENDING; | ||
385 | } | ||
378 | break; | 386 | break; |
379 | 387 | ||
380 | case AE_CTRL_FALSE: | 388 | case AE_CTRL_FALSE: |
381 | |||
382 | /* | 389 | /* |
383 | * Either an IF/WHILE Predicate was false or we encountered a BREAK | 390 | * Either an IF/WHILE Predicate was false or we encountered a BREAK |
384 | * opcode. In both cases, we do not execute the rest of the | 391 | * opcode. In both cases, we do not execute the rest of the |
@@ -503,22 +510,23 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
503 | } else if (status == AE_CTRL_TERMINATE) { | 510 | } else if (status == AE_CTRL_TERMINATE) { |
504 | status = AE_OK; | 511 | status = AE_OK; |
505 | } else if ((status != AE_OK) && (walk_state->method_desc)) { | 512 | } else if ((status != AE_OK) && (walk_state->method_desc)) { |
506 | ACPI_REPORT_METHOD_ERROR("Method execution failed", | 513 | /* Either the method parse or actual execution failed */ |
507 | walk_state->method_node, NULL, | ||
508 | status); | ||
509 | |||
510 | /* Ensure proper cleanup */ | ||
511 | 514 | ||
512 | walk_state->parse_flags |= ACPI_PARSE_EXECUTE; | 515 | ACPI_REPORT_METHOD_ERROR |
516 | ("Method parse/execution failed", | ||
517 | walk_state->method_node, NULL, status); | ||
513 | 518 | ||
514 | /* Check for possible multi-thread reentrancy problem */ | 519 | /* Check for possible multi-thread reentrancy problem */ |
515 | 520 | ||
516 | if ((status == AE_ALREADY_EXISTS) && | 521 | if ((status == AE_ALREADY_EXISTS) && |
517 | (!walk_state->method_desc->method.semaphore)) { | 522 | (!walk_state->method_desc->method.semaphore)) { |
518 | /* | 523 | /* |
519 | * This method is marked not_serialized, but it tried to create | 524 | * Method tried to create an object twice. The probable cause is |
525 | * that the method cannot handle reentrancy. | ||
526 | * | ||
527 | * The method is marked not_serialized, but it tried to create | ||
520 | * a named object, causing the second thread entrance to fail. | 528 | * a named object, causing the second thread entrance to fail. |
521 | * We will workaround this by marking the method permanently | 529 | * Workaround this problem by marking the method permanently |
522 | * as Serialized. | 530 | * as Serialized. |
523 | */ | 531 | */ |
524 | walk_state->method_desc->method.method_flags |= | 532 | walk_state->method_desc->method.method_flags |= |
@@ -536,15 +544,22 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
536 | acpi_ds_scope_stack_clear(walk_state); | 544 | acpi_ds_scope_stack_clear(walk_state); |
537 | 545 | ||
538 | /* | 546 | /* |
539 | * If we just returned from the execution of a control method, | 547 | * If we just returned from the execution of a control method or if we |
540 | * there's lots of cleanup to do | 548 | * encountered an error during the method parse phase, there's lots of |
549 | * cleanup to do | ||
541 | */ | 550 | */ |
542 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == | 551 | if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == |
543 | ACPI_PARSE_EXECUTE) { | 552 | ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) { |
544 | if (walk_state->method_desc) { | 553 | if (walk_state->method_desc) { |
545 | /* Decrement the thread count on the method parse tree */ | 554 | /* Decrement the thread count on the method parse tree */ |
546 | 555 | ||
547 | walk_state->method_desc->method.thread_count--; | 556 | if (walk_state->method_desc->method. |
557 | thread_count) { | ||
558 | walk_state->method_desc->method. | ||
559 | thread_count--; | ||
560 | } else { | ||
561 | ACPI_REPORT_ERROR(("Invalid zero thread count in method\n")); | ||
562 | } | ||
548 | } | 563 | } |
549 | 564 | ||
550 | acpi_ds_terminate_control_method(walk_state); | 565 | acpi_ds_terminate_control_method(walk_state); |
@@ -553,7 +568,6 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
553 | /* Delete this walk state and all linked control states */ | 568 | /* Delete this walk state and all linked control states */ |
554 | 569 | ||
555 | acpi_ps_cleanup_scope(&walk_state->parser_state); | 570 | acpi_ps_cleanup_scope(&walk_state->parser_state); |
556 | |||
557 | previous_walk_state = walk_state; | 571 | previous_walk_state = walk_state; |
558 | 572 | ||
559 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 573 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index 4dcbd443160e..14d544d60867 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c | |||
@@ -50,6 +50,10 @@ | |||
50 | ACPI_MODULE_NAME("psxface") | 50 | ACPI_MODULE_NAME("psxface") |
51 | 51 | ||
52 | /* Local Prototypes */ | 52 | /* Local Prototypes */ |
53 | static void acpi_ps_start_trace(struct acpi_parameter_info *info); | ||
54 | |||
55 | static void acpi_ps_stop_trace(struct acpi_parameter_info *info); | ||
56 | |||
53 | static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info); | 57 | static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info); |
54 | 58 | ||
55 | static void | 59 | static void |
@@ -57,6 +61,136 @@ acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action); | |||
57 | 61 | ||
58 | /******************************************************************************* | 62 | /******************************************************************************* |
59 | * | 63 | * |
64 | * FUNCTION: acpi_debug_trace | ||
65 | * | ||
66 | * PARAMETERS: method_name - Valid ACPI name string | ||
67 | * debug_level - Optional level mask. 0 to use default | ||
68 | * debug_layer - Optional layer mask. 0 to use default | ||
69 | * Flags - bit 1: one shot(1) or persistent(0) | ||
70 | * | ||
71 | * RETURN: Status | ||
72 | * | ||
73 | * DESCRIPTION: External interface to enable debug tracing during control | ||
74 | * method execution | ||
75 | * | ||
76 | ******************************************************************************/ | ||
77 | |||
78 | acpi_status | ||
79 | acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags) | ||
80 | { | ||
81 | acpi_status status; | ||
82 | |||
83 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
84 | if (ACPI_FAILURE(status)) { | ||
85 | return (status); | ||
86 | } | ||
87 | |||
88 | /* TBDs: Validate name, allow full path or just nameseg */ | ||
89 | |||
90 | acpi_gbl_trace_method_name = *ACPI_CAST_PTR(u32, name); | ||
91 | acpi_gbl_trace_flags = flags; | ||
92 | |||
93 | if (debug_level) { | ||
94 | acpi_gbl_trace_dbg_level = debug_level; | ||
95 | } | ||
96 | if (debug_layer) { | ||
97 | acpi_gbl_trace_dbg_layer = debug_layer; | ||
98 | } | ||
99 | |||
100 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
101 | return (AE_OK); | ||
102 | } | ||
103 | |||
104 | /******************************************************************************* | ||
105 | * | ||
106 | * FUNCTION: acpi_ps_start_trace | ||
107 | * | ||
108 | * PARAMETERS: Info - Method info struct | ||
109 | * | ||
110 | * RETURN: None | ||
111 | * | ||
112 | * DESCRIPTION: Start control method execution trace | ||
113 | * | ||
114 | ******************************************************************************/ | ||
115 | |||
116 | static void acpi_ps_start_trace(struct acpi_parameter_info *info) | ||
117 | { | ||
118 | acpi_status status; | ||
119 | |||
120 | ACPI_FUNCTION_ENTRY(); | ||
121 | |||
122 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
123 | if (ACPI_FAILURE(status)) { | ||
124 | return; | ||
125 | } | ||
126 | |||
127 | if ((!acpi_gbl_trace_method_name) || | ||
128 | (acpi_gbl_trace_method_name != info->node->name.integer)) { | ||
129 | goto exit; | ||
130 | } | ||
131 | |||
132 | acpi_gbl_original_dbg_level = acpi_dbg_level; | ||
133 | acpi_gbl_original_dbg_layer = acpi_dbg_layer; | ||
134 | |||
135 | acpi_dbg_level = 0x00FFFFFF; | ||
136 | acpi_dbg_layer = ACPI_UINT32_MAX; | ||
137 | |||
138 | if (acpi_gbl_trace_dbg_level) { | ||
139 | acpi_dbg_level = acpi_gbl_trace_dbg_level; | ||
140 | } | ||
141 | if (acpi_gbl_trace_dbg_layer) { | ||
142 | acpi_dbg_layer = acpi_gbl_trace_dbg_layer; | ||
143 | } | ||
144 | |||
145 | exit: | ||
146 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
147 | } | ||
148 | |||
149 | /******************************************************************************* | ||
150 | * | ||
151 | * FUNCTION: acpi_ps_stop_trace | ||
152 | * | ||
153 | * PARAMETERS: Info - Method info struct | ||
154 | * | ||
155 | * RETURN: None | ||
156 | * | ||
157 | * DESCRIPTION: Stop control method execution trace | ||
158 | * | ||
159 | ******************************************************************************/ | ||
160 | |||
161 | static void acpi_ps_stop_trace(struct acpi_parameter_info *info) | ||
162 | { | ||
163 | acpi_status status; | ||
164 | |||
165 | ACPI_FUNCTION_ENTRY(); | ||
166 | |||
167 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
168 | if (ACPI_FAILURE(status)) { | ||
169 | return; | ||
170 | } | ||
171 | |||
172 | if ((!acpi_gbl_trace_method_name) || | ||
173 | (acpi_gbl_trace_method_name != info->node->name.integer)) { | ||
174 | goto exit; | ||
175 | } | ||
176 | |||
177 | /* Disable further tracing if type is one-shot */ | ||
178 | |||
179 | if (acpi_gbl_trace_flags & 1) { | ||
180 | acpi_gbl_trace_method_name = 0; | ||
181 | acpi_gbl_trace_dbg_level = 0; | ||
182 | acpi_gbl_trace_dbg_layer = 0; | ||
183 | } | ||
184 | |||
185 | acpi_dbg_level = acpi_gbl_original_dbg_level; | ||
186 | acpi_dbg_layer = acpi_gbl_original_dbg_layer; | ||
187 | |||
188 | exit: | ||
189 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
190 | } | ||
191 | |||
192 | /******************************************************************************* | ||
193 | * | ||
60 | * FUNCTION: acpi_ps_execute_method | 194 | * FUNCTION: acpi_ps_execute_method |
61 | * | 195 | * |
62 | * PARAMETERS: Info - Method info block, contains: | 196 | * PARAMETERS: Info - Method info block, contains: |
@@ -104,6 +238,10 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
104 | */ | 238 | */ |
105 | acpi_ps_update_parameter_list(info, REF_INCREMENT); | 239 | acpi_ps_update_parameter_list(info, REF_INCREMENT); |
106 | 240 | ||
241 | /* Begin tracing if requested */ | ||
242 | |||
243 | acpi_ps_start_trace(info); | ||
244 | |||
107 | /* | 245 | /* |
108 | * 1) Perform the first pass parse of the method to enter any | 246 | * 1) Perform the first pass parse of the method to enter any |
109 | * named objects that it creates into the namespace | 247 | * named objects that it creates into the namespace |
@@ -129,6 +267,10 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
129 | status = acpi_ps_execute_pass(info); | 267 | status = acpi_ps_execute_pass(info); |
130 | 268 | ||
131 | cleanup: | 269 | cleanup: |
270 | /* End optional tracing */ | ||
271 | |||
272 | acpi_ps_stop_trace(info); | ||
273 | |||
132 | /* Take away the extra reference that we gave the parameters above */ | 274 | /* Take away the extra reference that we gave the parameters above */ |
133 | 275 | ||
134 | acpi_ps_update_parameter_list(info, REF_DECREMENT); | 276 | acpi_ps_update_parameter_list(info, REF_DECREMENT); |
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 09567c2edcfb..726dda1fce1c 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -258,7 +258,7 @@ typedef int (*irq_lookup_func) (struct acpi_prt_entry *, int *, int *, char **); | |||
258 | 258 | ||
259 | static int | 259 | static int |
260 | acpi_pci_allocate_irq(struct acpi_prt_entry *entry, | 260 | acpi_pci_allocate_irq(struct acpi_prt_entry *entry, |
261 | int *edge_level, int *active_high_low, char **link) | 261 | int *triggering, int *polarity, char **link) |
262 | { | 262 | { |
263 | int irq; | 263 | int irq; |
264 | 264 | ||
@@ -266,8 +266,8 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, | |||
266 | 266 | ||
267 | if (entry->link.handle) { | 267 | if (entry->link.handle) { |
268 | irq = acpi_pci_link_allocate_irq(entry->link.handle, | 268 | irq = acpi_pci_link_allocate_irq(entry->link.handle, |
269 | entry->link.index, edge_level, | 269 | entry->link.index, triggering, |
270 | active_high_low, link); | 270 | polarity, link); |
271 | if (irq < 0) { | 271 | if (irq < 0) { |
272 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 272 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, |
273 | "Invalid IRQ link routing entry\n")); | 273 | "Invalid IRQ link routing entry\n")); |
@@ -275,8 +275,8 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, | |||
275 | } | 275 | } |
276 | } else { | 276 | } else { |
277 | irq = entry->link.index; | 277 | irq = entry->link.index; |
278 | *edge_level = ACPI_LEVEL_SENSITIVE; | 278 | *triggering = ACPI_LEVEL_SENSITIVE; |
279 | *active_high_low = ACPI_ACTIVE_LOW; | 279 | *polarity = ACPI_ACTIVE_LOW; |
280 | } | 280 | } |
281 | 281 | ||
282 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); | 282 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); |
@@ -285,7 +285,7 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, | |||
285 | 285 | ||
286 | static int | 286 | static int |
287 | acpi_pci_free_irq(struct acpi_prt_entry *entry, | 287 | acpi_pci_free_irq(struct acpi_prt_entry *entry, |
288 | int *edge_level, int *active_high_low, char **link) | 288 | int *triggering, int *polarity, char **link) |
289 | { | 289 | { |
290 | int irq; | 290 | int irq; |
291 | 291 | ||
@@ -307,8 +307,8 @@ static int | |||
307 | acpi_pci_irq_lookup(struct pci_bus *bus, | 307 | acpi_pci_irq_lookup(struct pci_bus *bus, |
308 | int device, | 308 | int device, |
309 | int pin, | 309 | int pin, |
310 | int *edge_level, | 310 | int *triggering, |
311 | int *active_high_low, char **link, irq_lookup_func func) | 311 | int *polarity, char **link, irq_lookup_func func) |
312 | { | 312 | { |
313 | struct acpi_prt_entry *entry = NULL; | 313 | struct acpi_prt_entry *entry = NULL; |
314 | int segment = pci_domain_nr(bus); | 314 | int segment = pci_domain_nr(bus); |
@@ -327,7 +327,7 @@ acpi_pci_irq_lookup(struct pci_bus *bus, | |||
327 | return_VALUE(-1); | 327 | return_VALUE(-1); |
328 | } | 328 | } |
329 | 329 | ||
330 | ret = func(entry, edge_level, active_high_low, link); | 330 | ret = func(entry, triggering, polarity, link); |
331 | return_VALUE(ret); | 331 | return_VALUE(ret); |
332 | } | 332 | } |
333 | 333 | ||
@@ -339,8 +339,8 @@ acpi_pci_irq_lookup(struct pci_bus *bus, | |||
339 | static int | 339 | static int |
340 | acpi_pci_irq_derive(struct pci_dev *dev, | 340 | acpi_pci_irq_derive(struct pci_dev *dev, |
341 | int pin, | 341 | int pin, |
342 | int *edge_level, | 342 | int *triggering, |
343 | int *active_high_low, char **link, irq_lookup_func func) | 343 | int *polarity, char **link, irq_lookup_func func) |
344 | { | 344 | { |
345 | struct pci_dev *bridge = dev; | 345 | struct pci_dev *bridge = dev; |
346 | int irq = -1; | 346 | int irq = -1; |
@@ -375,7 +375,7 @@ acpi_pci_irq_derive(struct pci_dev *dev, | |||
375 | } | 375 | } |
376 | 376 | ||
377 | irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn), | 377 | irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn), |
378 | pin, edge_level, active_high_low, | 378 | pin, triggering, polarity, |
379 | link, func); | 379 | link, func); |
380 | } | 380 | } |
381 | 381 | ||
@@ -402,8 +402,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
402 | { | 402 | { |
403 | int irq = 0; | 403 | int irq = 0; |
404 | u8 pin = 0; | 404 | u8 pin = 0; |
405 | int edge_level = ACPI_LEVEL_SENSITIVE; | 405 | int triggering = ACPI_LEVEL_SENSITIVE; |
406 | int active_high_low = ACPI_ACTIVE_LOW; | 406 | int polarity = ACPI_ACTIVE_LOW; |
407 | char *link = NULL; | 407 | char *link = NULL; |
408 | int rc; | 408 | int rc; |
409 | 409 | ||
@@ -432,7 +432,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
432 | * values override any BIOS-assigned IRQs set during boot. | 432 | * values override any BIOS-assigned IRQs set during boot. |
433 | */ | 433 | */ |
434 | irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, | 434 | irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, |
435 | &edge_level, &active_high_low, &link, | 435 | &triggering, &polarity, &link, |
436 | acpi_pci_allocate_irq); | 436 | acpi_pci_allocate_irq); |
437 | 437 | ||
438 | /* | 438 | /* |
@@ -440,8 +440,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
440 | * device's parent bridge. | 440 | * device's parent bridge. |
441 | */ | 441 | */ |
442 | if (irq < 0) | 442 | if (irq < 0) |
443 | irq = acpi_pci_irq_derive(dev, pin, &edge_level, | 443 | irq = acpi_pci_irq_derive(dev, pin, &triggering, |
444 | &active_high_low, &link, | 444 | &polarity, &link, |
445 | acpi_pci_allocate_irq); | 445 | acpi_pci_allocate_irq); |
446 | 446 | ||
447 | /* | 447 | /* |
@@ -463,7 +463,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
463 | } | 463 | } |
464 | } | 464 | } |
465 | 465 | ||
466 | rc = acpi_register_gsi(irq, edge_level, active_high_low); | 466 | rc = acpi_register_gsi(irq, triggering, polarity); |
467 | if (rc < 0) { | 467 | if (rc < 0) { |
468 | printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed " | 468 | printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed " |
469 | "to register GSI\n", pci_name(dev), ('A' + pin)); | 469 | "to register GSI\n", pci_name(dev), ('A' + pin)); |
@@ -478,8 +478,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
478 | printk("Link [%s] -> ", link); | 478 | printk("Link [%s] -> ", link); |
479 | 479 | ||
480 | printk("GSI %u (%s, %s) -> IRQ %d\n", irq, | 480 | printk("GSI %u (%s, %s) -> IRQ %d\n", irq, |
481 | (edge_level == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", | 481 | (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", |
482 | (active_high_low == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); | 482 | (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); |
483 | 483 | ||
484 | return_VALUE(0); | 484 | return_VALUE(0); |
485 | } | 485 | } |
@@ -495,8 +495,8 @@ void acpi_pci_irq_disable(struct pci_dev *dev) | |||
495 | { | 495 | { |
496 | int gsi = 0; | 496 | int gsi = 0; |
497 | u8 pin = 0; | 497 | u8 pin = 0; |
498 | int edge_level = ACPI_LEVEL_SENSITIVE; | 498 | int triggering = ACPI_LEVEL_SENSITIVE; |
499 | int active_high_low = ACPI_ACTIVE_LOW; | 499 | int polarity = ACPI_ACTIVE_LOW; |
500 | 500 | ||
501 | ACPI_FUNCTION_TRACE("acpi_pci_irq_disable"); | 501 | ACPI_FUNCTION_TRACE("acpi_pci_irq_disable"); |
502 | 502 | ||
@@ -512,7 +512,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev) | |||
512 | * First we check the PCI IRQ routing table (PRT) for an IRQ. | 512 | * First we check the PCI IRQ routing table (PRT) for an IRQ. |
513 | */ | 513 | */ |
514 | gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, | 514 | gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, |
515 | &edge_level, &active_high_low, NULL, | 515 | &triggering, &polarity, NULL, |
516 | acpi_pci_free_irq); | 516 | acpi_pci_free_irq); |
517 | /* | 517 | /* |
518 | * If no PRT entry was found, we'll try to derive an IRQ from the | 518 | * If no PRT entry was found, we'll try to derive an IRQ from the |
@@ -520,7 +520,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev) | |||
520 | */ | 520 | */ |
521 | if (gsi < 0) | 521 | if (gsi < 0) |
522 | gsi = acpi_pci_irq_derive(dev, pin, | 522 | gsi = acpi_pci_irq_derive(dev, pin, |
523 | &edge_level, &active_high_low, NULL, | 523 | &triggering, &polarity, NULL, |
524 | acpi_pci_free_irq); | 524 | acpi_pci_free_irq); |
525 | if (gsi < 0) | 525 | if (gsi < 0) |
526 | return_VOID; | 526 | return_VOID; |
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 78927c0f1551..1ffc77115367 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -70,8 +70,8 @@ static struct acpi_driver acpi_pci_link_driver = { | |||
70 | */ | 70 | */ |
71 | struct acpi_pci_link_irq { | 71 | struct acpi_pci_link_irq { |
72 | u8 active; /* Current IRQ */ | 72 | u8 active; /* Current IRQ */ |
73 | u8 edge_level; /* All IRQs */ | 73 | u8 triggering; /* All IRQs */ |
74 | u8 active_high_low; /* All IRQs */ | 74 | u8 polarity; /* All IRQs */ |
75 | u8 resource_type; | 75 | u8 resource_type; |
76 | u8 possible_count; | 76 | u8 possible_count; |
77 | u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; | 77 | u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; |
@@ -108,19 +108,19 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) | |||
108 | 108 | ||
109 | ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible"); | 109 | ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible"); |
110 | 110 | ||
111 | switch (resource->id) { | 111 | switch (resource->type) { |
112 | case ACPI_RSTYPE_START_DPF: | 112 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: |
113 | return_ACPI_STATUS(AE_OK); | 113 | return_ACPI_STATUS(AE_OK); |
114 | case ACPI_RSTYPE_IRQ: | 114 | case ACPI_RESOURCE_TYPE_IRQ: |
115 | { | 115 | { |
116 | struct acpi_resource_irq *p = &resource->data.irq; | 116 | struct acpi_resource_irq *p = &resource->data.irq; |
117 | if (!p || !p->number_of_interrupts) { | 117 | if (!p || !p->interrupt_count) { |
118 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 118 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, |
119 | "Blank IRQ resource\n")); | 119 | "Blank IRQ resource\n")); |
120 | return_ACPI_STATUS(AE_OK); | 120 | return_ACPI_STATUS(AE_OK); |
121 | } | 121 | } |
122 | for (i = 0; | 122 | for (i = 0; |
123 | (i < p->number_of_interrupts | 123 | (i < p->interrupt_count |
124 | && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { | 124 | && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { |
125 | if (!p->interrupts[i]) { | 125 | if (!p->interrupts[i]) { |
126 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 126 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, |
@@ -131,22 +131,22 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) | |||
131 | link->irq.possible[i] = p->interrupts[i]; | 131 | link->irq.possible[i] = p->interrupts[i]; |
132 | link->irq.possible_count++; | 132 | link->irq.possible_count++; |
133 | } | 133 | } |
134 | link->irq.edge_level = p->edge_level; | 134 | link->irq.triggering = p->triggering; |
135 | link->irq.active_high_low = p->active_high_low; | 135 | link->irq.polarity = p->polarity; |
136 | link->irq.resource_type = ACPI_RSTYPE_IRQ; | 136 | link->irq.resource_type = ACPI_RESOURCE_TYPE_IRQ; |
137 | break; | 137 | break; |
138 | } | 138 | } |
139 | case ACPI_RSTYPE_EXT_IRQ: | 139 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
140 | { | 140 | { |
141 | struct acpi_resource_ext_irq *p = | 141 | struct acpi_resource_extended_irq *p = |
142 | &resource->data.extended_irq; | 142 | &resource->data.extended_irq; |
143 | if (!p || !p->number_of_interrupts) { | 143 | if (!p || !p->interrupt_count) { |
144 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 144 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, |
145 | "Blank EXT IRQ resource\n")); | 145 | "Blank EXT IRQ resource\n")); |
146 | return_ACPI_STATUS(AE_OK); | 146 | return_ACPI_STATUS(AE_OK); |
147 | } | 147 | } |
148 | for (i = 0; | 148 | for (i = 0; |
149 | (i < p->number_of_interrupts | 149 | (i < p->interrupt_count |
150 | && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { | 150 | && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { |
151 | if (!p->interrupts[i]) { | 151 | if (!p->interrupts[i]) { |
152 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 152 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, |
@@ -157,9 +157,9 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) | |||
157 | link->irq.possible[i] = p->interrupts[i]; | 157 | link->irq.possible[i] = p->interrupts[i]; |
158 | link->irq.possible_count++; | 158 | link->irq.possible_count++; |
159 | } | 159 | } |
160 | link->irq.edge_level = p->edge_level; | 160 | link->irq.triggering = p->triggering; |
161 | link->irq.active_high_low = p->active_high_low; | 161 | link->irq.polarity = p->polarity; |
162 | link->irq.resource_type = ACPI_RSTYPE_EXT_IRQ; | 162 | link->irq.resource_type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; |
163 | break; | 163 | break; |
164 | } | 164 | } |
165 | default: | 165 | default: |
@@ -201,11 +201,11 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) | |||
201 | 201 | ||
202 | ACPI_FUNCTION_TRACE("acpi_pci_link_check_current"); | 202 | ACPI_FUNCTION_TRACE("acpi_pci_link_check_current"); |
203 | 203 | ||
204 | switch (resource->id) { | 204 | switch (resource->type) { |
205 | case ACPI_RSTYPE_IRQ: | 205 | case ACPI_RESOURCE_TYPE_IRQ: |
206 | { | 206 | { |
207 | struct acpi_resource_irq *p = &resource->data.irq; | 207 | struct acpi_resource_irq *p = &resource->data.irq; |
208 | if (!p || !p->number_of_interrupts) { | 208 | if (!p || !p->interrupt_count) { |
209 | /* | 209 | /* |
210 | * IRQ descriptors may have no IRQ# bits set, | 210 | * IRQ descriptors may have no IRQ# bits set, |
211 | * particularly those those w/ _STA disabled | 211 | * particularly those those w/ _STA disabled |
@@ -217,11 +217,11 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) | |||
217 | *irq = p->interrupts[0]; | 217 | *irq = p->interrupts[0]; |
218 | break; | 218 | break; |
219 | } | 219 | } |
220 | case ACPI_RSTYPE_EXT_IRQ: | 220 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
221 | { | 221 | { |
222 | struct acpi_resource_ext_irq *p = | 222 | struct acpi_resource_extended_irq *p = |
223 | &resource->data.extended_irq; | 223 | &resource->data.extended_irq; |
224 | if (!p || !p->number_of_interrupts) { | 224 | if (!p || !p->interrupt_count) { |
225 | /* | 225 | /* |
226 | * extended IRQ descriptors must | 226 | * extended IRQ descriptors must |
227 | * return at least 1 IRQ | 227 | * return at least 1 IRQ |
@@ -325,36 +325,36 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) | |||
325 | buffer.pointer = resource; | 325 | buffer.pointer = resource; |
326 | 326 | ||
327 | switch (link->irq.resource_type) { | 327 | switch (link->irq.resource_type) { |
328 | case ACPI_RSTYPE_IRQ: | 328 | case ACPI_RESOURCE_TYPE_IRQ: |
329 | resource->res.id = ACPI_RSTYPE_IRQ; | 329 | resource->res.type = ACPI_RESOURCE_TYPE_IRQ; |
330 | resource->res.length = sizeof(struct acpi_resource); | 330 | resource->res.length = sizeof(struct acpi_resource); |
331 | resource->res.data.irq.edge_level = link->irq.edge_level; | 331 | resource->res.data.irq.triggering = link->irq.triggering; |
332 | resource->res.data.irq.active_high_low = | 332 | resource->res.data.irq.polarity = |
333 | link->irq.active_high_low; | 333 | link->irq.polarity; |
334 | if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) | 334 | if (link->irq.triggering == ACPI_EDGE_SENSITIVE) |
335 | resource->res.data.irq.shared_exclusive = | 335 | resource->res.data.irq.sharable = |
336 | ACPI_EXCLUSIVE; | 336 | ACPI_EXCLUSIVE; |
337 | else | 337 | else |
338 | resource->res.data.irq.shared_exclusive = ACPI_SHARED; | 338 | resource->res.data.irq.sharable = ACPI_SHARED; |
339 | resource->res.data.irq.number_of_interrupts = 1; | 339 | resource->res.data.irq.interrupt_count = 1; |
340 | resource->res.data.irq.interrupts[0] = irq; | 340 | resource->res.data.irq.interrupts[0] = irq; |
341 | break; | 341 | break; |
342 | 342 | ||
343 | case ACPI_RSTYPE_EXT_IRQ: | 343 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
344 | resource->res.id = ACPI_RSTYPE_EXT_IRQ; | 344 | resource->res.type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; |
345 | resource->res.length = sizeof(struct acpi_resource); | 345 | resource->res.length = sizeof(struct acpi_resource); |
346 | resource->res.data.extended_irq.producer_consumer = | 346 | resource->res.data.extended_irq.producer_consumer = |
347 | ACPI_CONSUMER; | 347 | ACPI_CONSUMER; |
348 | resource->res.data.extended_irq.edge_level = | 348 | resource->res.data.extended_irq.triggering = |
349 | link->irq.edge_level; | 349 | link->irq.triggering; |
350 | resource->res.data.extended_irq.active_high_low = | 350 | resource->res.data.extended_irq.polarity = |
351 | link->irq.active_high_low; | 351 | link->irq.polarity; |
352 | if (link->irq.edge_level == ACPI_EDGE_SENSITIVE) | 352 | if (link->irq.triggering == ACPI_EDGE_SENSITIVE) |
353 | resource->res.data.irq.shared_exclusive = | 353 | resource->res.data.irq.sharable = |
354 | ACPI_EXCLUSIVE; | 354 | ACPI_EXCLUSIVE; |
355 | else | 355 | else |
356 | resource->res.data.irq.shared_exclusive = ACPI_SHARED; | 356 | resource->res.data.irq.sharable = ACPI_SHARED; |
357 | resource->res.data.extended_irq.number_of_interrupts = 1; | 357 | resource->res.data.extended_irq.interrupt_count = 1; |
358 | resource->res.data.extended_irq.interrupts[0] = irq; | 358 | resource->res.data.extended_irq.interrupts[0] = irq; |
359 | /* ignore resource_source, it's optional */ | 359 | /* ignore resource_source, it's optional */ |
360 | break; | 360 | break; |
@@ -364,7 +364,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) | |||
364 | goto end; | 364 | goto end; |
365 | 365 | ||
366 | } | 366 | } |
367 | resource->end.id = ACPI_RSTYPE_END_TAG; | 367 | resource->end.type = ACPI_RESOURCE_TYPE_END_TAG; |
368 | 368 | ||
369 | /* Attempt to set the resource */ | 369 | /* Attempt to set the resource */ |
370 | status = acpi_set_current_resources(link->handle, &buffer); | 370 | status = acpi_set_current_resources(link->handle, &buffer); |
@@ -613,7 +613,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) | |||
613 | int | 613 | int |
614 | acpi_pci_link_allocate_irq(acpi_handle handle, | 614 | acpi_pci_link_allocate_irq(acpi_handle handle, |
615 | int index, | 615 | int index, |
616 | int *edge_level, int *active_high_low, char **name) | 616 | int *triggering, int *polarity, char **name) |
617 | { | 617 | { |
618 | int result = 0; | 618 | int result = 0; |
619 | struct acpi_device *device = NULL; | 619 | struct acpi_device *device = NULL; |
@@ -653,10 +653,10 @@ acpi_pci_link_allocate_irq(acpi_handle handle, | |||
653 | link->refcnt++; | 653 | link->refcnt++; |
654 | up(&acpi_link_lock); | 654 | up(&acpi_link_lock); |
655 | 655 | ||
656 | if (edge_level) | 656 | if (triggering) |
657 | *edge_level = link->irq.edge_level; | 657 | *triggering = link->irq.triggering; |
658 | if (active_high_low) | 658 | if (polarity) |
659 | *active_high_low = link->irq.active_high_low; | 659 | *polarity = link->irq.polarity; |
660 | if (name) | 660 | if (name) |
661 | *name = acpi_device_bid(link->device); | 661 | *name = acpi_device_bid(link->device); |
662 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 662 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 0fd9988c283d..4c313eab6313 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -122,15 +122,15 @@ get_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) | |||
122 | int *busnr = (int *)data; | 122 | int *busnr = (int *)data; |
123 | struct acpi_resource_address64 address; | 123 | struct acpi_resource_address64 address; |
124 | 124 | ||
125 | if (resource->id != ACPI_RSTYPE_ADDRESS16 && | 125 | if (resource->type != ACPI_RESOURCE_TYPE_ADDRESS16 && |
126 | resource->id != ACPI_RSTYPE_ADDRESS32 && | 126 | resource->type != ACPI_RESOURCE_TYPE_ADDRESS32 && |
127 | resource->id != ACPI_RSTYPE_ADDRESS64) | 127 | resource->type != ACPI_RESOURCE_TYPE_ADDRESS64) |
128 | return AE_OK; | 128 | return AE_OK; |
129 | 129 | ||
130 | acpi_resource_to_address64(resource, &address); | 130 | acpi_resource_to_address64(resource, &address); |
131 | if ((address.address_length > 0) && | 131 | if ((address.address_length > 0) && |
132 | (address.resource_type == ACPI_BUS_NUMBER_RANGE)) | 132 | (address.resource_type == ACPI_BUS_NUMBER_RANGE)) |
133 | *busnr = address.min_address_range; | 133 | *busnr = address.minimum; |
134 | 134 | ||
135 | return AE_OK; | 135 | return AE_OK; |
136 | } | 136 | } |
diff --git a/drivers/acpi/resources/Makefile b/drivers/acpi/resources/Makefile index 2130b74170c3..8de4f69dfa09 100644 --- a/drivers/acpi/resources/Makefile +++ b/drivers/acpi/resources/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for all Linux ACPI interpreter subdirectories | 2 | # Makefile for all Linux ACPI interpreter subdirectories |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := rsaddr.o rscreate.o rsio.o rslist.o rsmisc.o rsxface.o \ | 5 | obj-y := rsaddr.o rscreate.o rsinfo.o rsio.o rslist.o rsmisc.o rsxface.o \ |
6 | rscalc.o rsirq.o rsmemory.o rsutils.o | 6 | rscalc.o rsirq.o rsmemory.o rsutils.o |
7 | 7 | ||
8 | obj-$(ACPI_FUTURE_USAGE) += rsdump.o | 8 | obj-$(ACPI_FUTURE_USAGE) += rsdump.o |
diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c index 23b54baa0cb2..4ac942badbc0 100644 --- a/drivers/acpi/resources/rsaddr.c +++ b/drivers/acpi/resources/rsaddr.c | |||
@@ -47,1072 +47,334 @@ | |||
47 | #define _COMPONENT ACPI_RESOURCES | 47 | #define _COMPONENT ACPI_RESOURCES |
48 | ACPI_MODULE_NAME("rsaddr") | 48 | ACPI_MODULE_NAME("rsaddr") |
49 | 49 | ||
50 | /* Local prototypes */ | ||
51 | static void | ||
52 | acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags); | ||
53 | |||
54 | static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource); | ||
55 | |||
56 | static void | ||
57 | acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags); | ||
58 | |||
59 | static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource); | ||
60 | |||
61 | /******************************************************************************* | 50 | /******************************************************************************* |
62 | * | 51 | * |
63 | * FUNCTION: acpi_rs_decode_general_flags | 52 | * acpi_rs_convert_address16 - All WORD (16-bit) address resources |
64 | * | ||
65 | * PARAMETERS: Resource - Address resource data struct | ||
66 | * Flags - Actual flag byte | ||
67 | * | ||
68 | * RETURN: Decoded flag bits in resource struct | ||
69 | * | ||
70 | * DESCRIPTION: Decode a general flag byte to an address resource struct | ||
71 | * | 53 | * |
72 | ******************************************************************************/ | 54 | ******************************************************************************/ |
55 | struct acpi_rsconvert_info acpi_rs_convert_address16[5] = { | ||
56 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS16, | ||
57 | ACPI_RS_SIZE(struct acpi_resource_address16), | ||
58 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_address16)}, | ||
73 | 59 | ||
74 | static void | 60 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS16, |
75 | acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags) | 61 | sizeof(struct aml_resource_address16), |
76 | { | 62 | 0}, |
77 | ACPI_FUNCTION_ENTRY(); | ||
78 | |||
79 | /* Producer / Consumer - flag bit[0] */ | ||
80 | |||
81 | resource->address.producer_consumer = (u32) (flags & 0x01); | ||
82 | 63 | ||
83 | /* Decode (_DEC) - flag bit[1] */ | 64 | /* Resource Type, General Flags, and Type-Specific Flags */ |
84 | 65 | ||
85 | resource->address.decode = (u32) ((flags >> 1) & 0x01); | 66 | {ACPI_RSC_ADDRESS, 0, 0, 0}, |
86 | 67 | ||
87 | /* Min Address Fixed (_MIF) - flag bit[2] */ | 68 | /* |
69 | * These fields are contiguous in both the source and destination: | ||
70 | * Address Granularity | ||
71 | * Address Range Minimum | ||
72 | * Address Range Maximum | ||
73 | * Address Translation Offset | ||
74 | * Address Length | ||
75 | */ | ||
76 | {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.address16.granularity), | ||
77 | AML_OFFSET(address16.granularity), | ||
78 | 5}, | ||
88 | 79 | ||
89 | resource->address.min_address_fixed = (u32) ((flags >> 2) & 0x01); | 80 | /* Optional resource_source (Index and String) */ |
90 | 81 | ||
91 | /* Max Address Fixed (_MAF) - flag bit[3] */ | 82 | {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address16.resource_source), |
92 | 83 | 0, | |
93 | resource->address.max_address_fixed = (u32) ((flags >> 3) & 0x01); | 84 | sizeof(struct aml_resource_address16)} |
94 | } | 85 | }; |
95 | 86 | ||
96 | /******************************************************************************* | 87 | /******************************************************************************* |
97 | * | 88 | * |
98 | * FUNCTION: acpi_rs_encode_general_flags | 89 | * acpi_rs_convert_address32 - All DWORD (32-bit) address resources |
99 | * | ||
100 | * PARAMETERS: Resource - Address resource data struct | ||
101 | * | ||
102 | * RETURN: Encoded general flag byte | ||
103 | * | ||
104 | * DESCRIPTION: Construct a general flag byte from an address resource struct | ||
105 | * | 90 | * |
106 | ******************************************************************************/ | 91 | ******************************************************************************/ |
107 | 92 | ||
108 | static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource) | 93 | struct acpi_rsconvert_info acpi_rs_convert_address32[5] = { |
109 | { | 94 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS32, |
110 | u8 flags; | 95 | ACPI_RS_SIZE(struct acpi_resource_address32), |
111 | 96 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_address32)}, | |
112 | ACPI_FUNCTION_ENTRY(); | ||
113 | |||
114 | /* Producer / Consumer - flag bit[0] */ | ||
115 | |||
116 | flags = (u8) (resource->address.producer_consumer & 0x01); | ||
117 | |||
118 | /* Decode (_DEC) - flag bit[1] */ | ||
119 | |||
120 | flags |= (u8) ((resource->address.decode & 0x01) << 1); | ||
121 | |||
122 | /* Min Address Fixed (_MIF) - flag bit[2] */ | ||
123 | |||
124 | flags |= (u8) ((resource->address.min_address_fixed & 0x01) << 2); | ||
125 | 97 | ||
126 | /* Max Address Fixed (_MAF) - flag bit[3] */ | 98 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS32, |
99 | sizeof(struct aml_resource_address32), | ||
100 | 0}, | ||
127 | 101 | ||
128 | flags |= (u8) ((resource->address.max_address_fixed & 0x01) << 3); | 102 | /* Resource Type, General Flags, and Type-Specific Flags */ |
129 | 103 | ||
130 | return (flags); | 104 | {ACPI_RSC_ADDRESS, 0, 0, 0}, |
131 | } | ||
132 | |||
133 | /******************************************************************************* | ||
134 | * | ||
135 | * FUNCTION: acpi_rs_decode_specific_flags | ||
136 | * | ||
137 | * PARAMETERS: Resource - Address resource data struct | ||
138 | * Flags - Actual flag byte | ||
139 | * | ||
140 | * RETURN: Decoded flag bits in attribute struct | ||
141 | * | ||
142 | * DESCRIPTION: Decode a type-specific flag byte to an attribute struct. | ||
143 | * Type-specific flags are only defined for the Memory and IO | ||
144 | * resource types. | ||
145 | * | ||
146 | ******************************************************************************/ | ||
147 | 105 | ||
148 | static void | 106 | /* |
149 | acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags) | 107 | * These fields are contiguous in both the source and destination: |
150 | { | 108 | * Address Granularity |
151 | ACPI_FUNCTION_ENTRY(); | 109 | * Address Range Minimum |
152 | 110 | * Address Range Maximum | |
153 | if (resource->address.resource_type == ACPI_MEMORY_RANGE) { | 111 | * Address Translation Offset |
154 | /* Write Status (_RW) - flag bit[0] */ | 112 | * Address Length |
155 | 113 | */ | |
156 | resource->address.attribute.memory.read_write_attribute = | 114 | {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.address32.granularity), |
157 | (u16) (flags & 0x01); | 115 | AML_OFFSET(address32.granularity), |
158 | 116 | 5}, | |
159 | /* Memory Attributes (_MEM) - flag bits[2:1] */ | ||
160 | |||
161 | resource->address.attribute.memory.cache_attribute = | ||
162 | (u16) ((flags >> 1) & 0x03); | ||
163 | } else if (resource->address.resource_type == ACPI_IO_RANGE) { | ||
164 | /* Ranges (_RNG) - flag bits[1:0] */ | ||
165 | |||
166 | resource->address.attribute.io.range_attribute = | ||
167 | (u16) (flags & 0x03); | ||
168 | 117 | ||
169 | /* Translations (_TTP and _TRS) - flag bits[5:4] */ | 118 | /* Optional resource_source (Index and String) */ |
170 | 119 | ||
171 | resource->address.attribute.io.translation_attribute = | 120 | {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address32.resource_source), |
172 | (u16) ((flags >> 4) & 0x03); | 121 | 0, |
173 | } | 122 | sizeof(struct aml_resource_address32)} |
174 | } | 123 | }; |
175 | 124 | ||
176 | /******************************************************************************* | 125 | /******************************************************************************* |
177 | * | 126 | * |
178 | * FUNCTION: acpi_rs_encode_specific_flags | 127 | * acpi_rs_convert_address64 - All QWORD (64-bit) address resources |
179 | * | ||
180 | * PARAMETERS: Resource - Address resource data struct | ||
181 | * | ||
182 | * RETURN: Encoded type-specific flag byte | ||
183 | * | ||
184 | * DESCRIPTION: Construct a type-specific flag byte from an attribute struct. | ||
185 | * Type-specific flags are only defined for the Memory and IO | ||
186 | * resource types. | ||
187 | * | 128 | * |
188 | ******************************************************************************/ | 129 | ******************************************************************************/ |
189 | 130 | ||
190 | static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource) | 131 | struct acpi_rsconvert_info acpi_rs_convert_address64[5] = { |
191 | { | 132 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS64, |
192 | u8 flags = 0; | 133 | ACPI_RS_SIZE(struct acpi_resource_address64), |
193 | 134 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_address64)}, | |
194 | ACPI_FUNCTION_ENTRY(); | ||
195 | |||
196 | if (resource->address.resource_type == ACPI_MEMORY_RANGE) { | ||
197 | /* Write Status (_RW) - flag bit[0] */ | ||
198 | 135 | ||
199 | flags = (u8) | 136 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS64, |
200 | (resource->address.attribute.memory. | 137 | sizeof(struct aml_resource_address64), |
201 | read_write_attribute & 0x01); | 138 | 0}, |
202 | 139 | ||
203 | /* Memory Attributes (_MEM) - flag bits[2:1] */ | 140 | /* Resource Type, General Flags, and Type-Specific Flags */ |
204 | 141 | ||
205 | flags |= (u8) | 142 | {ACPI_RSC_ADDRESS, 0, 0, 0}, |
206 | ((resource->address.attribute.memory. | ||
207 | cache_attribute & 0x03) << 1); | ||
208 | } else if (resource->address.resource_type == ACPI_IO_RANGE) { | ||
209 | /* Ranges (_RNG) - flag bits[1:0] */ | ||
210 | 143 | ||
211 | flags = (u8) | 144 | /* |
212 | (resource->address.attribute.io.range_attribute & 0x03); | 145 | * These fields are contiguous in both the source and destination: |
146 | * Address Granularity | ||
147 | * Address Range Minimum | ||
148 | * Address Range Maximum | ||
149 | * Address Translation Offset | ||
150 | * Address Length | ||
151 | */ | ||
152 | {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.address64.granularity), | ||
153 | AML_OFFSET(address64.granularity), | ||
154 | 5}, | ||
213 | 155 | ||
214 | /* Translations (_TTP and _TRS) - flag bits[5:4] */ | 156 | /* Optional resource_source (Index and String) */ |
215 | 157 | ||
216 | flags |= (u8) | 158 | {ACPI_RSC_SOURCE, ACPI_RS_OFFSET(data.address64.resource_source), |
217 | ((resource->address.attribute.io. | 159 | 0, |
218 | translation_attribute & 0x03) << 4); | 160 | sizeof(struct aml_resource_address64)} |
219 | } | 161 | }; |
220 | |||
221 | return (flags); | ||
222 | } | ||
223 | 162 | ||
224 | /******************************************************************************* | 163 | /******************************************************************************* |
225 | * | 164 | * |
226 | * FUNCTION: acpi_rs_address16_resource | 165 | * acpi_rs_convert_ext_address64 - All Extended (64-bit) address resources |
227 | * | ||
228 | * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte | ||
229 | * stream | ||
230 | * bytes_consumed - Pointer to where the number of bytes | ||
231 | * consumed the byte_stream_buffer is | ||
232 | * returned | ||
233 | * output_buffer - Pointer to the return data buffer | ||
234 | * structure_size - Pointer to where the number of bytes | ||
235 | * in the return data struct is returned | ||
236 | * | ||
237 | * RETURN: Status | ||
238 | * | ||
239 | * DESCRIPTION: Take the resource byte stream and fill out the appropriate | ||
240 | * structure pointed to by the output_buffer. Return the | ||
241 | * number of bytes consumed from the byte stream. | ||
242 | * | 166 | * |
243 | ******************************************************************************/ | 167 | ******************************************************************************/ |
244 | 168 | ||
245 | acpi_status | 169 | struct acpi_rsconvert_info acpi_rs_convert_ext_address64[5] = { |
246 | acpi_rs_address16_resource(u8 * byte_stream_buffer, | 170 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, |
247 | acpi_size * bytes_consumed, | 171 | ACPI_RS_SIZE(struct acpi_resource_extended_address64), |
248 | u8 ** output_buffer, acpi_size * structure_size) | 172 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_ext_address64)}, |
249 | { | ||
250 | u32 index; | ||
251 | u16 temp16; | ||
252 | u8 temp8; | ||
253 | u8 *temp_ptr; | ||
254 | u8 *buffer = byte_stream_buffer; | ||
255 | struct acpi_resource *output_struct = (void *)*output_buffer; | ||
256 | acpi_size struct_size = | ||
257 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16); | ||
258 | |||
259 | ACPI_FUNCTION_TRACE("rs_address16_resource"); | ||
260 | |||
261 | /* Get the Descriptor Length field */ | ||
262 | |||
263 | buffer += 1; | ||
264 | ACPI_MOVE_16_TO_16(&temp16, buffer); | ||
265 | |||
266 | /* Validate minimum descriptor length */ | ||
267 | |||
268 | if (temp16 < 13) { | ||
269 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); | ||
270 | } | ||
271 | |||
272 | *bytes_consumed = temp16 + 3; | ||
273 | output_struct->id = ACPI_RSTYPE_ADDRESS16; | ||
274 | |||
275 | /* Get the Resource Type (Byte3) */ | ||
276 | 173 | ||
277 | buffer += 2; | 174 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64, |
278 | temp8 = *buffer; | 175 | sizeof(struct aml_resource_extended_address64), |
176 | 0}, | ||
279 | 177 | ||
280 | /* Values 0-2 and 0xC0-0xFF are valid */ | 178 | /* Resource Type, General Flags, and Type-Specific Flags */ |
281 | 179 | ||
282 | if ((temp8 > 2) && (temp8 < 0xC0)) { | 180 | {ACPI_RSC_ADDRESS, 0, 0, 0}, |
283 | return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); | ||
284 | } | ||
285 | |||
286 | output_struct->data.address16.resource_type = temp8; | ||
287 | |||
288 | /* Get the General Flags (Byte4) */ | ||
289 | |||
290 | buffer += 1; | ||
291 | acpi_rs_decode_general_flags(&output_struct->data, *buffer); | ||
292 | |||
293 | /* Get the Type Specific Flags (Byte5) */ | ||
294 | |||
295 | buffer += 1; | ||
296 | acpi_rs_decode_specific_flags(&output_struct->data, *buffer); | ||
297 | |||
298 | /* Get Granularity (Bytes 6-7) */ | ||
299 | |||
300 | buffer += 1; | ||
301 | ACPI_MOVE_16_TO_32(&output_struct->data.address16.granularity, buffer); | ||
302 | |||
303 | /* Get min_address_range (Bytes 8-9) */ | ||
304 | 181 | ||
305 | buffer += 2; | 182 | /* Revision ID */ |
306 | ACPI_MOVE_16_TO_32(&output_struct->data.address16.min_address_range, | ||
307 | buffer); | ||
308 | |||
309 | /* Get max_address_range (Bytes 10-11) */ | ||
310 | |||
311 | buffer += 2; | ||
312 | ACPI_MOVE_16_TO_32(&output_struct->data.address16.max_address_range, | ||
313 | buffer); | ||
314 | |||
315 | /* Get address_translation_offset (Bytes 12-13) */ | ||
316 | |||
317 | buffer += 2; | ||
318 | ACPI_MOVE_16_TO_32(&output_struct->data.address16. | ||
319 | address_translation_offset, buffer); | ||
320 | |||
321 | /* Get address_length (Bytes 14-15) */ | ||
322 | |||
323 | buffer += 2; | ||
324 | ACPI_MOVE_16_TO_32(&output_struct->data.address16.address_length, | ||
325 | buffer); | ||
326 | |||
327 | /* Resource Source Index (if present) */ | ||
328 | |||
329 | buffer += 2; | ||
330 | 183 | ||
184 | {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.ext_address64.revision_iD), | ||
185 | AML_OFFSET(ext_address64.revision_iD), | ||
186 | 1}, | ||
331 | /* | 187 | /* |
332 | * This will leave us pointing to the Resource Source Index | 188 | * These fields are contiguous in both the source and destination: |
333 | * If it is present, then save it off and calculate the | 189 | * Address Granularity |
334 | * pointer to where the null terminated string goes: | 190 | * Address Range Minimum |
335 | * Each Interrupt takes 32-bits + the 5 bytes of the | 191 | * Address Range Maximum |
336 | * stream that are default. | 192 | * Address Translation Offset |
337 | * | 193 | * Address Length |
338 | * Note: Some resource descriptors will have an additional null, so | 194 | * Type-Specific Attribute |
339 | * we add 1 to the length. | ||
340 | */ | 195 | */ |
341 | if (*bytes_consumed > (16 + 1)) { | 196 | {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.ext_address64.granularity), |
342 | /* Dereference the Index */ | 197 | AML_OFFSET(ext_address64.granularity), |
343 | 198 | 6} | |
344 | output_struct->data.address16.resource_source.index = | 199 | }; |
345 | (u32) * buffer; | ||
346 | |||
347 | /* Point to the String */ | ||
348 | |||
349 | buffer += 1; | ||
350 | |||
351 | /* Point the String pointer to the end of this structure */ | ||
352 | |||
353 | output_struct->data.address16.resource_source.string_ptr = | ||
354 | (char *)((u8 *) output_struct + struct_size); | ||
355 | |||
356 | temp_ptr = (u8 *) | ||
357 | output_struct->data.address16.resource_source.string_ptr; | ||
358 | |||
359 | /* Copy the resource_source string into the buffer */ | ||
360 | |||
361 | index = 0; | ||
362 | while (*buffer) { | ||
363 | *temp_ptr = *buffer; | ||
364 | |||
365 | temp_ptr++; | ||
366 | buffer++; | ||
367 | index++; | ||
368 | } | ||
369 | |||
370 | /* Add the terminating null and set the string length */ | ||
371 | |||
372 | *temp_ptr = 0; | ||
373 | output_struct->data.address16.resource_source.string_length = | ||
374 | index + 1; | ||
375 | |||
376 | /* | ||
377 | * In order for the struct_size to fall on a 32-bit boundary, | ||
378 | * calculate the length of the string and expand the | ||
379 | * struct_size to the next 32-bit boundary. | ||
380 | */ | ||
381 | temp8 = (u8) (index + 1); | ||
382 | struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); | ||
383 | } else { | ||
384 | output_struct->data.address16.resource_source.index = 0; | ||
385 | output_struct->data.address16.resource_source.string_length = 0; | ||
386 | output_struct->data.address16.resource_source.string_ptr = NULL; | ||
387 | } | ||
388 | |||
389 | /* Set the Length parameter */ | ||
390 | |||
391 | output_struct->length = (u32) struct_size; | ||
392 | |||
393 | /* Return the final size of the structure */ | ||
394 | |||
395 | *structure_size = struct_size; | ||
396 | return_ACPI_STATUS(AE_OK); | ||
397 | } | ||
398 | 200 | ||
399 | /******************************************************************************* | 201 | /******************************************************************************* |
400 | * | 202 | * |
401 | * FUNCTION: acpi_rs_address16_stream | 203 | * acpi_rs_convert_general_flags - Flags common to all address descriptors |
402 | * | ||
403 | * PARAMETERS: linked_list - Pointer to the resource linked list | ||
404 | * output_buffer - Pointer to the user's return buffer | ||
405 | * bytes_consumed - Pointer to where the number of bytes | ||
406 | * used in the output_buffer is returned | ||
407 | * | ||
408 | * RETURN: Status | ||
409 | * | ||
410 | * DESCRIPTION: Take the linked list resource structure and fills in the | ||
411 | * the appropriate bytes in a byte stream | ||
412 | * | 204 | * |
413 | ******************************************************************************/ | 205 | ******************************************************************************/ |
414 | 206 | ||
415 | acpi_status | 207 | static struct acpi_rsconvert_info acpi_rs_convert_general_flags[6] = { |
416 | acpi_rs_address16_stream(struct acpi_resource *linked_list, | 208 | {ACPI_RSC_FLAGINIT, 0, AML_OFFSET(address.flags), |
417 | u8 ** output_buffer, acpi_size * bytes_consumed) | 209 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_general_flags)}, |
418 | { | ||
419 | u8 *buffer = *output_buffer; | ||
420 | u8 *length_field; | ||
421 | acpi_size actual_bytes; | ||
422 | |||
423 | ACPI_FUNCTION_TRACE("rs_address16_stream"); | ||
424 | |||
425 | /* Set the Descriptor Type field */ | ||
426 | |||
427 | *buffer = ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE; | ||
428 | buffer += 1; | ||
429 | |||
430 | /* Save a pointer to the Length field - to be filled in later */ | ||
431 | |||
432 | length_field = buffer; | ||
433 | buffer += 2; | ||
434 | |||
435 | /* Set the Resource Type (Memory, Io, bus_number) */ | ||
436 | |||
437 | *buffer = (u8) (linked_list->data.address16.resource_type & 0x03); | ||
438 | buffer += 1; | ||
439 | |||
440 | /* Set the general flags */ | ||
441 | |||
442 | *buffer = acpi_rs_encode_general_flags(&linked_list->data); | ||
443 | buffer += 1; | ||
444 | |||
445 | /* Set the type specific flags */ | ||
446 | |||
447 | *buffer = acpi_rs_encode_specific_flags(&linked_list->data); | ||
448 | buffer += 1; | ||
449 | |||
450 | /* Set the address space granularity */ | ||
451 | |||
452 | ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.granularity); | ||
453 | buffer += 2; | ||
454 | |||
455 | /* Set the address range minimum */ | ||
456 | 210 | ||
457 | ACPI_MOVE_32_TO_16(buffer, | 211 | /* Resource Type (Memory, Io, bus_number, etc.) */ |
458 | &linked_list->data.address16.min_address_range); | ||
459 | buffer += 2; | ||
460 | 212 | ||
461 | /* Set the address range maximum */ | 213 | {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.address.resource_type), |
214 | AML_OFFSET(address.resource_type), | ||
215 | 1}, | ||
462 | 216 | ||
463 | ACPI_MOVE_32_TO_16(buffer, | 217 | /* General Flags - Consume, Decode, min_fixed, max_fixed */ |
464 | &linked_list->data.address16.max_address_range); | ||
465 | buffer += 2; | ||
466 | 218 | ||
467 | /* Set the address translation offset */ | 219 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.producer_consumer), |
220 | AML_OFFSET(address.flags), | ||
221 | 0}, | ||
468 | 222 | ||
469 | ACPI_MOVE_32_TO_16(buffer, | 223 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.decode), |
470 | &linked_list->data.address16. | 224 | AML_OFFSET(address.flags), |
471 | address_translation_offset); | 225 | 1}, |
472 | buffer += 2; | ||
473 | 226 | ||
474 | /* Set the address length */ | 227 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.min_address_fixed), |
228 | AML_OFFSET(address.flags), | ||
229 | 2}, | ||
475 | 230 | ||
476 | ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.address_length); | 231 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.max_address_fixed), |
477 | buffer += 2; | 232 | AML_OFFSET(address.flags), |
478 | 233 | 3} | |
479 | /* Resource Source Index and Resource Source are optional */ | 234 | }; |
480 | |||
481 | if (linked_list->data.address16.resource_source.string_length) { | ||
482 | *buffer = | ||
483 | (u8) linked_list->data.address16.resource_source.index; | ||
484 | buffer += 1; | ||
485 | |||
486 | /* Copy the resource_source string */ | ||
487 | |||
488 | ACPI_STRCPY((char *)buffer, | ||
489 | linked_list->data.address16.resource_source. | ||
490 | string_ptr); | ||
491 | |||
492 | /* | ||
493 | * Buffer needs to be set to the length of the string + one for the | ||
494 | * terminating null | ||
495 | */ | ||
496 | buffer += | ||
497 | (acpi_size) (ACPI_STRLEN | ||
498 | (linked_list->data.address16.resource_source. | ||
499 | string_ptr) + 1); | ||
500 | } | ||
501 | |||
502 | /* Return the number of bytes consumed in this operation */ | ||
503 | |||
504 | actual_bytes = ACPI_PTR_DIFF(buffer, *output_buffer); | ||
505 | *bytes_consumed = actual_bytes; | ||
506 | |||
507 | /* | ||
508 | * Set the length field to the number of bytes consumed | ||
509 | * minus the header size (3 bytes) | ||
510 | */ | ||
511 | actual_bytes -= 3; | ||
512 | ACPI_MOVE_SIZE_TO_16(length_field, &actual_bytes); | ||
513 | return_ACPI_STATUS(AE_OK); | ||
514 | } | ||
515 | 235 | ||
516 | /******************************************************************************* | 236 | /******************************************************************************* |
517 | * | 237 | * |
518 | * FUNCTION: acpi_rs_address32_resource | 238 | * acpi_rs_convert_mem_flags - Flags common to Memory address descriptors |
519 | * | ||
520 | * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte | ||
521 | * stream | ||
522 | * bytes_consumed - Pointer to where the number of bytes | ||
523 | * consumed the byte_stream_buffer is | ||
524 | * returned | ||
525 | * output_buffer - Pointer to the return data buffer | ||
526 | * structure_size - Pointer to where the number of bytes | ||
527 | * in the return data struct is returned | ||
528 | * | ||
529 | * RETURN: Status | ||
530 | * | ||
531 | * DESCRIPTION: Take the resource byte stream and fill out the appropriate | ||
532 | * structure pointed to by the output_buffer. Return the | ||
533 | * number of bytes consumed from the byte stream. | ||
534 | * | 239 | * |
535 | ******************************************************************************/ | 240 | ******************************************************************************/ |
536 | 241 | ||
537 | acpi_status | 242 | static struct acpi_rsconvert_info acpi_rs_convert_mem_flags[5] = { |
538 | acpi_rs_address32_resource(u8 * byte_stream_buffer, | 243 | {ACPI_RSC_FLAGINIT, 0, AML_OFFSET(address.specific_flags), |
539 | acpi_size * bytes_consumed, | 244 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_mem_flags)}, |
540 | u8 ** output_buffer, acpi_size * structure_size) | ||
541 | { | ||
542 | u16 temp16; | ||
543 | u8 temp8; | ||
544 | u8 *temp_ptr; | ||
545 | u32 index; | ||
546 | u8 *buffer = byte_stream_buffer; | ||
547 | struct acpi_resource *output_struct = (void *)*output_buffer; | ||
548 | acpi_size struct_size = | ||
549 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32); | ||
550 | 245 | ||
551 | ACPI_FUNCTION_TRACE("rs_address32_resource"); | 246 | /* Memory-specific flags */ |
552 | 247 | ||
553 | /* Get the Descriptor Length field */ | 248 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.write_protect), |
249 | AML_OFFSET(address.specific_flags), | ||
250 | 0}, | ||
554 | 251 | ||
555 | buffer += 1; | 252 | {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.caching), |
556 | ACPI_MOVE_16_TO_16(&temp16, buffer); | 253 | AML_OFFSET(address.specific_flags), |
254 | 1}, | ||
557 | 255 | ||
558 | /* Validate minimum descriptor length */ | 256 | {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.range_type), |
257 | AML_OFFSET(address.specific_flags), | ||
258 | 3}, | ||
559 | 259 | ||
560 | if (temp16 < 23) { | 260 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.mem.translation), |
561 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); | 261 | AML_OFFSET(address.specific_flags), |
562 | } | 262 | 5} |
563 | 263 | }; | |
564 | *bytes_consumed = temp16 + 3; | ||
565 | output_struct->id = ACPI_RSTYPE_ADDRESS32; | ||
566 | |||
567 | /* Get the Resource Type (Byte3) */ | ||
568 | |||
569 | buffer += 2; | ||
570 | temp8 = *buffer; | ||
571 | |||
572 | /* Values 0-2 and 0xC0-0xFF are valid */ | ||
573 | |||
574 | if ((temp8 > 2) && (temp8 < 0xC0)) { | ||
575 | return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); | ||
576 | } | ||
577 | |||
578 | output_struct->data.address32.resource_type = temp8; | ||
579 | |||
580 | /* Get the General Flags (Byte4) */ | ||
581 | |||
582 | buffer += 1; | ||
583 | acpi_rs_decode_general_flags(&output_struct->data, *buffer); | ||
584 | |||
585 | /* Get the Type Specific Flags (Byte5) */ | ||
586 | |||
587 | buffer += 1; | ||
588 | acpi_rs_decode_specific_flags(&output_struct->data, *buffer); | ||
589 | |||
590 | /* Get Granularity (Bytes 6-9) */ | ||
591 | |||
592 | buffer += 1; | ||
593 | ACPI_MOVE_32_TO_32(&output_struct->data.address32.granularity, buffer); | ||
594 | |||
595 | /* Get min_address_range (Bytes 10-13) */ | ||
596 | |||
597 | buffer += 4; | ||
598 | ACPI_MOVE_32_TO_32(&output_struct->data.address32.min_address_range, | ||
599 | buffer); | ||
600 | |||
601 | /* Get max_address_range (Bytes 14-17) */ | ||
602 | |||
603 | buffer += 4; | ||
604 | ACPI_MOVE_32_TO_32(&output_struct->data.address32.max_address_range, | ||
605 | buffer); | ||
606 | |||
607 | /* Get address_translation_offset (Bytes 18-21) */ | ||
608 | |||
609 | buffer += 4; | ||
610 | ACPI_MOVE_32_TO_32(&output_struct->data.address32. | ||
611 | address_translation_offset, buffer); | ||
612 | |||
613 | /* Get address_length (Bytes 22-25) */ | ||
614 | |||
615 | buffer += 4; | ||
616 | ACPI_MOVE_32_TO_32(&output_struct->data.address32.address_length, | ||
617 | buffer); | ||
618 | |||
619 | /* Resource Source Index (if present) */ | ||
620 | |||
621 | buffer += 4; | ||
622 | |||
623 | /* | ||
624 | * This will leave us pointing to the Resource Source Index | ||
625 | * If it is present, then save it off and calculate the | ||
626 | * pointer to where the null terminated string goes: | ||
627 | * | ||
628 | * Note: Some resource descriptors will have an additional null, so | ||
629 | * we add 1 to the length. | ||
630 | */ | ||
631 | if (*bytes_consumed > (26 + 1)) { | ||
632 | /* Dereference the Index */ | ||
633 | |||
634 | output_struct->data.address32.resource_source.index = | ||
635 | (u32) * buffer; | ||
636 | |||
637 | /* Point to the String */ | ||
638 | |||
639 | buffer += 1; | ||
640 | |||
641 | /* Point the String pointer to the end of this structure */ | ||
642 | |||
643 | output_struct->data.address32.resource_source.string_ptr = | ||
644 | (char *)((u8 *) output_struct + struct_size); | ||
645 | |||
646 | temp_ptr = (u8 *) | ||
647 | output_struct->data.address32.resource_source.string_ptr; | ||
648 | |||
649 | /* Copy the resource_source string into the buffer */ | ||
650 | |||
651 | index = 0; | ||
652 | while (*buffer) { | ||
653 | *temp_ptr = *buffer; | ||
654 | |||
655 | temp_ptr++; | ||
656 | buffer++; | ||
657 | index++; | ||
658 | } | ||
659 | |||
660 | /* Add the terminating null and set the string length */ | ||
661 | |||
662 | *temp_ptr = 0; | ||
663 | output_struct->data.address32.resource_source.string_length = | ||
664 | index + 1; | ||
665 | |||
666 | /* | ||
667 | * In order for the struct_size to fall on a 32-bit boundary, | ||
668 | * calculate the length of the string and expand the | ||
669 | * struct_size to the next 32-bit boundary. | ||
670 | */ | ||
671 | temp8 = (u8) (index + 1); | ||
672 | struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); | ||
673 | } else { | ||
674 | output_struct->data.address32.resource_source.index = 0; | ||
675 | output_struct->data.address32.resource_source.string_length = 0; | ||
676 | output_struct->data.address32.resource_source.string_ptr = NULL; | ||
677 | } | ||
678 | |||
679 | /* Set the Length parameter */ | ||
680 | |||
681 | output_struct->length = (u32) struct_size; | ||
682 | |||
683 | /* Return the final size of the structure */ | ||
684 | |||
685 | *structure_size = struct_size; | ||
686 | return_ACPI_STATUS(AE_OK); | ||
687 | } | ||
688 | 264 | ||
689 | /******************************************************************************* | 265 | /******************************************************************************* |
690 | * | 266 | * |
691 | * FUNCTION: acpi_rs_address32_stream | 267 | * acpi_rs_convert_io_flags - Flags common to I/O address descriptors |
692 | * | ||
693 | * PARAMETERS: linked_list - Pointer to the resource linked list | ||
694 | * output_buffer - Pointer to the user's return buffer | ||
695 | * bytes_consumed - Pointer to where the number of bytes | ||
696 | * used in the output_buffer is returned | ||
697 | * | ||
698 | * RETURN: Status | ||
699 | * | ||
700 | * DESCRIPTION: Take the linked list resource structure and fills in the | ||
701 | * the appropriate bytes in a byte stream | ||
702 | * | 268 | * |
703 | ******************************************************************************/ | 269 | ******************************************************************************/ |
704 | 270 | ||
705 | acpi_status | 271 | static struct acpi_rsconvert_info acpi_rs_convert_io_flags[4] = { |
706 | acpi_rs_address32_stream(struct acpi_resource *linked_list, | 272 | {ACPI_RSC_FLAGINIT, 0, AML_OFFSET(address.specific_flags), |
707 | u8 ** output_buffer, acpi_size * bytes_consumed) | 273 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_io_flags)}, |
708 | { | ||
709 | u8 *buffer; | ||
710 | u16 *length_field; | ||
711 | |||
712 | ACPI_FUNCTION_TRACE("rs_address32_stream"); | ||
713 | |||
714 | buffer = *output_buffer; | ||
715 | |||
716 | /* Set the Descriptor Type field */ | ||
717 | |||
718 | *buffer = ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE; | ||
719 | buffer += 1; | ||
720 | |||
721 | /* Save a pointer to the Length field - to be filled in later */ | ||
722 | |||
723 | length_field = ACPI_CAST_PTR(u16, buffer); | ||
724 | buffer += 2; | ||
725 | |||
726 | /* Set the Resource Type (Memory, Io, bus_number) */ | ||
727 | |||
728 | *buffer = (u8) (linked_list->data.address32.resource_type & 0x03); | ||
729 | buffer += 1; | ||
730 | |||
731 | /* Set the general flags */ | ||
732 | |||
733 | *buffer = acpi_rs_encode_general_flags(&linked_list->data); | ||
734 | buffer += 1; | ||
735 | |||
736 | /* Set the type specific flags */ | ||
737 | |||
738 | *buffer = acpi_rs_encode_specific_flags(&linked_list->data); | ||
739 | buffer += 1; | ||
740 | |||
741 | /* Set the address space granularity */ | ||
742 | |||
743 | ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.granularity); | ||
744 | buffer += 4; | ||
745 | |||
746 | /* Set the address range minimum */ | ||
747 | |||
748 | ACPI_MOVE_32_TO_32(buffer, | ||
749 | &linked_list->data.address32.min_address_range); | ||
750 | buffer += 4; | ||
751 | |||
752 | /* Set the address range maximum */ | ||
753 | |||
754 | ACPI_MOVE_32_TO_32(buffer, | ||
755 | &linked_list->data.address32.max_address_range); | ||
756 | buffer += 4; | ||
757 | |||
758 | /* Set the address translation offset */ | ||
759 | |||
760 | ACPI_MOVE_32_TO_32(buffer, | ||
761 | &linked_list->data.address32. | ||
762 | address_translation_offset); | ||
763 | buffer += 4; | ||
764 | |||
765 | /* Set the address length */ | ||
766 | |||
767 | ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.address_length); | ||
768 | buffer += 4; | ||
769 | 274 | ||
770 | /* Resource Source Index and Resource Source are optional */ | 275 | /* I/O-specific flags */ |
771 | 276 | ||
772 | if (linked_list->data.address32.resource_source.string_length) { | 277 | {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.address.info.io.range_type), |
773 | *buffer = | 278 | AML_OFFSET(address.specific_flags), |
774 | (u8) linked_list->data.address32.resource_source.index; | 279 | 0}, |
775 | buffer += 1; | ||
776 | 280 | ||
777 | /* Copy the resource_source string */ | 281 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.info.io.translation), |
282 | AML_OFFSET(address.specific_flags), | ||
283 | 4}, | ||
778 | 284 | ||
779 | ACPI_STRCPY((char *)buffer, | 285 | {ACPI_RSC_1BITFLAG, |
780 | linked_list->data.address32.resource_source. | 286 | ACPI_RS_OFFSET(data.address.info.io.translation_type), |
781 | string_ptr); | 287 | AML_OFFSET(address.specific_flags), |
782 | 288 | 5} | |
783 | /* | 289 | }; |
784 | * Buffer needs to be set to the length of the string + one for the | ||
785 | * terminating null | ||
786 | */ | ||
787 | buffer += | ||
788 | (acpi_size) (ACPI_STRLEN | ||
789 | (linked_list->data.address32.resource_source. | ||
790 | string_ptr) + 1); | ||
791 | } | ||
792 | |||
793 | /* Return the number of bytes consumed in this operation */ | ||
794 | |||
795 | *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); | ||
796 | |||
797 | /* | ||
798 | * Set the length field to the number of bytes consumed | ||
799 | * minus the header size (3 bytes) | ||
800 | */ | ||
801 | *length_field = (u16) (*bytes_consumed - 3); | ||
802 | return_ACPI_STATUS(AE_OK); | ||
803 | } | ||
804 | 290 | ||
805 | /******************************************************************************* | 291 | /******************************************************************************* |
806 | * | 292 | * |
807 | * FUNCTION: acpi_rs_address64_resource | 293 | * FUNCTION: acpi_rs_get_address_common |
808 | * | 294 | * |
809 | * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte | 295 | * PARAMETERS: Resource - Pointer to the internal resource struct |
810 | * stream | 296 | * Aml - Pointer to the AML resource descriptor |
811 | * bytes_consumed - Pointer to where the number of bytes | ||
812 | * consumed the byte_stream_buffer is | ||
813 | * returned | ||
814 | * output_buffer - Pointer to the return data buffer | ||
815 | * structure_size - Pointer to where the number of bytes | ||
816 | * in the return data struct is returned | ||
817 | * | 297 | * |
818 | * RETURN: Status | 298 | * RETURN: TRUE if the resource_type field is OK, FALSE otherwise |
819 | * | 299 | * |
820 | * DESCRIPTION: Take the resource byte stream and fill out the appropriate | 300 | * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor |
821 | * structure pointed to by the output_buffer. Return the | 301 | * to an internal resource descriptor |
822 | * number of bytes consumed from the byte stream. | ||
823 | * | 302 | * |
824 | ******************************************************************************/ | 303 | ******************************************************************************/ |
825 | 304 | ||
826 | acpi_status | 305 | u8 |
827 | acpi_rs_address64_resource(u8 * byte_stream_buffer, | 306 | acpi_rs_get_address_common(struct acpi_resource *resource, |
828 | acpi_size * bytes_consumed, | 307 | union aml_resource *aml) |
829 | u8 ** output_buffer, acpi_size * structure_size) | ||
830 | { | 308 | { |
831 | u16 temp16; | 309 | ACPI_FUNCTION_ENTRY(); |
832 | u8 temp8; | ||
833 | u8 resource_type; | ||
834 | u8 *temp_ptr; | ||
835 | u32 index; | ||
836 | u8 *buffer = byte_stream_buffer; | ||
837 | struct acpi_resource *output_struct = (void *)*output_buffer; | ||
838 | acpi_size struct_size = | ||
839 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64); | ||
840 | |||
841 | ACPI_FUNCTION_TRACE("rs_address64_resource"); | ||
842 | |||
843 | /* Get the Descriptor Type */ | ||
844 | |||
845 | resource_type = *buffer; | ||
846 | |||
847 | /* Get the Descriptor Length field */ | ||
848 | |||
849 | buffer += 1; | ||
850 | ACPI_MOVE_16_TO_16(&temp16, buffer); | ||
851 | |||
852 | /* Validate minimum descriptor length */ | ||
853 | |||
854 | if (temp16 < 43) { | ||
855 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); | ||
856 | } | ||
857 | |||
858 | *bytes_consumed = temp16 + 3; | ||
859 | output_struct->id = ACPI_RSTYPE_ADDRESS64; | ||
860 | |||
861 | /* Get the Resource Type (Byte3) */ | ||
862 | |||
863 | buffer += 2; | ||
864 | temp8 = *buffer; | ||
865 | |||
866 | /* Values 0-2 and 0xC0-0xFF are valid */ | ||
867 | |||
868 | if ((temp8 > 2) && (temp8 < 0xC0)) { | ||
869 | return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); | ||
870 | } | ||
871 | |||
872 | output_struct->data.address64.resource_type = temp8; | ||
873 | |||
874 | /* Get the General Flags (Byte4) */ | ||
875 | |||
876 | buffer += 1; | ||
877 | acpi_rs_decode_general_flags(&output_struct->data, *buffer); | ||
878 | |||
879 | /* Get the Type Specific Flags (Byte5) */ | ||
880 | |||
881 | buffer += 1; | ||
882 | acpi_rs_decode_specific_flags(&output_struct->data, *buffer); | ||
883 | 310 | ||
884 | if (resource_type == ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE) { | 311 | /* Validate the Resource Type */ |
885 | /* Move past revision_id and Reserved byte */ | ||
886 | 312 | ||
887 | buffer += 2; | 313 | if ((aml->address.resource_type > 2) |
314 | && (aml->address.resource_type < 0xC0)) { | ||
315 | return (FALSE); | ||
888 | } | 316 | } |
889 | 317 | ||
890 | /* Get Granularity (Bytes 6-13) or (Bytes 8-15) */ | 318 | /* Get the Resource Type and General Flags */ |
891 | |||
892 | buffer += 1; | ||
893 | ACPI_MOVE_64_TO_64(&output_struct->data.address64.granularity, buffer); | ||
894 | |||
895 | /* Get min_address_range (Bytes 14-21) or (Bytes 16-23) */ | ||
896 | |||
897 | buffer += 8; | ||
898 | ACPI_MOVE_64_TO_64(&output_struct->data.address64.min_address_range, | ||
899 | buffer); | ||
900 | |||
901 | /* Get max_address_range (Bytes 22-29) or (Bytes 24-31) */ | ||
902 | |||
903 | buffer += 8; | ||
904 | ACPI_MOVE_64_TO_64(&output_struct->data.address64.max_address_range, | ||
905 | buffer); | ||
906 | |||
907 | /* Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) */ | ||
908 | |||
909 | buffer += 8; | ||
910 | ACPI_MOVE_64_TO_64(&output_struct->data.address64. | ||
911 | address_translation_offset, buffer); | ||
912 | 319 | ||
913 | /* Get address_length (Bytes 38-45) or (Bytes 40-47) */ | 320 | (void)acpi_rs_convert_aml_to_resource(resource, aml, |
321 | acpi_rs_convert_general_flags); | ||
914 | 322 | ||
915 | buffer += 8; | 323 | /* Get the Type-Specific Flags (Memory and I/O descriptors only) */ |
916 | ACPI_MOVE_64_TO_64(&output_struct->data.address64.address_length, | ||
917 | buffer); | ||
918 | 324 | ||
919 | output_struct->data.address64.resource_source.index = 0; | 325 | if (resource->data.address.resource_type == ACPI_MEMORY_RANGE) { |
920 | output_struct->data.address64.resource_source.string_length = 0; | 326 | (void)acpi_rs_convert_aml_to_resource(resource, aml, |
921 | output_struct->data.address64.resource_source.string_ptr = NULL; | 327 | acpi_rs_convert_mem_flags); |
922 | 328 | } else if (resource->data.address.resource_type == ACPI_IO_RANGE) { | |
923 | if (resource_type == ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE) { | 329 | (void)acpi_rs_convert_aml_to_resource(resource, aml, |
924 | /* Get type_specific_attribute (Bytes 48-55) */ | 330 | acpi_rs_convert_io_flags); |
925 | |||
926 | buffer += 8; | ||
927 | ACPI_MOVE_64_TO_64(&output_struct->data.address64. | ||
928 | type_specific_attributes, buffer); | ||
929 | } else { | 331 | } else { |
930 | output_struct->data.address64.type_specific_attributes = 0; | 332 | /* Generic resource type, just grab the type_specific byte */ |
931 | |||
932 | /* Resource Source Index (if present) */ | ||
933 | |||
934 | buffer += 8; | ||
935 | |||
936 | /* | ||
937 | * This will leave us pointing to the Resource Source Index | ||
938 | * If it is present, then save it off and calculate the | ||
939 | * pointer to where the null terminated string goes: | ||
940 | * Each Interrupt takes 32-bits + the 5 bytes of the | ||
941 | * stream that are default. | ||
942 | * | ||
943 | * Note: Some resource descriptors will have an additional null, so | ||
944 | * we add 1 to the length. | ||
945 | */ | ||
946 | if (*bytes_consumed > (46 + 1)) { | ||
947 | /* Dereference the Index */ | ||
948 | |||
949 | output_struct->data.address64.resource_source.index = | ||
950 | (u32) * buffer; | ||
951 | |||
952 | /* Point to the String */ | ||
953 | |||
954 | buffer += 1; | ||
955 | |||
956 | /* Point the String pointer to the end of this structure */ | ||
957 | |||
958 | output_struct->data.address64.resource_source. | ||
959 | string_ptr = | ||
960 | (char *)((u8 *) output_struct + struct_size); | ||
961 | |||
962 | temp_ptr = (u8 *) | ||
963 | output_struct->data.address64.resource_source. | ||
964 | string_ptr; | ||
965 | |||
966 | /* Copy the resource_source string into the buffer */ | ||
967 | |||
968 | index = 0; | ||
969 | while (*buffer) { | ||
970 | *temp_ptr = *buffer; | ||
971 | |||
972 | temp_ptr++; | ||
973 | buffer++; | ||
974 | index++; | ||
975 | } | ||
976 | |||
977 | /* | ||
978 | * Add the terminating null and set the string length | ||
979 | */ | ||
980 | *temp_ptr = 0; | ||
981 | output_struct->data.address64.resource_source. | ||
982 | string_length = index + 1; | ||
983 | |||
984 | /* | ||
985 | * In order for the struct_size to fall on a 32-bit boundary, | ||
986 | * calculate the length of the string and expand the | ||
987 | * struct_size to the next 32-bit boundary. | ||
988 | */ | ||
989 | temp8 = (u8) (index + 1); | ||
990 | struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); | ||
991 | } | ||
992 | } | ||
993 | |||
994 | /* Set the Length parameter */ | ||
995 | |||
996 | output_struct->length = (u32) struct_size; | ||
997 | 333 | ||
998 | /* Return the final size of the structure */ | 334 | resource->data.address.info.type_specific = |
335 | aml->address.specific_flags; | ||
336 | } | ||
999 | 337 | ||
1000 | *structure_size = struct_size; | 338 | return (TRUE); |
1001 | return_ACPI_STATUS(AE_OK); | ||
1002 | } | 339 | } |
1003 | 340 | ||
1004 | /******************************************************************************* | 341 | /******************************************************************************* |
1005 | * | 342 | * |
1006 | * FUNCTION: acpi_rs_address64_stream | 343 | * FUNCTION: acpi_rs_set_address_common |
1007 | * | 344 | * |
1008 | * PARAMETERS: linked_list - Pointer to the resource linked list | 345 | * PARAMETERS: Aml - Pointer to the AML resource descriptor |
1009 | * output_buffer - Pointer to the user's return buffer | 346 | * Resource - Pointer to the internal resource struct |
1010 | * bytes_consumed - Pointer to where the number of bytes | ||
1011 | * used in the output_buffer is returned | ||
1012 | * | 347 | * |
1013 | * RETURN: Status | 348 | * RETURN: None |
1014 | * | 349 | * |
1015 | * DESCRIPTION: Take the linked list resource structure and fills in the | 350 | * DESCRIPTION: Convert common flag fields from a resource descriptor to an |
1016 | * the appropriate bytes in a byte stream | 351 | * AML descriptor |
1017 | * | 352 | * |
1018 | ******************************************************************************/ | 353 | ******************************************************************************/ |
1019 | 354 | ||
1020 | acpi_status | 355 | void |
1021 | acpi_rs_address64_stream(struct acpi_resource *linked_list, | 356 | acpi_rs_set_address_common(union aml_resource *aml, |
1022 | u8 ** output_buffer, acpi_size * bytes_consumed) | 357 | struct acpi_resource *resource) |
1023 | { | 358 | { |
1024 | u8 *buffer; | 359 | ACPI_FUNCTION_ENTRY(); |
1025 | u16 *length_field; | ||
1026 | |||
1027 | ACPI_FUNCTION_TRACE("rs_address64_stream"); | ||
1028 | |||
1029 | buffer = *output_buffer; | ||
1030 | |||
1031 | /* Set the Descriptor Type field */ | ||
1032 | |||
1033 | *buffer = ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE; | ||
1034 | buffer += 1; | ||
1035 | |||
1036 | /* Save a pointer to the Length field - to be filled in later */ | ||
1037 | |||
1038 | length_field = ACPI_CAST_PTR(u16, buffer); | ||
1039 | buffer += 2; | ||
1040 | |||
1041 | /* Set the Resource Type (Memory, Io, bus_number) */ | ||
1042 | |||
1043 | *buffer = (u8) (linked_list->data.address64.resource_type & 0x03); | ||
1044 | buffer += 1; | ||
1045 | |||
1046 | /* Set the general flags */ | ||
1047 | |||
1048 | *buffer = acpi_rs_encode_general_flags(&linked_list->data); | ||
1049 | buffer += 1; | ||
1050 | |||
1051 | /* Set the type specific flags */ | ||
1052 | |||
1053 | *buffer = acpi_rs_encode_specific_flags(&linked_list->data); | ||
1054 | buffer += 1; | ||
1055 | |||
1056 | /* Set the address space granularity */ | ||
1057 | |||
1058 | ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.granularity); | ||
1059 | buffer += 8; | ||
1060 | |||
1061 | /* Set the address range minimum */ | ||
1062 | |||
1063 | ACPI_MOVE_64_TO_64(buffer, | ||
1064 | &linked_list->data.address64.min_address_range); | ||
1065 | buffer += 8; | ||
1066 | |||
1067 | /* Set the address range maximum */ | ||
1068 | |||
1069 | ACPI_MOVE_64_TO_64(buffer, | ||
1070 | &linked_list->data.address64.max_address_range); | ||
1071 | buffer += 8; | ||
1072 | |||
1073 | /* Set the address translation offset */ | ||
1074 | |||
1075 | ACPI_MOVE_64_TO_64(buffer, | ||
1076 | &linked_list->data.address64. | ||
1077 | address_translation_offset); | ||
1078 | buffer += 8; | ||
1079 | |||
1080 | /* Set the address length */ | ||
1081 | |||
1082 | ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.address_length); | ||
1083 | buffer += 8; | ||
1084 | 360 | ||
1085 | /* Resource Source Index and Resource Source are optional */ | 361 | /* Set the Resource Type and General Flags */ |
1086 | 362 | ||
1087 | if (linked_list->data.address64.resource_source.string_length) { | 363 | (void)acpi_rs_convert_resource_to_aml(resource, aml, |
1088 | *buffer = | 364 | acpi_rs_convert_general_flags); |
1089 | (u8) linked_list->data.address64.resource_source.index; | ||
1090 | buffer += 1; | ||
1091 | 365 | ||
1092 | /* Copy the resource_source string */ | 366 | /* Set the Type-Specific Flags (Memory and I/O descriptors only) */ |
1093 | 367 | ||
1094 | ACPI_STRCPY((char *)buffer, | 368 | if (resource->data.address.resource_type == ACPI_MEMORY_RANGE) { |
1095 | linked_list->data.address64.resource_source. | 369 | (void)acpi_rs_convert_resource_to_aml(resource, aml, |
1096 | string_ptr); | 370 | acpi_rs_convert_mem_flags); |
371 | } else if (resource->data.address.resource_type == ACPI_IO_RANGE) { | ||
372 | (void)acpi_rs_convert_resource_to_aml(resource, aml, | ||
373 | acpi_rs_convert_io_flags); | ||
374 | } else { | ||
375 | /* Generic resource type, just copy the type_specific byte */ | ||
1097 | 376 | ||
1098 | /* | 377 | aml->address.specific_flags = |
1099 | * Buffer needs to be set to the length of the string + one for the | 378 | resource->data.address.info.type_specific; |
1100 | * terminating null | ||
1101 | */ | ||
1102 | buffer += | ||
1103 | (acpi_size) (ACPI_STRLEN | ||
1104 | (linked_list->data.address64.resource_source. | ||
1105 | string_ptr) + 1); | ||
1106 | } | 379 | } |
1107 | |||
1108 | /* Return the number of bytes consumed in this operation */ | ||
1109 | |||
1110 | *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); | ||
1111 | |||
1112 | /* | ||
1113 | * Set the length field to the number of bytes consumed | ||
1114 | * minus the header size (3 bytes) | ||
1115 | */ | ||
1116 | *length_field = (u16) (*bytes_consumed - 3); | ||
1117 | return_ACPI_STATUS(AE_OK); | ||
1118 | } | 380 | } |
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index 378f58390fc1..c2c4d9079c6c 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c | |||
@@ -49,652 +49,433 @@ | |||
49 | #define _COMPONENT ACPI_RESOURCES | 49 | #define _COMPONENT ACPI_RESOURCES |
50 | ACPI_MODULE_NAME("rscalc") | 50 | ACPI_MODULE_NAME("rscalc") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | static u8 acpi_rs_count_set_bits(u16 bit_field); | ||
54 | |||
55 | static acpi_rs_length | ||
56 | acpi_rs_struct_option_length(struct acpi_resource_source *resource_source); | ||
57 | |||
58 | static u32 | ||
59 | acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length); | ||
60 | |||
52 | /******************************************************************************* | 61 | /******************************************************************************* |
53 | * | 62 | * |
54 | * FUNCTION: acpi_rs_get_byte_stream_length | 63 | * FUNCTION: acpi_rs_count_set_bits |
55 | * | 64 | * |
56 | * PARAMETERS: linked_list - Pointer to the resource linked list | 65 | * PARAMETERS: bit_field - Field in which to count bits |
57 | * size_needed - u32 pointer of the size buffer needed | ||
58 | * to properly return the parsed data | ||
59 | * | 66 | * |
60 | * RETURN: Status | 67 | * RETURN: Number of bits set within the field |
61 | * | 68 | * |
62 | * DESCRIPTION: Takes the resource byte stream and parses it once, calculating | 69 | * DESCRIPTION: Count the number of bits set in a resource field. Used for |
63 | * the size buffer needed to hold the linked list that conveys | 70 | * (Short descriptor) interrupt and DMA lists. |
64 | * the resource data. | ||
65 | * | 71 | * |
66 | ******************************************************************************/ | 72 | ******************************************************************************/ |
67 | acpi_status | ||
68 | acpi_rs_get_byte_stream_length(struct acpi_resource *linked_list, | ||
69 | acpi_size * size_needed) | ||
70 | { | ||
71 | acpi_size byte_stream_size_needed = 0; | ||
72 | acpi_size segment_size; | ||
73 | u8 done = FALSE; | ||
74 | |||
75 | ACPI_FUNCTION_TRACE("rs_get_byte_stream_length"); | ||
76 | |||
77 | while (!done) { | ||
78 | /* Init the variable that will hold the size to add to the total. */ | ||
79 | |||
80 | segment_size = 0; | ||
81 | |||
82 | switch (linked_list->id) { | ||
83 | case ACPI_RSTYPE_IRQ: | ||
84 | /* | ||
85 | * IRQ Resource | ||
86 | * For an IRQ Resource, Byte 3, although optional, will always be | ||
87 | * created - it holds IRQ information. | ||
88 | */ | ||
89 | segment_size = 4; | ||
90 | break; | ||
91 | |||
92 | case ACPI_RSTYPE_DMA: | ||
93 | /* | ||
94 | * DMA Resource | ||
95 | * For this resource the size is static | ||
96 | */ | ||
97 | segment_size = 3; | ||
98 | break; | ||
99 | |||
100 | case ACPI_RSTYPE_START_DPF: | ||
101 | /* | ||
102 | * Start Dependent Functions Resource | ||
103 | * For a start_dependent_functions Resource, Byte 1, although | ||
104 | * optional, will always be created. | ||
105 | */ | ||
106 | segment_size = 2; | ||
107 | break; | ||
108 | |||
109 | case ACPI_RSTYPE_END_DPF: | ||
110 | /* | ||
111 | * End Dependent Functions Resource | ||
112 | * For this resource the size is static | ||
113 | */ | ||
114 | segment_size = 1; | ||
115 | break; | ||
116 | |||
117 | case ACPI_RSTYPE_IO: | ||
118 | /* | ||
119 | * IO Port Resource | ||
120 | * For this resource the size is static | ||
121 | */ | ||
122 | segment_size = 8; | ||
123 | break; | ||
124 | 73 | ||
125 | case ACPI_RSTYPE_FIXED_IO: | 74 | static u8 acpi_rs_count_set_bits(u16 bit_field) |
126 | /* | 75 | { |
127 | * Fixed IO Port Resource | 76 | u8 bits_set; |
128 | * For this resource the size is static | ||
129 | */ | ||
130 | segment_size = 4; | ||
131 | break; | ||
132 | |||
133 | case ACPI_RSTYPE_VENDOR: | ||
134 | /* | ||
135 | * Vendor Defined Resource | ||
136 | * For a Vendor Specific resource, if the Length is between 1 and 7 | ||
137 | * it will be created as a Small Resource data type, otherwise it | ||
138 | * is a Large Resource data type. | ||
139 | */ | ||
140 | if (linked_list->data.vendor_specific.length > 7) { | ||
141 | segment_size = 3; | ||
142 | } else { | ||
143 | segment_size = 1; | ||
144 | } | ||
145 | segment_size += | ||
146 | linked_list->data.vendor_specific.length; | ||
147 | break; | ||
148 | |||
149 | case ACPI_RSTYPE_END_TAG: | ||
150 | /* | ||
151 | * End Tag | ||
152 | * For this resource the size is static | ||
153 | */ | ||
154 | segment_size = 2; | ||
155 | done = TRUE; | ||
156 | break; | ||
157 | |||
158 | case ACPI_RSTYPE_MEM24: | ||
159 | /* | ||
160 | * 24-Bit Memory Resource | ||
161 | * For this resource the size is static | ||
162 | */ | ||
163 | segment_size = 12; | ||
164 | break; | ||
165 | 77 | ||
166 | case ACPI_RSTYPE_MEM32: | 78 | ACPI_FUNCTION_ENTRY(); |
167 | /* | ||
168 | * 32-Bit Memory Range Resource | ||
169 | * For this resource the size is static | ||
170 | */ | ||
171 | segment_size = 20; | ||
172 | break; | ||
173 | 79 | ||
174 | case ACPI_RSTYPE_FIXED_MEM32: | 80 | for (bits_set = 0; bit_field; bits_set++) { |
175 | /* | 81 | /* Zero the least significant bit that is set */ |
176 | * 32-Bit Fixed Memory Resource | ||
177 | * For this resource the size is static | ||
178 | */ | ||
179 | segment_size = 12; | ||
180 | break; | ||
181 | 82 | ||
182 | case ACPI_RSTYPE_ADDRESS16: | 83 | bit_field &= (bit_field - 1); |
183 | /* | 84 | } |
184 | * 16-Bit Address Resource | ||
185 | * The base size of this byte stream is 16. If a Resource Source | ||
186 | * string is not NULL, add 1 for the Index + the length of the null | ||
187 | * terminated string Resource Source + 1 for the null. | ||
188 | */ | ||
189 | segment_size = 16; | ||
190 | |||
191 | if (linked_list->data.address16.resource_source. | ||
192 | string_ptr) { | ||
193 | segment_size += | ||
194 | linked_list->data.address16.resource_source. | ||
195 | string_length; | ||
196 | segment_size++; | ||
197 | } | ||
198 | break; | ||
199 | 85 | ||
200 | case ACPI_RSTYPE_ADDRESS32: | 86 | return (bits_set); |
201 | /* | 87 | } |
202 | * 32-Bit Address Resource | ||
203 | * The base size of this byte stream is 26. If a Resource | ||
204 | * Source string is not NULL, add 1 for the Index + the | ||
205 | * length of the null terminated string Resource Source + | ||
206 | * 1 for the null. | ||
207 | */ | ||
208 | segment_size = 26; | ||
209 | |||
210 | if (linked_list->data.address32.resource_source. | ||
211 | string_ptr) { | ||
212 | segment_size += | ||
213 | linked_list->data.address32.resource_source. | ||
214 | string_length; | ||
215 | segment_size++; | ||
216 | } | ||
217 | break; | ||
218 | 88 | ||
219 | case ACPI_RSTYPE_ADDRESS64: | 89 | /******************************************************************************* |
220 | /* | 90 | * |
221 | * 64-Bit Address Resource | 91 | * FUNCTION: acpi_rs_struct_option_length |
222 | * The base size of this byte stream is 46. If a resource_source | 92 | * |
223 | * string is not NULL, add 1 for the Index + the length of the null | 93 | * PARAMETERS: resource_source - Pointer to optional descriptor field |
224 | * terminated string Resource Source + 1 for the null. | 94 | * |
225 | */ | 95 | * RETURN: Status |
226 | segment_size = 46; | 96 | * |
227 | 97 | * DESCRIPTION: Common code to handle optional resource_source_index and | |
228 | if (linked_list->data.address64.resource_source. | 98 | * resource_source fields in some Large descriptors. Used during |
229 | string_ptr) { | 99 | * list-to-stream conversion |
230 | segment_size += | 100 | * |
231 | linked_list->data.address64.resource_source. | 101 | ******************************************************************************/ |
232 | string_length; | ||
233 | segment_size++; | ||
234 | } | ||
235 | break; | ||
236 | 102 | ||
237 | case ACPI_RSTYPE_EXT_IRQ: | 103 | static acpi_rs_length |
238 | /* | 104 | acpi_rs_struct_option_length(struct acpi_resource_source *resource_source) |
239 | * Extended IRQ Resource | 105 | { |
240 | * The base size of this byte stream is 9. This is for an Interrupt | 106 | ACPI_FUNCTION_ENTRY(); |
241 | * table length of 1. For each additional interrupt, add 4. | ||
242 | * If a Resource Source string is not NULL, add 1 for the | ||
243 | * Index + the length of the null terminated string | ||
244 | * Resource Source + 1 for the null. | ||
245 | */ | ||
246 | segment_size = 9 + (((acpi_size) | ||
247 | linked_list->data.extended_irq. | ||
248 | number_of_interrupts - 1) * 4); | ||
249 | |||
250 | if (linked_list->data.extended_irq.resource_source. | ||
251 | string_ptr) { | ||
252 | segment_size += | ||
253 | linked_list->data.extended_irq. | ||
254 | resource_source.string_length; | ||
255 | segment_size++; | ||
256 | } | ||
257 | break; | ||
258 | 107 | ||
259 | default: | 108 | /* |
109 | * If the resource_source string is valid, return the size of the string | ||
110 | * (string_length includes the NULL terminator) plus the size of the | ||
111 | * resource_source_index (1). | ||
112 | */ | ||
113 | if (resource_source->string_ptr) { | ||
114 | return ((acpi_rs_length) (resource_source->string_length + 1)); | ||
115 | } | ||
260 | 116 | ||
261 | /* If we get here, everything is out of sync, exit with error */ | 117 | return (0); |
118 | } | ||
262 | 119 | ||
263 | return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); | 120 | /******************************************************************************* |
121 | * | ||
122 | * FUNCTION: acpi_rs_stream_option_length | ||
123 | * | ||
124 | * PARAMETERS: resource_length - Length from the resource header | ||
125 | * minimum_total_length - Minimum length of this resource, before | ||
126 | * any optional fields. Includes header size | ||
127 | * | ||
128 | * RETURN: Length of optional string (0 if no string present) | ||
129 | * | ||
130 | * DESCRIPTION: Common code to handle optional resource_source_index and | ||
131 | * resource_source fields in some Large descriptors. Used during | ||
132 | * stream-to-list conversion | ||
133 | * | ||
134 | ******************************************************************************/ | ||
264 | 135 | ||
265 | } /* switch (linked_list->Id) */ | 136 | static u32 |
137 | acpi_rs_stream_option_length(u32 resource_length, | ||
138 | u32 minimum_aml_resource_length) | ||
139 | { | ||
140 | u32 string_length = 0; | ||
266 | 141 | ||
267 | /* Update the total */ | 142 | ACPI_FUNCTION_ENTRY(); |
268 | 143 | ||
269 | byte_stream_size_needed += segment_size; | 144 | /* |
145 | * The resource_source_index and resource_source are optional elements of some | ||
146 | * Large-type resource descriptors. | ||
147 | */ | ||
270 | 148 | ||
271 | /* Point to the next object */ | 149 | /* |
150 | * If the length of the actual resource descriptor is greater than the ACPI | ||
151 | * spec-defined minimum length, it means that a resource_source_index exists | ||
152 | * and is followed by a (required) null terminated string. The string length | ||
153 | * (including the null terminator) is the resource length minus the minimum | ||
154 | * length, minus one byte for the resource_source_index itself. | ||
155 | */ | ||
156 | if (resource_length > minimum_aml_resource_length) { | ||
157 | /* Compute the length of the optional string */ | ||
272 | 158 | ||
273 | linked_list = ACPI_PTR_ADD(struct acpi_resource, | 159 | string_length = |
274 | linked_list, linked_list->length); | 160 | resource_length - minimum_aml_resource_length - 1; |
275 | } | 161 | } |
276 | 162 | ||
277 | /* This is the data the caller needs */ | 163 | /* Round up length to 32 bits for internal structure alignment */ |
278 | 164 | ||
279 | *size_needed = byte_stream_size_needed; | 165 | return (ACPI_ROUND_UP_to_32_bITS(string_length)); |
280 | return_ACPI_STATUS(AE_OK); | ||
281 | } | 166 | } |
282 | 167 | ||
283 | /******************************************************************************* | 168 | /******************************************************************************* |
284 | * | 169 | * |
285 | * FUNCTION: acpi_rs_get_list_length | 170 | * FUNCTION: acpi_rs_get_aml_length |
286 | * | 171 | * |
287 | * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream | 172 | * PARAMETERS: Resource - Pointer to the resource linked list |
288 | * byte_stream_buffer_length - Size of byte_stream_buffer | 173 | * size_needed - Where the required size is returned |
289 | * size_needed - u32 pointer of the size buffer | ||
290 | * needed to properly return the | ||
291 | * parsed data | ||
292 | * | 174 | * |
293 | * RETURN: Status | 175 | * RETURN: Status |
294 | * | 176 | * |
295 | * DESCRIPTION: Takes the resource byte stream and parses it once, calculating | 177 | * DESCRIPTION: Takes a linked list of internal resource descriptors and |
296 | * the size buffer needed to hold the linked list that conveys | 178 | * calculates the size buffer needed to hold the corresponding |
297 | * the resource data. | 179 | * external resource byte stream. |
298 | * | 180 | * |
299 | ******************************************************************************/ | 181 | ******************************************************************************/ |
300 | 182 | ||
301 | acpi_status | 183 | acpi_status |
302 | acpi_rs_get_list_length(u8 * byte_stream_buffer, | 184 | acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) |
303 | u32 byte_stream_buffer_length, acpi_size * size_needed) | ||
304 | { | 185 | { |
305 | u32 buffer_size = 0; | 186 | acpi_size aml_size_needed = 0; |
306 | u32 bytes_parsed = 0; | 187 | acpi_rs_length total_size; |
307 | u8 number_of_interrupts = 0; | ||
308 | u8 number_of_channels = 0; | ||
309 | u8 resource_type; | ||
310 | u32 structure_size; | ||
311 | u32 bytes_consumed; | ||
312 | u8 *buffer; | ||
313 | u8 temp8; | ||
314 | u16 temp16; | ||
315 | u8 index; | ||
316 | u8 additional_bytes; | ||
317 | |||
318 | ACPI_FUNCTION_TRACE("rs_get_list_length"); | ||
319 | 188 | ||
320 | while (bytes_parsed < byte_stream_buffer_length) { | 189 | ACPI_FUNCTION_TRACE("rs_get_aml_length"); |
321 | /* The next byte in the stream is the resource type */ | ||
322 | 190 | ||
323 | resource_type = acpi_rs_get_resource_type(*byte_stream_buffer); | 191 | /* Traverse entire list of internal resource descriptors */ |
324 | 192 | ||
325 | switch (resource_type) { | 193 | while (resource) { |
326 | case ACPI_RDESC_TYPE_MEMORY_24: | 194 | /* Validate the descriptor type */ |
327 | /* | ||
328 | * 24-Bit Memory Resource | ||
329 | */ | ||
330 | bytes_consumed = 12; | ||
331 | |||
332 | structure_size = | ||
333 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24); | ||
334 | break; | ||
335 | 195 | ||
336 | case ACPI_RDESC_TYPE_LARGE_VENDOR: | 196 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { |
337 | /* | 197 | return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); |
338 | * Vendor Defined Resource | 198 | } |
339 | */ | ||
340 | buffer = byte_stream_buffer; | ||
341 | ++buffer; | ||
342 | |||
343 | ACPI_MOVE_16_TO_16(&temp16, buffer); | ||
344 | bytes_consumed = temp16 + 3; | ||
345 | |||
346 | /* Ensure a 32-bit boundary for the structure */ | ||
347 | 199 | ||
348 | temp16 = (u16) ACPI_ROUND_UP_to_32_bITS(temp16); | 200 | /* Get the base size of the (external stream) resource descriptor */ |
349 | 201 | ||
350 | structure_size = | 202 | total_size = acpi_gbl_aml_resource_sizes[resource->type]; |
351 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) + | ||
352 | (temp16 * sizeof(u8)); | ||
353 | break; | ||
354 | 203 | ||
355 | case ACPI_RDESC_TYPE_MEMORY_32: | 204 | /* |
205 | * Augment the base size for descriptors with optional and/or | ||
206 | * variable-length fields | ||
207 | */ | ||
208 | switch (resource->type) { | ||
209 | case ACPI_RESOURCE_TYPE_VENDOR: | ||
356 | /* | 210 | /* |
357 | * 32-Bit Memory Range Resource | 211 | * Vendor Defined Resource: |
212 | * For a Vendor Specific resource, if the Length is between 1 and 7 | ||
213 | * it will be created as a Small Resource data type, otherwise it | ||
214 | * is a Large Resource data type. | ||
358 | */ | 215 | */ |
359 | bytes_consumed = 20; | 216 | if (resource->data.vendor.byte_length > 7) { |
217 | /* Base size of a Large resource descriptor */ | ||
360 | 218 | ||
361 | structure_size = | 219 | total_size = |
362 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32); | 220 | sizeof(struct aml_resource_large_header); |
363 | break; | 221 | } |
364 | 222 | ||
365 | case ACPI_RDESC_TYPE_FIXED_MEMORY_32: | 223 | /* Add the size of the vendor-specific data */ |
366 | /* | ||
367 | * 32-Bit Fixed Memory Resource | ||
368 | */ | ||
369 | bytes_consumed = 12; | ||
370 | 224 | ||
371 | structure_size = | 225 | total_size = (acpi_rs_length) |
372 | ACPI_SIZEOF_RESOURCE(struct | 226 | (total_size + resource->data.vendor.byte_length); |
373 | acpi_resource_fixed_mem32); | ||
374 | break; | 227 | break; |
375 | 228 | ||
376 | case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE: | 229 | case ACPI_RESOURCE_TYPE_END_TAG: |
377 | /* | 230 | /* |
378 | * 64-Bit Address Resource | 231 | * End Tag: |
232 | * We are done -- return the accumulated total size. | ||
379 | */ | 233 | */ |
380 | buffer = byte_stream_buffer; | 234 | *size_needed = aml_size_needed + total_size; |
381 | 235 | ||
382 | ++buffer; | 236 | /* Normal exit */ |
383 | ACPI_MOVE_16_TO_16(&temp16, buffer); | ||
384 | 237 | ||
385 | bytes_consumed = temp16 + 3; | 238 | return_ACPI_STATUS(AE_OK); |
386 | structure_size = | ||
387 | ACPI_SIZEOF_RESOURCE(struct | ||
388 | acpi_resource_address64); | ||
389 | break; | ||
390 | 239 | ||
391 | case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE: | 240 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
392 | /* | 241 | /* |
393 | * 64-Bit Address Resource | 242 | * 16-Bit Address Resource: |
243 | * Add the size of the optional resource_source info | ||
394 | */ | 244 | */ |
395 | buffer = byte_stream_buffer; | 245 | total_size = (acpi_rs_length) |
396 | 246 | (total_size + | |
397 | ++buffer; | 247 | acpi_rs_struct_option_length(&resource->data. |
398 | ACPI_MOVE_16_TO_16(&temp16, buffer); | 248 | address16. |
399 | 249 | resource_source)); | |
400 | bytes_consumed = temp16 + 3; | 250 | break; |
401 | 251 | ||
252 | case ACPI_RESOURCE_TYPE_ADDRESS32: | ||
402 | /* | 253 | /* |
403 | * Resource Source Index and Resource Source are optional elements. | 254 | * 32-Bit Address Resource: |
404 | * Check the length of the Bytestream. If it is greater than 43, | 255 | * Add the size of the optional resource_source info |
405 | * that means that an Index exists and is followed by a null | ||
406 | * terminated string. Therefore, set the temp variable to the | ||
407 | * length minus the minimum byte stream length plus the byte for | ||
408 | * the Index to determine the size of the NULL terminated string. | ||
409 | */ | 256 | */ |
410 | if (43 < temp16) { | 257 | total_size = (acpi_rs_length) |
411 | temp8 = (u8) (temp16 - 44); | 258 | (total_size + |
412 | } else { | 259 | acpi_rs_struct_option_length(&resource->data. |
413 | temp8 = 0; | 260 | address32. |
414 | } | 261 | resource_source)); |
415 | |||
416 | /* Ensure a 64-bit boundary for the structure */ | ||
417 | |||
418 | temp8 = (u8) ACPI_ROUND_UP_to_64_bITS(temp8); | ||
419 | |||
420 | structure_size = | ||
421 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64) | ||
422 | + (temp8 * sizeof(u8)); | ||
423 | break; | 262 | break; |
424 | 263 | ||
425 | case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE: | 264 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
426 | /* | 265 | /* |
427 | * 32-Bit Address Resource | 266 | * 64-Bit Address Resource: |
267 | * Add the size of the optional resource_source info | ||
428 | */ | 268 | */ |
429 | buffer = byte_stream_buffer; | 269 | total_size = (acpi_rs_length) |
430 | 270 | (total_size + | |
431 | ++buffer; | 271 | acpi_rs_struct_option_length(&resource->data. |
432 | ACPI_MOVE_16_TO_16(&temp16, buffer); | 272 | address64. |
433 | 273 | resource_source)); | |
434 | bytes_consumed = temp16 + 3; | 274 | break; |
435 | 275 | ||
276 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | ||
436 | /* | 277 | /* |
437 | * Resource Source Index and Resource Source are optional elements. | 278 | * Extended IRQ Resource: |
438 | * Check the length of the Bytestream. If it is greater than 23, | 279 | * Add the size of each additional optional interrupt beyond the |
439 | * that means that an Index exists and is followed by a null | 280 | * required 1 (4 bytes for each u32 interrupt number) |
440 | * terminated string. Therefore, set the temp variable to the | ||
441 | * length minus the minimum byte stream length plus the byte for | ||
442 | * the Index to determine the size of the NULL terminated string. | ||
443 | */ | 281 | */ |
444 | if (23 < temp16) { | 282 | total_size = (acpi_rs_length) |
445 | temp8 = (u8) (temp16 - 24); | 283 | (total_size + |
446 | } else { | 284 | ((resource->data.extended_irq.interrupt_count - |
447 | temp8 = 0; | 285 | 1) * 4) + |
448 | } | 286 | /* Add the size of the optional resource_source info */ |
449 | 287 | acpi_rs_struct_option_length(&resource->data. | |
450 | /* Ensure a 32-bit boundary for the structure */ | 288 | extended_irq. |
451 | 289 | resource_source)); | |
452 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); | 290 | break; |
453 | 291 | ||
454 | structure_size = | 292 | default: |
455 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32) | ||
456 | + (temp8 * sizeof(u8)); | ||
457 | break; | 293 | break; |
294 | } | ||
458 | 295 | ||
459 | case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE: | 296 | /* Update the total */ |
460 | /* | ||
461 | * 16-Bit Address Resource | ||
462 | */ | ||
463 | buffer = byte_stream_buffer; | ||
464 | 297 | ||
465 | ++buffer; | 298 | aml_size_needed += total_size; |
466 | ACPI_MOVE_16_TO_16(&temp16, buffer); | ||
467 | 299 | ||
468 | bytes_consumed = temp16 + 3; | 300 | /* Point to the next object */ |
469 | 301 | ||
470 | /* | 302 | resource = |
471 | * Resource Source Index and Resource Source are optional elements. | 303 | ACPI_ADD_PTR(struct acpi_resource, resource, |
472 | * Check the length of the Bytestream. If it is greater than 13, | 304 | resource->length); |
473 | * that means that an Index exists and is followed by a null | 305 | } |
474 | * terminated string. Therefore, set the temp variable to the | ||
475 | * length minus the minimum byte stream length plus the byte for | ||
476 | * the Index to determine the size of the NULL terminated string. | ||
477 | */ | ||
478 | if (13 < temp16) { | ||
479 | temp8 = (u8) (temp16 - 14); | ||
480 | } else { | ||
481 | temp8 = 0; | ||
482 | } | ||
483 | 306 | ||
484 | /* Ensure a 32-bit boundary for the structure */ | 307 | /* Did not find an end_tag resource descriptor */ |
485 | 308 | ||
486 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); | 309 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); |
310 | } | ||
487 | 311 | ||
488 | structure_size = | 312 | /******************************************************************************* |
489 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16) | 313 | * |
490 | + (temp8 * sizeof(u8)); | 314 | * FUNCTION: acpi_rs_get_list_length |
491 | break; | 315 | * |
316 | * PARAMETERS: aml_buffer - Pointer to the resource byte stream | ||
317 | * aml_buffer_length - Size of aml_buffer | ||
318 | * size_needed - Where the size needed is returned | ||
319 | * | ||
320 | * RETURN: Status | ||
321 | * | ||
322 | * DESCRIPTION: Takes an external resource byte stream and calculates the size | ||
323 | * buffer needed to hold the corresponding internal resource | ||
324 | * descriptor linked list. | ||
325 | * | ||
326 | ******************************************************************************/ | ||
492 | 327 | ||
493 | case ACPI_RDESC_TYPE_EXTENDED_XRUPT: | 328 | acpi_status |
494 | /* | 329 | acpi_rs_get_list_length(u8 * aml_buffer, |
495 | * Extended IRQ | 330 | u32 aml_buffer_length, acpi_size * size_needed) |
496 | */ | 331 | { |
497 | buffer = byte_stream_buffer; | 332 | acpi_status status; |
333 | u8 *end_aml; | ||
334 | u8 *buffer; | ||
335 | u32 buffer_size = 0; | ||
336 | u16 temp16; | ||
337 | u16 resource_length; | ||
338 | u32 extra_struct_bytes; | ||
339 | u8 resource_index; | ||
340 | u8 minimum_aml_resource_length; | ||
498 | 341 | ||
499 | ++buffer; | 342 | ACPI_FUNCTION_TRACE("rs_get_list_length"); |
500 | ACPI_MOVE_16_TO_16(&temp16, buffer); | ||
501 | 343 | ||
502 | bytes_consumed = temp16 + 3; | 344 | end_aml = aml_buffer + aml_buffer_length; |
503 | 345 | ||
504 | /* | 346 | /* Walk the list of AML resource descriptors */ |
505 | * Point past the length field and the Interrupt vector flags to | ||
506 | * save off the Interrupt table length to the Temp8 variable. | ||
507 | */ | ||
508 | buffer += 3; | ||
509 | temp8 = *buffer; | ||
510 | 347 | ||
511 | /* | 348 | while (aml_buffer < end_aml) { |
512 | * To compensate for multiple interrupt numbers, add 4 bytes for | 349 | /* Validate the Resource Type and Resource Length */ |
513 | * each additional interrupts greater than 1 | ||
514 | */ | ||
515 | additional_bytes = (u8) ((temp8 - 1) * 4); | ||
516 | 350 | ||
517 | /* | 351 | status = acpi_ut_validate_resource(aml_buffer, &resource_index); |
518 | * Resource Source Index and Resource Source are optional elements. | 352 | if (ACPI_FAILURE(status)) { |
519 | * Check the length of the Bytestream. If it is greater than 9, | 353 | return_ACPI_STATUS(status); |
520 | * that means that an Index exists and is followed by a null | 354 | } |
521 | * terminated string. Therefore, set the temp variable to the | ||
522 | * length minus the minimum byte stream length plus the byte for | ||
523 | * the Index to determine the size of the NULL terminated string. | ||
524 | */ | ||
525 | if (9 + additional_bytes < temp16) { | ||
526 | temp8 = (u8) (temp16 - (9 + additional_bytes)); | ||
527 | } else { | ||
528 | temp8 = 0; | ||
529 | } | ||
530 | 355 | ||
531 | /* Ensure a 32-bit boundary for the structure */ | 356 | /* Get the resource length and base (minimum) AML size */ |
532 | 357 | ||
533 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); | 358 | resource_length = acpi_ut_get_resource_length(aml_buffer); |
359 | minimum_aml_resource_length = | ||
360 | acpi_gbl_resource_aml_sizes[resource_index]; | ||
534 | 361 | ||
535 | structure_size = | 362 | /* |
536 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq) + | 363 | * Augment the size for descriptors with optional |
537 | (additional_bytes * sizeof(u8)) + | 364 | * and/or variable length fields |
538 | (temp8 * sizeof(u8)); | 365 | */ |
539 | break; | 366 | extra_struct_bytes = 0; |
367 | buffer = | ||
368 | aml_buffer + acpi_ut_get_resource_header_length(aml_buffer); | ||
540 | 369 | ||
541 | case ACPI_RDESC_TYPE_IRQ_FORMAT: | 370 | switch (acpi_ut_get_resource_type(aml_buffer)) { |
371 | case ACPI_RESOURCE_NAME_IRQ: | ||
542 | /* | 372 | /* |
543 | * IRQ Resource. | 373 | * IRQ Resource: |
544 | * Determine if it there are two or three trailing bytes | 374 | * Get the number of bits set in the 16-bit IRQ mask |
545 | */ | 375 | */ |
546 | buffer = byte_stream_buffer; | ||
547 | temp8 = *buffer; | ||
548 | |||
549 | if (temp8 & 0x01) { | ||
550 | bytes_consumed = 4; | ||
551 | } else { | ||
552 | bytes_consumed = 3; | ||
553 | } | ||
554 | |||
555 | /* Point past the descriptor */ | ||
556 | |||
557 | ++buffer; | ||
558 | |||
559 | /* Look at the number of bits set */ | ||
560 | |||
561 | ACPI_MOVE_16_TO_16(&temp16, buffer); | 376 | ACPI_MOVE_16_TO_16(&temp16, buffer); |
562 | 377 | extra_struct_bytes = acpi_rs_count_set_bits(temp16); | |
563 | for (index = 0; index < 16; index++) { | ||
564 | if (temp16 & 0x1) { | ||
565 | ++number_of_interrupts; | ||
566 | } | ||
567 | |||
568 | temp16 >>= 1; | ||
569 | } | ||
570 | |||
571 | structure_size = | ||
572 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_io) + | ||
573 | (number_of_interrupts * sizeof(u32)); | ||
574 | break; | 378 | break; |
575 | 379 | ||
576 | case ACPI_RDESC_TYPE_DMA_FORMAT: | 380 | case ACPI_RESOURCE_NAME_DMA: |
577 | /* | 381 | /* |
578 | * DMA Resource | 382 | * DMA Resource: |
383 | * Get the number of bits set in the 8-bit DMA mask | ||
579 | */ | 384 | */ |
580 | buffer = byte_stream_buffer; | 385 | extra_struct_bytes = acpi_rs_count_set_bits(*buffer); |
581 | bytes_consumed = 3; | ||
582 | |||
583 | /* Point past the descriptor */ | ||
584 | |||
585 | ++buffer; | ||
586 | |||
587 | /* Look at the number of bits set */ | ||
588 | |||
589 | temp8 = *buffer; | ||
590 | |||
591 | for (index = 0; index < 8; index++) { | ||
592 | if (temp8 & 0x1) { | ||
593 | ++number_of_channels; | ||
594 | } | ||
595 | |||
596 | temp8 >>= 1; | ||
597 | } | ||
598 | |||
599 | structure_size = | ||
600 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma) + | ||
601 | (number_of_channels * sizeof(u32)); | ||
602 | break; | 386 | break; |
603 | 387 | ||
604 | case ACPI_RDESC_TYPE_START_DEPENDENT: | 388 | case ACPI_RESOURCE_NAME_VENDOR_SMALL: |
605 | /* | 389 | /* |
606 | * Start Dependent Functions Resource | 390 | * Vendor Resource: |
607 | * Determine if it there are two or three trailing bytes | 391 | * Ensure a 32-bit boundary for the structure |
608 | */ | 392 | */ |
609 | buffer = byte_stream_buffer; | 393 | extra_struct_bytes = |
610 | temp8 = *buffer; | 394 | ACPI_ROUND_UP_to_32_bITS(resource_length) - |
611 | 395 | resource_length; | |
612 | if (temp8 & 0x01) { | ||
613 | bytes_consumed = 2; | ||
614 | } else { | ||
615 | bytes_consumed = 1; | ||
616 | } | ||
617 | |||
618 | structure_size = | ||
619 | ACPI_SIZEOF_RESOURCE(struct | ||
620 | acpi_resource_start_dpf); | ||
621 | break; | 396 | break; |
622 | 397 | ||
623 | case ACPI_RDESC_TYPE_END_DEPENDENT: | 398 | case ACPI_RESOURCE_NAME_END_TAG: |
624 | /* | 399 | /* |
625 | * End Dependent Functions Resource | 400 | * End Tag: This is the normal exit, add size of end_tag |
626 | */ | 401 | */ |
627 | bytes_consumed = 1; | 402 | *size_needed = buffer_size + ACPI_RS_SIZE_MIN; |
628 | structure_size = ACPI_RESOURCE_LENGTH; | 403 | return_ACPI_STATUS(AE_OK); |
629 | break; | ||
630 | 404 | ||
631 | case ACPI_RDESC_TYPE_IO_PORT: | 405 | case ACPI_RESOURCE_NAME_VENDOR_LARGE: |
632 | /* | 406 | /* |
633 | * IO Port Resource | 407 | * Vendor Resource: |
408 | * Add vendor data and ensure a 32-bit boundary for the structure | ||
634 | */ | 409 | */ |
635 | bytes_consumed = 8; | 410 | extra_struct_bytes = |
636 | structure_size = | 411 | ACPI_ROUND_UP_to_32_bITS(resource_length) - |
637 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_io); | 412 | resource_length; |
638 | break; | 413 | break; |
639 | 414 | ||
640 | case ACPI_RDESC_TYPE_FIXED_IO_PORT: | 415 | case ACPI_RESOURCE_NAME_ADDRESS32: |
416 | case ACPI_RESOURCE_NAME_ADDRESS16: | ||
641 | /* | 417 | /* |
642 | * Fixed IO Port Resource | 418 | * 32-Bit or 16-bit Address Resource: |
419 | * Add the size of any optional data (resource_source) | ||
643 | */ | 420 | */ |
644 | bytes_consumed = 4; | 421 | extra_struct_bytes = |
645 | structure_size = | 422 | acpi_rs_stream_option_length(resource_length, |
646 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io); | 423 | minimum_aml_resource_length); |
647 | break; | 424 | break; |
648 | 425 | ||
649 | case ACPI_RDESC_TYPE_SMALL_VENDOR: | 426 | case ACPI_RESOURCE_NAME_EXTENDED_IRQ: |
650 | /* | 427 | /* |
651 | * Vendor Specific Resource | 428 | * Extended IRQ: |
429 | * Point past the interrupt_vector_flags to get the | ||
430 | * interrupt_table_length. | ||
652 | */ | 431 | */ |
653 | buffer = byte_stream_buffer; | 432 | buffer++; |
654 | 433 | ||
655 | temp8 = *buffer; | 434 | extra_struct_bytes = |
656 | temp8 = (u8) (temp8 & 0x7); | 435 | /* |
657 | bytes_consumed = temp8 + 1; | 436 | * Add 4 bytes for each additional interrupt. Note: at |
658 | 437 | * least one interrupt is required and is included in | |
659 | /* Ensure a 32-bit boundary for the structure */ | 438 | * the minimum descriptor size |
660 | 439 | */ | |
661 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8); | 440 | ((*buffer - 1) * sizeof(u32)) + |
662 | structure_size = | 441 | /* Add the size of any optional data (resource_source) */ |
663 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) + | 442 | acpi_rs_stream_option_length(resource_length - |
664 | (temp8 * sizeof(u8)); | 443 | extra_struct_bytes, |
444 | minimum_aml_resource_length); | ||
665 | break; | 445 | break; |
666 | 446 | ||
667 | case ACPI_RDESC_TYPE_END_TAG: | 447 | case ACPI_RESOURCE_NAME_ADDRESS64: |
668 | /* | 448 | /* |
669 | * End Tag | 449 | * 64-Bit Address Resource: |
450 | * Add the size of any optional data (resource_source) | ||
451 | * Ensure a 64-bit boundary for the structure | ||
670 | */ | 452 | */ |
671 | bytes_consumed = 2; | 453 | extra_struct_bytes = |
672 | structure_size = ACPI_RESOURCE_LENGTH; | 454 | ACPI_ROUND_UP_to_64_bITS |
673 | byte_stream_buffer_length = bytes_parsed; | 455 | (acpi_rs_stream_option_length |
456 | (resource_length, minimum_aml_resource_length)); | ||
674 | break; | 457 | break; |
675 | 458 | ||
676 | default: | 459 | default: |
677 | /* | 460 | break; |
678 | * If we get here, everything is out of sync, | ||
679 | * exit with an error | ||
680 | */ | ||
681 | return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); | ||
682 | } | 461 | } |
683 | 462 | ||
684 | /* Update the return value and counter */ | 463 | /* Update the required buffer size for the internal descriptor structs */ |
685 | |||
686 | buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(structure_size); | ||
687 | bytes_parsed += bytes_consumed; | ||
688 | 464 | ||
689 | /* Set the byte stream to point to the next resource */ | 465 | temp16 = (u16) (acpi_gbl_resource_struct_sizes[resource_index] + |
466 | extra_struct_bytes); | ||
467 | buffer_size += (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(temp16); | ||
690 | 468 | ||
691 | byte_stream_buffer += bytes_consumed; | 469 | /* |
470 | * Point to the next resource within the stream | ||
471 | * using the size of the header plus the length contained in the header | ||
472 | */ | ||
473 | aml_buffer += acpi_ut_get_descriptor_length(aml_buffer); | ||
692 | } | 474 | } |
693 | 475 | ||
694 | /* This is the data the caller needs */ | 476 | /* Did not find an end_tag resource descriptor */ |
695 | 477 | ||
696 | *size_needed = buffer_size; | 478 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); |
697 | return_ACPI_STATUS(AE_OK); | ||
698 | } | 479 | } |
699 | 480 | ||
700 | /******************************************************************************* | 481 | /******************************************************************************* |
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index 0911526b7ad8..6c7c6c560635 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c | |||
@@ -53,10 +53,10 @@ ACPI_MODULE_NAME("rscreate") | |||
53 | * | 53 | * |
54 | * FUNCTION: acpi_rs_create_resource_list | 54 | * FUNCTION: acpi_rs_create_resource_list |
55 | * | 55 | * |
56 | * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream | 56 | * PARAMETERS: aml_buffer - Pointer to the resource byte stream |
57 | * output_buffer - Pointer to the user's buffer | 57 | * output_buffer - Pointer to the user's buffer |
58 | * | 58 | * |
59 | * RETURN: Status - AE_OK if okay, else a valid acpi_status code | 59 | * RETURN: Status: AE_OK if okay, else a valid acpi_status code |
60 | * If output_buffer is not large enough, output_buffer_length | 60 | * If output_buffer is not large enough, output_buffer_length |
61 | * indicates how large output_buffer should be, else it | 61 | * indicates how large output_buffer should be, else it |
62 | * indicates how may u8 elements of output_buffer are valid. | 62 | * indicates how may u8 elements of output_buffer are valid. |
@@ -67,33 +67,30 @@ ACPI_MODULE_NAME("rscreate") | |||
67 | * | 67 | * |
68 | ******************************************************************************/ | 68 | ******************************************************************************/ |
69 | acpi_status | 69 | acpi_status |
70 | acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, | 70 | acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, |
71 | struct acpi_buffer *output_buffer) | 71 | struct acpi_buffer *output_buffer) |
72 | { | 72 | { |
73 | 73 | ||
74 | acpi_status status; | 74 | acpi_status status; |
75 | u8 *byte_stream_start; | 75 | u8 *aml_start; |
76 | acpi_size list_size_needed = 0; | 76 | acpi_size list_size_needed = 0; |
77 | u32 byte_stream_buffer_length; | 77 | u32 aml_buffer_length; |
78 | 78 | ||
79 | ACPI_FUNCTION_TRACE("rs_create_resource_list"); | 79 | ACPI_FUNCTION_TRACE("rs_create_resource_list"); |
80 | 80 | ||
81 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_buffer = %p\n", | 81 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_buffer = %p\n", aml_buffer)); |
82 | byte_stream_buffer)); | ||
83 | 82 | ||
84 | /* Params already validated, so we don't re-validate here */ | 83 | /* Params already validated, so we don't re-validate here */ |
85 | 84 | ||
86 | byte_stream_buffer_length = byte_stream_buffer->buffer.length; | 85 | aml_buffer_length = aml_buffer->buffer.length; |
87 | byte_stream_start = byte_stream_buffer->buffer.pointer; | 86 | aml_start = aml_buffer->buffer.pointer; |
88 | 87 | ||
89 | /* | 88 | /* |
90 | * Pass the byte_stream_buffer into a module that can calculate | 89 | * Pass the aml_buffer into a module that can calculate |
91 | * the buffer size needed for the linked list | 90 | * the buffer size needed for the linked list |
92 | */ | 91 | */ |
93 | status = | 92 | status = acpi_rs_get_list_length(aml_start, aml_buffer_length, |
94 | acpi_rs_get_list_length(byte_stream_start, | 93 | &list_size_needed); |
95 | byte_stream_buffer_length, | ||
96 | &list_size_needed); | ||
97 | 94 | ||
98 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n", | 95 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n", |
99 | status, (u32) list_size_needed)); | 96 | status, (u32) list_size_needed)); |
@@ -110,10 +107,8 @@ acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, | |||
110 | 107 | ||
111 | /* Do the conversion */ | 108 | /* Do the conversion */ |
112 | 109 | ||
113 | status = | 110 | status = acpi_rs_convert_aml_to_resources(aml_start, aml_buffer_length, |
114 | acpi_rs_byte_stream_to_list(byte_stream_start, | 111 | output_buffer->pointer); |
115 | byte_stream_buffer_length, | ||
116 | output_buffer->pointer); | ||
117 | if (ACPI_FAILURE(status)) { | 112 | if (ACPI_FAILURE(status)) { |
118 | return_ACPI_STATUS(status); | 113 | return_ACPI_STATUS(status); |
119 | } | 114 | } |
@@ -360,7 +355,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
360 | 355 | ||
361 | /******************************************************************************* | 356 | /******************************************************************************* |
362 | * | 357 | * |
363 | * FUNCTION: acpi_rs_create_byte_stream | 358 | * FUNCTION: acpi_rs_create_aml_resources |
364 | * | 359 | * |
365 | * PARAMETERS: linked_list_buffer - Pointer to the resource linked list | 360 | * PARAMETERS: linked_list_buffer - Pointer to the resource linked list |
366 | * output_buffer - Pointer to the user's buffer | 361 | * output_buffer - Pointer to the user's buffer |
@@ -377,13 +372,13 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
377 | ******************************************************************************/ | 372 | ******************************************************************************/ |
378 | 373 | ||
379 | acpi_status | 374 | acpi_status |
380 | acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, | 375 | acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, |
381 | struct acpi_buffer *output_buffer) | 376 | struct acpi_buffer *output_buffer) |
382 | { | 377 | { |
383 | acpi_status status; | 378 | acpi_status status; |
384 | acpi_size byte_stream_size_needed = 0; | 379 | acpi_size aml_size_needed = 0; |
385 | 380 | ||
386 | ACPI_FUNCTION_TRACE("rs_create_byte_stream"); | 381 | ACPI_FUNCTION_TRACE("rs_create_aml_resources"); |
387 | 382 | ||
388 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "linked_list_buffer = %p\n", | 383 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "linked_list_buffer = %p\n", |
389 | linked_list_buffer)); | 384 | linked_list_buffer)); |
@@ -394,11 +389,10 @@ acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, | |||
394 | * Pass the linked_list_buffer into a module that calculates | 389 | * Pass the linked_list_buffer into a module that calculates |
395 | * the buffer size needed for the byte stream. | 390 | * the buffer size needed for the byte stream. |
396 | */ | 391 | */ |
397 | status = acpi_rs_get_byte_stream_length(linked_list_buffer, | 392 | status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed); |
398 | &byte_stream_size_needed); | ||
399 | 393 | ||
400 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_size_needed=%X, %s\n", | 394 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_size_needed=%X, %s\n", |
401 | (u32) byte_stream_size_needed, | 395 | (u32) aml_size_needed, |
402 | acpi_format_exception(status))); | 396 | acpi_format_exception(status))); |
403 | if (ACPI_FAILURE(status)) { | 397 | if (ACPI_FAILURE(status)) { |
404 | return_ACPI_STATUS(status); | 398 | return_ACPI_STATUS(status); |
@@ -406,8 +400,7 @@ acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, | |||
406 | 400 | ||
407 | /* Validate/Allocate/Clear caller buffer */ | 401 | /* Validate/Allocate/Clear caller buffer */ |
408 | 402 | ||
409 | status = | 403 | status = acpi_ut_initialize_buffer(output_buffer, aml_size_needed); |
410 | acpi_ut_initialize_buffer(output_buffer, byte_stream_size_needed); | ||
411 | if (ACPI_FAILURE(status)) { | 404 | if (ACPI_FAILURE(status)) { |
412 | return_ACPI_STATUS(status); | 405 | return_ACPI_STATUS(status); |
413 | } | 406 | } |
@@ -415,9 +408,9 @@ acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, | |||
415 | /* Do the conversion */ | 408 | /* Do the conversion */ |
416 | 409 | ||
417 | status = | 410 | status = |
418 | acpi_rs_list_to_byte_stream(linked_list_buffer, | 411 | acpi_rs_convert_resources_to_aml(linked_list_buffer, |
419 | byte_stream_size_needed, | 412 | aml_size_needed, |
420 | output_buffer->pointer); | 413 | output_buffer->pointer); |
421 | if (ACPI_FAILURE(status)) { | 414 | if (ACPI_FAILURE(status)) { |
422 | return_ACPI_STATUS(status); | 415 | return_ACPI_STATUS(status); |
423 | } | 416 | } |
diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index 75bd34d1783f..c24e3eb658c3 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c | |||
@@ -49,1063 +49,716 @@ ACPI_MODULE_NAME("rsdump") | |||
49 | 49 | ||
50 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 50 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
51 | /* Local prototypes */ | 51 | /* Local prototypes */ |
52 | static void acpi_rs_dump_irq(union acpi_resource_data *data); | 52 | static void acpi_rs_out_string(char *title, char *value); |
53 | 53 | ||
54 | static void acpi_rs_dump_address16(union acpi_resource_data *data); | 54 | static void acpi_rs_out_integer8(char *title, u8 value); |
55 | 55 | ||
56 | static void acpi_rs_dump_address32(union acpi_resource_data *data); | 56 | static void acpi_rs_out_integer16(char *title, u16 value); |
57 | 57 | ||
58 | static void acpi_rs_dump_address64(union acpi_resource_data *data); | 58 | static void acpi_rs_out_integer32(char *title, u32 value); |
59 | 59 | ||
60 | static void acpi_rs_dump_dma(union acpi_resource_data *data); | 60 | static void acpi_rs_out_integer64(char *title, u64 value); |
61 | 61 | ||
62 | static void acpi_rs_dump_io(union acpi_resource_data *data); | 62 | static void acpi_rs_out_title(char *title); |
63 | 63 | ||
64 | static void acpi_rs_dump_extended_irq(union acpi_resource_data *data); | 64 | static void acpi_rs_dump_byte_list(u16 length, u8 * data); |
65 | 65 | ||
66 | static void acpi_rs_dump_fixed_io(union acpi_resource_data *data); | 66 | static void acpi_rs_dump_dword_list(u8 length, u32 * data); |
67 | 67 | ||
68 | static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *data); | 68 | static void acpi_rs_dump_short_byte_list(u8 length, u8 * data); |
69 | 69 | ||
70 | static void acpi_rs_dump_memory24(union acpi_resource_data *data); | 70 | static void |
71 | acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source); | ||
71 | 72 | ||
72 | static void acpi_rs_dump_memory32(union acpi_resource_data *data); | 73 | static void acpi_rs_dump_address_common(union acpi_resource_data *resource); |
73 | 74 | ||
74 | static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *data); | 75 | static void |
76 | acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table); | ||
75 | 77 | ||
76 | static void acpi_rs_dump_vendor_specific(union acpi_resource_data *data); | 78 | #define ACPI_RSD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_resource_data,f) |
79 | #define ACPI_PRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_pci_routing_table,f) | ||
80 | #define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_rsdump_info)) | ||
77 | 81 | ||
78 | /******************************************************************************* | 82 | /******************************************************************************* |
79 | * | 83 | * |
80 | * FUNCTION: acpi_rs_dump_irq | 84 | * Resource Descriptor info tables |
81 | * | 85 | * |
82 | * PARAMETERS: Data - pointer to the resource structure to dump. | 86 | * Note: The first table entry must be a Title or Literal and must contain |
83 | * | 87 | * the table length (number of table entries) |
84 | * RETURN: None | ||
85 | * | ||
86 | * DESCRIPTION: Prints out the various members of the Data structure type. | ||
87 | * | 88 | * |
88 | ******************************************************************************/ | 89 | ******************************************************************************/ |
89 | 90 | ||
90 | static void acpi_rs_dump_irq(union acpi_resource_data *data) | 91 | struct acpi_rsdump_info acpi_rs_dump_irq[6] = { |
91 | { | 92 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL}, |
92 | struct acpi_resource_irq *irq_data = (struct acpi_resource_irq *)data; | 93 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering", |
93 | u8 index = 0; | 94 | acpi_gbl_HEdecode}, |
94 | 95 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity", | |
95 | ACPI_FUNCTION_ENTRY(); | 96 | acpi_gbl_LLdecode}, |
96 | 97 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing", | |
97 | acpi_os_printf("IRQ Resource\n"); | 98 | acpi_gbl_SHRdecode}, |
99 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count), | ||
100 | "Interrupt Count", NULL}, | ||
101 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]), | ||
102 | "Interrupt List", NULL} | ||
103 | }; | ||
104 | |||
105 | struct acpi_rsdump_info acpi_rs_dump_dma[6] = { | ||
106 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL}, | ||
107 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed", | ||
108 | acpi_gbl_TYPdecode}, | ||
109 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering", | ||
110 | acpi_gbl_BMdecode}, | ||
111 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type", | ||
112 | acpi_gbl_SIZdecode}, | ||
113 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count", | ||
114 | NULL}, | ||
115 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List", | ||
116 | NULL} | ||
117 | }; | ||
118 | |||
119 | struct acpi_rsdump_info acpi_rs_dump_start_dpf[3] = { | ||
120 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_start_dpf), | ||
121 | "Start-Dependent-Functions", NULL}, | ||
122 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.compatibility_priority), | ||
123 | "Compatibility Priority", acpi_gbl_config_decode}, | ||
124 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.performance_robustness), | ||
125 | "Performance/Robustness", acpi_gbl_config_decode} | ||
126 | }; | ||
127 | |||
128 | struct acpi_rsdump_info acpi_rs_dump_end_dpf[1] = { | ||
129 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_dpf), | ||
130 | "End-Dependent-Functions", NULL} | ||
131 | }; | ||
132 | |||
133 | struct acpi_rsdump_info acpi_rs_dump_io[6] = { | ||
134 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io), "I/O", NULL}, | ||
135 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(io.io_decode), "Address Decoding", | ||
136 | acpi_gbl_io_decode}, | ||
137 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.minimum), "Address Minimum", NULL}, | ||
138 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.maximum), "Address Maximum", NULL}, | ||
139 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.alignment), "Alignment", NULL}, | ||
140 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.address_length), "Address Length", | ||
141 | NULL} | ||
142 | }; | ||
143 | |||
144 | struct acpi_rsdump_info acpi_rs_dump_fixed_io[3] = { | ||
145 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_io), | ||
146 | "Fixed I/O", NULL}, | ||
147 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_io.address), "Address", NULL}, | ||
148 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_io.address_length), | ||
149 | "Address Length", NULL} | ||
150 | }; | ||
151 | |||
152 | struct acpi_rsdump_info acpi_rs_dump_vendor[3] = { | ||
153 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_vendor), | ||
154 | "Vendor Specific", NULL}, | ||
155 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(vendor.byte_length), "Length", NULL}, | ||
156 | {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET(vendor.byte_data[0]), "Vendor Data", | ||
157 | NULL} | ||
158 | }; | ||
159 | |||
160 | struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = { | ||
161 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "end_tag", | ||
162 | NULL} | ||
163 | }; | ||
164 | |||
165 | struct acpi_rsdump_info acpi_rs_dump_memory24[6] = { | ||
166 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24), | ||
167 | "24-Bit Memory Range", NULL}, | ||
168 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect), | ||
169 | "Write Protect", acpi_gbl_RWdecode}, | ||
170 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum", | ||
171 | NULL}, | ||
172 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum", | ||
173 | NULL}, | ||
174 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.alignment), "Alignment", | ||
175 | NULL}, | ||
176 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.address_length), | ||
177 | "Address Length", NULL} | ||
178 | }; | ||
179 | |||
180 | struct acpi_rsdump_info acpi_rs_dump_memory32[6] = { | ||
181 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32), | ||
182 | "32-Bit Memory Range", NULL}, | ||
183 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect), | ||
184 | "Write Protect", acpi_gbl_RWdecode}, | ||
185 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum", | ||
186 | NULL}, | ||
187 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum", | ||
188 | NULL}, | ||
189 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.alignment), "Alignment", | ||
190 | NULL}, | ||
191 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.address_length), | ||
192 | "Address Length", NULL} | ||
193 | }; | ||
194 | |||
195 | struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = { | ||
196 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32), | ||
197 | "32-Bit Fixed Memory Range", NULL}, | ||
198 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect), | ||
199 | "Write Protect", acpi_gbl_RWdecode}, | ||
200 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address", | ||
201 | NULL}, | ||
202 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length), | ||
203 | "Address Length", NULL} | ||
204 | }; | ||
205 | |||
206 | struct acpi_rsdump_info acpi_rs_dump_address16[8] = { | ||
207 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address16), | ||
208 | "16-Bit WORD Address Space", NULL}, | ||
209 | {ACPI_RSD_ADDRESS, 0, NULL, NULL}, | ||
210 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.granularity), "Granularity", | ||
211 | NULL}, | ||
212 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.minimum), "Address Minimum", | ||
213 | NULL}, | ||
214 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.maximum), "Address Maximum", | ||
215 | NULL}, | ||
216 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.translation_offset), | ||
217 | "Translation Offset", NULL}, | ||
218 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address_length), | ||
219 | "Address Length", NULL}, | ||
220 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address16.resource_source), NULL, NULL} | ||
221 | }; | ||
222 | |||
223 | struct acpi_rsdump_info acpi_rs_dump_address32[8] = { | ||
224 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address32), | ||
225 | "32-Bit DWORD Address Space", NULL}, | ||
226 | {ACPI_RSD_ADDRESS, 0, NULL, NULL}, | ||
227 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.granularity), "Granularity", | ||
228 | NULL}, | ||
229 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.minimum), "Address Minimum", | ||
230 | NULL}, | ||
231 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.maximum), "Address Maximum", | ||
232 | NULL}, | ||
233 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.translation_offset), | ||
234 | "Translation Offset", NULL}, | ||
235 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address_length), | ||
236 | "Address Length", NULL}, | ||
237 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address32.resource_source), NULL, NULL} | ||
238 | }; | ||
239 | |||
240 | struct acpi_rsdump_info acpi_rs_dump_address64[8] = { | ||
241 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address64), | ||
242 | "64-Bit QWORD Address Space", NULL}, | ||
243 | {ACPI_RSD_ADDRESS, 0, NULL, NULL}, | ||
244 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.granularity), "Granularity", | ||
245 | NULL}, | ||
246 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.minimum), "Address Minimum", | ||
247 | NULL}, | ||
248 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.maximum), "Address Maximum", | ||
249 | NULL}, | ||
250 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.translation_offset), | ||
251 | "Translation Offset", NULL}, | ||
252 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address_length), | ||
253 | "Address Length", NULL}, | ||
254 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address64.resource_source), NULL, NULL} | ||
255 | }; | ||
256 | |||
257 | struct acpi_rsdump_info acpi_rs_dump_ext_address64[8] = { | ||
258 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_address64), | ||
259 | "64-Bit Extended Address Space", NULL}, | ||
260 | {ACPI_RSD_ADDRESS, 0, NULL, NULL}, | ||
261 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.granularity), | ||
262 | "Granularity", NULL}, | ||
263 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.minimum), | ||
264 | "Address Minimum", NULL}, | ||
265 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.maximum), | ||
266 | "Address Maximum", NULL}, | ||
267 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.translation_offset), | ||
268 | "Translation Offset", NULL}, | ||
269 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address_length), | ||
270 | "Address Length", NULL}, | ||
271 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.type_specific), | ||
272 | "Type-Specific Attribute", NULL} | ||
273 | }; | ||
274 | |||
275 | struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = { | ||
276 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_irq), | ||
277 | "Extended IRQ", NULL}, | ||
278 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer), | ||
279 | "Type", acpi_gbl_consume_decode}, | ||
280 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering), | ||
281 | "Triggering", acpi_gbl_HEdecode}, | ||
282 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity", | ||
283 | acpi_gbl_LLdecode}, | ||
284 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing", | ||
285 | acpi_gbl_SHRdecode}, | ||
286 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL, | ||
287 | NULL}, | ||
288 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count), | ||
289 | "Interrupt Count", NULL}, | ||
290 | {ACPI_RSD_DWORDLIST, ACPI_RSD_OFFSET(extended_irq.interrupts[0]), | ||
291 | "Interrupt List", NULL} | ||
292 | }; | ||
293 | |||
294 | struct acpi_rsdump_info acpi_rs_dump_generic_reg[6] = { | ||
295 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_generic_reg), | ||
296 | "Generic Register", NULL}, | ||
297 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.space_id), "Space ID", | ||
298 | NULL}, | ||
299 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_width), "Bit Width", | ||
300 | NULL}, | ||
301 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_offset), "Bit Offset", | ||
302 | NULL}, | ||
303 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.access_size), | ||
304 | "Access Size", NULL}, | ||
305 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(generic_reg.address), "Address", NULL} | ||
306 | }; | ||
98 | 307 | ||
99 | acpi_os_printf(" %s Triggered\n", | 308 | /* |
100 | ACPI_LEVEL_SENSITIVE == | 309 | * Tables used for common address descriptor flag fields |
101 | irq_data->edge_level ? "Level" : "Edge"); | 310 | */ |
102 | 311 | static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = { | |
103 | acpi_os_printf(" Active %s\n", | 312 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_general_flags), NULL, |
104 | ACPI_ACTIVE_LOW == | 313 | NULL}, |
105 | irq_data->active_high_low ? "Low" : "High"); | 314 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer), |
106 | 315 | "Consumer/Producer", acpi_gbl_consume_decode}, | |
107 | acpi_os_printf(" %s\n", | 316 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode", |
108 | ACPI_SHARED == | 317 | acpi_gbl_DECdecode}, |
109 | irq_data->shared_exclusive ? "Shared" : "Exclusive"); | 318 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed), |
110 | 319 | "Min Relocatability", acpi_gbl_min_decode}, | |
111 | acpi_os_printf(" %X Interrupts ( ", irq_data->number_of_interrupts); | 320 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed), |
112 | 321 | "Max Relocatability", acpi_gbl_max_decode} | |
113 | for (index = 0; index < irq_data->number_of_interrupts; index++) { | 322 | }; |
114 | acpi_os_printf("%X ", irq_data->interrupts[index]); | 323 | |
115 | } | 324 | static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = { |
325 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags), | ||
326 | "Resource Type", (void *)"Memory Range"}, | ||
327 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect), | ||
328 | "Write Protect", acpi_gbl_RWdecode}, | ||
329 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching), | ||
330 | "Caching", acpi_gbl_MEMdecode}, | ||
331 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type), | ||
332 | "Range Type", acpi_gbl_MTPdecode}, | ||
333 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation), | ||
334 | "Translation", acpi_gbl_TTPdecode} | ||
335 | }; | ||
336 | |||
337 | static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = { | ||
338 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags), | ||
339 | "Resource Type", (void *)"I/O Range"}, | ||
340 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type), | ||
341 | "Range Type", acpi_gbl_RNGdecode}, | ||
342 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation), | ||
343 | "Translation", acpi_gbl_TTPdecode}, | ||
344 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type), | ||
345 | "Translation Type", acpi_gbl_TRSdecode} | ||
346 | }; | ||
116 | 347 | ||
117 | acpi_os_printf(")\n"); | 348 | /* |
118 | return; | 349 | * Table used to dump _PRT contents |
119 | } | 350 | */ |
351 | static struct acpi_rsdump_info acpi_rs_dump_prt[5] = { | ||
352 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_prt), NULL, NULL}, | ||
353 | {ACPI_RSD_UINT64, ACPI_PRT_OFFSET(address), "Address", NULL}, | ||
354 | {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(pin), "Pin", NULL}, | ||
355 | {ACPI_RSD_STRING, ACPI_PRT_OFFSET(source[0]), "Source", NULL}, | ||
356 | {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(source_index), "Source Index", NULL} | ||
357 | }; | ||
120 | 358 | ||
121 | /******************************************************************************* | 359 | /******************************************************************************* |
122 | * | 360 | * |
123 | * FUNCTION: acpi_rs_dump_dma | 361 | * FUNCTION: acpi_rs_dump_descriptor |
124 | * | 362 | * |
125 | * PARAMETERS: Data - pointer to the resource structure to dump. | 363 | * PARAMETERS: Resource |
126 | * | 364 | * |
127 | * RETURN: None | 365 | * RETURN: None |
128 | * | 366 | * |
129 | * DESCRIPTION: Prints out the various members of the Data structure type. | 367 | * DESCRIPTION: |
130 | * | 368 | * |
131 | ******************************************************************************/ | 369 | ******************************************************************************/ |
132 | 370 | ||
133 | static void acpi_rs_dump_dma(union acpi_resource_data *data) | 371 | static void |
372 | acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) | ||
134 | { | 373 | { |
135 | struct acpi_resource_dma *dma_data = (struct acpi_resource_dma *)data; | 374 | u8 *target = NULL; |
136 | u8 index = 0; | 375 | u8 *previous_target; |
137 | 376 | char *name; | |
138 | ACPI_FUNCTION_ENTRY(); | 377 | u8 count; |
139 | 378 | ||
140 | acpi_os_printf("DMA Resource\n"); | 379 | /* First table entry must contain the table length (# of table entries) */ |
141 | 380 | ||
142 | switch (dma_data->type) { | 381 | count = table->offset; |
143 | case ACPI_COMPATIBILITY: | 382 | |
144 | acpi_os_printf(" Compatibility mode\n"); | 383 | while (count) { |
145 | break; | 384 | previous_target = target; |
146 | 385 | target = ACPI_ADD_PTR(u8, resource, table->offset); | |
147 | case ACPI_TYPE_A: | 386 | name = table->name; |
148 | acpi_os_printf(" Type A\n"); | 387 | |
149 | break; | 388 | switch (table->opcode) { |
150 | 389 | case ACPI_RSD_TITLE: | |
151 | case ACPI_TYPE_B: | 390 | /* |
152 | acpi_os_printf(" Type B\n"); | 391 | * Optional resource title |
153 | break; | 392 | */ |
154 | 393 | if (table->name) { | |
155 | case ACPI_TYPE_F: | 394 | acpi_os_printf("%s Resource\n", name); |
156 | acpi_os_printf(" Type F\n"); | 395 | } |
157 | break; | 396 | break; |
158 | |||
159 | default: | ||
160 | acpi_os_printf(" Invalid DMA type\n"); | ||
161 | break; | ||
162 | } | ||
163 | |||
164 | acpi_os_printf(" %sBus Master\n", | ||
165 | ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a "); | ||
166 | |||
167 | switch (dma_data->transfer) { | ||
168 | case ACPI_TRANSFER_8: | ||
169 | acpi_os_printf(" 8-bit only transfer\n"); | ||
170 | break; | ||
171 | 397 | ||
172 | case ACPI_TRANSFER_8_16: | 398 | /* Strings */ |
173 | acpi_os_printf(" 8 and 16-bit transfer\n"); | ||
174 | break; | ||
175 | 399 | ||
176 | case ACPI_TRANSFER_16: | 400 | case ACPI_RSD_LITERAL: |
177 | acpi_os_printf(" 16 bit only transfer\n"); | 401 | acpi_rs_out_string(name, |
178 | break; | 402 | ACPI_CAST_PTR(char, table->pointer)); |
403 | break; | ||
179 | 404 | ||
180 | default: | 405 | case ACPI_RSD_STRING: |
181 | acpi_os_printf(" Invalid transfer preference\n"); | 406 | acpi_rs_out_string(name, ACPI_CAST_PTR(char, target)); |
182 | break; | 407 | break; |
183 | } | ||
184 | 408 | ||
185 | acpi_os_printf(" Number of Channels: %X ( ", | 409 | /* Data items, 8/16/32/64 bit */ |
186 | dma_data->number_of_channels); | ||
187 | 410 | ||
188 | for (index = 0; index < dma_data->number_of_channels; index++) { | 411 | case ACPI_RSD_UINT8: |
189 | acpi_os_printf("%X ", dma_data->channels[index]); | 412 | acpi_rs_out_integer8(name, ACPI_GET8(target)); |
190 | } | 413 | break; |
191 | 414 | ||
192 | acpi_os_printf(")\n"); | 415 | case ACPI_RSD_UINT16: |
193 | return; | 416 | acpi_rs_out_integer16(name, ACPI_GET16(target)); |
194 | } | 417 | break; |
195 | 418 | ||
196 | /******************************************************************************* | 419 | case ACPI_RSD_UINT32: |
197 | * | 420 | acpi_rs_out_integer32(name, ACPI_GET32(target)); |
198 | * FUNCTION: acpi_rs_dump_start_depend_fns | 421 | break; |
199 | * | ||
200 | * PARAMETERS: Data - pointer to the resource structure to dump. | ||
201 | * | ||
202 | * RETURN: None | ||
203 | * | ||
204 | * DESCRIPTION: Prints out the various members of the Data structure type. | ||
205 | * | ||
206 | ******************************************************************************/ | ||
207 | 422 | ||
208 | static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *data) | 423 | case ACPI_RSD_UINT64: |
209 | { | 424 | acpi_rs_out_integer64(name, ACPI_GET64(target)); |
210 | struct acpi_resource_start_dpf *sdf_data = | 425 | break; |
211 | (struct acpi_resource_start_dpf *)data; | ||
212 | 426 | ||
213 | ACPI_FUNCTION_ENTRY(); | 427 | /* Flags: 1-bit and 2-bit flags supported */ |
214 | 428 | ||
215 | acpi_os_printf("Start Dependent Functions Resource\n"); | 429 | case ACPI_RSD_1BITFLAG: |
430 | acpi_rs_out_string(name, ACPI_CAST_PTR(char, | ||
431 | table-> | ||
432 | pointer[*target & | ||
433 | 0x01])); | ||
434 | break; | ||
216 | 435 | ||
217 | switch (sdf_data->compatibility_priority) { | 436 | case ACPI_RSD_2BITFLAG: |
218 | case ACPI_GOOD_CONFIGURATION: | 437 | acpi_rs_out_string(name, ACPI_CAST_PTR(char, |
219 | acpi_os_printf(" Good configuration\n"); | 438 | table-> |
220 | break; | 439 | pointer[*target & |
440 | 0x03])); | ||
441 | break; | ||
221 | 442 | ||
222 | case ACPI_ACCEPTABLE_CONFIGURATION: | 443 | case ACPI_RSD_SHORTLIST: |
223 | acpi_os_printf(" Acceptable configuration\n"); | 444 | /* |
224 | break; | 445 | * Short byte list (single line output) for DMA and IRQ resources |
446 | * Note: The list length is obtained from the previous table entry | ||
447 | */ | ||
448 | if (previous_target) { | ||
449 | acpi_rs_out_title(name); | ||
450 | acpi_rs_dump_short_byte_list(*previous_target, | ||
451 | target); | ||
452 | } | ||
453 | break; | ||
225 | 454 | ||
226 | case ACPI_SUB_OPTIMAL_CONFIGURATION: | 455 | case ACPI_RSD_LONGLIST: |
227 | acpi_os_printf(" Sub-optimal configuration\n"); | 456 | /* |
228 | break; | 457 | * Long byte list for Vendor resource data |
458 | * Note: The list length is obtained from the previous table entry | ||
459 | */ | ||
460 | if (previous_target) { | ||
461 | acpi_rs_dump_byte_list(ACPI_GET16 | ||
462 | (previous_target), | ||
463 | target); | ||
464 | } | ||
465 | break; | ||
229 | 466 | ||
230 | default: | 467 | case ACPI_RSD_DWORDLIST: |
231 | acpi_os_printf(" Invalid compatibility priority\n"); | 468 | /* |
232 | break; | 469 | * Dword list for Extended Interrupt resources |
233 | } | 470 | * Note: The list length is obtained from the previous table entry |
471 | */ | ||
472 | if (previous_target) { | ||
473 | acpi_rs_dump_dword_list(*previous_target, | ||
474 | ACPI_CAST_PTR(u32, | ||
475 | target)); | ||
476 | } | ||
477 | break; | ||
234 | 478 | ||
235 | switch (sdf_data->performance_robustness) { | 479 | case ACPI_RSD_ADDRESS: |
236 | case ACPI_GOOD_CONFIGURATION: | 480 | /* |
237 | acpi_os_printf(" Good configuration\n"); | 481 | * Common flags for all Address resources |
238 | break; | 482 | */ |
483 | acpi_rs_dump_address_common(ACPI_CAST_PTR | ||
484 | (union acpi_resource_data, | ||
485 | target)); | ||
486 | break; | ||
239 | 487 | ||
240 | case ACPI_ACCEPTABLE_CONFIGURATION: | 488 | case ACPI_RSD_SOURCE: |
241 | acpi_os_printf(" Acceptable configuration\n"); | 489 | /* |
242 | break; | 490 | * Optional resource_source for Address resources |
491 | */ | ||
492 | acpi_rs_dump_resource_source(ACPI_CAST_PTR | ||
493 | (struct | ||
494 | acpi_resource_source, | ||
495 | target)); | ||
496 | break; | ||
243 | 497 | ||
244 | case ACPI_SUB_OPTIMAL_CONFIGURATION: | 498 | default: |
245 | acpi_os_printf(" Sub-optimal configuration\n"); | 499 | acpi_os_printf("**** Invalid table opcode [%X] ****\n", |
246 | break; | 500 | table->opcode); |
501 | return; | ||
502 | } | ||
247 | 503 | ||
248 | default: | 504 | table++; |
249 | acpi_os_printf(" Invalid performance robustness preference\n"); | 505 | count--; |
250 | break; | ||
251 | } | 506 | } |
252 | |||
253 | return; | ||
254 | } | ||
255 | |||
256 | /******************************************************************************* | ||
257 | * | ||
258 | * FUNCTION: acpi_rs_dump_io | ||
259 | * | ||
260 | * PARAMETERS: Data - pointer to the resource structure to dump. | ||
261 | * | ||
262 | * RETURN: None | ||
263 | * | ||
264 | * DESCRIPTION: Prints out the various members of the Data structure type. | ||
265 | * | ||
266 | ******************************************************************************/ | ||
267 | |||
268 | static void acpi_rs_dump_io(union acpi_resource_data *data) | ||
269 | { | ||
270 | struct acpi_resource_io *io_data = (struct acpi_resource_io *)data; | ||
271 | |||
272 | ACPI_FUNCTION_ENTRY(); | ||
273 | |||
274 | acpi_os_printf("Io Resource\n"); | ||
275 | |||
276 | acpi_os_printf(" %d bit decode\n", | ||
277 | ACPI_DECODE_16 == io_data->io_decode ? 16 : 10); | ||
278 | |||
279 | acpi_os_printf(" Range minimum base: %08X\n", | ||
280 | io_data->min_base_address); | ||
281 | |||
282 | acpi_os_printf(" Range maximum base: %08X\n", | ||
283 | io_data->max_base_address); | ||
284 | |||
285 | acpi_os_printf(" Alignment: %08X\n", io_data->alignment); | ||
286 | |||
287 | acpi_os_printf(" Range Length: %08X\n", io_data->range_length); | ||
288 | |||
289 | return; | ||
290 | } | ||
291 | |||
292 | /******************************************************************************* | ||
293 | * | ||
294 | * FUNCTION: acpi_rs_dump_fixed_io | ||
295 | * | ||
296 | * PARAMETERS: Data - pointer to the resource structure to dump. | ||
297 | * | ||
298 | * RETURN: None | ||
299 | * | ||
300 | * DESCRIPTION: Prints out the various members of the Data structure type. | ||
301 | * | ||
302 | ******************************************************************************/ | ||
303 | |||
304 | static void acpi_rs_dump_fixed_io(union acpi_resource_data *data) | ||
305 | { | ||
306 | struct acpi_resource_fixed_io *fixed_io_data = | ||
307 | (struct acpi_resource_fixed_io *)data; | ||
308 | |||
309 | ACPI_FUNCTION_ENTRY(); | ||
310 | |||
311 | acpi_os_printf("Fixed Io Resource\n"); | ||
312 | acpi_os_printf(" Range base address: %08X", | ||
313 | fixed_io_data->base_address); | ||
314 | |||
315 | acpi_os_printf(" Range length: %08X", fixed_io_data->range_length); | ||
316 | |||
317 | return; | ||
318 | } | 507 | } |
319 | 508 | ||
320 | /******************************************************************************* | 509 | /******************************************************************************* |
321 | * | 510 | * |
322 | * FUNCTION: acpi_rs_dump_vendor_specific | 511 | * FUNCTION: acpi_rs_dump_resource_source |
323 | * | 512 | * |
324 | * PARAMETERS: Data - pointer to the resource structure to dump. | 513 | * PARAMETERS: resource_source - Pointer to a Resource Source struct |
325 | * | 514 | * |
326 | * RETURN: None | 515 | * RETURN: None |
327 | * | 516 | * |
328 | * DESCRIPTION: Prints out the various members of the Data structure type. | 517 | * DESCRIPTION: Common routine for dumping the optional resource_source and the |
518 | * corresponding resource_source_index. | ||
329 | * | 519 | * |
330 | ******************************************************************************/ | 520 | ******************************************************************************/ |
331 | 521 | ||
332 | static void acpi_rs_dump_vendor_specific(union acpi_resource_data *data) | 522 | static void |
523 | acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source) | ||
333 | { | 524 | { |
334 | struct acpi_resource_vendor *vendor_data = | ||
335 | (struct acpi_resource_vendor *)data; | ||
336 | u16 index = 0; | ||
337 | |||
338 | ACPI_FUNCTION_ENTRY(); | 525 | ACPI_FUNCTION_ENTRY(); |
339 | 526 | ||
340 | acpi_os_printf("Vendor Specific Resource\n"); | 527 | if (resource_source->index == 0xFF) { |
341 | 528 | return; | |
342 | acpi_os_printf(" Length: %08X\n", vendor_data->length); | ||
343 | |||
344 | for (index = 0; index < vendor_data->length; index++) { | ||
345 | acpi_os_printf(" Byte %X: %08X\n", | ||
346 | index, vendor_data->reserved[index]); | ||
347 | } | 529 | } |
348 | 530 | ||
349 | return; | 531 | acpi_rs_out_integer8("Resource Source Index", resource_source->index); |
350 | } | ||
351 | |||
352 | /******************************************************************************* | ||
353 | * | ||
354 | * FUNCTION: acpi_rs_dump_memory24 | ||
355 | * | ||
356 | * PARAMETERS: Data - pointer to the resource structure to dump. | ||
357 | * | ||
358 | * RETURN: None | ||
359 | * | ||
360 | * DESCRIPTION: Prints out the various members of the Data structure type. | ||
361 | * | ||
362 | ******************************************************************************/ | ||
363 | |||
364 | static void acpi_rs_dump_memory24(union acpi_resource_data *data) | ||
365 | { | ||
366 | struct acpi_resource_mem24 *memory24_data = | ||
367 | (struct acpi_resource_mem24 *)data; | ||
368 | |||
369 | ACPI_FUNCTION_ENTRY(); | ||
370 | |||
371 | acpi_os_printf("24-Bit Memory Range Resource\n"); | ||
372 | |||
373 | acpi_os_printf(" Read%s\n", | ||
374 | ACPI_READ_WRITE_MEMORY == | ||
375 | memory24_data->read_write_attribute ? | ||
376 | "/Write" : " only"); | ||
377 | |||
378 | acpi_os_printf(" Range minimum base: %08X\n", | ||
379 | memory24_data->min_base_address); | ||
380 | |||
381 | acpi_os_printf(" Range maximum base: %08X\n", | ||
382 | memory24_data->max_base_address); | ||
383 | |||
384 | acpi_os_printf(" Alignment: %08X\n", memory24_data->alignment); | ||
385 | |||
386 | acpi_os_printf(" Range length: %08X\n", memory24_data->range_length); | ||
387 | |||
388 | return; | ||
389 | } | ||
390 | |||
391 | /******************************************************************************* | ||
392 | * | ||
393 | * FUNCTION: acpi_rs_dump_memory32 | ||
394 | * | ||
395 | * PARAMETERS: Data - pointer to the resource structure to dump. | ||
396 | * | ||
397 | * RETURN: None | ||
398 | * | ||
399 | * DESCRIPTION: Prints out the various members of the Data structure type. | ||
400 | * | ||
401 | ******************************************************************************/ | ||
402 | |||
403 | static void acpi_rs_dump_memory32(union acpi_resource_data *data) | ||
404 | { | ||
405 | struct acpi_resource_mem32 *memory32_data = | ||
406 | (struct acpi_resource_mem32 *)data; | ||
407 | |||
408 | ACPI_FUNCTION_ENTRY(); | ||
409 | |||
410 | acpi_os_printf("32-Bit Memory Range Resource\n"); | ||
411 | |||
412 | acpi_os_printf(" Read%s\n", | ||
413 | ACPI_READ_WRITE_MEMORY == | ||
414 | memory32_data->read_write_attribute ? | ||
415 | "/Write" : " only"); | ||
416 | |||
417 | acpi_os_printf(" Range minimum base: %08X\n", | ||
418 | memory32_data->min_base_address); | ||
419 | |||
420 | acpi_os_printf(" Range maximum base: %08X\n", | ||
421 | memory32_data->max_base_address); | ||
422 | |||
423 | acpi_os_printf(" Alignment: %08X\n", memory32_data->alignment); | ||
424 | |||
425 | acpi_os_printf(" Range length: %08X\n", memory32_data->range_length); | ||
426 | 532 | ||
427 | return; | 533 | acpi_rs_out_string("Resource Source", |
534 | resource_source->string_ptr ? | ||
535 | resource_source->string_ptr : "[Not Specified]"); | ||
428 | } | 536 | } |
429 | 537 | ||
430 | /******************************************************************************* | 538 | /******************************************************************************* |
431 | * | 539 | * |
432 | * FUNCTION: acpi_rs_dump_fixed_memory32 | 540 | * FUNCTION: acpi_rs_dump_address_common |
433 | * | 541 | * |
434 | * PARAMETERS: Data - pointer to the resource structure to dump. | 542 | * PARAMETERS: Resource - Pointer to an internal resource descriptor |
435 | * | ||
436 | * RETURN: | ||
437 | * | ||
438 | * DESCRIPTION: Prints out the various members of the Data structure type. | ||
439 | * | ||
440 | ******************************************************************************/ | ||
441 | |||
442 | static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *data) | ||
443 | { | ||
444 | struct acpi_resource_fixed_mem32 *fixed_memory32_data = | ||
445 | (struct acpi_resource_fixed_mem32 *)data; | ||
446 | |||
447 | ACPI_FUNCTION_ENTRY(); | ||
448 | |||
449 | acpi_os_printf("32-Bit Fixed Location Memory Range Resource\n"); | ||
450 | |||
451 | acpi_os_printf(" Read%s\n", | ||
452 | ACPI_READ_WRITE_MEMORY == | ||
453 | fixed_memory32_data-> | ||
454 | read_write_attribute ? "/Write" : " Only"); | ||
455 | |||
456 | acpi_os_printf(" Range base address: %08X\n", | ||
457 | fixed_memory32_data->range_base_address); | ||
458 | |||
459 | acpi_os_printf(" Range length: %08X\n", | ||
460 | fixed_memory32_data->range_length); | ||
461 | |||
462 | return; | ||
463 | } | ||
464 | |||
465 | /******************************************************************************* | ||
466 | * | ||
467 | * FUNCTION: acpi_rs_dump_address16 | ||
468 | * | ||
469 | * PARAMETERS: Data - pointer to the resource structure to dump. | ||
470 | * | 543 | * |
471 | * RETURN: None | 544 | * RETURN: None |
472 | * | 545 | * |
473 | * DESCRIPTION: Prints out the various members of the Data structure type. | 546 | * DESCRIPTION: Dump the fields that are common to all Address resource |
547 | * descriptors | ||
474 | * | 548 | * |
475 | ******************************************************************************/ | 549 | ******************************************************************************/ |
476 | 550 | ||
477 | static void acpi_rs_dump_address16(union acpi_resource_data *data) | 551 | static void acpi_rs_dump_address_common(union acpi_resource_data *resource) |
478 | { | 552 | { |
479 | struct acpi_resource_address16 *address16_data = | ||
480 | (struct acpi_resource_address16 *)data; | ||
481 | |||
482 | ACPI_FUNCTION_ENTRY(); | 553 | ACPI_FUNCTION_ENTRY(); |
483 | 554 | ||
484 | acpi_os_printf("16-Bit Address Space Resource\n"); | 555 | /* Decode the type-specific flags */ |
485 | acpi_os_printf(" Resource Type: "); | ||
486 | 556 | ||
487 | switch (address16_data->resource_type) { | 557 | switch (resource->address.resource_type) { |
488 | case ACPI_MEMORY_RANGE: | 558 | case ACPI_MEMORY_RANGE: |
489 | 559 | ||
490 | acpi_os_printf("Memory Range\n"); | 560 | acpi_rs_dump_descriptor(resource, acpi_rs_dump_memory_flags); |
491 | |||
492 | switch (address16_data->attribute.memory.cache_attribute) { | ||
493 | case ACPI_NON_CACHEABLE_MEMORY: | ||
494 | acpi_os_printf | ||
495 | (" Type Specific: Noncacheable memory\n"); | ||
496 | break; | ||
497 | |||
498 | case ACPI_CACHABLE_MEMORY: | ||
499 | acpi_os_printf(" Type Specific: Cacheable memory\n"); | ||
500 | break; | ||
501 | |||
502 | case ACPI_WRITE_COMBINING_MEMORY: | ||
503 | acpi_os_printf | ||
504 | (" Type Specific: Write-combining memory\n"); | ||
505 | break; | ||
506 | |||
507 | case ACPI_PREFETCHABLE_MEMORY: | ||
508 | acpi_os_printf | ||
509 | (" Type Specific: Prefetchable memory\n"); | ||
510 | break; | ||
511 | |||
512 | default: | ||
513 | acpi_os_printf | ||
514 | (" Type Specific: Invalid cache attribute\n"); | ||
515 | break; | ||
516 | } | ||
517 | |||
518 | acpi_os_printf(" Type Specific: Read%s\n", | ||
519 | ACPI_READ_WRITE_MEMORY == | ||
520 | address16_data->attribute.memory. | ||
521 | read_write_attribute ? "/Write" : " Only"); | ||
522 | break; | 561 | break; |
523 | 562 | ||
524 | case ACPI_IO_RANGE: | 563 | case ACPI_IO_RANGE: |
525 | 564 | ||
526 | acpi_os_printf("I/O Range\n"); | 565 | acpi_rs_dump_descriptor(resource, acpi_rs_dump_io_flags); |
527 | |||
528 | switch (address16_data->attribute.io.range_attribute) { | ||
529 | case ACPI_NON_ISA_ONLY_RANGES: | ||
530 | acpi_os_printf | ||
531 | (" Type Specific: Non-ISA Io Addresses\n"); | ||
532 | break; | ||
533 | |||
534 | case ACPI_ISA_ONLY_RANGES: | ||
535 | acpi_os_printf(" Type Specific: ISA Io Addresses\n"); | ||
536 | break; | ||
537 | |||
538 | case ACPI_ENTIRE_RANGE: | ||
539 | acpi_os_printf | ||
540 | (" Type Specific: ISA and non-ISA Io Addresses\n"); | ||
541 | break; | ||
542 | |||
543 | default: | ||
544 | acpi_os_printf | ||
545 | (" Type Specific: Invalid range attribute\n"); | ||
546 | break; | ||
547 | } | ||
548 | |||
549 | acpi_os_printf(" Type Specific: %s Translation\n", | ||
550 | ACPI_SPARSE_TRANSLATION == | ||
551 | address16_data->attribute.io. | ||
552 | translation_attribute ? "Sparse" : "Dense"); | ||
553 | break; | 566 | break; |
554 | 567 | ||
555 | case ACPI_BUS_NUMBER_RANGE: | 568 | case ACPI_BUS_NUMBER_RANGE: |
556 | 569 | ||
557 | acpi_os_printf("Bus Number Range\n"); | 570 | acpi_rs_out_string("Resource Type", "Bus Number Range"); |
558 | break; | 571 | break; |
559 | 572 | ||
560 | default: | 573 | default: |
561 | 574 | ||
562 | acpi_os_printf("0x%2.2X\n", address16_data->resource_type); | 575 | acpi_rs_out_integer8("Resource Type", |
576 | (u8) resource->address.resource_type); | ||
563 | break; | 577 | break; |
564 | } | 578 | } |
565 | 579 | ||
566 | acpi_os_printf(" Resource %s\n", | 580 | /* Decode the general flags */ |
567 | ACPI_CONSUMER == address16_data->producer_consumer ? | ||
568 | "Consumer" : "Producer"); | ||
569 | |||
570 | acpi_os_printf(" %s decode\n", | ||
571 | ACPI_SUB_DECODE == address16_data->decode ? | ||
572 | "Subtractive" : "Positive"); | ||
573 | 581 | ||
574 | acpi_os_printf(" Min address is %s fixed\n", | 582 | acpi_rs_dump_descriptor(resource, acpi_rs_dump_general_flags); |
575 | ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ? | ||
576 | "" : "not"); | ||
577 | |||
578 | acpi_os_printf(" Max address is %s fixed\n", | ||
579 | ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ? | ||
580 | "" : "not"); | ||
581 | |||
582 | acpi_os_printf(" Granularity: %08X\n", address16_data->granularity); | ||
583 | |||
584 | acpi_os_printf(" Address range min: %08X\n", | ||
585 | address16_data->min_address_range); | ||
586 | |||
587 | acpi_os_printf(" Address range max: %08X\n", | ||
588 | address16_data->max_address_range); | ||
589 | |||
590 | acpi_os_printf(" Address translation offset: %08X\n", | ||
591 | address16_data->address_translation_offset); | ||
592 | |||
593 | acpi_os_printf(" Address Length: %08X\n", | ||
594 | address16_data->address_length); | ||
595 | |||
596 | if (0xFF != address16_data->resource_source.index) { | ||
597 | acpi_os_printf(" Resource Source Index: %X\n", | ||
598 | address16_data->resource_source.index); | ||
599 | |||
600 | acpi_os_printf(" Resource Source: %s\n", | ||
601 | address16_data->resource_source.string_ptr); | ||
602 | } | ||
603 | |||
604 | return; | ||
605 | } | 583 | } |
606 | 584 | ||
607 | /******************************************************************************* | 585 | /******************************************************************************* |
608 | * | 586 | * |
609 | * FUNCTION: acpi_rs_dump_address32 | 587 | * FUNCTION: acpi_rs_dump_resource_list |
610 | * | 588 | * |
611 | * PARAMETERS: Data - pointer to the resource structure to dump. | 589 | * PARAMETERS: resource_list - Pointer to a resource descriptor list |
612 | * | 590 | * |
613 | * RETURN: None | 591 | * RETURN: None |
614 | * | 592 | * |
615 | * DESCRIPTION: Prints out the various members of the Data structure type. | 593 | * DESCRIPTION: Dispatches the structure to the correct dump routine. |
616 | * | 594 | * |
617 | ******************************************************************************/ | 595 | ******************************************************************************/ |
618 | 596 | ||
619 | static void acpi_rs_dump_address32(union acpi_resource_data *data) | 597 | void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) |
620 | { | 598 | { |
621 | struct acpi_resource_address32 *address32_data = | 599 | u32 count = 0; |
622 | (struct acpi_resource_address32 *)data; | 600 | u32 type; |
623 | 601 | ||
624 | ACPI_FUNCTION_ENTRY(); | 602 | ACPI_FUNCTION_ENTRY(); |
625 | 603 | ||
626 | acpi_os_printf("32-Bit Address Space Resource\n"); | 604 | if (!(acpi_dbg_level & ACPI_LV_RESOURCES) |
627 | 605 | || !(_COMPONENT & acpi_dbg_layer)) { | |
628 | switch (address32_data->resource_type) { | 606 | return; |
629 | case ACPI_MEMORY_RANGE: | 607 | } |
630 | |||
631 | acpi_os_printf(" Resource Type: Memory Range\n"); | ||
632 | |||
633 | switch (address32_data->attribute.memory.cache_attribute) { | ||
634 | case ACPI_NON_CACHEABLE_MEMORY: | ||
635 | acpi_os_printf | ||
636 | (" Type Specific: Noncacheable memory\n"); | ||
637 | break; | ||
638 | |||
639 | case ACPI_CACHABLE_MEMORY: | ||
640 | acpi_os_printf(" Type Specific: Cacheable memory\n"); | ||
641 | break; | ||
642 | |||
643 | case ACPI_WRITE_COMBINING_MEMORY: | ||
644 | acpi_os_printf | ||
645 | (" Type Specific: Write-combining memory\n"); | ||
646 | break; | ||
647 | |||
648 | case ACPI_PREFETCHABLE_MEMORY: | ||
649 | acpi_os_printf | ||
650 | (" Type Specific: Prefetchable memory\n"); | ||
651 | break; | ||
652 | |||
653 | default: | ||
654 | acpi_os_printf | ||
655 | (" Type Specific: Invalid cache attribute\n"); | ||
656 | break; | ||
657 | } | ||
658 | |||
659 | acpi_os_printf(" Type Specific: Read%s\n", | ||
660 | ACPI_READ_WRITE_MEMORY == | ||
661 | address32_data->attribute.memory. | ||
662 | read_write_attribute ? "/Write" : " Only"); | ||
663 | break; | ||
664 | |||
665 | case ACPI_IO_RANGE: | ||
666 | |||
667 | acpi_os_printf(" Resource Type: Io Range\n"); | ||
668 | 608 | ||
669 | switch (address32_data->attribute.io.range_attribute) { | 609 | /* Walk list and dump all resource descriptors (END_TAG terminates) */ |
670 | case ACPI_NON_ISA_ONLY_RANGES: | ||
671 | acpi_os_printf | ||
672 | (" Type Specific: Non-ISA Io Addresses\n"); | ||
673 | break; | ||
674 | 610 | ||
675 | case ACPI_ISA_ONLY_RANGES: | 611 | do { |
676 | acpi_os_printf(" Type Specific: ISA Io Addresses\n"); | 612 | acpi_os_printf("\n[%02X] ", count); |
677 | break; | 613 | count++; |
678 | 614 | ||
679 | case ACPI_ENTIRE_RANGE: | 615 | /* Validate Type before dispatch */ |
680 | acpi_os_printf | ||
681 | (" Type Specific: ISA and non-ISA Io Addresses\n"); | ||
682 | break; | ||
683 | 616 | ||
684 | default: | 617 | type = resource_list->type; |
618 | if (type > ACPI_RESOURCE_TYPE_MAX) { | ||
685 | acpi_os_printf | 619 | acpi_os_printf |
686 | (" Type Specific: Invalid Range attribute"); | 620 | ("Invalid descriptor type (%X) in resource list\n", |
687 | break; | 621 | resource_list->type); |
622 | return; | ||
688 | } | 623 | } |
689 | 624 | ||
690 | acpi_os_printf(" Type Specific: %s Translation\n", | 625 | /* Dump the resource descriptor */ |
691 | ACPI_SPARSE_TRANSLATION == | ||
692 | address32_data->attribute.io. | ||
693 | translation_attribute ? "Sparse" : "Dense"); | ||
694 | break; | ||
695 | |||
696 | case ACPI_BUS_NUMBER_RANGE: | ||
697 | |||
698 | acpi_os_printf(" Resource Type: Bus Number Range\n"); | ||
699 | break; | ||
700 | |||
701 | default: | ||
702 | |||
703 | acpi_os_printf(" Resource Type: 0x%2.2X\n", | ||
704 | address32_data->resource_type); | ||
705 | break; | ||
706 | } | ||
707 | |||
708 | acpi_os_printf(" Resource %s\n", | ||
709 | ACPI_CONSUMER == address32_data->producer_consumer ? | ||
710 | "Consumer" : "Producer"); | ||
711 | |||
712 | acpi_os_printf(" %s decode\n", | ||
713 | ACPI_SUB_DECODE == address32_data->decode ? | ||
714 | "Subtractive" : "Positive"); | ||
715 | |||
716 | acpi_os_printf(" Min address is %s fixed\n", | ||
717 | ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ? | ||
718 | "" : "not "); | ||
719 | |||
720 | acpi_os_printf(" Max address is %s fixed\n", | ||
721 | ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ? | ||
722 | "" : "not "); | ||
723 | 626 | ||
724 | acpi_os_printf(" Granularity: %08X\n", address32_data->granularity); | 627 | acpi_rs_dump_descriptor(&resource_list->data, |
628 | acpi_gbl_dump_resource_dispatch[type]); | ||
725 | 629 | ||
726 | acpi_os_printf(" Address range min: %08X\n", | 630 | /* Point to the next resource structure */ |
727 | address32_data->min_address_range); | ||
728 | 631 | ||
729 | acpi_os_printf(" Address range max: %08X\n", | 632 | resource_list = |
730 | address32_data->max_address_range); | 633 | ACPI_ADD_PTR(struct acpi_resource, resource_list, |
634 | resource_list->length); | ||
731 | 635 | ||
732 | acpi_os_printf(" Address translation offset: %08X\n", | 636 | /* Exit when END_TAG descriptor is reached */ |
733 | address32_data->address_translation_offset); | ||
734 | 637 | ||
735 | acpi_os_printf(" Address Length: %08X\n", | 638 | } while (type != ACPI_RESOURCE_TYPE_END_TAG); |
736 | address32_data->address_length); | ||
737 | |||
738 | if (0xFF != address32_data->resource_source.index) { | ||
739 | acpi_os_printf(" Resource Source Index: %X\n", | ||
740 | address32_data->resource_source.index); | ||
741 | |||
742 | acpi_os_printf(" Resource Source: %s\n", | ||
743 | address32_data->resource_source.string_ptr); | ||
744 | } | ||
745 | |||
746 | return; | ||
747 | } | 639 | } |
748 | 640 | ||
749 | /******************************************************************************* | 641 | /******************************************************************************* |
750 | * | 642 | * |
751 | * FUNCTION: acpi_rs_dump_address64 | 643 | * FUNCTION: acpi_rs_dump_irq_list |
752 | * | 644 | * |
753 | * PARAMETERS: Data - pointer to the resource structure to dump. | 645 | * PARAMETERS: route_table - Pointer to the routing table to dump. |
754 | * | 646 | * |
755 | * RETURN: None | 647 | * RETURN: None |
756 | * | 648 | * |
757 | * DESCRIPTION: Prints out the various members of the Data structure type. | 649 | * DESCRIPTION: Print IRQ routing table |
758 | * | 650 | * |
759 | ******************************************************************************/ | 651 | ******************************************************************************/ |
760 | 652 | ||
761 | static void acpi_rs_dump_address64(union acpi_resource_data *data) | 653 | void acpi_rs_dump_irq_list(u8 * route_table) |
762 | { | 654 | { |
763 | struct acpi_resource_address64 *address64_data = | 655 | struct acpi_pci_routing_table *prt_element; |
764 | (struct acpi_resource_address64 *)data; | 656 | u8 count; |
765 | 657 | ||
766 | ACPI_FUNCTION_ENTRY(); | 658 | ACPI_FUNCTION_ENTRY(); |
767 | 659 | ||
768 | acpi_os_printf("64-Bit Address Space Resource\n"); | 660 | if (!(acpi_dbg_level & ACPI_LV_RESOURCES) |
769 | 661 | || !(_COMPONENT & acpi_dbg_layer)) { | |
770 | switch (address64_data->resource_type) { | 662 | return; |
771 | case ACPI_MEMORY_RANGE: | ||
772 | |||
773 | acpi_os_printf(" Resource Type: Memory Range\n"); | ||
774 | |||
775 | switch (address64_data->attribute.memory.cache_attribute) { | ||
776 | case ACPI_NON_CACHEABLE_MEMORY: | ||
777 | acpi_os_printf | ||
778 | (" Type Specific: Noncacheable memory\n"); | ||
779 | break; | ||
780 | |||
781 | case ACPI_CACHABLE_MEMORY: | ||
782 | acpi_os_printf(" Type Specific: Cacheable memory\n"); | ||
783 | break; | ||
784 | |||
785 | case ACPI_WRITE_COMBINING_MEMORY: | ||
786 | acpi_os_printf | ||
787 | (" Type Specific: Write-combining memory\n"); | ||
788 | break; | ||
789 | |||
790 | case ACPI_PREFETCHABLE_MEMORY: | ||
791 | acpi_os_printf | ||
792 | (" Type Specific: Prefetchable memory\n"); | ||
793 | break; | ||
794 | |||
795 | default: | ||
796 | acpi_os_printf | ||
797 | (" Type Specific: Invalid cache attribute\n"); | ||
798 | break; | ||
799 | } | ||
800 | |||
801 | acpi_os_printf(" Type Specific: Read%s\n", | ||
802 | ACPI_READ_WRITE_MEMORY == | ||
803 | address64_data->attribute.memory. | ||
804 | read_write_attribute ? "/Write" : " Only"); | ||
805 | break; | ||
806 | |||
807 | case ACPI_IO_RANGE: | ||
808 | |||
809 | acpi_os_printf(" Resource Type: Io Range\n"); | ||
810 | |||
811 | switch (address64_data->attribute.io.range_attribute) { | ||
812 | case ACPI_NON_ISA_ONLY_RANGES: | ||
813 | acpi_os_printf | ||
814 | (" Type Specific: Non-ISA Io Addresses\n"); | ||
815 | break; | ||
816 | |||
817 | case ACPI_ISA_ONLY_RANGES: | ||
818 | acpi_os_printf(" Type Specific: ISA Io Addresses\n"); | ||
819 | break; | ||
820 | |||
821 | case ACPI_ENTIRE_RANGE: | ||
822 | acpi_os_printf | ||
823 | (" Type Specific: ISA and non-ISA Io Addresses\n"); | ||
824 | break; | ||
825 | |||
826 | default: | ||
827 | acpi_os_printf | ||
828 | (" Type Specific: Invalid Range attribute"); | ||
829 | break; | ||
830 | } | ||
831 | |||
832 | acpi_os_printf(" Type Specific: %s Translation\n", | ||
833 | ACPI_SPARSE_TRANSLATION == | ||
834 | address64_data->attribute.io. | ||
835 | translation_attribute ? "Sparse" : "Dense"); | ||
836 | break; | ||
837 | |||
838 | case ACPI_BUS_NUMBER_RANGE: | ||
839 | |||
840 | acpi_os_printf(" Resource Type: Bus Number Range\n"); | ||
841 | break; | ||
842 | |||
843 | default: | ||
844 | |||
845 | acpi_os_printf(" Resource Type: 0x%2.2X\n", | ||
846 | address64_data->resource_type); | ||
847 | break; | ||
848 | } | 663 | } |
849 | 664 | ||
850 | acpi_os_printf(" Resource %s\n", | 665 | prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, route_table); |
851 | ACPI_CONSUMER == address64_data->producer_consumer ? | ||
852 | "Consumer" : "Producer"); | ||
853 | |||
854 | acpi_os_printf(" %s decode\n", | ||
855 | ACPI_SUB_DECODE == address64_data->decode ? | ||
856 | "Subtractive" : "Positive"); | ||
857 | |||
858 | acpi_os_printf(" Min address is %s fixed\n", | ||
859 | ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ? | ||
860 | "" : "not "); | ||
861 | |||
862 | acpi_os_printf(" Max address is %s fixed\n", | ||
863 | ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ? | ||
864 | "" : "not "); | ||
865 | 666 | ||
866 | acpi_os_printf(" Granularity: %8.8X%8.8X\n", | 667 | /* Dump all table elements, Exit on zero length element */ |
867 | ACPI_FORMAT_UINT64(address64_data->granularity)); | ||
868 | 668 | ||
869 | acpi_os_printf(" Address range min: %8.8X%8.8X\n", | 669 | for (count = 0; prt_element->length; count++) { |
870 | ACPI_FORMAT_UINT64(address64_data->min_address_range)); | 670 | acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n", |
671 | count); | ||
672 | acpi_rs_dump_descriptor(prt_element, acpi_rs_dump_prt); | ||
871 | 673 | ||
872 | acpi_os_printf(" Address range max: %8.8X%8.8X\n", | 674 | prt_element = ACPI_ADD_PTR(struct acpi_pci_routing_table, |
873 | ACPI_FORMAT_UINT64(address64_data->max_address_range)); | 675 | prt_element, prt_element->length); |
874 | |||
875 | acpi_os_printf(" Address translation offset: %8.8X%8.8X\n", | ||
876 | ACPI_FORMAT_UINT64(address64_data-> | ||
877 | address_translation_offset)); | ||
878 | |||
879 | acpi_os_printf(" Address Length: %8.8X%8.8X\n", | ||
880 | ACPI_FORMAT_UINT64(address64_data->address_length)); | ||
881 | |||
882 | acpi_os_printf(" Type Specific Attributes: %8.8X%8.8X\n", | ||
883 | ACPI_FORMAT_UINT64(address64_data-> | ||
884 | type_specific_attributes)); | ||
885 | |||
886 | if (0xFF != address64_data->resource_source.index) { | ||
887 | acpi_os_printf(" Resource Source Index: %X\n", | ||
888 | address64_data->resource_source.index); | ||
889 | |||
890 | acpi_os_printf(" Resource Source: %s\n", | ||
891 | address64_data->resource_source.string_ptr); | ||
892 | } | 676 | } |
893 | |||
894 | return; | ||
895 | } | 677 | } |
896 | 678 | ||
897 | /******************************************************************************* | 679 | /******************************************************************************* |
898 | * | 680 | * |
899 | * FUNCTION: acpi_rs_dump_extended_irq | 681 | * FUNCTION: acpi_rs_out* |
900 | * | 682 | * |
901 | * PARAMETERS: Data - pointer to the resource structure to dump. | 683 | * PARAMETERS: Title - Name of the resource field |
684 | * Value - Value of the resource field | ||
902 | * | 685 | * |
903 | * RETURN: None | 686 | * RETURN: None |
904 | * | 687 | * |
905 | * DESCRIPTION: Prints out the various members of the Data structure type. | 688 | * DESCRIPTION: Miscellaneous helper functions to consistently format the |
689 | * output of the resource dump routines | ||
906 | * | 690 | * |
907 | ******************************************************************************/ | 691 | ******************************************************************************/ |
908 | 692 | ||
909 | static void acpi_rs_dump_extended_irq(union acpi_resource_data *data) | 693 | static void acpi_rs_out_string(char *title, char *value) |
910 | { | 694 | { |
911 | struct acpi_resource_ext_irq *ext_irq_data = | 695 | acpi_os_printf("%27s : %s\n", title, value); |
912 | (struct acpi_resource_ext_irq *)data; | 696 | } |
913 | u8 index = 0; | ||
914 | |||
915 | ACPI_FUNCTION_ENTRY(); | ||
916 | |||
917 | acpi_os_printf("Extended IRQ Resource\n"); | ||
918 | |||
919 | acpi_os_printf(" Resource %s\n", | ||
920 | ACPI_CONSUMER == ext_irq_data->producer_consumer ? | ||
921 | "Consumer" : "Producer"); | ||
922 | |||
923 | acpi_os_printf(" %s\n", | ||
924 | ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ? | ||
925 | "Level" : "Edge"); | ||
926 | |||
927 | acpi_os_printf(" Active %s\n", | ||
928 | ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ? | ||
929 | "low" : "high"); | ||
930 | |||
931 | acpi_os_printf(" %s\n", | ||
932 | ACPI_SHARED == ext_irq_data->shared_exclusive ? | ||
933 | "Shared" : "Exclusive"); | ||
934 | |||
935 | acpi_os_printf(" Interrupts : %X ( ", | ||
936 | ext_irq_data->number_of_interrupts); | ||
937 | 697 | ||
938 | for (index = 0; index < ext_irq_data->number_of_interrupts; index++) { | 698 | static void acpi_rs_out_integer8(char *title, u8 value) |
939 | acpi_os_printf("%X ", ext_irq_data->interrupts[index]); | 699 | { |
940 | } | 700 | acpi_os_printf("%27s : %2.2X\n", title, value); |
701 | } | ||
941 | 702 | ||
942 | acpi_os_printf(")\n"); | 703 | static void acpi_rs_out_integer16(char *title, u16 value) |
704 | { | ||
705 | acpi_os_printf("%27s : %4.4X\n", title, value); | ||
706 | } | ||
943 | 707 | ||
944 | if (0xFF != ext_irq_data->resource_source.index) { | 708 | static void acpi_rs_out_integer32(char *title, u32 value) |
945 | acpi_os_printf(" Resource Source Index: %X", | 709 | { |
946 | ext_irq_data->resource_source.index); | 710 | acpi_os_printf("%27s : %8.8X\n", title, value); |
711 | } | ||
947 | 712 | ||
948 | acpi_os_printf(" Resource Source: %s", | 713 | static void acpi_rs_out_integer64(char *title, u64 value) |
949 | ext_irq_data->resource_source.string_ptr); | 714 | { |
950 | } | 715 | acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); |
716 | } | ||
951 | 717 | ||
952 | return; | 718 | static void acpi_rs_out_title(char *title) |
719 | { | ||
720 | acpi_os_printf("%27s : ", title); | ||
953 | } | 721 | } |
954 | 722 | ||
955 | /******************************************************************************* | 723 | /******************************************************************************* |
956 | * | 724 | * |
957 | * FUNCTION: acpi_rs_dump_resource_list | 725 | * FUNCTION: acpi_rs_dump*List |
958 | * | 726 | * |
959 | * PARAMETERS: Resource - pointer to the resource structure to dump. | 727 | * PARAMETERS: Length - Number of elements in the list |
728 | * Data - Start of the list | ||
960 | * | 729 | * |
961 | * RETURN: None | 730 | * RETURN: None |
962 | * | 731 | * |
963 | * DESCRIPTION: Dispatches the structure to the correct dump routine. | 732 | * DESCRIPTION: Miscellaneous functions to dump lists of raw data |
964 | * | 733 | * |
965 | ******************************************************************************/ | 734 | ******************************************************************************/ |
966 | 735 | ||
967 | void acpi_rs_dump_resource_list(struct acpi_resource *resource) | 736 | static void acpi_rs_dump_byte_list(u16 length, u8 * data) |
968 | { | 737 | { |
969 | u8 count = 0; | 738 | u8 i; |
970 | u8 done = FALSE; | ||
971 | |||
972 | ACPI_FUNCTION_ENTRY(); | ||
973 | |||
974 | if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) { | ||
975 | while (!done) { | ||
976 | acpi_os_printf("Resource structure %X.\n", count++); | ||
977 | |||
978 | switch (resource->id) { | ||
979 | case ACPI_RSTYPE_IRQ: | ||
980 | acpi_rs_dump_irq(&resource->data); | ||
981 | break; | ||
982 | |||
983 | case ACPI_RSTYPE_DMA: | ||
984 | acpi_rs_dump_dma(&resource->data); | ||
985 | break; | ||
986 | |||
987 | case ACPI_RSTYPE_START_DPF: | ||
988 | acpi_rs_dump_start_depend_fns(&resource->data); | ||
989 | break; | ||
990 | |||
991 | case ACPI_RSTYPE_END_DPF: | ||
992 | acpi_os_printf | ||
993 | ("end_dependent_functions Resource\n"); | ||
994 | /* acpi_rs_dump_end_dependent_functions (Resource->Data); */ | ||
995 | break; | ||
996 | |||
997 | case ACPI_RSTYPE_IO: | ||
998 | acpi_rs_dump_io(&resource->data); | ||
999 | break; | ||
1000 | |||
1001 | case ACPI_RSTYPE_FIXED_IO: | ||
1002 | acpi_rs_dump_fixed_io(&resource->data); | ||
1003 | break; | ||
1004 | |||
1005 | case ACPI_RSTYPE_VENDOR: | ||
1006 | acpi_rs_dump_vendor_specific(&resource->data); | ||
1007 | break; | ||
1008 | 739 | ||
1009 | case ACPI_RSTYPE_END_TAG: | 740 | for (i = 0; i < length; i++) { |
1010 | /*rs_dump_end_tag (Resource->Data); */ | 741 | acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]); |
1011 | acpi_os_printf("end_tag Resource\n"); | ||
1012 | done = TRUE; | ||
1013 | break; | ||
1014 | |||
1015 | case ACPI_RSTYPE_MEM24: | ||
1016 | acpi_rs_dump_memory24(&resource->data); | ||
1017 | break; | ||
1018 | |||
1019 | case ACPI_RSTYPE_MEM32: | ||
1020 | acpi_rs_dump_memory32(&resource->data); | ||
1021 | break; | ||
1022 | |||
1023 | case ACPI_RSTYPE_FIXED_MEM32: | ||
1024 | acpi_rs_dump_fixed_memory32(&resource->data); | ||
1025 | break; | ||
1026 | |||
1027 | case ACPI_RSTYPE_ADDRESS16: | ||
1028 | acpi_rs_dump_address16(&resource->data); | ||
1029 | break; | ||
1030 | |||
1031 | case ACPI_RSTYPE_ADDRESS32: | ||
1032 | acpi_rs_dump_address32(&resource->data); | ||
1033 | break; | ||
1034 | |||
1035 | case ACPI_RSTYPE_ADDRESS64: | ||
1036 | acpi_rs_dump_address64(&resource->data); | ||
1037 | break; | ||
1038 | |||
1039 | case ACPI_RSTYPE_EXT_IRQ: | ||
1040 | acpi_rs_dump_extended_irq(&resource->data); | ||
1041 | break; | ||
1042 | |||
1043 | default: | ||
1044 | acpi_os_printf("Invalid resource type\n"); | ||
1045 | break; | ||
1046 | |||
1047 | } | ||
1048 | |||
1049 | resource = | ||
1050 | ACPI_PTR_ADD(struct acpi_resource, resource, | ||
1051 | resource->length); | ||
1052 | } | ||
1053 | } | 742 | } |
1054 | |||
1055 | return; | ||
1056 | } | 743 | } |
1057 | 744 | ||
1058 | /******************************************************************************* | 745 | static void acpi_rs_dump_short_byte_list(u8 length, u8 * data) |
1059 | * | ||
1060 | * FUNCTION: acpi_rs_dump_irq_list | ||
1061 | * | ||
1062 | * PARAMETERS: route_table - pointer to the routing table to dump. | ||
1063 | * | ||
1064 | * RETURN: None | ||
1065 | * | ||
1066 | * DESCRIPTION: Dispatches the structures to the correct dump routine. | ||
1067 | * | ||
1068 | ******************************************************************************/ | ||
1069 | |||
1070 | void acpi_rs_dump_irq_list(u8 * route_table) | ||
1071 | { | 746 | { |
1072 | u8 *buffer = route_table; | 747 | u8 i; |
1073 | u8 count = 0; | ||
1074 | u8 done = FALSE; | ||
1075 | struct acpi_pci_routing_table *prt_element; | ||
1076 | 748 | ||
1077 | ACPI_FUNCTION_ENTRY(); | 749 | for (i = 0; i < length; i++) { |
1078 | 750 | acpi_os_printf("%X ", data[i]); | |
1079 | if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) { | 751 | } |
1080 | prt_element = | 752 | acpi_os_printf("\n"); |
1081 | ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); | 753 | } |
1082 | |||
1083 | while (!done) { | ||
1084 | acpi_os_printf("PCI IRQ Routing Table structure %X.\n", | ||
1085 | count++); | ||
1086 | |||
1087 | acpi_os_printf(" Address: %8.8X%8.8X\n", | ||
1088 | ACPI_FORMAT_UINT64(prt_element-> | ||
1089 | address)); | ||
1090 | |||
1091 | acpi_os_printf(" Pin: %X\n", prt_element->pin); | ||
1092 | |||
1093 | acpi_os_printf(" Source: %s\n", prt_element->source); | ||
1094 | 754 | ||
1095 | acpi_os_printf(" source_index: %X\n", | 755 | static void acpi_rs_dump_dword_list(u8 length, u32 * data) |
1096 | prt_element->source_index); | 756 | { |
757 | u8 i; | ||
1097 | 758 | ||
1098 | buffer += prt_element->length; | 759 | for (i = 0; i < length; i++) { |
1099 | prt_element = | 760 | acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]); |
1100 | ACPI_CAST_PTR(struct acpi_pci_routing_table, | ||
1101 | buffer); | ||
1102 | if (0 == prt_element->length) { | ||
1103 | done = TRUE; | ||
1104 | } | ||
1105 | } | ||
1106 | } | 761 | } |
1107 | |||
1108 | return; | ||
1109 | } | 762 | } |
1110 | 763 | ||
1111 | #endif | 764 | #endif |
diff --git a/drivers/acpi/resources/rsinfo.c b/drivers/acpi/resources/rsinfo.c new file mode 100644 index 000000000000..623b06689336 --- /dev/null +++ b/drivers/acpi/resources/rsinfo.c | |||
@@ -0,0 +1,204 @@ | |||
1 | /******************************************************************************* | ||
2 | * | ||
3 | * Module Name: rsinfo - Dispatch and Info tables | ||
4 | * | ||
5 | ******************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include <acpi/acresrc.h> | ||
46 | |||
47 | #define _COMPONENT ACPI_RESOURCES | ||
48 | ACPI_MODULE_NAME("rsinfo") | ||
49 | |||
50 | /* | ||
51 | * Resource dispatch and information tables. Any new resource types (either | ||
52 | * Large or Small) must be reflected in each of these tables, so they are here | ||
53 | * in one place. | ||
54 | * | ||
55 | * The tables for Large descriptors are indexed by bits 6:0 of the AML | ||
56 | * descriptor type byte. The tables for Small descriptors are indexed by | ||
57 | * bits 6:3 of the descriptor byte. The tables for internal resource | ||
58 | * descriptors are indexed by the acpi_resource_type field. | ||
59 | */ | ||
60 | /* Dispatch table for resource-to-AML (Set Resource) conversion functions */ | ||
61 | struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[] = { | ||
62 | acpi_rs_set_irq, /* 0x00, ACPI_RESOURCE_TYPE_IRQ */ | ||
63 | acpi_rs_convert_dma, /* 0x01, ACPI_RESOURCE_TYPE_DMA */ | ||
64 | acpi_rs_set_start_dpf, /* 0x02, ACPI_RESOURCE_TYPE_START_DEPENDENT */ | ||
65 | acpi_rs_convert_end_dpf, /* 0x03, ACPI_RESOURCE_TYPE_END_DEPENDENT */ | ||
66 | acpi_rs_convert_io, /* 0x04, ACPI_RESOURCE_TYPE_IO */ | ||
67 | acpi_rs_convert_fixed_io, /* 0x05, ACPI_RESOURCE_TYPE_FIXED_IO */ | ||
68 | acpi_rs_set_vendor, /* 0x06, ACPI_RESOURCE_TYPE_VENDOR */ | ||
69 | acpi_rs_convert_end_tag, /* 0x07, ACPI_RESOURCE_TYPE_END_TAG */ | ||
70 | acpi_rs_convert_memory24, /* 0x08, ACPI_RESOURCE_TYPE_MEMORY24 */ | ||
71 | acpi_rs_convert_memory32, /* 0x09, ACPI_RESOURCE_TYPE_MEMORY32 */ | ||
72 | acpi_rs_convert_fixed_memory32, /* 0x0A, ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ | ||
73 | acpi_rs_convert_address16, /* 0x0B, ACPI_RESOURCE_TYPE_ADDRESS16 */ | ||
74 | acpi_rs_convert_address32, /* 0x0C, ACPI_RESOURCE_TYPE_ADDRESS32 */ | ||
75 | acpi_rs_convert_address64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */ | ||
76 | acpi_rs_convert_ext_address64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ | ||
77 | acpi_rs_convert_ext_irq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ | ||
78 | acpi_rs_convert_generic_reg /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ | ||
79 | }; | ||
80 | |||
81 | /* Dispatch tables for AML-to-resource (Get Resource) conversion functions */ | ||
82 | |||
83 | struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[] = { | ||
84 | /* Small descriptors */ | ||
85 | |||
86 | NULL, /* 0x00, Reserved */ | ||
87 | NULL, /* 0x01, Reserved */ | ||
88 | NULL, /* 0x02, Reserved */ | ||
89 | NULL, /* 0x03, Reserved */ | ||
90 | acpi_rs_get_irq, /* 0x04, ACPI_RESOURCE_NAME_IRQ */ | ||
91 | acpi_rs_convert_dma, /* 0x05, ACPI_RESOURCE_NAME_DMA */ | ||
92 | acpi_rs_get_start_dpf, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */ | ||
93 | acpi_rs_convert_end_dpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */ | ||
94 | acpi_rs_convert_io, /* 0x08, ACPI_RESOURCE_NAME_IO */ | ||
95 | acpi_rs_convert_fixed_io, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */ | ||
96 | NULL, /* 0x0A, Reserved */ | ||
97 | NULL, /* 0x0B, Reserved */ | ||
98 | NULL, /* 0x0C, Reserved */ | ||
99 | NULL, /* 0x0D, Reserved */ | ||
100 | acpi_rs_get_vendor_small, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */ | ||
101 | acpi_rs_convert_end_tag, /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */ | ||
102 | |||
103 | /* Large descriptors */ | ||
104 | |||
105 | NULL, /* 0x00, Reserved */ | ||
106 | acpi_rs_convert_memory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */ | ||
107 | acpi_rs_convert_generic_reg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */ | ||
108 | NULL, /* 0x03, Reserved */ | ||
109 | acpi_rs_get_vendor_large, /* 0x04, ACPI_RESOURCE_NAME_VENDOR_LARGE */ | ||
110 | acpi_rs_convert_memory32, /* 0x05, ACPI_RESOURCE_NAME_MEMORY32 */ | ||
111 | acpi_rs_convert_fixed_memory32, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY32 */ | ||
112 | acpi_rs_convert_address32, /* 0x07, ACPI_RESOURCE_NAME_ADDRESS32 */ | ||
113 | acpi_rs_convert_address16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */ | ||
114 | acpi_rs_convert_ext_irq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */ | ||
115 | acpi_rs_convert_address64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */ | ||
116 | acpi_rs_convert_ext_address64 /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ | ||
117 | }; | ||
118 | |||
119 | #ifdef ACPI_FUTURE_USAGE | ||
120 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
121 | |||
122 | /* Dispatch table for resource dump functions */ | ||
123 | |||
124 | struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[] = { | ||
125 | acpi_rs_dump_irq, /* ACPI_RESOURCE_TYPE_IRQ */ | ||
126 | acpi_rs_dump_dma, /* ACPI_RESOURCE_TYPE_DMA */ | ||
127 | acpi_rs_dump_start_dpf, /* ACPI_RESOURCE_TYPE_START_DEPENDENT */ | ||
128 | acpi_rs_dump_end_dpf, /* ACPI_RESOURCE_TYPE_END_DEPENDENT */ | ||
129 | acpi_rs_dump_io, /* ACPI_RESOURCE_TYPE_IO */ | ||
130 | acpi_rs_dump_fixed_io, /* ACPI_RESOURCE_TYPE_FIXED_IO */ | ||
131 | acpi_rs_dump_vendor, /* ACPI_RESOURCE_TYPE_VENDOR */ | ||
132 | acpi_rs_dump_end_tag, /* ACPI_RESOURCE_TYPE_END_TAG */ | ||
133 | acpi_rs_dump_memory24, /* ACPI_RESOURCE_TYPE_MEMORY24 */ | ||
134 | acpi_rs_dump_memory32, /* ACPI_RESOURCE_TYPE_MEMORY32 */ | ||
135 | acpi_rs_dump_fixed_memory32, /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ | ||
136 | acpi_rs_dump_address16, /* ACPI_RESOURCE_TYPE_ADDRESS16 */ | ||
137 | acpi_rs_dump_address32, /* ACPI_RESOURCE_TYPE_ADDRESS32 */ | ||
138 | acpi_rs_dump_address64, /* ACPI_RESOURCE_TYPE_ADDRESS64 */ | ||
139 | acpi_rs_dump_ext_address64, /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ | ||
140 | acpi_rs_dump_ext_irq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ | ||
141 | acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ | ||
142 | }; | ||
143 | #endif | ||
144 | #endif /* ACPI_FUTURE_USAGE */ | ||
145 | /* | ||
146 | * Base sizes for external AML resource descriptors, indexed by internal type. | ||
147 | * Includes size of the descriptor header (1 byte for small descriptors, | ||
148 | * 3 bytes for large descriptors) | ||
149 | */ | ||
150 | const u8 acpi_gbl_aml_resource_sizes[] = { | ||
151 | sizeof(struct aml_resource_irq), /* ACPI_RESOURCE_TYPE_IRQ (optional Byte 3 always created) */ | ||
152 | sizeof(struct aml_resource_dma), /* ACPI_RESOURCE_TYPE_DMA */ | ||
153 | sizeof(struct aml_resource_start_dependent), /* ACPI_RESOURCE_TYPE_START_DEPENDENT (optional Byte 1 always created) */ | ||
154 | sizeof(struct aml_resource_end_dependent), /* ACPI_RESOURCE_TYPE_END_DEPENDENT */ | ||
155 | sizeof(struct aml_resource_io), /* ACPI_RESOURCE_TYPE_IO */ | ||
156 | sizeof(struct aml_resource_fixed_io), /* ACPI_RESOURCE_TYPE_FIXED_IO */ | ||
157 | sizeof(struct aml_resource_vendor_small), /* ACPI_RESOURCE_TYPE_VENDOR */ | ||
158 | sizeof(struct aml_resource_end_tag), /* ACPI_RESOURCE_TYPE_END_TAG */ | ||
159 | sizeof(struct aml_resource_memory24), /* ACPI_RESOURCE_TYPE_MEMORY24 */ | ||
160 | sizeof(struct aml_resource_memory32), /* ACPI_RESOURCE_TYPE_MEMORY32 */ | ||
161 | sizeof(struct aml_resource_fixed_memory32), /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ | ||
162 | sizeof(struct aml_resource_address16), /* ACPI_RESOURCE_TYPE_ADDRESS16 */ | ||
163 | sizeof(struct aml_resource_address32), /* ACPI_RESOURCE_TYPE_ADDRESS32 */ | ||
164 | sizeof(struct aml_resource_address64), /* ACPI_RESOURCE_TYPE_ADDRESS64 */ | ||
165 | sizeof(struct aml_resource_extended_address64), /*ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ | ||
166 | sizeof(struct aml_resource_extended_irq), /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ | ||
167 | sizeof(struct aml_resource_generic_register) /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ | ||
168 | }; | ||
169 | |||
170 | const u8 acpi_gbl_resource_struct_sizes[] = { | ||
171 | /* Small descriptors */ | ||
172 | |||
173 | 0, | ||
174 | 0, | ||
175 | 0, | ||
176 | 0, | ||
177 | ACPI_RS_SIZE(struct acpi_resource_irq), | ||
178 | ACPI_RS_SIZE(struct acpi_resource_dma), | ||
179 | ACPI_RS_SIZE(struct acpi_resource_start_dependent), | ||
180 | ACPI_RS_SIZE_MIN, | ||
181 | ACPI_RS_SIZE(struct acpi_resource_io), | ||
182 | ACPI_RS_SIZE(struct acpi_resource_fixed_io), | ||
183 | 0, | ||
184 | 0, | ||
185 | 0, | ||
186 | 0, | ||
187 | ACPI_RS_SIZE(struct acpi_resource_vendor), | ||
188 | ACPI_RS_SIZE_MIN, | ||
189 | |||
190 | /* Large descriptors */ | ||
191 | |||
192 | 0, | ||
193 | ACPI_RS_SIZE(struct acpi_resource_memory24), | ||
194 | ACPI_RS_SIZE(struct acpi_resource_generic_register), | ||
195 | 0, | ||
196 | ACPI_RS_SIZE(struct acpi_resource_vendor), | ||
197 | ACPI_RS_SIZE(struct acpi_resource_memory32), | ||
198 | ACPI_RS_SIZE(struct acpi_resource_fixed_memory32), | ||
199 | ACPI_RS_SIZE(struct acpi_resource_address32), | ||
200 | ACPI_RS_SIZE(struct acpi_resource_address16), | ||
201 | ACPI_RS_SIZE(struct acpi_resource_extended_irq), | ||
202 | ACPI_RS_SIZE(struct acpi_resource_address64), | ||
203 | ACPI_RS_SIZE(struct acpi_resource_extended_address64) | ||
204 | }; | ||
diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c index d53bbe89e851..ef24ba110c6e 100644 --- a/drivers/acpi/resources/rsio.c +++ b/drivers/acpi/resources/rsio.c | |||
@@ -49,428 +49,206 @@ ACPI_MODULE_NAME("rsio") | |||
49 | 49 | ||
50 | /******************************************************************************* | 50 | /******************************************************************************* |
51 | * | 51 | * |
52 | * FUNCTION: acpi_rs_io_resource | 52 | * acpi_rs_convert_io |
53 | * | 53 | * |
54 | * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte | 54 | ******************************************************************************/ |
55 | * stream | 55 | struct acpi_rsconvert_info acpi_rs_convert_io[5] = { |
56 | * bytes_consumed - Pointer to where the number of bytes | 56 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IO, |
57 | * consumed the byte_stream_buffer is | 57 | ACPI_RS_SIZE(struct acpi_resource_io), |
58 | * returned | 58 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_io)}, |
59 | * output_buffer - Pointer to the return data buffer | 59 | |
60 | * structure_size - Pointer to where the number of bytes | 60 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IO, |
61 | * in the return data struct is returned | 61 | sizeof(struct aml_resource_io), |
62 | * | 62 | 0}, |
63 | * RETURN: Status | 63 | |
64 | /* Decode flag */ | ||
65 | |||
66 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.io.io_decode), | ||
67 | AML_OFFSET(io.flags), | ||
68 | 0}, | ||
69 | /* | ||
70 | * These fields are contiguous in both the source and destination: | ||
71 | * Address Alignment | ||
72 | * Length | ||
73 | * Minimum Base Address | ||
74 | * Maximum Base Address | ||
75 | */ | ||
76 | {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.io.alignment), | ||
77 | AML_OFFSET(io.alignment), | ||
78 | 2}, | ||
79 | |||
80 | {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.io.minimum), | ||
81 | AML_OFFSET(io.minimum), | ||
82 | 2} | ||
83 | }; | ||
84 | |||
85 | /******************************************************************************* | ||
64 | * | 86 | * |
65 | * DESCRIPTION: Take the resource byte stream and fill out the appropriate | 87 | * acpi_rs_convert_fixed_io |
66 | * structure pointed to by the output_buffer. Return the | ||
67 | * number of bytes consumed from the byte stream. | ||
68 | * | 88 | * |
69 | ******************************************************************************/ | 89 | ******************************************************************************/ |
70 | acpi_status | ||
71 | acpi_rs_io_resource(u8 * byte_stream_buffer, | ||
72 | acpi_size * bytes_consumed, | ||
73 | u8 ** output_buffer, acpi_size * structure_size) | ||
74 | { | ||
75 | u8 *buffer = byte_stream_buffer; | ||
76 | struct acpi_resource *output_struct = (void *)*output_buffer; | ||
77 | u16 temp16 = 0; | ||
78 | u8 temp8 = 0; | ||
79 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_io); | ||
80 | |||
81 | ACPI_FUNCTION_TRACE("rs_io_resource"); | ||
82 | |||
83 | /* The number of bytes consumed are Constant */ | ||
84 | |||
85 | *bytes_consumed = 8; | ||
86 | |||
87 | output_struct->id = ACPI_RSTYPE_IO; | ||
88 | |||
89 | /* Check Decode */ | ||
90 | |||
91 | buffer += 1; | ||
92 | temp8 = *buffer; | ||
93 | |||
94 | output_struct->data.io.io_decode = temp8 & 0x01; | ||
95 | |||
96 | /* Check min_base Address */ | ||
97 | |||
98 | buffer += 1; | ||
99 | ACPI_MOVE_16_TO_16(&temp16, buffer); | ||
100 | |||
101 | output_struct->data.io.min_base_address = temp16; | ||
102 | |||
103 | /* Check max_base Address */ | ||
104 | 90 | ||
105 | buffer += 2; | 91 | struct acpi_rsconvert_info acpi_rs_convert_fixed_io[4] = { |
106 | ACPI_MOVE_16_TO_16(&temp16, buffer); | 92 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_IO, |
107 | 93 | ACPI_RS_SIZE(struct acpi_resource_fixed_io), | |
108 | output_struct->data.io.max_base_address = temp16; | 94 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_fixed_io)}, |
109 | 95 | ||
110 | /* Check Base alignment */ | 96 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_IO, |
111 | 97 | sizeof(struct aml_resource_fixed_io), | |
112 | buffer += 2; | 98 | 0}, |
113 | temp8 = *buffer; | 99 | /* |
114 | 100 | * These fields are contiguous in both the source and destination: | |
115 | output_struct->data.io.alignment = temp8; | 101 | * Base Address |
116 | 102 | * Length | |
117 | /* Check range_length */ | 103 | */ |
118 | 104 | {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.fixed_io.address_length), | |
119 | buffer += 1; | 105 | AML_OFFSET(fixed_io.address_length), |
120 | temp8 = *buffer; | 106 | 1}, |
121 | 107 | ||
122 | output_struct->data.io.range_length = temp8; | 108 | {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.fixed_io.address), |
123 | 109 | AML_OFFSET(fixed_io.address), | |
124 | /* Set the Length parameter */ | 110 | 1} |
125 | 111 | }; | |
126 | output_struct->length = (u32) struct_size; | ||
127 | |||
128 | /* Return the final size of the structure */ | ||
129 | |||
130 | *structure_size = struct_size; | ||
131 | return_ACPI_STATUS(AE_OK); | ||
132 | } | ||
133 | 112 | ||
134 | /******************************************************************************* | 113 | /******************************************************************************* |
135 | * | 114 | * |
136 | * FUNCTION: acpi_rs_fixed_io_resource | 115 | * acpi_rs_convert_generic_reg |
137 | * | ||
138 | * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte | ||
139 | * stream | ||
140 | * bytes_consumed - Pointer to where the number of bytes | ||
141 | * consumed the byte_stream_buffer is | ||
142 | * returned | ||
143 | * output_buffer - Pointer to the return data buffer | ||
144 | * structure_size - Pointer to where the number of bytes | ||
145 | * in the return data struct is returned | ||
146 | * | ||
147 | * RETURN: Status | ||
148 | * | ||
149 | * DESCRIPTION: Take the resource byte stream and fill out the appropriate | ||
150 | * structure pointed to by the output_buffer. Return the | ||
151 | * number of bytes consumed from the byte stream. | ||
152 | * | 116 | * |
153 | ******************************************************************************/ | 117 | ******************************************************************************/ |
154 | 118 | ||
155 | acpi_status | 119 | struct acpi_rsconvert_info acpi_rs_convert_generic_reg[4] = { |
156 | acpi_rs_fixed_io_resource(u8 * byte_stream_buffer, | 120 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GENERIC_REGISTER, |
157 | acpi_size * bytes_consumed, | 121 | ACPI_RS_SIZE(struct acpi_resource_generic_register), |
158 | u8 ** output_buffer, acpi_size * structure_size) | 122 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_generic_reg)}, |
159 | { | 123 | |
160 | u8 *buffer = byte_stream_buffer; | 124 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_GENERIC_REGISTER, |
161 | struct acpi_resource *output_struct = (void *)*output_buffer; | 125 | sizeof(struct aml_resource_generic_register), |
162 | u16 temp16 = 0; | 126 | 0}, |
163 | u8 temp8 = 0; | 127 | /* |
164 | acpi_size struct_size = | 128 | * These fields are contiguous in both the source and destination: |
165 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io); | 129 | * Address Space ID |
166 | 130 | * Register Bit Width | |
167 | ACPI_FUNCTION_TRACE("rs_fixed_io_resource"); | 131 | * Register Bit Offset |
168 | 132 | * Access Size | |
169 | /* The number of bytes consumed are Constant */ | 133 | */ |
170 | 134 | {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.generic_reg.space_id), | |
171 | *bytes_consumed = 4; | 135 | AML_OFFSET(generic_reg.address_space_id), |
172 | 136 | 4}, | |
173 | output_struct->id = ACPI_RSTYPE_FIXED_IO; | 137 | |
174 | 138 | /* Get the Register Address */ | |
175 | /* Check Range Base Address */ | 139 | |
176 | 140 | {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.generic_reg.address), | |
177 | buffer += 1; | 141 | AML_OFFSET(generic_reg.address), |
178 | ACPI_MOVE_16_TO_16(&temp16, buffer); | 142 | 1} |
179 | 143 | }; | |
180 | output_struct->data.fixed_io.base_address = temp16; | ||
181 | |||
182 | /* Check range_length */ | ||
183 | |||
184 | buffer += 2; | ||
185 | temp8 = *buffer; | ||
186 | |||
187 | output_struct->data.fixed_io.range_length = temp8; | ||
188 | |||
189 | /* Set the Length parameter */ | ||
190 | |||
191 | output_struct->length = (u32) struct_size; | ||
192 | |||
193 | /* Return the final size of the structure */ | ||
194 | |||
195 | *structure_size = struct_size; | ||
196 | return_ACPI_STATUS(AE_OK); | ||
197 | } | ||
198 | 144 | ||
199 | /******************************************************************************* | 145 | /******************************************************************************* |
200 | * | 146 | * |
201 | * FUNCTION: acpi_rs_io_stream | 147 | * acpi_rs_convert_end_dpf |
202 | * | ||
203 | * PARAMETERS: linked_list - Pointer to the resource linked list | ||
204 | * output_buffer - Pointer to the user's return buffer | ||
205 | * bytes_consumed - Pointer to where the number of bytes | ||
206 | * used in the output_buffer is returned | ||
207 | * | ||
208 | * RETURN: Status | ||
209 | * | ||
210 | * DESCRIPTION: Take the linked list resource structure and fills in the | ||
211 | * the appropriate bytes in a byte stream | ||
212 | * | 148 | * |
213 | ******************************************************************************/ | 149 | ******************************************************************************/ |
214 | 150 | ||
215 | acpi_status | 151 | struct acpi_rsconvert_info acpi_rs_convert_end_dpf[2] = { |
216 | acpi_rs_io_stream(struct acpi_resource *linked_list, | 152 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_DEPENDENT, |
217 | u8 ** output_buffer, acpi_size * bytes_consumed) | 153 | ACPI_RS_SIZE_MIN, |
218 | { | 154 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_end_dpf)}, |
219 | u8 *buffer = *output_buffer; | ||
220 | u16 temp16 = 0; | ||
221 | u8 temp8 = 0; | ||
222 | |||
223 | ACPI_FUNCTION_TRACE("rs_io_stream"); | ||
224 | |||
225 | /* The descriptor field is static */ | ||
226 | |||
227 | *buffer = 0x47; | ||
228 | buffer += 1; | ||
229 | |||
230 | /* Io Information Byte */ | ||
231 | |||
232 | temp8 = (u8) (linked_list->data.io.io_decode & 0x01); | ||
233 | |||
234 | *buffer = temp8; | ||
235 | buffer += 1; | ||
236 | |||
237 | /* Set the Range minimum base address */ | ||
238 | |||
239 | temp16 = (u16) linked_list->data.io.min_base_address; | ||
240 | |||
241 | ACPI_MOVE_16_TO_16(buffer, &temp16); | ||
242 | buffer += 2; | ||
243 | |||
244 | /* Set the Range maximum base address */ | ||
245 | |||
246 | temp16 = (u16) linked_list->data.io.max_base_address; | ||
247 | 155 | ||
248 | ACPI_MOVE_16_TO_16(buffer, &temp16); | 156 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_DEPENDENT, |
249 | buffer += 2; | 157 | sizeof(struct aml_resource_end_dependent), |
250 | 158 | 0} | |
251 | /* Set the base alignment */ | 159 | }; |
252 | |||
253 | temp8 = (u8) linked_list->data.io.alignment; | ||
254 | |||
255 | *buffer = temp8; | ||
256 | buffer += 1; | ||
257 | |||
258 | /* Set the range length */ | ||
259 | |||
260 | temp8 = (u8) linked_list->data.io.range_length; | ||
261 | |||
262 | *buffer = temp8; | ||
263 | buffer += 1; | ||
264 | |||
265 | /* Return the number of bytes consumed in this operation */ | ||
266 | |||
267 | *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); | ||
268 | return_ACPI_STATUS(AE_OK); | ||
269 | } | ||
270 | 160 | ||
271 | /******************************************************************************* | 161 | /******************************************************************************* |
272 | * | 162 | * |
273 | * FUNCTION: acpi_rs_fixed_io_stream | 163 | * acpi_rs_convert_end_tag |
274 | * | ||
275 | * PARAMETERS: linked_list - Pointer to the resource linked list | ||
276 | * output_buffer - Pointer to the user's return buffer | ||
277 | * bytes_consumed - Pointer to where the number of bytes | ||
278 | * used in the output_buffer is returned | ||
279 | * | ||
280 | * RETURN: Status | ||
281 | * | ||
282 | * DESCRIPTION: Take the linked list resource structure and fills in the | ||
283 | * the appropriate bytes in a byte stream | ||
284 | * | 164 | * |
285 | ******************************************************************************/ | 165 | ******************************************************************************/ |
286 | 166 | ||
287 | acpi_status | 167 | struct acpi_rsconvert_info acpi_rs_convert_end_tag[2] = { |
288 | acpi_rs_fixed_io_stream(struct acpi_resource *linked_list, | 168 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_TAG, |
289 | u8 ** output_buffer, acpi_size * bytes_consumed) | 169 | ACPI_RS_SIZE_MIN, |
290 | { | 170 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_end_tag)}, |
291 | u8 *buffer = *output_buffer; | 171 | |
292 | u16 temp16 = 0; | 172 | /* |
293 | u8 temp8 = 0; | 173 | * Note: The checksum field is set to zero, meaning that the resource |
294 | 174 | * data is treated as if the checksum operation succeeded. | |
295 | ACPI_FUNCTION_TRACE("rs_fixed_io_stream"); | 175 | * (ACPI Spec 1.0b Section 6.4.2.8) |
296 | 176 | */ | |
297 | /* The descriptor field is static */ | 177 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_TAG, |
298 | 178 | sizeof(struct aml_resource_end_tag), | |
299 | *buffer = 0x4B; | 179 | 0} |
300 | 180 | }; | |
301 | buffer += 1; | ||
302 | |||
303 | /* Set the Range base address */ | ||
304 | |||
305 | temp16 = (u16) linked_list->data.fixed_io.base_address; | ||
306 | |||
307 | ACPI_MOVE_16_TO_16(buffer, &temp16); | ||
308 | buffer += 2; | ||
309 | |||
310 | /* Set the range length */ | ||
311 | |||
312 | temp8 = (u8) linked_list->data.fixed_io.range_length; | ||
313 | |||
314 | *buffer = temp8; | ||
315 | buffer += 1; | ||
316 | |||
317 | /* Return the number of bytes consumed in this operation */ | ||
318 | |||
319 | *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); | ||
320 | return_ACPI_STATUS(AE_OK); | ||
321 | } | ||
322 | 181 | ||
323 | /******************************************************************************* | 182 | /******************************************************************************* |
324 | * | 183 | * |
325 | * FUNCTION: acpi_rs_dma_resource | 184 | * acpi_rs_get_start_dpf |
326 | * | ||
327 | * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte | ||
328 | * stream | ||
329 | * bytes_consumed - Pointer to where the number of bytes | ||
330 | * consumed the byte_stream_buffer is | ||
331 | * returned | ||
332 | * output_buffer - Pointer to the return data buffer | ||
333 | * structure_size - Pointer to where the number of bytes | ||
334 | * in the return data struct is returned | ||
335 | * | ||
336 | * RETURN: Status | ||
337 | * | ||
338 | * DESCRIPTION: Take the resource byte stream and fill out the appropriate | ||
339 | * structure pointed to by the output_buffer. Return the | ||
340 | * number of bytes consumed from the byte stream. | ||
341 | * | 185 | * |
342 | ******************************************************************************/ | 186 | ******************************************************************************/ |
343 | 187 | ||
344 | acpi_status | 188 | struct acpi_rsconvert_info acpi_rs_get_start_dpf[5] = { |
345 | acpi_rs_dma_resource(u8 * byte_stream_buffer, | 189 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_START_DEPENDENT, |
346 | acpi_size * bytes_consumed, | 190 | ACPI_RS_SIZE(struct acpi_resource_start_dependent), |
347 | u8 ** output_buffer, acpi_size * structure_size) | 191 | ACPI_RSC_TABLE_SIZE(acpi_rs_get_start_dpf)}, |
348 | { | ||
349 | u8 *buffer = byte_stream_buffer; | ||
350 | struct acpi_resource *output_struct = (void *)*output_buffer; | ||
351 | u8 temp8 = 0; | ||
352 | u8 index; | ||
353 | u8 i; | ||
354 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma); | ||
355 | |||
356 | ACPI_FUNCTION_TRACE("rs_dma_resource"); | ||
357 | |||
358 | /* The number of bytes consumed are Constant */ | ||
359 | 192 | ||
360 | *bytes_consumed = 3; | 193 | /* Defaults for Compatibility and Performance priorities */ |
361 | output_struct->id = ACPI_RSTYPE_DMA; | ||
362 | 194 | ||
363 | /* Point to the 8-bits of Byte 1 */ | 195 | {ACPI_RSC_SET8, ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), |
196 | ACPI_ACCEPTABLE_CONFIGURATION, | ||
197 | 2}, | ||
364 | 198 | ||
365 | buffer += 1; | 199 | /* All done if there is no flag byte present in the descriptor */ |
366 | temp8 = *buffer; | ||
367 | 200 | ||
368 | /* Decode the DMA channel bits */ | 201 | {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 1}, |
369 | 202 | ||
370 | for (i = 0, index = 0; index < 8; index++) { | 203 | /* Flag byte is present, get the flags */ |
371 | if ((temp8 >> index) & 0x01) { | ||
372 | output_struct->data.dma.channels[i] = index; | ||
373 | i++; | ||
374 | } | ||
375 | } | ||
376 | 204 | ||
377 | /* Zero DMA channels is valid */ | 205 | {ACPI_RSC_2BITFLAG, |
206 | ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), | ||
207 | AML_OFFSET(start_dpf.flags), | ||
208 | 0}, | ||
378 | 209 | ||
379 | output_struct->data.dma.number_of_channels = i; | 210 | {ACPI_RSC_2BITFLAG, |
380 | if (i > 0) { | 211 | ACPI_RS_OFFSET(data.start_dpf.performance_robustness), |
381 | /* Calculate the structure size based upon the number of interrupts */ | 212 | AML_OFFSET(start_dpf.flags), |
382 | 213 | 2} | |
383 | struct_size += ((acpi_size) i - 1) * 4; | 214 | }; |
384 | } | ||
385 | |||
386 | /* Point to Byte 2 */ | ||
387 | |||
388 | buffer += 1; | ||
389 | temp8 = *buffer; | ||
390 | |||
391 | /* Check for transfer preference (Bits[1:0]) */ | ||
392 | |||
393 | output_struct->data.dma.transfer = temp8 & 0x03; | ||
394 | |||
395 | if (0x03 == output_struct->data.dma.transfer) { | ||
396 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
397 | "Invalid DMA.Transfer preference (3)\n")); | ||
398 | return_ACPI_STATUS(AE_BAD_DATA); | ||
399 | } | ||
400 | |||
401 | /* Get bus master preference (Bit[2]) */ | ||
402 | |||
403 | output_struct->data.dma.bus_master = (temp8 >> 2) & 0x01; | ||
404 | |||
405 | /* Get channel speed support (Bits[6:5]) */ | ||
406 | |||
407 | output_struct->data.dma.type = (temp8 >> 5) & 0x03; | ||
408 | |||
409 | /* Set the Length parameter */ | ||
410 | |||
411 | output_struct->length = (u32) struct_size; | ||
412 | |||
413 | /* Return the final size of the structure */ | ||
414 | |||
415 | *structure_size = struct_size; | ||
416 | return_ACPI_STATUS(AE_OK); | ||
417 | } | ||
418 | 215 | ||
419 | /******************************************************************************* | 216 | /******************************************************************************* |
420 | * | 217 | * |
421 | * FUNCTION: acpi_rs_dma_stream | 218 | * acpi_rs_set_start_dpf |
422 | * | ||
423 | * PARAMETERS: linked_list - Pointer to the resource linked list | ||
424 | * output_buffer - Pointer to the user's return buffer | ||
425 | * bytes_consumed - Pointer to where the number of bytes | ||
426 | * used in the output_buffer is returned | ||
427 | * | ||
428 | * RETURN: Status | ||
429 | * | ||
430 | * DESCRIPTION: Take the linked list resource structure and fills in the | ||
431 | * the appropriate bytes in a byte stream | ||
432 | * | 219 | * |
433 | ******************************************************************************/ | 220 | ******************************************************************************/ |
434 | 221 | ||
435 | acpi_status | 222 | struct acpi_rsconvert_info acpi_rs_set_start_dpf[6] = { |
436 | acpi_rs_dma_stream(struct acpi_resource *linked_list, | 223 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_START_DEPENDENT, |
437 | u8 ** output_buffer, acpi_size * bytes_consumed) | 224 | sizeof(struct aml_resource_start_dependent), |
438 | { | 225 | ACPI_RSC_TABLE_SIZE(acpi_rs_set_start_dpf)}, |
439 | u8 *buffer = *output_buffer; | 226 | |
440 | u16 temp16 = 0; | 227 | /* Set the default flag values */ |
441 | u8 temp8 = 0; | 228 | |
442 | u8 index; | 229 | {ACPI_RSC_2BITFLAG, |
443 | 230 | ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), | |
444 | ACPI_FUNCTION_TRACE("rs_dma_stream"); | 231 | AML_OFFSET(start_dpf.flags), |
445 | 232 | 0}, | |
446 | /* The descriptor field is static */ | 233 | |
447 | 234 | {ACPI_RSC_2BITFLAG, | |
448 | *buffer = 0x2A; | 235 | ACPI_RS_OFFSET(data.start_dpf.performance_robustness), |
449 | buffer += 1; | 236 | AML_OFFSET(start_dpf.flags), |
450 | temp8 = 0; | 237 | 2}, |
451 | 238 | /* | |
452 | /* Loop through all of the Channels and set the mask bits */ | 239 | * All done if flags byte is necessary -- if either priority value |
453 | 240 | * is not ACPI_ACCEPTABLE_CONFIGURATION | |
454 | for (index = 0; | 241 | */ |
455 | index < linked_list->data.dma.number_of_channels; index++) { | 242 | {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, |
456 | temp16 = (u16) linked_list->data.dma.channels[index]; | 243 | ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), |
457 | temp8 |= 0x1 << temp16; | 244 | ACPI_ACCEPTABLE_CONFIGURATION}, |
458 | } | 245 | |
459 | 246 | {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, | |
460 | *buffer = temp8; | 247 | ACPI_RS_OFFSET(data.start_dpf.performance_robustness), |
461 | buffer += 1; | 248 | ACPI_ACCEPTABLE_CONFIGURATION}, |
462 | 249 | ||
463 | /* Set the DMA Info */ | 250 | /* Flag byte is not necessary */ |
464 | 251 | ||
465 | temp8 = (u8) ((linked_list->data.dma.type & 0x03) << 5); | 252 | {ACPI_RSC_LENGTH, 0, 0, |
466 | temp8 |= ((linked_list->data.dma.bus_master & 0x01) << 2); | 253 | sizeof(struct aml_resource_start_dependent_noprio)} |
467 | temp8 |= (linked_list->data.dma.transfer & 0x03); | 254 | }; |
468 | |||
469 | *buffer = temp8; | ||
470 | buffer += 1; | ||
471 | |||
472 | /* Return the number of bytes consumed in this operation */ | ||
473 | |||
474 | *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); | ||
475 | return_ACPI_STATUS(AE_OK); | ||
476 | } | ||
diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c index 56043fee96cb..79e71257b69a 100644 --- a/drivers/acpi/resources/rsirq.c +++ b/drivers/acpi/resources/rsirq.c | |||
@@ -49,504 +49,182 @@ ACPI_MODULE_NAME("rsirq") | |||
49 | 49 | ||
50 | /******************************************************************************* | 50 | /******************************************************************************* |
51 | * | 51 | * |
52 | * FUNCTION: acpi_rs_irq_resource | 52 | * acpi_rs_get_irq |
53 | * | ||
54 | * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte | ||
55 | * stream | ||
56 | * bytes_consumed - Pointer to where the number of bytes | ||
57 | * consumed the byte_stream_buffer is | ||
58 | * returned | ||
59 | * output_buffer - Pointer to the return data buffer | ||
60 | * structure_size - Pointer to where the number of bytes | ||
61 | * in the return data struct is returned | ||
62 | * | ||
63 | * RETURN: Status | ||
64 | * | ||
65 | * DESCRIPTION: Take the resource byte stream and fill out the appropriate | ||
66 | * structure pointed to by the output_buffer. Return the | ||
67 | * number of bytes consumed from the byte stream. | ||
68 | * | 53 | * |
69 | ******************************************************************************/ | 54 | ******************************************************************************/ |
70 | acpi_status | 55 | struct acpi_rsconvert_info acpi_rs_get_irq[7] = { |
71 | acpi_rs_irq_resource(u8 * byte_stream_buffer, | 56 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IRQ, |
72 | acpi_size * bytes_consumed, | 57 | ACPI_RS_SIZE(struct acpi_resource_irq), |
73 | u8 ** output_buffer, acpi_size * structure_size) | 58 | ACPI_RSC_TABLE_SIZE(acpi_rs_get_irq)}, |
74 | { | ||
75 | u8 *buffer = byte_stream_buffer; | ||
76 | struct acpi_resource *output_struct = (void *)*output_buffer; | ||
77 | u16 temp16 = 0; | ||
78 | u8 temp8 = 0; | ||
79 | u8 index; | ||
80 | u8 i; | ||
81 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq); | ||
82 | |||
83 | ACPI_FUNCTION_TRACE("rs_irq_resource"); | ||
84 | |||
85 | /* | ||
86 | * The number of bytes consumed are contained in the descriptor | ||
87 | * (Bits:0-1) | ||
88 | */ | ||
89 | temp8 = *buffer; | ||
90 | *bytes_consumed = (temp8 & 0x03) + 1; | ||
91 | output_struct->id = ACPI_RSTYPE_IRQ; | ||
92 | |||
93 | /* Point to the 16-bits of Bytes 1 and 2 */ | ||
94 | |||
95 | buffer += 1; | ||
96 | ACPI_MOVE_16_TO_16(&temp16, buffer); | ||
97 | |||
98 | output_struct->data.irq.number_of_interrupts = 0; | ||
99 | |||
100 | /* Decode the IRQ bits */ | ||
101 | |||
102 | for (i = 0, index = 0; index < 16; index++) { | ||
103 | if ((temp16 >> index) & 0x01) { | ||
104 | output_struct->data.irq.interrupts[i] = index; | ||
105 | i++; | ||
106 | } | ||
107 | } | ||
108 | 59 | ||
109 | /* Zero interrupts is valid */ | 60 | /* Get the IRQ mask (bytes 1:2) */ |
110 | 61 | ||
111 | output_struct->data.irq.number_of_interrupts = i; | 62 | {ACPI_RSC_BITMASK16, ACPI_RS_OFFSET(data.irq.interrupts[0]), |
112 | if (i > 0) { | 63 | AML_OFFSET(irq.irq_mask), |
113 | /* Calculate the structure size based upon the number of interrupts */ | 64 | ACPI_RS_OFFSET(data.irq.interrupt_count)}, |
114 | 65 | ||
115 | struct_size += ((acpi_size) i - 1) * 4; | 66 | /* Set default flags (others are zero) */ |
116 | } | ||
117 | 67 | ||
118 | /* Point to Byte 3 if it is used */ | 68 | {ACPI_RSC_SET8, ACPI_RS_OFFSET(data.irq.triggering), |
69 | ACPI_EDGE_SENSITIVE, | ||
70 | 1}, | ||
119 | 71 | ||
120 | if (4 == *bytes_consumed) { | 72 | /* All done if no flag byte present in descriptor */ |
121 | buffer += 2; | ||
122 | temp8 = *buffer; | ||
123 | 73 | ||
124 | /* Check for HE, LL interrupts */ | 74 | {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3}, |
125 | 75 | ||
126 | switch (temp8 & 0x09) { | 76 | /* Get flags: Triggering[0], Polarity[3], Sharing[4] */ |
127 | case 0x01: /* HE */ | ||
128 | output_struct->data.irq.edge_level = | ||
129 | ACPI_EDGE_SENSITIVE; | ||
130 | output_struct->data.irq.active_high_low = | ||
131 | ACPI_ACTIVE_HIGH; | ||
132 | break; | ||
133 | 77 | ||
134 | case 0x08: /* LL */ | 78 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering), |
135 | output_struct->data.irq.edge_level = | 79 | AML_OFFSET(irq.flags), |
136 | ACPI_LEVEL_SENSITIVE; | 80 | 0}, |
137 | output_struct->data.irq.active_high_low = | ||
138 | ACPI_ACTIVE_LOW; | ||
139 | break; | ||
140 | 81 | ||
141 | default: | 82 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.polarity), |
142 | /* | 83 | AML_OFFSET(irq.flags), |
143 | * Only _LL and _HE polarity/trigger interrupts | 84 | 3}, |
144 | * are allowed (ACPI spec, section "IRQ Format") | ||
145 | * so 0x00 and 0x09 are illegal. | ||
146 | */ | ||
147 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
148 | "Invalid interrupt polarity/trigger in resource list, %X\n", | ||
149 | temp8)); | ||
150 | return_ACPI_STATUS(AE_BAD_DATA); | ||
151 | } | ||
152 | 85 | ||
153 | /* Check for sharable */ | 86 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable), |
154 | 87 | AML_OFFSET(irq.flags), | |
155 | output_struct->data.irq.shared_exclusive = (temp8 >> 3) & 0x01; | 88 | 4} |
156 | } else { | 89 | }; |
157 | /* | ||
158 | * Assume Edge Sensitive, Active High, Non-Sharable | ||
159 | * per ACPI Specification | ||
160 | */ | ||
161 | output_struct->data.irq.edge_level = ACPI_EDGE_SENSITIVE; | ||
162 | output_struct->data.irq.active_high_low = ACPI_ACTIVE_HIGH; | ||
163 | output_struct->data.irq.shared_exclusive = ACPI_EXCLUSIVE; | ||
164 | } | ||
165 | |||
166 | /* Set the Length parameter */ | ||
167 | |||
168 | output_struct->length = (u32) struct_size; | ||
169 | |||
170 | /* Return the final size of the structure */ | ||
171 | |||
172 | *structure_size = struct_size; | ||
173 | return_ACPI_STATUS(AE_OK); | ||
174 | } | ||
175 | 90 | ||
176 | /******************************************************************************* | 91 | /******************************************************************************* |
177 | * | 92 | * |
178 | * FUNCTION: acpi_rs_irq_stream | 93 | * acpi_rs_set_irq |
179 | * | ||
180 | * PARAMETERS: linked_list - Pointer to the resource linked list | ||
181 | * output_buffer - Pointer to the user's return buffer | ||
182 | * bytes_consumed - Pointer to where the number of bytes | ||
183 | * used in the output_buffer is returned | ||
184 | * | ||
185 | * RETURN: Status | ||
186 | * | ||
187 | * DESCRIPTION: Take the linked list resource structure and fills in the | ||
188 | * the appropriate bytes in a byte stream | ||
189 | * | 94 | * |
190 | ******************************************************************************/ | 95 | ******************************************************************************/ |
191 | 96 | ||
192 | acpi_status | 97 | struct acpi_rsconvert_info acpi_rs_set_irq[9] = { |
193 | acpi_rs_irq_stream(struct acpi_resource *linked_list, | 98 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IRQ, |
194 | u8 ** output_buffer, acpi_size * bytes_consumed) | 99 | sizeof(struct aml_resource_irq), |
195 | { | 100 | ACPI_RSC_TABLE_SIZE(acpi_rs_set_irq)}, |
196 | u8 *buffer = *output_buffer; | ||
197 | u16 temp16 = 0; | ||
198 | u8 temp8 = 0; | ||
199 | u8 index; | ||
200 | u8 IRqinfo_byte_needed; | ||
201 | |||
202 | ACPI_FUNCTION_TRACE("rs_irq_stream"); | ||
203 | |||
204 | /* | ||
205 | * The descriptor field is set based upon whether a third byte is | ||
206 | * needed to contain the IRQ Information. | ||
207 | */ | ||
208 | if (ACPI_EDGE_SENSITIVE == linked_list->data.irq.edge_level && | ||
209 | ACPI_ACTIVE_HIGH == linked_list->data.irq.active_high_low && | ||
210 | ACPI_EXCLUSIVE == linked_list->data.irq.shared_exclusive) { | ||
211 | *buffer = 0x22; | ||
212 | IRqinfo_byte_needed = FALSE; | ||
213 | } else { | ||
214 | *buffer = 0x23; | ||
215 | IRqinfo_byte_needed = TRUE; | ||
216 | } | ||
217 | |||
218 | buffer += 1; | ||
219 | temp16 = 0; | ||
220 | |||
221 | /* Loop through all of the interrupts and set the mask bits */ | ||
222 | |||
223 | for (index = 0; | ||
224 | index < linked_list->data.irq.number_of_interrupts; index++) { | ||
225 | temp8 = (u8) linked_list->data.irq.interrupts[index]; | ||
226 | temp16 |= 0x1 << temp8; | ||
227 | } | ||
228 | |||
229 | ACPI_MOVE_16_TO_16(buffer, &temp16); | ||
230 | buffer += 2; | ||
231 | |||
232 | /* Set the IRQ Info byte if needed. */ | ||
233 | |||
234 | if (IRqinfo_byte_needed) { | ||
235 | temp8 = 0; | ||
236 | temp8 = (u8) ((linked_list->data.irq.shared_exclusive & | ||
237 | 0x01) << 4); | ||
238 | |||
239 | if (ACPI_LEVEL_SENSITIVE == linked_list->data.irq.edge_level && | ||
240 | ACPI_ACTIVE_LOW == linked_list->data.irq.active_high_low) { | ||
241 | temp8 |= 0x08; | ||
242 | } else { | ||
243 | temp8 |= 0x01; | ||
244 | } | ||
245 | |||
246 | *buffer = temp8; | ||
247 | buffer += 1; | ||
248 | } | ||
249 | |||
250 | /* Return the number of bytes consumed in this operation */ | ||
251 | |||
252 | *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); | ||
253 | return_ACPI_STATUS(AE_OK); | ||
254 | } | ||
255 | |||
256 | /******************************************************************************* | ||
257 | * | ||
258 | * FUNCTION: acpi_rs_extended_irq_resource | ||
259 | * | ||
260 | * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte | ||
261 | * stream | ||
262 | * bytes_consumed - Pointer to where the number of bytes | ||
263 | * consumed the byte_stream_buffer is | ||
264 | * returned | ||
265 | * output_buffer - Pointer to the return data buffer | ||
266 | * structure_size - Pointer to where the number of bytes | ||
267 | * in the return data struct is returned | ||
268 | * | ||
269 | * RETURN: Status | ||
270 | * | ||
271 | * DESCRIPTION: Take the resource byte stream and fill out the appropriate | ||
272 | * structure pointed to by the output_buffer. Return the | ||
273 | * number of bytes consumed from the byte stream. | ||
274 | * | ||
275 | ******************************************************************************/ | ||
276 | |||
277 | acpi_status | ||
278 | acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, | ||
279 | acpi_size * bytes_consumed, | ||
280 | u8 ** output_buffer, acpi_size * structure_size) | ||
281 | { | ||
282 | u8 *buffer = byte_stream_buffer; | ||
283 | struct acpi_resource *output_struct = (void *)*output_buffer; | ||
284 | u16 temp16 = 0; | ||
285 | u8 temp8 = 0; | ||
286 | u8 *temp_ptr; | ||
287 | u8 index; | ||
288 | acpi_size struct_size = | ||
289 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq); | ||
290 | |||
291 | ACPI_FUNCTION_TRACE("rs_extended_irq_resource"); | ||
292 | |||
293 | /* Get the Descriptor Length field */ | ||
294 | |||
295 | buffer += 1; | ||
296 | ACPI_MOVE_16_TO_16(&temp16, buffer); | ||
297 | |||
298 | /* Validate minimum descriptor length */ | ||
299 | |||
300 | if (temp16 < 6) { | ||
301 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); | ||
302 | } | ||
303 | |||
304 | *bytes_consumed = temp16 + 3; | ||
305 | output_struct->id = ACPI_RSTYPE_EXT_IRQ; | ||
306 | |||
307 | /* Point to the Byte3 */ | ||
308 | |||
309 | buffer += 2; | ||
310 | temp8 = *buffer; | ||
311 | |||
312 | output_struct->data.extended_irq.producer_consumer = temp8 & 0x01; | ||
313 | 101 | ||
314 | /* | 102 | /* Convert interrupt list to 16-bit IRQ bitmask */ |
315 | * Check for Interrupt Mode | ||
316 | * | ||
317 | * The definition of an Extended IRQ changed between ACPI spec v1.0b | ||
318 | * and ACPI spec 2.0 (section 6.4.3.6 in both). | ||
319 | * | ||
320 | * - Edge/Level are defined opposite in the table vs the headers | ||
321 | */ | ||
322 | output_struct->data.extended_irq.edge_level = | ||
323 | (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE; | ||
324 | |||
325 | /* Check Interrupt Polarity */ | ||
326 | |||
327 | output_struct->data.extended_irq.active_high_low = (temp8 >> 2) & 0x1; | ||
328 | |||
329 | /* Check for sharable */ | ||
330 | |||
331 | output_struct->data.extended_irq.shared_exclusive = (temp8 >> 3) & 0x01; | ||
332 | 103 | ||
333 | /* Point to Byte4 (IRQ Table length) */ | 104 | {ACPI_RSC_BITMASK16, ACPI_RS_OFFSET(data.irq.interrupts[0]), |
105 | AML_OFFSET(irq.irq_mask), | ||
106 | ACPI_RS_OFFSET(data.irq.interrupt_count)}, | ||
334 | 107 | ||
335 | buffer += 1; | 108 | /* Set the flags byte by default */ |
336 | temp8 = *buffer; | ||
337 | 109 | ||
338 | /* Must have at least one IRQ */ | 110 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering), |
111 | AML_OFFSET(irq.flags), | ||
112 | 0}, | ||
339 | 113 | ||
340 | if (temp8 < 1) { | 114 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.polarity), |
341 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); | 115 | AML_OFFSET(irq.flags), |
342 | } | 116 | 3}, |
343 | |||
344 | output_struct->data.extended_irq.number_of_interrupts = temp8; | ||
345 | 117 | ||
118 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable), | ||
119 | AML_OFFSET(irq.flags), | ||
120 | 4}, | ||
346 | /* | 121 | /* |
347 | * Add any additional structure size to properly calculate | 122 | * Check if the flags byte is necessary. Not needed if the flags are: |
348 | * the next pointer at the end of this function | 123 | * ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_HIGH, ACPI_EXCLUSIVE |
349 | */ | 124 | */ |
350 | struct_size += (temp8 - 1) * 4; | 125 | {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, |
351 | 126 | ACPI_RS_OFFSET(data.irq.triggering), | |
352 | /* Point to Byte5 (First IRQ Number) */ | 127 | ACPI_EDGE_SENSITIVE}, |
353 | |||
354 | buffer += 1; | ||
355 | |||
356 | /* Cycle through every IRQ in the table */ | ||
357 | |||
358 | for (index = 0; index < temp8; index++) { | ||
359 | ACPI_MOVE_32_TO_32(&output_struct->data.extended_irq. | ||
360 | interrupts[index], buffer); | ||
361 | |||
362 | /* Point to the next IRQ */ | ||
363 | |||
364 | buffer += 4; | ||
365 | } | ||
366 | |||
367 | /* | ||
368 | * This will leave us pointing to the Resource Source Index | ||
369 | * If it is present, then save it off and calculate the | ||
370 | * pointer to where the null terminated string goes: | ||
371 | * Each Interrupt takes 32-bits + the 5 bytes of the | ||
372 | * stream that are default. | ||
373 | * | ||
374 | * Note: Some resource descriptors will have an additional null, so | ||
375 | * we add 1 to the length. | ||
376 | */ | ||
377 | if (*bytes_consumed > | ||
378 | ((acpi_size) output_struct->data.extended_irq.number_of_interrupts * | ||
379 | 4) + (5 + 1)) { | ||
380 | /* Dereference the Index */ | ||
381 | |||
382 | temp8 = *buffer; | ||
383 | output_struct->data.extended_irq.resource_source.index = | ||
384 | (u32) temp8; | ||
385 | |||
386 | /* Point to the String */ | ||
387 | |||
388 | buffer += 1; | ||
389 | |||
390 | /* Point the String pointer to the end of this structure. */ | ||
391 | |||
392 | output_struct->data.extended_irq.resource_source.string_ptr = | ||
393 | (char *)((char *)output_struct + struct_size); | ||
394 | 128 | ||
395 | temp_ptr = (u8 *) | 129 | {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, |
396 | output_struct->data.extended_irq.resource_source.string_ptr; | 130 | ACPI_RS_OFFSET(data.irq.polarity), |
131 | ACPI_ACTIVE_HIGH}, | ||
397 | 132 | ||
398 | /* Copy the string into the buffer */ | 133 | {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, |
134 | ACPI_RS_OFFSET(data.irq.sharable), | ||
135 | ACPI_EXCLUSIVE}, | ||
399 | 136 | ||
400 | index = 0; | 137 | /* irq_no_flags() descriptor can be used */ |
401 | while (*buffer) { | ||
402 | *temp_ptr = *buffer; | ||
403 | 138 | ||
404 | temp_ptr += 1; | 139 | {ACPI_RSC_LENGTH, 0, 0, sizeof(struct aml_resource_irq_noflags)} |
405 | buffer += 1; | 140 | }; |
406 | index += 1; | ||
407 | } | ||
408 | |||
409 | /* Add the terminating null */ | ||
410 | |||
411 | *temp_ptr = 0; | ||
412 | output_struct->data.extended_irq.resource_source.string_length = | ||
413 | index + 1; | ||
414 | |||
415 | /* | ||
416 | * In order for the struct_size to fall on a 32-bit boundary, | ||
417 | * calculate the length of the string and expand the | ||
418 | * struct_size to the next 32-bit boundary. | ||
419 | */ | ||
420 | temp8 = (u8) (index + 1); | ||
421 | struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); | ||
422 | } else { | ||
423 | output_struct->data.extended_irq.resource_source.index = 0; | ||
424 | output_struct->data.extended_irq.resource_source.string_length = | ||
425 | 0; | ||
426 | output_struct->data.extended_irq.resource_source.string_ptr = | ||
427 | NULL; | ||
428 | } | ||
429 | |||
430 | /* Set the Length parameter */ | ||
431 | |||
432 | output_struct->length = (u32) struct_size; | ||
433 | |||
434 | /* Return the final size of the structure */ | ||
435 | |||
436 | *structure_size = struct_size; | ||
437 | return_ACPI_STATUS(AE_OK); | ||
438 | } | ||
439 | 141 | ||
440 | /******************************************************************************* | 142 | /******************************************************************************* |
441 | * | 143 | * |
442 | * FUNCTION: acpi_rs_extended_irq_stream | 144 | * acpi_rs_convert_ext_irq |
443 | * | ||
444 | * PARAMETERS: linked_list - Pointer to the resource linked list | ||
445 | * output_buffer - Pointer to the user's return buffer | ||
446 | * bytes_consumed - Pointer to where the number of bytes | ||
447 | * used in the output_buffer is returned | ||
448 | * | ||
449 | * RETURN: Status | ||
450 | * | ||
451 | * DESCRIPTION: Take the linked list resource structure and fills in the | ||
452 | * the appropriate bytes in a byte stream | ||
453 | * | 145 | * |
454 | ******************************************************************************/ | 146 | ******************************************************************************/ |
455 | 147 | ||
456 | acpi_status | 148 | struct acpi_rsconvert_info acpi_rs_convert_ext_irq[9] = { |
457 | acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, | 149 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_IRQ, |
458 | u8 ** output_buffer, acpi_size * bytes_consumed) | 150 | ACPI_RS_SIZE(struct acpi_resource_extended_irq), |
459 | { | 151 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_ext_irq)}, |
460 | u8 *buffer = *output_buffer; | ||
461 | u16 *length_field; | ||
462 | u8 temp8 = 0; | ||
463 | u8 index; | ||
464 | 152 | ||
465 | ACPI_FUNCTION_TRACE("rs_extended_irq_stream"); | 153 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_IRQ, |
154 | sizeof(struct aml_resource_extended_irq), | ||
155 | 0}, | ||
466 | 156 | ||
467 | /* Set the Descriptor Type field */ | 157 | /* Flag bits */ |
468 | 158 | ||
469 | *buffer = ACPI_RDESC_TYPE_EXTENDED_XRUPT; | 159 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.producer_consumer), |
470 | buffer += 1; | 160 | AML_OFFSET(extended_irq.flags), |
161 | 0}, | ||
471 | 162 | ||
472 | /* Save a pointer to the Length field - to be filled in later */ | 163 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.triggering), |
164 | AML_OFFSET(extended_irq.flags), | ||
165 | 1}, | ||
473 | 166 | ||
474 | length_field = ACPI_CAST_PTR(u16, buffer); | 167 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.polarity), |
475 | buffer += 2; | 168 | AML_OFFSET(extended_irq.flags), |
169 | 2}, | ||
476 | 170 | ||
477 | /* Set the Interrupt vector flags */ | 171 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.sharable), |
172 | AML_OFFSET(extended_irq.flags), | ||
173 | 3}, | ||
478 | 174 | ||
479 | temp8 = (u8) (linked_list->data.extended_irq.producer_consumer & 0x01); | 175 | /* IRQ Table length (Byte4) */ |
480 | temp8 |= | ||
481 | ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3); | ||
482 | 176 | ||
483 | /* | 177 | {ACPI_RSC_COUNT, ACPI_RS_OFFSET(data.extended_irq.interrupt_count), |
484 | * Set the Interrupt Mode | 178 | AML_OFFSET(extended_irq.interrupt_count), |
485 | * | 179 | sizeof(u32)} |
486 | * The definition of an Extended IRQ changed between ACPI spec v1.0b | 180 | , |
487 | * and ACPI spec 2.0 (section 6.4.3.6 in both). This code does not | ||
488 | * implement the more restrictive definition of 1.0b | ||
489 | * | ||
490 | * - Edge/Level are defined opposite in the table vs the headers | ||
491 | */ | ||
492 | if (ACPI_EDGE_SENSITIVE == linked_list->data.extended_irq.edge_level) { | ||
493 | temp8 |= 0x2; | ||
494 | } | ||
495 | |||
496 | /* Set the Interrupt Polarity */ | ||
497 | 181 | ||
498 | temp8 |= ((linked_list->data.extended_irq.active_high_low & 0x1) << 2); | 182 | /* Copy every IRQ in the table, each is 32 bits */ |
499 | 183 | ||
500 | *buffer = temp8; | 184 | {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.extended_irq.interrupts[0]), |
501 | buffer += 1; | 185 | AML_OFFSET(extended_irq.interrupts[0]), |
186 | 0} | ||
187 | , | ||
502 | 188 | ||
503 | /* Set the Interrupt table length */ | 189 | /* Optional resource_source (Index and String) */ |
504 | 190 | ||
505 | temp8 = (u8) linked_list->data.extended_irq.number_of_interrupts; | 191 | {ACPI_RSC_SOURCEX, ACPI_RS_OFFSET(data.extended_irq.resource_source), |
192 | ACPI_RS_OFFSET(data.extended_irq.interrupts[0]), | ||
193 | sizeof(struct aml_resource_extended_irq)} | ||
194 | }; | ||
506 | 195 | ||
507 | *buffer = temp8; | 196 | /******************************************************************************* |
508 | buffer += 1; | 197 | * |
509 | 198 | * acpi_rs_convert_dma | |
510 | for (index = 0; | 199 | * |
511 | index < linked_list->data.extended_irq.number_of_interrupts; | 200 | ******************************************************************************/ |
512 | index++) { | ||
513 | ACPI_MOVE_32_TO_32(buffer, | ||
514 | &linked_list->data.extended_irq. | ||
515 | interrupts[index]); | ||
516 | buffer += 4; | ||
517 | } | ||
518 | 201 | ||
519 | /* Resource Source Index and Resource Source are optional */ | 202 | struct acpi_rsconvert_info acpi_rs_convert_dma[6] = { |
203 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_DMA, | ||
204 | ACPI_RS_SIZE(struct acpi_resource_dma), | ||
205 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_dma)}, | ||
520 | 206 | ||
521 | if (0 != linked_list->data.extended_irq.resource_source.string_length) { | 207 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_DMA, |
522 | *buffer = | 208 | sizeof(struct aml_resource_dma), |
523 | (u8) linked_list->data.extended_irq.resource_source.index; | 209 | 0}, |
524 | buffer += 1; | ||
525 | 210 | ||
526 | /* Copy the string */ | 211 | /* Flags: transfer preference, bus mastering, channel speed */ |
527 | 212 | ||
528 | ACPI_STRCPY((char *)buffer, | 213 | {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.dma.transfer), |
529 | linked_list->data.extended_irq.resource_source. | 214 | AML_OFFSET(dma.flags), |
530 | string_ptr); | 215 | 0}, |
531 | 216 | ||
532 | /* | 217 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.dma.bus_master), |
533 | * Buffer needs to be set to the length of the string + one for the | 218 | AML_OFFSET(dma.flags), |
534 | * terminating null | 219 | 2}, |
535 | */ | ||
536 | buffer += | ||
537 | (acpi_size) (ACPI_STRLEN | ||
538 | (linked_list->data.extended_irq. | ||
539 | resource_source.string_ptr) + 1); | ||
540 | } | ||
541 | 220 | ||
542 | /* Return the number of bytes consumed in this operation */ | 221 | {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.dma.type), |
222 | AML_OFFSET(dma.flags), | ||
223 | 5}, | ||
543 | 224 | ||
544 | *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); | 225 | /* DMA channel mask bits */ |
545 | 226 | ||
546 | /* | 227 | {ACPI_RSC_BITMASK, ACPI_RS_OFFSET(data.dma.channels[0]), |
547 | * Set the length field to the number of bytes consumed | 228 | AML_OFFSET(dma.dma_channel_mask), |
548 | * minus the header size (3 bytes) | 229 | ACPI_RS_OFFSET(data.dma.channel_count)} |
549 | */ | 230 | }; |
550 | *length_field = (u16) (*bytes_consumed - 3); | ||
551 | return_ACPI_STATUS(AE_OK); | ||
552 | } | ||
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index 103eb31c284e..573c06705641 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c | |||
@@ -49,52 +49,12 @@ ACPI_MODULE_NAME("rslist") | |||
49 | 49 | ||
50 | /******************************************************************************* | 50 | /******************************************************************************* |
51 | * | 51 | * |
52 | * FUNCTION: acpi_rs_get_resource_type | 52 | * FUNCTION: acpi_rs_convert_aml_to_resources |
53 | * | 53 | * |
54 | * PARAMETERS: resource_start_byte - Byte 0 of a resource descriptor | 54 | * PARAMETERS: Aml - Pointer to the resource byte stream |
55 | * | 55 | * aml_length - Length of Aml |
56 | * RETURN: The Resource Type with no extraneous bits | 56 | * output_buffer - Pointer to the buffer that will |
57 | * | 57 | * contain the output structures |
58 | * DESCRIPTION: Extract the Resource Type/Name from the first byte of | ||
59 | * a resource descriptor. | ||
60 | * | ||
61 | ******************************************************************************/ | ||
62 | u8 acpi_rs_get_resource_type(u8 resource_start_byte) | ||
63 | { | ||
64 | |||
65 | ACPI_FUNCTION_ENTRY(); | ||
66 | |||
67 | /* Determine if this is a small or large resource */ | ||
68 | |||
69 | switch (resource_start_byte & ACPI_RDESC_TYPE_MASK) { | ||
70 | case ACPI_RDESC_TYPE_SMALL: | ||
71 | |||
72 | /* Small Resource Type -- Only bits 6:3 are valid */ | ||
73 | |||
74 | return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK)); | ||
75 | |||
76 | case ACPI_RDESC_TYPE_LARGE: | ||
77 | |||
78 | /* Large Resource Type -- All bits are valid */ | ||
79 | |||
80 | return (resource_start_byte); | ||
81 | |||
82 | default: | ||
83 | /* Invalid type */ | ||
84 | break; | ||
85 | } | ||
86 | |||
87 | return (0xFF); | ||
88 | } | ||
89 | |||
90 | /******************************************************************************* | ||
91 | * | ||
92 | * FUNCTION: acpi_rs_byte_stream_to_list | ||
93 | * | ||
94 | * PARAMETERS: byte_stream_buffer - Pointer to the resource byte stream | ||
95 | * byte_stream_buffer_length - Length of byte_stream_buffer | ||
96 | * output_buffer - Pointer to the buffer that will | ||
97 | * contain the output structures | ||
98 | * | 58 | * |
99 | * RETURN: Status | 59 | * RETURN: Status |
100 | * | 60 | * |
@@ -102,241 +62,76 @@ u8 acpi_rs_get_resource_type(u8 resource_start_byte) | |||
102 | * linked list of resources in the caller's output buffer | 62 | * linked list of resources in the caller's output buffer |
103 | * | 63 | * |
104 | ******************************************************************************/ | 64 | ******************************************************************************/ |
105 | |||
106 | acpi_status | 65 | acpi_status |
107 | acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, | 66 | acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer) |
108 | u32 byte_stream_buffer_length, u8 * output_buffer) | ||
109 | { | 67 | { |
68 | struct acpi_resource *resource = (void *)output_buffer; | ||
110 | acpi_status status; | 69 | acpi_status status; |
111 | acpi_size bytes_parsed = 0; | 70 | u8 resource_index; |
112 | u8 resource_type = 0; | 71 | u8 *end_aml; |
113 | acpi_size bytes_consumed = 0; | 72 | |
114 | u8 *buffer = output_buffer; | 73 | ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); |
115 | acpi_size structure_size = 0; | ||
116 | u8 end_tag_processed = FALSE; | ||
117 | struct acpi_resource *resource; | ||
118 | |||
119 | ACPI_FUNCTION_TRACE("rs_byte_stream_to_list"); | ||
120 | |||
121 | while (bytes_parsed < byte_stream_buffer_length && !end_tag_processed) { | ||
122 | /* The next byte in the stream is the resource type */ | ||
123 | |||
124 | resource_type = acpi_rs_get_resource_type(*byte_stream_buffer); | ||
125 | |||
126 | switch (resource_type) { | ||
127 | case ACPI_RDESC_TYPE_MEMORY_24: | ||
128 | /* | ||
129 | * 24-Bit Memory Resource | ||
130 | */ | ||
131 | status = acpi_rs_memory24_resource(byte_stream_buffer, | ||
132 | &bytes_consumed, | ||
133 | &buffer, | ||
134 | &structure_size); | ||
135 | break; | ||
136 | |||
137 | case ACPI_RDESC_TYPE_LARGE_VENDOR: | ||
138 | /* | ||
139 | * Vendor Defined Resource | ||
140 | */ | ||
141 | status = acpi_rs_vendor_resource(byte_stream_buffer, | ||
142 | &bytes_consumed, | ||
143 | &buffer, | ||
144 | &structure_size); | ||
145 | break; | ||
146 | |||
147 | case ACPI_RDESC_TYPE_MEMORY_32: | ||
148 | /* | ||
149 | * 32-Bit Memory Range Resource | ||
150 | */ | ||
151 | status = | ||
152 | acpi_rs_memory32_range_resource(byte_stream_buffer, | ||
153 | &bytes_consumed, | ||
154 | &buffer, | ||
155 | &structure_size); | ||
156 | break; | ||
157 | |||
158 | case ACPI_RDESC_TYPE_FIXED_MEMORY_32: | ||
159 | /* | ||
160 | * 32-Bit Fixed Memory Resource | ||
161 | */ | ||
162 | status = | ||
163 | acpi_rs_fixed_memory32_resource(byte_stream_buffer, | ||
164 | &bytes_consumed, | ||
165 | &buffer, | ||
166 | &structure_size); | ||
167 | break; | ||
168 | |||
169 | case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE: | ||
170 | case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE: | ||
171 | /* | ||
172 | * 64-Bit Address Resource | ||
173 | */ | ||
174 | status = acpi_rs_address64_resource(byte_stream_buffer, | ||
175 | &bytes_consumed, | ||
176 | &buffer, | ||
177 | &structure_size); | ||
178 | break; | ||
179 | |||
180 | case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE: | ||
181 | /* | ||
182 | * 32-Bit Address Resource | ||
183 | */ | ||
184 | status = acpi_rs_address32_resource(byte_stream_buffer, | ||
185 | &bytes_consumed, | ||
186 | &buffer, | ||
187 | &structure_size); | ||
188 | break; | ||
189 | |||
190 | case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE: | ||
191 | /* | ||
192 | * 16-Bit Address Resource | ||
193 | */ | ||
194 | status = acpi_rs_address16_resource(byte_stream_buffer, | ||
195 | &bytes_consumed, | ||
196 | &buffer, | ||
197 | &structure_size); | ||
198 | break; | ||
199 | |||
200 | case ACPI_RDESC_TYPE_EXTENDED_XRUPT: | ||
201 | /* | ||
202 | * Extended IRQ | ||
203 | */ | ||
204 | status = | ||
205 | acpi_rs_extended_irq_resource(byte_stream_buffer, | ||
206 | &bytes_consumed, | ||
207 | &buffer, | ||
208 | &structure_size); | ||
209 | break; | ||
210 | |||
211 | case ACPI_RDESC_TYPE_IRQ_FORMAT: | ||
212 | /* | ||
213 | * IRQ Resource | ||
214 | */ | ||
215 | status = acpi_rs_irq_resource(byte_stream_buffer, | ||
216 | &bytes_consumed, &buffer, | ||
217 | &structure_size); | ||
218 | break; | ||
219 | |||
220 | case ACPI_RDESC_TYPE_DMA_FORMAT: | ||
221 | /* | ||
222 | * DMA Resource | ||
223 | */ | ||
224 | status = acpi_rs_dma_resource(byte_stream_buffer, | ||
225 | &bytes_consumed, &buffer, | ||
226 | &structure_size); | ||
227 | break; | ||
228 | |||
229 | case ACPI_RDESC_TYPE_START_DEPENDENT: | ||
230 | /* | ||
231 | * Start Dependent Functions Resource | ||
232 | */ | ||
233 | status = | ||
234 | acpi_rs_start_depend_fns_resource | ||
235 | (byte_stream_buffer, &bytes_consumed, &buffer, | ||
236 | &structure_size); | ||
237 | break; | ||
238 | |||
239 | case ACPI_RDESC_TYPE_END_DEPENDENT: | ||
240 | /* | ||
241 | * End Dependent Functions Resource | ||
242 | */ | ||
243 | status = | ||
244 | acpi_rs_end_depend_fns_resource(byte_stream_buffer, | ||
245 | &bytes_consumed, | ||
246 | &buffer, | ||
247 | &structure_size); | ||
248 | break; | ||
249 | |||
250 | case ACPI_RDESC_TYPE_IO_PORT: | ||
251 | /* | ||
252 | * IO Port Resource | ||
253 | */ | ||
254 | status = acpi_rs_io_resource(byte_stream_buffer, | ||
255 | &bytes_consumed, &buffer, | ||
256 | &structure_size); | ||
257 | break; | ||
258 | |||
259 | case ACPI_RDESC_TYPE_FIXED_IO_PORT: | ||
260 | /* | ||
261 | * Fixed IO Port Resource | ||
262 | */ | ||
263 | status = acpi_rs_fixed_io_resource(byte_stream_buffer, | ||
264 | &bytes_consumed, | ||
265 | &buffer, | ||
266 | &structure_size); | ||
267 | break; | ||
268 | |||
269 | case ACPI_RDESC_TYPE_SMALL_VENDOR: | ||
270 | /* | ||
271 | * Vendor Specific Resource | ||
272 | */ | ||
273 | status = acpi_rs_vendor_resource(byte_stream_buffer, | ||
274 | &bytes_consumed, | ||
275 | &buffer, | ||
276 | &structure_size); | ||
277 | break; | ||
278 | |||
279 | case ACPI_RDESC_TYPE_END_TAG: | ||
280 | /* | ||
281 | * End Tag | ||
282 | */ | ||
283 | end_tag_processed = TRUE; | ||
284 | status = acpi_rs_end_tag_resource(byte_stream_buffer, | ||
285 | &bytes_consumed, | ||
286 | &buffer, | ||
287 | &structure_size); | ||
288 | break; | ||
289 | |||
290 | default: | ||
291 | /* | ||
292 | * Invalid/Unknown resource type | ||
293 | */ | ||
294 | status = AE_AML_INVALID_RESOURCE_TYPE; | ||
295 | break; | ||
296 | } | ||
297 | 74 | ||
75 | end_aml = aml + aml_length; | ||
76 | |||
77 | /* Loop until end-of-buffer or an end_tag is found */ | ||
78 | |||
79 | while (aml < end_aml) { | ||
80 | /* Validate the Resource Type and Resource Length */ | ||
81 | |||
82 | status = acpi_ut_validate_resource(aml, &resource_index); | ||
298 | if (ACPI_FAILURE(status)) { | 83 | if (ACPI_FAILURE(status)) { |
299 | return_ACPI_STATUS(status); | 84 | return_ACPI_STATUS(status); |
300 | } | 85 | } |
301 | 86 | ||
302 | /* Update the return value and counter */ | 87 | /* Convert the AML byte stream resource to a local resource struct */ |
303 | 88 | ||
304 | bytes_parsed += bytes_consumed; | 89 | status = |
90 | acpi_rs_convert_aml_to_resource(resource, | ||
91 | ACPI_CAST_PTR(union | ||
92 | aml_resource, | ||
93 | aml), | ||
94 | acpi_gbl_get_resource_dispatch | ||
95 | [resource_index]); | ||
96 | if (ACPI_FAILURE(status)) { | ||
97 | ACPI_REPORT_ERROR(("Could not convert AML resource (Type %X) to resource, %s\n", *aml, acpi_format_exception(status))); | ||
98 | return_ACPI_STATUS(status); | ||
99 | } | ||
305 | 100 | ||
306 | /* Set the byte stream to point to the next resource */ | 101 | /* Normal exit on completion of an end_tag resource descriptor */ |
307 | 102 | ||
308 | byte_stream_buffer += bytes_consumed; | 103 | if (acpi_ut_get_resource_type(aml) == |
104 | ACPI_RESOURCE_NAME_END_TAG) { | ||
105 | return_ACPI_STATUS(AE_OK); | ||
106 | } | ||
309 | 107 | ||
310 | /* Set the Buffer to the next structure */ | 108 | /* Point to the next input AML resource */ |
311 | 109 | ||
312 | resource = ACPI_CAST_PTR(struct acpi_resource, buffer); | 110 | aml += acpi_ut_get_descriptor_length(aml); |
313 | resource->length = | ||
314 | (u32) ACPI_ALIGN_RESOURCE_SIZE(resource->length); | ||
315 | buffer += ACPI_ALIGN_RESOURCE_SIZE(structure_size); | ||
316 | } | ||
317 | 111 | ||
318 | /* Check the reason for exiting the while loop */ | 112 | /* Point to the next structure in the output buffer */ |
319 | 113 | ||
320 | if (!end_tag_processed) { | 114 | resource = |
321 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | 115 | ACPI_ADD_PTR(struct acpi_resource, resource, |
116 | resource->length); | ||
322 | } | 117 | } |
323 | 118 | ||
324 | return_ACPI_STATUS(AE_OK); | 119 | /* Did not find an end_tag resource descriptor */ |
120 | |||
121 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | ||
325 | } | 122 | } |
326 | 123 | ||
327 | /******************************************************************************* | 124 | /******************************************************************************* |
328 | * | 125 | * |
329 | * FUNCTION: acpi_rs_list_to_byte_stream | 126 | * FUNCTION: acpi_rs_convert_resources_to_aml |
330 | * | 127 | * |
331 | * PARAMETERS: linked_list - Pointer to the resource linked list | 128 | * PARAMETERS: Resource - Pointer to the resource linked list |
332 | * byte_steam_size_needed - Calculated size of the byte stream | 129 | * aml_size_needed - Calculated size of the byte stream |
333 | * needed from calling | 130 | * needed from calling acpi_rs_get_aml_length() |
334 | * acpi_rs_get_byte_stream_length() | 131 | * The size of the output_buffer is |
335 | * The size of the output_buffer is | 132 | * guaranteed to be >= aml_size_needed |
336 | * guaranteed to be >= | 133 | * output_buffer - Pointer to the buffer that will |
337 | * byte_stream_size_needed | 134 | * contain the byte stream |
338 | * output_buffer - Pointer to the buffer that will | ||
339 | * contain the byte stream | ||
340 | * | 135 | * |
341 | * RETURN: Status | 136 | * RETURN: Status |
342 | * | 137 | * |
@@ -346,180 +141,71 @@ acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, | |||
346 | ******************************************************************************/ | 141 | ******************************************************************************/ |
347 | 142 | ||
348 | acpi_status | 143 | acpi_status |
349 | acpi_rs_list_to_byte_stream(struct acpi_resource *linked_list, | 144 | acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, |
350 | acpi_size byte_stream_size_needed, | 145 | acpi_size aml_size_needed, u8 * output_buffer) |
351 | u8 * output_buffer) | ||
352 | { | 146 | { |
147 | u8 *aml = output_buffer; | ||
148 | u8 *end_aml = output_buffer + aml_size_needed; | ||
353 | acpi_status status; | 149 | acpi_status status; |
354 | u8 *buffer = output_buffer; | 150 | |
355 | acpi_size bytes_consumed = 0; | 151 | ACPI_FUNCTION_TRACE("rs_convert_resources_to_aml"); |
356 | u8 done = FALSE; | 152 | |
357 | 153 | /* Walk the resource descriptor list, convert each descriptor */ | |
358 | ACPI_FUNCTION_TRACE("rs_list_to_byte_stream"); | 154 | |
359 | 155 | while (aml < end_aml) { | |
360 | while (!done) { | 156 | /* Validate the (internal) Resource Type */ |
361 | switch (linked_list->id) { | 157 | |
362 | case ACPI_RSTYPE_IRQ: | 158 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { |
363 | /* | ||
364 | * IRQ Resource | ||
365 | */ | ||
366 | status = | ||
367 | acpi_rs_irq_stream(linked_list, &buffer, | ||
368 | &bytes_consumed); | ||
369 | break; | ||
370 | |||
371 | case ACPI_RSTYPE_DMA: | ||
372 | /* | ||
373 | * DMA Resource | ||
374 | */ | ||
375 | status = | ||
376 | acpi_rs_dma_stream(linked_list, &buffer, | ||
377 | &bytes_consumed); | ||
378 | break; | ||
379 | |||
380 | case ACPI_RSTYPE_START_DPF: | ||
381 | /* | ||
382 | * Start Dependent Functions Resource | ||
383 | */ | ||
384 | status = acpi_rs_start_depend_fns_stream(linked_list, | ||
385 | &buffer, | ||
386 | &bytes_consumed); | ||
387 | break; | ||
388 | |||
389 | case ACPI_RSTYPE_END_DPF: | ||
390 | /* | ||
391 | * End Dependent Functions Resource | ||
392 | */ | ||
393 | status = acpi_rs_end_depend_fns_stream(linked_list, | ||
394 | &buffer, | ||
395 | &bytes_consumed); | ||
396 | break; | ||
397 | |||
398 | case ACPI_RSTYPE_IO: | ||
399 | /* | ||
400 | * IO Port Resource | ||
401 | */ | ||
402 | status = | ||
403 | acpi_rs_io_stream(linked_list, &buffer, | ||
404 | &bytes_consumed); | ||
405 | break; | ||
406 | |||
407 | case ACPI_RSTYPE_FIXED_IO: | ||
408 | /* | ||
409 | * Fixed IO Port Resource | ||
410 | */ | ||
411 | status = | ||
412 | acpi_rs_fixed_io_stream(linked_list, &buffer, | ||
413 | &bytes_consumed); | ||
414 | break; | ||
415 | |||
416 | case ACPI_RSTYPE_VENDOR: | ||
417 | /* | ||
418 | * Vendor Defined Resource | ||
419 | */ | ||
420 | status = | ||
421 | acpi_rs_vendor_stream(linked_list, &buffer, | ||
422 | &bytes_consumed); | ||
423 | break; | ||
424 | |||
425 | case ACPI_RSTYPE_END_TAG: | ||
426 | /* | ||
427 | * End Tag | ||
428 | */ | ||
429 | status = | ||
430 | acpi_rs_end_tag_stream(linked_list, &buffer, | ||
431 | &bytes_consumed); | ||
432 | |||
433 | /* An End Tag indicates the end of the Resource Template */ | ||
434 | |||
435 | done = TRUE; | ||
436 | break; | ||
437 | |||
438 | case ACPI_RSTYPE_MEM24: | ||
439 | /* | ||
440 | * 24-Bit Memory Resource | ||
441 | */ | ||
442 | status = | ||
443 | acpi_rs_memory24_stream(linked_list, &buffer, | ||
444 | &bytes_consumed); | ||
445 | break; | ||
446 | |||
447 | case ACPI_RSTYPE_MEM32: | ||
448 | /* | ||
449 | * 32-Bit Memory Range Resource | ||
450 | */ | ||
451 | status = | ||
452 | acpi_rs_memory32_range_stream(linked_list, &buffer, | ||
453 | &bytes_consumed); | ||
454 | break; | ||
455 | |||
456 | case ACPI_RSTYPE_FIXED_MEM32: | ||
457 | /* | ||
458 | * 32-Bit Fixed Memory Resource | ||
459 | */ | ||
460 | status = | ||
461 | acpi_rs_fixed_memory32_stream(linked_list, &buffer, | ||
462 | &bytes_consumed); | ||
463 | break; | ||
464 | |||
465 | case ACPI_RSTYPE_ADDRESS16: | ||
466 | /* | ||
467 | * 16-Bit Address Descriptor Resource | ||
468 | */ | ||
469 | status = acpi_rs_address16_stream(linked_list, &buffer, | ||
470 | &bytes_consumed); | ||
471 | break; | ||
472 | |||
473 | case ACPI_RSTYPE_ADDRESS32: | ||
474 | /* | ||
475 | * 32-Bit Address Descriptor Resource | ||
476 | */ | ||
477 | status = acpi_rs_address32_stream(linked_list, &buffer, | ||
478 | &bytes_consumed); | ||
479 | break; | ||
480 | |||
481 | case ACPI_RSTYPE_ADDRESS64: | ||
482 | /* | ||
483 | * 64-Bit Address Descriptor Resource | ||
484 | */ | ||
485 | status = acpi_rs_address64_stream(linked_list, &buffer, | ||
486 | &bytes_consumed); | ||
487 | break; | ||
488 | |||
489 | case ACPI_RSTYPE_EXT_IRQ: | ||
490 | /* | ||
491 | * Extended IRQ Resource | ||
492 | */ | ||
493 | status = | ||
494 | acpi_rs_extended_irq_stream(linked_list, &buffer, | ||
495 | &bytes_consumed); | ||
496 | break; | ||
497 | |||
498 | default: | ||
499 | /* | ||
500 | * If we get here, everything is out of sync, | ||
501 | * so exit with an error | ||
502 | */ | ||
503 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 159 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
504 | "Invalid descriptor type (%X) in resource list\n", | 160 | "Invalid descriptor type (%X) in resource list\n", |
505 | linked_list->id)); | 161 | resource->type)); |
506 | status = AE_BAD_DATA; | 162 | return_ACPI_STATUS(AE_BAD_DATA); |
507 | break; | ||
508 | } | 163 | } |
509 | 164 | ||
165 | /* Perform the conversion */ | ||
166 | |||
167 | status = acpi_rs_convert_resource_to_aml(resource, | ||
168 | ACPI_CAST_PTR(union | ||
169 | aml_resource, | ||
170 | aml), | ||
171 | acpi_gbl_set_resource_dispatch | ||
172 | [resource->type]); | ||
510 | if (ACPI_FAILURE(status)) { | 173 | if (ACPI_FAILURE(status)) { |
174 | ACPI_REPORT_ERROR(("Could not convert resource (type %X) to AML, %s\n", resource->type, acpi_format_exception(status))); | ||
511 | return_ACPI_STATUS(status); | 175 | return_ACPI_STATUS(status); |
512 | } | 176 | } |
513 | 177 | ||
514 | /* Set the Buffer to point to the open byte */ | 178 | /* Perform final sanity check on the new AML resource descriptor */ |
179 | |||
180 | status = | ||
181 | acpi_ut_validate_resource(ACPI_CAST_PTR | ||
182 | (union aml_resource, aml), NULL); | ||
183 | if (ACPI_FAILURE(status)) { | ||
184 | return_ACPI_STATUS(status); | ||
185 | } | ||
515 | 186 | ||
516 | buffer += bytes_consumed; | 187 | /* Check for end-of-list, normal exit */ |
517 | 188 | ||
518 | /* Point to the next object */ | 189 | if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { |
190 | /* An End Tag indicates the end of the input Resource Template */ | ||
519 | 191 | ||
520 | linked_list = ACPI_PTR_ADD(struct acpi_resource, | 192 | return_ACPI_STATUS(AE_OK); |
521 | linked_list, linked_list->length); | 193 | } |
194 | |||
195 | /* | ||
196 | * Extract the total length of the new descriptor and set the | ||
197 | * Aml to point to the next (output) resource descriptor | ||
198 | */ | ||
199 | aml += acpi_ut_get_descriptor_length(aml); | ||
200 | |||
201 | /* Point to the next input resource descriptor */ | ||
202 | |||
203 | resource = | ||
204 | ACPI_ADD_PTR(struct acpi_resource, resource, | ||
205 | resource->length); | ||
522 | } | 206 | } |
523 | 207 | ||
524 | return_ACPI_STATUS(AE_OK); | 208 | /* Completed buffer, but did not find an end_tag resource descriptor */ |
209 | |||
210 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | ||
525 | } | 211 | } |
diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c index daba1a1ed46d..418a3fb64077 100644 --- a/drivers/acpi/resources/rsmemory.c +++ b/drivers/acpi/resources/rsmemory.c | |||
@@ -49,454 +49,187 @@ ACPI_MODULE_NAME("rsmemory") | |||
49 | 49 | ||
50 | /******************************************************************************* | 50 | /******************************************************************************* |
51 | * | 51 | * |
52 | * FUNCTION: acpi_rs_memory24_resource | 52 | * acpi_rs_convert_memory24 |
53 | * | ||
54 | * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte | ||
55 | * stream | ||
56 | * bytes_consumed - Pointer to where the number of bytes | ||
57 | * consumed the byte_stream_buffer is | ||
58 | * returned | ||
59 | * output_buffer - Pointer to the return data buffer | ||
60 | * structure_size - Pointer to where the number of bytes | ||
61 | * in the return data struct is returned | ||
62 | * | ||
63 | * RETURN: Status | ||
64 | * | ||
65 | * DESCRIPTION: Take the resource byte stream and fill out the appropriate | ||
66 | * structure pointed to by the output_buffer. Return the | ||
67 | * number of bytes consumed from the byte stream. | ||
68 | * | 53 | * |
69 | ******************************************************************************/ | 54 | ******************************************************************************/ |
70 | acpi_status | 55 | struct acpi_rsconvert_info acpi_rs_convert_memory24[4] = { |
71 | acpi_rs_memory24_resource(u8 * byte_stream_buffer, | 56 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY24, |
72 | acpi_size * bytes_consumed, | 57 | ACPI_RS_SIZE(struct acpi_resource_memory24), |
73 | u8 ** output_buffer, acpi_size * structure_size) | 58 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory24)}, |
74 | { | ||
75 | u8 *buffer = byte_stream_buffer; | ||
76 | struct acpi_resource *output_struct = (void *)*output_buffer; | ||
77 | u16 temp16 = 0; | ||
78 | u8 temp8 = 0; | ||
79 | acpi_size struct_size = | ||
80 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24); | ||
81 | |||
82 | ACPI_FUNCTION_TRACE("rs_memory24_resource"); | ||
83 | |||
84 | /* Point past the Descriptor to get the number of bytes consumed */ | ||
85 | |||
86 | buffer += 1; | ||
87 | |||
88 | ACPI_MOVE_16_TO_16(&temp16, buffer); | ||
89 | buffer += 2; | ||
90 | *bytes_consumed = (acpi_size) temp16 + 3; | ||
91 | output_struct->id = ACPI_RSTYPE_MEM24; | ||
92 | |||
93 | /* Check Byte 3 the Read/Write bit */ | ||
94 | |||
95 | temp8 = *buffer; | ||
96 | buffer += 1; | ||
97 | output_struct->data.memory24.read_write_attribute = temp8 & 0x01; | ||
98 | |||
99 | /* Get min_base_address (Bytes 4-5) */ | ||
100 | |||
101 | ACPI_MOVE_16_TO_16(&temp16, buffer); | ||
102 | buffer += 2; | ||
103 | output_struct->data.memory24.min_base_address = temp16; | ||
104 | |||
105 | /* Get max_base_address (Bytes 6-7) */ | ||
106 | |||
107 | ACPI_MOVE_16_TO_16(&temp16, buffer); | ||
108 | buffer += 2; | ||
109 | output_struct->data.memory24.max_base_address = temp16; | ||
110 | 59 | ||
111 | /* Get Alignment (Bytes 8-9) */ | 60 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY24, |
61 | sizeof(struct aml_resource_memory24), | ||
62 | 0}, | ||
112 | 63 | ||
113 | ACPI_MOVE_16_TO_16(&temp16, buffer); | 64 | /* Read/Write bit */ |
114 | buffer += 2; | ||
115 | output_struct->data.memory24.alignment = temp16; | ||
116 | 65 | ||
117 | /* Get range_length (Bytes 10-11) */ | 66 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory24.write_protect), |
118 | 67 | AML_OFFSET(memory24.flags), | |
119 | ACPI_MOVE_16_TO_16(&temp16, buffer); | 68 | 0}, |
120 | output_struct->data.memory24.range_length = temp16; | 69 | /* |
121 | 70 | * These fields are contiguous in both the source and destination: | |
122 | /* Set the Length parameter */ | 71 | * Minimum Base Address |
123 | 72 | * Maximum Base Address | |
124 | output_struct->length = (u32) struct_size; | 73 | * Address Base Alignment |
125 | 74 | * Range Length | |
126 | /* Return the final size of the structure */ | 75 | */ |
127 | 76 | {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.memory24.minimum), | |
128 | *structure_size = struct_size; | 77 | AML_OFFSET(memory24.minimum), |
129 | return_ACPI_STATUS(AE_OK); | 78 | 4} |
130 | } | 79 | }; |
131 | 80 | ||
132 | /******************************************************************************* | 81 | /******************************************************************************* |
133 | * | 82 | * |
134 | * FUNCTION: acpi_rs_memory24_stream | 83 | * acpi_rs_convert_memory32 |
135 | * | ||
136 | * PARAMETERS: linked_list - Pointer to the resource linked list | ||
137 | * output_buffer - Pointer to the user's return buffer | ||
138 | * bytes_consumed - Pointer to where the number of bytes | ||
139 | * used in the output_buffer is returned | ||
140 | * | ||
141 | * RETURN: Status | ||
142 | * | ||
143 | * DESCRIPTION: Take the linked list resource structure and fills in the | ||
144 | * the appropriate bytes in a byte stream | ||
145 | * | 84 | * |
146 | ******************************************************************************/ | 85 | ******************************************************************************/ |
147 | 86 | ||
148 | acpi_status | 87 | struct acpi_rsconvert_info acpi_rs_convert_memory32[4] = { |
149 | acpi_rs_memory24_stream(struct acpi_resource *linked_list, | 88 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY32, |
150 | u8 ** output_buffer, acpi_size * bytes_consumed) | 89 | ACPI_RS_SIZE(struct acpi_resource_memory32), |
151 | { | 90 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory32)}, |
152 | u8 *buffer = *output_buffer; | ||
153 | u16 temp16 = 0; | ||
154 | u8 temp8 = 0; | ||
155 | |||
156 | ACPI_FUNCTION_TRACE("rs_memory24_stream"); | ||
157 | |||
158 | /* The descriptor field is static */ | ||
159 | |||
160 | *buffer = 0x81; | ||
161 | buffer += 1; | ||
162 | 91 | ||
163 | /* The length field is static */ | 92 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY32, |
93 | sizeof(struct aml_resource_memory32), | ||
94 | 0}, | ||
164 | 95 | ||
165 | temp16 = 0x09; | 96 | /* Read/Write bit */ |
166 | ACPI_MOVE_16_TO_16(buffer, &temp16); | ||
167 | buffer += 2; | ||
168 | 97 | ||
169 | /* Set the Information Byte */ | 98 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory32.write_protect), |
170 | 99 | AML_OFFSET(memory32.flags), | |
171 | temp8 = (u8) (linked_list->data.memory24.read_write_attribute & 0x01); | 100 | 0}, |
172 | *buffer = temp8; | 101 | /* |
173 | buffer += 1; | 102 | * These fields are contiguous in both the source and destination: |
174 | 103 | * Minimum Base Address | |
175 | /* Set the Range minimum base address */ | 104 | * Maximum Base Address |
176 | 105 | * Address Base Alignment | |
177 | ACPI_MOVE_32_TO_16(buffer, | 106 | * Range Length |
178 | &linked_list->data.memory24.min_base_address); | 107 | */ |
179 | buffer += 2; | 108 | {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.memory32.minimum), |
180 | 109 | AML_OFFSET(memory32.minimum), | |
181 | /* Set the Range maximum base address */ | 110 | 4} |
182 | 111 | }; | |
183 | ACPI_MOVE_32_TO_16(buffer, | ||
184 | &linked_list->data.memory24.max_base_address); | ||
185 | buffer += 2; | ||
186 | |||
187 | /* Set the base alignment */ | ||
188 | |||
189 | ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.alignment); | ||
190 | buffer += 2; | ||
191 | |||
192 | /* Set the range length */ | ||
193 | |||
194 | ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.range_length); | ||
195 | buffer += 2; | ||
196 | |||
197 | /* Return the number of bytes consumed in this operation */ | ||
198 | |||
199 | *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); | ||
200 | return_ACPI_STATUS(AE_OK); | ||
201 | } | ||
202 | 112 | ||
203 | /******************************************************************************* | 113 | /******************************************************************************* |
204 | * | 114 | * |
205 | * FUNCTION: acpi_rs_memory32_range_resource | 115 | * acpi_rs_convert_fixed_memory32 |
206 | * | ||
207 | * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte | ||
208 | * stream | ||
209 | * bytes_consumed - Pointer to where the number of bytes | ||
210 | * consumed the byte_stream_buffer is | ||
211 | * returned | ||
212 | * output_buffer - Pointer to the return data buffer | ||
213 | * structure_size - Pointer to where the number of bytes | ||
214 | * in the return data struct is returned | ||
215 | * | ||
216 | * RETURN: Status | ||
217 | * | ||
218 | * DESCRIPTION: Take the resource byte stream and fill out the appropriate | ||
219 | * structure pointed to by the output_buffer. Return the | ||
220 | * number of bytes consumed from the byte stream. | ||
221 | * | 116 | * |
222 | ******************************************************************************/ | 117 | ******************************************************************************/ |
223 | 118 | ||
224 | acpi_status | 119 | struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[4] = { |
225 | acpi_rs_memory32_range_resource(u8 * byte_stream_buffer, | 120 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_MEMORY32, |
226 | acpi_size * bytes_consumed, | 121 | ACPI_RS_SIZE(struct acpi_resource_fixed_memory32), |
227 | u8 ** output_buffer, acpi_size * structure_size) | 122 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_fixed_memory32)}, |
228 | { | ||
229 | u8 *buffer = byte_stream_buffer; | ||
230 | struct acpi_resource *output_struct = (void *)*output_buffer; | ||
231 | u16 temp16 = 0; | ||
232 | u8 temp8 = 0; | ||
233 | acpi_size struct_size = | ||
234 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32); | ||
235 | |||
236 | ACPI_FUNCTION_TRACE("rs_memory32_range_resource"); | ||
237 | |||
238 | /* Point past the Descriptor to get the number of bytes consumed */ | ||
239 | |||
240 | buffer += 1; | ||
241 | 123 | ||
242 | ACPI_MOVE_16_TO_16(&temp16, buffer); | 124 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_MEMORY32, |
243 | buffer += 2; | 125 | sizeof(struct aml_resource_fixed_memory32), |
244 | *bytes_consumed = (acpi_size) temp16 + 3; | 126 | 0}, |
245 | 127 | ||
246 | output_struct->id = ACPI_RSTYPE_MEM32; | 128 | /* Read/Write bit */ |
247 | 129 | ||
130 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.fixed_memory32.write_protect), | ||
131 | AML_OFFSET(fixed_memory32.flags), | ||
132 | 0}, | ||
248 | /* | 133 | /* |
249 | * Point to the place in the output buffer where the data portion will | 134 | * These fields are contiguous in both the source and destination: |
250 | * begin. | 135 | * Base Address |
251 | * 1. Set the RESOURCE_DATA * Data to point to its own address, then | 136 | * Range Length |
252 | * 2. Set the pointer to the next address. | ||
253 | * | ||
254 | * NOTE: output_struct->Data is cast to u8, otherwise, this addition adds | ||
255 | * 4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(u8) | ||
256 | */ | 137 | */ |
257 | 138 | {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.fixed_memory32.address), | |
258 | /* Check Byte 3 the Read/Write bit */ | 139 | AML_OFFSET(fixed_memory32.address), |
259 | 140 | 2} | |
260 | temp8 = *buffer; | 141 | }; |
261 | buffer += 1; | ||
262 | |||
263 | output_struct->data.memory32.read_write_attribute = temp8 & 0x01; | ||
264 | |||
265 | /* Get min_base_address (Bytes 4-7) */ | ||
266 | |||
267 | ACPI_MOVE_32_TO_32(&output_struct->data.memory32.min_base_address, | ||
268 | buffer); | ||
269 | buffer += 4; | ||
270 | |||
271 | /* Get max_base_address (Bytes 8-11) */ | ||
272 | |||
273 | ACPI_MOVE_32_TO_32(&output_struct->data.memory32.max_base_address, | ||
274 | buffer); | ||
275 | buffer += 4; | ||
276 | |||
277 | /* Get Alignment (Bytes 12-15) */ | ||
278 | |||
279 | ACPI_MOVE_32_TO_32(&output_struct->data.memory32.alignment, buffer); | ||
280 | buffer += 4; | ||
281 | |||
282 | /* Get range_length (Bytes 16-19) */ | ||
283 | |||
284 | ACPI_MOVE_32_TO_32(&output_struct->data.memory32.range_length, buffer); | ||
285 | |||
286 | /* Set the Length parameter */ | ||
287 | |||
288 | output_struct->length = (u32) struct_size; | ||
289 | |||
290 | /* Return the final size of the structure */ | ||
291 | |||
292 | *structure_size = struct_size; | ||
293 | return_ACPI_STATUS(AE_OK); | ||
294 | } | ||
295 | 142 | ||
296 | /******************************************************************************* | 143 | /******************************************************************************* |
297 | * | 144 | * |
298 | * FUNCTION: acpi_rs_fixed_memory32_resource | 145 | * acpi_rs_get_vendor_small |
299 | * | ||
300 | * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte | ||
301 | * stream | ||
302 | * bytes_consumed - Pointer to where the number of bytes | ||
303 | * consumed the byte_stream_buffer is | ||
304 | * returned | ||
305 | * output_buffer - Pointer to the return data buffer | ||
306 | * structure_size - Pointer to where the number of bytes | ||
307 | * in the return data struct is returned | ||
308 | * | ||
309 | * RETURN: Status | ||
310 | * | ||
311 | * DESCRIPTION: Take the resource byte stream and fill out the appropriate | ||
312 | * structure pointed to by the output_buffer. Return the | ||
313 | * number of bytes consumed from the byte stream. | ||
314 | * | 146 | * |
315 | ******************************************************************************/ | 147 | ******************************************************************************/ |
316 | 148 | ||
317 | acpi_status | 149 | struct acpi_rsconvert_info acpi_rs_get_vendor_small[3] = { |
318 | acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer, | 150 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR, |
319 | acpi_size * bytes_consumed, | 151 | ACPI_RS_SIZE(struct acpi_resource_vendor), |
320 | u8 ** output_buffer, acpi_size * structure_size) | 152 | ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_small)}, |
321 | { | ||
322 | u8 *buffer = byte_stream_buffer; | ||
323 | struct acpi_resource *output_struct = (void *)*output_buffer; | ||
324 | u16 temp16 = 0; | ||
325 | u8 temp8 = 0; | ||
326 | acpi_size struct_size = | ||
327 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_mem32); | ||
328 | |||
329 | ACPI_FUNCTION_TRACE("rs_fixed_memory32_resource"); | ||
330 | 153 | ||
331 | /* Point past the Descriptor to get the number of bytes consumed */ | 154 | /* Length of the vendor data (byte count) */ |
332 | 155 | ||
333 | buffer += 1; | 156 | {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), |
334 | ACPI_MOVE_16_TO_16(&temp16, buffer); | 157 | 0, |
158 | sizeof(u8)} | ||
159 | , | ||
335 | 160 | ||
336 | buffer += 2; | 161 | /* Vendor data */ |
337 | *bytes_consumed = (acpi_size) temp16 + 3; | ||
338 | 162 | ||
339 | output_struct->id = ACPI_RSTYPE_FIXED_MEM32; | 163 | {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), |
340 | 164 | sizeof(struct aml_resource_small_header), | |
341 | /* Check Byte 3 the Read/Write bit */ | 165 | 0} |
342 | 166 | }; | |
343 | temp8 = *buffer; | ||
344 | buffer += 1; | ||
345 | output_struct->data.fixed_memory32.read_write_attribute = temp8 & 0x01; | ||
346 | |||
347 | /* Get range_base_address (Bytes 4-7) */ | ||
348 | |||
349 | ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32. | ||
350 | range_base_address, buffer); | ||
351 | buffer += 4; | ||
352 | |||
353 | /* Get range_length (Bytes 8-11) */ | ||
354 | |||
355 | ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32.range_length, | ||
356 | buffer); | ||
357 | |||
358 | /* Set the Length parameter */ | ||
359 | |||
360 | output_struct->length = (u32) struct_size; | ||
361 | |||
362 | /* Return the final size of the structure */ | ||
363 | |||
364 | *structure_size = struct_size; | ||
365 | return_ACPI_STATUS(AE_OK); | ||
366 | } | ||
367 | 167 | ||
368 | /******************************************************************************* | 168 | /******************************************************************************* |
369 | * | 169 | * |
370 | * FUNCTION: acpi_rs_memory32_range_stream | 170 | * acpi_rs_get_vendor_large |
371 | * | ||
372 | * PARAMETERS: linked_list - Pointer to the resource linked list | ||
373 | * output_buffer - Pointer to the user's return buffer | ||
374 | * bytes_consumed - Pointer to where the number of bytes | ||
375 | * used in the output_buffer is returned | ||
376 | * | ||
377 | * RETURN: Status | ||
378 | * | ||
379 | * DESCRIPTION: Take the linked list resource structure and fills in the | ||
380 | * the appropriate bytes in a byte stream | ||
381 | * | 171 | * |
382 | ******************************************************************************/ | 172 | ******************************************************************************/ |
383 | 173 | ||
384 | acpi_status | 174 | struct acpi_rsconvert_info acpi_rs_get_vendor_large[3] = { |
385 | acpi_rs_memory32_range_stream(struct acpi_resource *linked_list, | 175 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR, |
386 | u8 ** output_buffer, acpi_size * bytes_consumed) | 176 | ACPI_RS_SIZE(struct acpi_resource_vendor), |
387 | { | 177 | ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_large)}, |
388 | u8 *buffer = *output_buffer; | ||
389 | u16 temp16 = 0; | ||
390 | u8 temp8 = 0; | ||
391 | |||
392 | ACPI_FUNCTION_TRACE("rs_memory32_range_stream"); | ||
393 | |||
394 | /* The descriptor field is static */ | ||
395 | |||
396 | *buffer = 0x85; | ||
397 | buffer += 1; | ||
398 | |||
399 | /* The length field is static */ | ||
400 | |||
401 | temp16 = 0x11; | ||
402 | |||
403 | ACPI_MOVE_16_TO_16(buffer, &temp16); | ||
404 | buffer += 2; | ||
405 | |||
406 | /* Set the Information Byte */ | ||
407 | |||
408 | temp8 = (u8) (linked_list->data.memory32.read_write_attribute & 0x01); | ||
409 | *buffer = temp8; | ||
410 | buffer += 1; | ||
411 | |||
412 | /* Set the Range minimum base address */ | ||
413 | |||
414 | ACPI_MOVE_32_TO_32(buffer, | ||
415 | &linked_list->data.memory32.min_base_address); | ||
416 | buffer += 4; | ||
417 | |||
418 | /* Set the Range maximum base address */ | ||
419 | |||
420 | ACPI_MOVE_32_TO_32(buffer, | ||
421 | &linked_list->data.memory32.max_base_address); | ||
422 | buffer += 4; | ||
423 | 178 | ||
424 | /* Set the base alignment */ | 179 | /* Length of the vendor data (byte count) */ |
425 | 180 | ||
426 | ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.alignment); | 181 | {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), |
427 | buffer += 4; | 182 | 0, |
183 | sizeof(u8)} | ||
184 | , | ||
428 | 185 | ||
429 | /* Set the range length */ | 186 | /* Vendor data */ |
430 | 187 | ||
431 | ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.range_length); | 188 | {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), |
432 | buffer += 4; | 189 | sizeof(struct aml_resource_large_header), |
433 | 190 | 0} | |
434 | /* Return the number of bytes consumed in this operation */ | 191 | }; |
435 | |||
436 | *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); | ||
437 | return_ACPI_STATUS(AE_OK); | ||
438 | } | ||
439 | 192 | ||
440 | /******************************************************************************* | 193 | /******************************************************************************* |
441 | * | 194 | * |
442 | * FUNCTION: acpi_rs_fixed_memory32_stream | 195 | * acpi_rs_set_vendor |
443 | * | ||
444 | * PARAMETERS: linked_list - Pointer to the resource linked list | ||
445 | * output_buffer - Pointer to the user's return buffer | ||
446 | * bytes_consumed - Pointer to where the number of bytes | ||
447 | * used in the output_buffer is returned | ||
448 | * | ||
449 | * RETURN: Status | ||
450 | * | ||
451 | * DESCRIPTION: Take the linked list resource structure and fills in the | ||
452 | * the appropriate bytes in a byte stream | ||
453 | * | 196 | * |
454 | ******************************************************************************/ | 197 | ******************************************************************************/ |
455 | 198 | ||
456 | acpi_status | 199 | struct acpi_rsconvert_info acpi_rs_set_vendor[7] = { |
457 | acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list, | 200 | /* Default is a small vendor descriptor */ |
458 | u8 ** output_buffer, acpi_size * bytes_consumed) | ||
459 | { | ||
460 | u8 *buffer = *output_buffer; | ||
461 | u16 temp16 = 0; | ||
462 | u8 temp8 = 0; | ||
463 | |||
464 | ACPI_FUNCTION_TRACE("rs_fixed_memory32_stream"); | ||
465 | 201 | ||
466 | /* The descriptor field is static */ | 202 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_SMALL, |
203 | sizeof(struct aml_resource_small_header), | ||
204 | ACPI_RSC_TABLE_SIZE(acpi_rs_set_vendor)}, | ||
467 | 205 | ||
468 | *buffer = 0x86; | 206 | /* Get the length and copy the data */ |
469 | buffer += 1; | ||
470 | 207 | ||
471 | /* The length field is static */ | 208 | {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), |
209 | 0, | ||
210 | 0}, | ||
472 | 211 | ||
473 | temp16 = 0x09; | 212 | {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), |
213 | sizeof(struct aml_resource_small_header), | ||
214 | 0}, | ||
474 | 215 | ||
475 | ACPI_MOVE_16_TO_16(buffer, &temp16); | 216 | /* |
476 | buffer += 2; | 217 | * All done if the Vendor byte length is 7 or less, meaning that it will |
477 | 218 | * fit within a small descriptor | |
478 | /* Set the Information Byte */ | 219 | */ |
479 | 220 | {ACPI_RSC_EXIT_LE, 0, 0, 7}, | |
480 | temp8 = | ||
481 | (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01); | ||
482 | *buffer = temp8; | ||
483 | buffer += 1; | ||
484 | |||
485 | /* Set the Range base address */ | ||
486 | |||
487 | ACPI_MOVE_32_TO_32(buffer, | ||
488 | &linked_list->data.fixed_memory32. | ||
489 | range_base_address); | ||
490 | buffer += 4; | ||
491 | 221 | ||
492 | /* Set the range length */ | 222 | /* Must create a large vendor descriptor */ |
493 | 223 | ||
494 | ACPI_MOVE_32_TO_32(buffer, | 224 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_LARGE, |
495 | &linked_list->data.fixed_memory32.range_length); | 225 | sizeof(struct aml_resource_large_header), |
496 | buffer += 4; | 226 | 0}, |
497 | 227 | ||
498 | /* Return the number of bytes consumed in this operation */ | 228 | {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), |
229 | 0, | ||
230 | 0}, | ||
499 | 231 | ||
500 | *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); | 232 | {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), |
501 | return_ACPI_STATUS(AE_OK); | 233 | sizeof(struct aml_resource_large_header), |
502 | } | 234 | 0} |
235 | }; | ||
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index 7a8a34e757f5..e1b5aa2af9a5 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c | |||
@@ -47,481 +47,506 @@ | |||
47 | #define _COMPONENT ACPI_RESOURCES | 47 | #define _COMPONENT ACPI_RESOURCES |
48 | ACPI_MODULE_NAME("rsmisc") | 48 | ACPI_MODULE_NAME("rsmisc") |
49 | 49 | ||
50 | #define INIT_RESOURCE_TYPE(i) i->resource_offset | ||
51 | #define INIT_RESOURCE_LENGTH(i) i->aml_offset | ||
52 | #define INIT_TABLE_LENGTH(i) i->value | ||
53 | #define COMPARE_OPCODE(i) i->resource_offset | ||
54 | #define COMPARE_TARGET(i) i->aml_offset | ||
55 | #define COMPARE_VALUE(i) i->value | ||
50 | /******************************************************************************* | 56 | /******************************************************************************* |
51 | * | 57 | * |
52 | * FUNCTION: acpi_rs_end_tag_resource | 58 | * FUNCTION: acpi_rs_convert_aml_to_resource |
53 | * | 59 | * |
54 | * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte | 60 | * PARAMETERS: Resource - Pointer to the resource descriptor |
55 | * stream | 61 | * Aml - Where the AML descriptor is returned |
56 | * bytes_consumed - Pointer to where the number of bytes | 62 | * Info - Pointer to appropriate conversion table |
57 | * consumed the byte_stream_buffer is | ||
58 | * returned | ||
59 | * output_buffer - Pointer to the return data buffer | ||
60 | * structure_size - Pointer to where the number of bytes | ||
61 | * in the return data struct is returned | ||
62 | * | 63 | * |
63 | * RETURN: Status | 64 | * RETURN: Status |
64 | * | 65 | * |
65 | * DESCRIPTION: Take the resource byte stream and fill out the appropriate | 66 | * DESCRIPTION: Convert an external AML resource descriptor to the corresponding |
66 | * structure pointed to by the output_buffer. Return the | 67 | * internal resource descriptor |
67 | * number of bytes consumed from the byte stream. | ||
68 | * | 68 | * |
69 | ******************************************************************************/ | 69 | ******************************************************************************/ |
70 | acpi_status | 70 | acpi_status |
71 | acpi_rs_end_tag_resource(u8 * byte_stream_buffer, | 71 | acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, |
72 | acpi_size * bytes_consumed, | 72 | union aml_resource *aml, |
73 | u8 ** output_buffer, acpi_size * structure_size) | 73 | struct acpi_rsconvert_info *info) |
74 | { | 74 | { |
75 | struct acpi_resource *output_struct = (void *)*output_buffer; | 75 | acpi_rs_length aml_resource_length; |
76 | acpi_size struct_size = ACPI_RESOURCE_LENGTH; | 76 | void *source; |
77 | 77 | void *destination; | |
78 | ACPI_FUNCTION_TRACE("rs_end_tag_resource"); | 78 | char *target; |
79 | 79 | u8 count; | |
80 | /* The number of bytes consumed is static */ | 80 | u8 flags_mode = FALSE; |
81 | 81 | u16 item_count = 0; | |
82 | *bytes_consumed = 2; | ||
83 | |||
84 | /* Fill out the structure */ | ||
85 | |||
86 | output_struct->id = ACPI_RSTYPE_END_TAG; | ||
87 | |||
88 | /* Set the Length parameter */ | ||
89 | |||
90 | output_struct->length = 0; | ||
91 | |||
92 | /* Return the final size of the structure */ | ||
93 | |||
94 | *structure_size = struct_size; | ||
95 | return_ACPI_STATUS(AE_OK); | ||
96 | } | ||
97 | |||
98 | /******************************************************************************* | ||
99 | * | ||
100 | * FUNCTION: acpi_rs_end_tag_stream | ||
101 | * | ||
102 | * PARAMETERS: linked_list - Pointer to the resource linked list | ||
103 | * output_buffer - Pointer to the user's return buffer | ||
104 | * bytes_consumed - Pointer to where the number of bytes | ||
105 | * used in the output_buffer is returned | ||
106 | * | ||
107 | * RETURN: Status | ||
108 | * | ||
109 | * DESCRIPTION: Take the linked list resource structure and fills in the | ||
110 | * the appropriate bytes in a byte stream | ||
111 | * | ||
112 | ******************************************************************************/ | ||
113 | |||
114 | acpi_status | ||
115 | acpi_rs_end_tag_stream(struct acpi_resource *linked_list, | ||
116 | u8 ** output_buffer, acpi_size * bytes_consumed) | ||
117 | { | ||
118 | u8 *buffer = *output_buffer; | ||
119 | u8 temp8 = 0; | ||
120 | |||
121 | ACPI_FUNCTION_TRACE("rs_end_tag_stream"); | ||
122 | |||
123 | /* The descriptor field is static */ | ||
124 | |||
125 | *buffer = 0x79; | ||
126 | buffer += 1; | ||
127 | |||
128 | /* | ||
129 | * Set the Checksum - zero means that the resource data is treated as if | ||
130 | * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8) | ||
131 | */ | ||
132 | temp8 = 0; | ||
133 | |||
134 | *buffer = temp8; | ||
135 | buffer += 1; | ||
136 | |||
137 | /* Return the number of bytes consumed in this operation */ | ||
138 | |||
139 | *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); | ||
140 | return_ACPI_STATUS(AE_OK); | ||
141 | } | ||
142 | |||
143 | /******************************************************************************* | ||
144 | * | ||
145 | * FUNCTION: acpi_rs_vendor_resource | ||
146 | * | ||
147 | * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte | ||
148 | * stream | ||
149 | * bytes_consumed - Pointer to where the number of bytes | ||
150 | * consumed the byte_stream_buffer is | ||
151 | * returned | ||
152 | * output_buffer - Pointer to the return data buffer | ||
153 | * structure_size - Pointer to where the number of bytes | ||
154 | * in the return data struct is returned | ||
155 | * | ||
156 | * RETURN: Status | ||
157 | * | ||
158 | * DESCRIPTION: Take the resource byte stream and fill out the appropriate | ||
159 | * structure pointed to by the output_buffer. Return the | ||
160 | * number of bytes consumed from the byte stream. | ||
161 | * | ||
162 | ******************************************************************************/ | ||
163 | |||
164 | acpi_status | ||
165 | acpi_rs_vendor_resource(u8 * byte_stream_buffer, | ||
166 | acpi_size * bytes_consumed, | ||
167 | u8 ** output_buffer, acpi_size * structure_size) | ||
168 | { | ||
169 | u8 *buffer = byte_stream_buffer; | ||
170 | struct acpi_resource *output_struct = (void *)*output_buffer; | ||
171 | u16 temp16 = 0; | 82 | u16 temp16 = 0; |
172 | u8 temp8 = 0; | ||
173 | u8 index; | ||
174 | acpi_size struct_size = | ||
175 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor); | ||
176 | |||
177 | ACPI_FUNCTION_TRACE("rs_vendor_resource"); | ||
178 | |||
179 | /* Dereference the Descriptor to find if this is a large or small item. */ | ||
180 | |||
181 | temp8 = *buffer; | ||
182 | |||
183 | if (temp8 & 0x80) { | ||
184 | /* Large Item, point to the length field */ | ||
185 | |||
186 | buffer += 1; | ||
187 | 83 | ||
188 | /* Dereference */ | 84 | ACPI_FUNCTION_TRACE("rs_get_resource"); |
189 | 85 | ||
190 | ACPI_MOVE_16_TO_16(&temp16, buffer); | 86 | if (((acpi_native_uint) resource) & 0x3) { |
191 | 87 | acpi_os_printf | |
192 | /* Calculate bytes consumed */ | 88 | ("**** GET: Misaligned resource pointer: %p Type %2.2X Len %X\n", |
193 | 89 | resource, resource->type, resource->length); | |
194 | *bytes_consumed = (acpi_size) temp16 + 3; | ||
195 | |||
196 | /* Point to the first vendor byte */ | ||
197 | |||
198 | buffer += 2; | ||
199 | } else { | ||
200 | /* Small Item, dereference the size */ | ||
201 | |||
202 | temp16 = (u8) (*buffer & 0x07); | ||
203 | |||
204 | /* Calculate bytes consumed */ | ||
205 | |||
206 | *bytes_consumed = (acpi_size) temp16 + 1; | ||
207 | |||
208 | /* Point to the first vendor byte */ | ||
209 | |||
210 | buffer += 1; | ||
211 | } | 90 | } |
212 | 91 | ||
213 | output_struct->id = ACPI_RSTYPE_VENDOR; | 92 | /* Extract the resource Length field (does not include header length) */ |
214 | output_struct->data.vendor_specific.length = temp16; | ||
215 | 93 | ||
216 | for (index = 0; index < temp16; index++) { | 94 | aml_resource_length = acpi_ut_get_resource_length(aml); |
217 | output_struct->data.vendor_specific.reserved[index] = *buffer; | ||
218 | buffer += 1; | ||
219 | } | ||
220 | 95 | ||
221 | /* | 96 | /* |
222 | * In order for the struct_size to fall on a 32-bit boundary, | 97 | * First table entry must be ACPI_RSC_INITxxx and must contain the |
223 | * calculate the length of the vendor string and expand the | 98 | * table length (# of table entries) |
224 | * struct_size to the next 32-bit boundary. | ||
225 | */ | 99 | */ |
226 | struct_size += ACPI_ROUND_UP_to_32_bITS(temp16); | 100 | count = INIT_TABLE_LENGTH(info); |
227 | 101 | ||
228 | /* Set the Length parameter */ | 102 | while (count) { |
229 | 103 | /* | |
230 | output_struct->length = (u32) struct_size; | 104 | * Source is the external AML byte stream buffer, |
231 | 105 | * destination is the internal resource descriptor | |
232 | /* Return the final size of the structure */ | 106 | */ |
233 | 107 | source = ACPI_ADD_PTR(void, aml, info->aml_offset); | |
234 | *structure_size = struct_size; | 108 | destination = |
235 | return_ACPI_STATUS(AE_OK); | 109 | ACPI_ADD_PTR(void, resource, info->resource_offset); |
236 | } | 110 | |
237 | 111 | switch (info->opcode) { | |
238 | /******************************************************************************* | 112 | case ACPI_RSC_INITGET: |
239 | * | 113 | /* |
240 | * FUNCTION: acpi_rs_vendor_stream | 114 | * Get the resource type and the initial (minimum) length |
241 | * | 115 | */ |
242 | * PARAMETERS: linked_list - Pointer to the resource linked list | 116 | ACPI_MEMSET(resource, 0, INIT_RESOURCE_LENGTH(info)); |
243 | * output_buffer - Pointer to the user's return buffer | 117 | resource->type = INIT_RESOURCE_TYPE(info); |
244 | * bytes_consumed - Pointer to where the number of bytes | 118 | resource->length = INIT_RESOURCE_LENGTH(info); |
245 | * used in the output_buffer is returned | 119 | break; |
246 | * | 120 | |
247 | * RETURN: Status | 121 | case ACPI_RSC_INITSET: |
248 | * | 122 | break; |
249 | * DESCRIPTION: Take the linked list resource structure and fills in the | 123 | |
250 | * the appropriate bytes in a byte stream | 124 | case ACPI_RSC_FLAGINIT: |
251 | * | 125 | |
252 | ******************************************************************************/ | 126 | flags_mode = TRUE; |
253 | 127 | break; | |
254 | acpi_status | 128 | |
255 | acpi_rs_vendor_stream(struct acpi_resource *linked_list, | 129 | case ACPI_RSC_1BITFLAG: |
256 | u8 ** output_buffer, acpi_size * bytes_consumed) | 130 | /* |
257 | { | 131 | * Mask and shift the flag bit |
258 | u8 *buffer = *output_buffer; | 132 | */ |
259 | u16 temp16 = 0; | 133 | ACPI_SET8(destination) = (u8) |
260 | u8 temp8 = 0; | 134 | ((ACPI_GET8(source) >> info->value) & 0x01); |
261 | u8 index; | 135 | break; |
262 | 136 | ||
263 | ACPI_FUNCTION_TRACE("rs_vendor_stream"); | 137 | case ACPI_RSC_2BITFLAG: |
264 | 138 | /* | |
265 | /* Dereference the length to find if this is a large or small item. */ | 139 | * Mask and shift the flag bits |
266 | 140 | */ | |
267 | if (linked_list->data.vendor_specific.length > 7) { | 141 | ACPI_SET8(destination) = (u8) |
268 | /* Large Item, Set the descriptor field and length bytes */ | 142 | ((ACPI_GET8(source) >> info->value) & 0x03); |
269 | 143 | break; | |
270 | *buffer = 0x84; | 144 | |
271 | buffer += 1; | 145 | case ACPI_RSC_COUNT: |
272 | 146 | ||
273 | temp16 = (u16) linked_list->data.vendor_specific.length; | 147 | item_count = ACPI_GET8(source); |
274 | 148 | ACPI_SET8(destination) = (u8) item_count; | |
275 | ACPI_MOVE_16_TO_16(buffer, &temp16); | 149 | |
276 | buffer += 2; | 150 | resource->length = resource->length + |
277 | } else { | 151 | (info->value * (item_count - 1)); |
278 | /* Small Item, Set the descriptor field */ | 152 | break; |
279 | 153 | ||
280 | temp8 = 0x70; | 154 | case ACPI_RSC_COUNT16: |
281 | temp8 |= (u8) linked_list->data.vendor_specific.length; | 155 | |
156 | item_count = aml_resource_length; | ||
157 | ACPI_SET16(destination) = item_count; | ||
158 | |||
159 | resource->length = resource->length + | ||
160 | (info->value * (item_count - 1)); | ||
161 | break; | ||
162 | |||
163 | case ACPI_RSC_LENGTH: | ||
164 | |||
165 | resource->length = resource->length + info->value; | ||
166 | break; | ||
167 | |||
168 | case ACPI_RSC_MOVE8: | ||
169 | case ACPI_RSC_MOVE16: | ||
170 | case ACPI_RSC_MOVE32: | ||
171 | case ACPI_RSC_MOVE64: | ||
172 | /* | ||
173 | * Raw data move. Use the Info value field unless item_count has | ||
174 | * been previously initialized via a COUNT opcode | ||
175 | */ | ||
176 | if (info->value) { | ||
177 | item_count = info->value; | ||
178 | } | ||
179 | acpi_rs_move_data(destination, source, item_count, | ||
180 | info->opcode); | ||
181 | break; | ||
182 | |||
183 | case ACPI_RSC_SET8: | ||
184 | |||
185 | ACPI_MEMSET(destination, info->aml_offset, info->value); | ||
186 | break; | ||
187 | |||
188 | case ACPI_RSC_DATA8: | ||
189 | |||
190 | target = ACPI_ADD_PTR(char, resource, info->value); | ||
191 | ACPI_MEMCPY(destination, source, ACPI_GET16(target)); | ||
192 | break; | ||
193 | |||
194 | case ACPI_RSC_ADDRESS: | ||
195 | /* | ||
196 | * Common handler for address descriptor flags | ||
197 | */ | ||
198 | if (!acpi_rs_get_address_common(resource, aml)) { | ||
199 | return_ACPI_STATUS | ||
200 | (AE_AML_INVALID_RESOURCE_TYPE); | ||
201 | } | ||
202 | break; | ||
203 | |||
204 | case ACPI_RSC_SOURCE: | ||
205 | /* | ||
206 | * Optional resource_source (Index and String) | ||
207 | */ | ||
208 | resource->length += | ||
209 | acpi_rs_get_resource_source(aml_resource_length, | ||
210 | info->value, | ||
211 | destination, aml, NULL); | ||
212 | break; | ||
213 | |||
214 | case ACPI_RSC_SOURCEX: | ||
215 | /* | ||
216 | * Optional resource_source (Index and String). This is the more | ||
217 | * complicated case used by the Interrupt() macro | ||
218 | */ | ||
219 | target = | ||
220 | ACPI_ADD_PTR(char, resource, | ||
221 | info->aml_offset + (item_count * 4)); | ||
222 | |||
223 | resource->length += | ||
224 | acpi_rs_get_resource_source(aml_resource_length, | ||
225 | (acpi_rs_length) (((item_count - 1) * sizeof(u32)) + info->value), destination, aml, target); | ||
226 | break; | ||
227 | |||
228 | case ACPI_RSC_BITMASK: | ||
229 | /* | ||
230 | * 8-bit encoded bitmask (DMA macro) | ||
231 | */ | ||
232 | item_count = | ||
233 | acpi_rs_decode_bitmask(ACPI_GET8(source), | ||
234 | destination); | ||
235 | if (item_count) { | ||
236 | resource->length += (item_count - 1); | ||
237 | } | ||
238 | |||
239 | target = ACPI_ADD_PTR(char, resource, info->value); | ||
240 | ACPI_SET8(target) = (u8) item_count; | ||
241 | break; | ||
242 | |||
243 | case ACPI_RSC_BITMASK16: | ||
244 | /* | ||
245 | * 16-bit encoded bitmask (IRQ macro) | ||
246 | */ | ||
247 | ACPI_MOVE_16_TO_16(&temp16, source); | ||
248 | |||
249 | item_count = | ||
250 | acpi_rs_decode_bitmask(temp16, destination); | ||
251 | if (item_count) { | ||
252 | resource->length += (item_count - 1); | ||
253 | } | ||
254 | |||
255 | target = ACPI_ADD_PTR(char, resource, info->value); | ||
256 | ACPI_SET8(target) = (u8) item_count; | ||
257 | break; | ||
258 | |||
259 | case ACPI_RSC_EXIT_NE: | ||
260 | /* | ||
261 | * Control - Exit conversion if not equal | ||
262 | */ | ||
263 | switch (info->resource_offset) { | ||
264 | case ACPI_RSC_COMPARE_AML_LENGTH: | ||
265 | if (aml_resource_length != info->value) { | ||
266 | goto exit; | ||
267 | } | ||
268 | break; | ||
269 | |||
270 | case ACPI_RSC_COMPARE_VALUE: | ||
271 | if (ACPI_GET8(source) != info->value) { | ||
272 | goto exit; | ||
273 | } | ||
274 | break; | ||
275 | |||
276 | default: | ||
277 | acpi_os_printf | ||
278 | ("*** Invalid conversion sub-opcode\n"); | ||
279 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
280 | } | ||
281 | break; | ||
282 | |||
283 | default: | ||
284 | |||
285 | acpi_os_printf("*** Invalid conversion opcode\n"); | ||
286 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
287 | } | ||
282 | 288 | ||
283 | *buffer = temp8; | 289 | count--; |
284 | buffer += 1; | 290 | info++; |
285 | } | 291 | } |
286 | 292 | ||
287 | /* Loop through all of the Vendor Specific fields */ | 293 | exit: |
288 | 294 | if (!flags_mode) { | |
289 | for (index = 0; index < linked_list->data.vendor_specific.length; | 295 | /* Round the resource struct length up to the next 32-bit boundary */ |
290 | index++) { | ||
291 | temp8 = linked_list->data.vendor_specific.reserved[index]; | ||
292 | 296 | ||
293 | *buffer = temp8; | 297 | resource->length = ACPI_ROUND_UP_to_32_bITS(resource->length); |
294 | buffer += 1; | ||
295 | } | 298 | } |
296 | |||
297 | /* Return the number of bytes consumed in this operation */ | ||
298 | |||
299 | *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); | ||
300 | return_ACPI_STATUS(AE_OK); | 299 | return_ACPI_STATUS(AE_OK); |
301 | } | 300 | } |
302 | 301 | ||
303 | /******************************************************************************* | 302 | /******************************************************************************* |
304 | * | 303 | * |
305 | * FUNCTION: acpi_rs_start_depend_fns_resource | 304 | * FUNCTION: acpi_rs_convert_resource_to_aml |
306 | * | 305 | * |
307 | * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte | 306 | * PARAMETERS: Resource - Pointer to the resource descriptor |
308 | * stream | 307 | * Aml - Where the AML descriptor is returned |
309 | * bytes_consumed - Pointer to where the number of bytes | 308 | * Info - Pointer to appropriate conversion table |
310 | * consumed the byte_stream_buffer is | ||
311 | * returned | ||
312 | * output_buffer - Pointer to the return data buffer | ||
313 | * structure_size - Pointer to where the number of bytes | ||
314 | * in the return data struct is returned | ||
315 | * | 309 | * |
316 | * RETURN: Status | 310 | * RETURN: Status |
317 | * | 311 | * |
318 | * DESCRIPTION: Take the resource byte stream and fill out the appropriate | 312 | * DESCRIPTION: Convert an internal resource descriptor to the corresponding |
319 | * structure pointed to by the output_buffer. Return the | 313 | * external AML resource descriptor. |
320 | * number of bytes consumed from the byte stream. | ||
321 | * | 314 | * |
322 | ******************************************************************************/ | 315 | ******************************************************************************/ |
323 | 316 | ||
324 | acpi_status | 317 | acpi_status |
325 | acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer, | 318 | acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, |
326 | acpi_size * bytes_consumed, | 319 | union aml_resource *aml, |
327 | u8 ** output_buffer, | 320 | struct acpi_rsconvert_info *info) |
328 | acpi_size * structure_size) | ||
329 | { | 321 | { |
330 | u8 *buffer = byte_stream_buffer; | 322 | void *source = NULL; |
331 | struct acpi_resource *output_struct = (void *)*output_buffer; | 323 | void *destination; |
332 | u8 temp8 = 0; | 324 | acpi_rsdesc_size aml_length = 0; |
333 | acpi_size struct_size = | 325 | u8 count; |
334 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dpf); | 326 | u16 temp16 = 0; |
335 | 327 | u16 item_count = 0; | |
336 | ACPI_FUNCTION_TRACE("rs_start_depend_fns_resource"); | ||
337 | |||
338 | /* The number of bytes consumed are found in the descriptor (Bits:0-1) */ | ||
339 | |||
340 | temp8 = *buffer; | ||
341 | |||
342 | *bytes_consumed = (temp8 & 0x01) + 1; | ||
343 | |||
344 | output_struct->id = ACPI_RSTYPE_START_DPF; | ||
345 | |||
346 | /* Point to Byte 1 if it is used */ | ||
347 | |||
348 | if (2 == *bytes_consumed) { | ||
349 | buffer += 1; | ||
350 | temp8 = *buffer; | ||
351 | |||
352 | /* Check Compatibility priority */ | ||
353 | |||
354 | output_struct->data.start_dpf.compatibility_priority = | ||
355 | temp8 & 0x03; | ||
356 | 328 | ||
357 | if (3 == output_struct->data.start_dpf.compatibility_priority) { | 329 | ACPI_FUNCTION_TRACE("rs_convert_resource_to_aml"); |
358 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); | ||
359 | } | ||
360 | 330 | ||
361 | /* Check Performance/Robustness preference */ | 331 | /* Validate the Resource pointer, must be 32-bit aligned */ |
362 | 332 | ||
363 | output_struct->data.start_dpf.performance_robustness = | 333 | if (((acpi_native_uint) resource) & 0x3) { |
364 | (temp8 >> 2) & 0x03; | 334 | acpi_os_printf |
335 | ("**** SET: Misaligned resource pointer: %p Type %2.2X Len %X\n", | ||
336 | resource, resource->type, resource->length); | ||
337 | } | ||
365 | 338 | ||
366 | if (3 == output_struct->data.start_dpf.performance_robustness) { | 339 | /* |
367 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); | 340 | * First table entry must be ACPI_RSC_INITxxx and must contain the |
341 | * table length (# of table entries) | ||
342 | */ | ||
343 | count = INIT_TABLE_LENGTH(info); | ||
344 | |||
345 | while (count) { | ||
346 | /* | ||
347 | * Source is the internal resource descriptor, | ||
348 | * destination is the external AML byte stream buffer | ||
349 | */ | ||
350 | source = ACPI_ADD_PTR(void, resource, info->resource_offset); | ||
351 | destination = ACPI_ADD_PTR(void, aml, info->aml_offset); | ||
352 | |||
353 | switch (info->opcode) { | ||
354 | case ACPI_RSC_INITSET: | ||
355 | |||
356 | ACPI_MEMSET(aml, 0, INIT_RESOURCE_LENGTH(info)); | ||
357 | aml_length = INIT_RESOURCE_LENGTH(info); | ||
358 | acpi_rs_set_resource_header(INIT_RESOURCE_TYPE(info), | ||
359 | aml_length, aml); | ||
360 | break; | ||
361 | |||
362 | case ACPI_RSC_INITGET: | ||
363 | break; | ||
364 | |||
365 | case ACPI_RSC_FLAGINIT: | ||
366 | /* | ||
367 | * Clear the flag byte | ||
368 | */ | ||
369 | ACPI_SET8(destination) = 0; | ||
370 | break; | ||
371 | |||
372 | case ACPI_RSC_1BITFLAG: | ||
373 | /* | ||
374 | * Mask and shift the flag bit | ||
375 | */ | ||
376 | ACPI_SET8(destination) |= (u8) | ||
377 | ((ACPI_GET8(source) & 0x01) << info->value); | ||
378 | break; | ||
379 | |||
380 | case ACPI_RSC_2BITFLAG: | ||
381 | /* | ||
382 | * Mask and shift the flag bits | ||
383 | */ | ||
384 | ACPI_SET8(destination) |= (u8) | ||
385 | ((ACPI_GET8(source) & 0x03) << info->value); | ||
386 | break; | ||
387 | |||
388 | case ACPI_RSC_COUNT: | ||
389 | |||
390 | item_count = ACPI_GET8(source); | ||
391 | ACPI_SET8(destination) = (u8) item_count; | ||
392 | |||
393 | aml_length = | ||
394 | (u16) (aml_length + | ||
395 | (info->value * (item_count - 1))); | ||
396 | break; | ||
397 | |||
398 | case ACPI_RSC_COUNT16: | ||
399 | |||
400 | item_count = ACPI_GET16(source); | ||
401 | aml_length = (u16) (aml_length + item_count); | ||
402 | acpi_rs_set_resource_length(aml_length, aml); | ||
403 | break; | ||
404 | |||
405 | case ACPI_RSC_LENGTH: | ||
406 | |||
407 | acpi_rs_set_resource_length(info->value, aml); | ||
408 | break; | ||
409 | |||
410 | case ACPI_RSC_MOVE8: | ||
411 | case ACPI_RSC_MOVE16: | ||
412 | case ACPI_RSC_MOVE32: | ||
413 | case ACPI_RSC_MOVE64: | ||
414 | |||
415 | if (info->value) { | ||
416 | item_count = info->value; | ||
417 | } | ||
418 | acpi_rs_move_data(destination, source, item_count, | ||
419 | info->opcode); | ||
420 | break; | ||
421 | |||
422 | case ACPI_RSC_ADDRESS: | ||
423 | |||
424 | /* Set the Resource Type, General Flags, and Type-Specific Flags */ | ||
425 | |||
426 | acpi_rs_set_address_common(aml, resource); | ||
427 | break; | ||
428 | |||
429 | case ACPI_RSC_SOURCEX: | ||
430 | /* | ||
431 | * Optional resource_source (Index and String) | ||
432 | */ | ||
433 | aml_length = | ||
434 | acpi_rs_set_resource_source(aml, | ||
435 | (acpi_rs_length) | ||
436 | aml_length, source); | ||
437 | acpi_rs_set_resource_length(aml_length, aml); | ||
438 | break; | ||
439 | |||
440 | case ACPI_RSC_SOURCE: | ||
441 | /* | ||
442 | * Optional resource_source (Index and String). This is the more | ||
443 | * complicated case used by the Interrupt() macro | ||
444 | */ | ||
445 | aml_length = | ||
446 | acpi_rs_set_resource_source(aml, info->value, | ||
447 | source); | ||
448 | acpi_rs_set_resource_length(aml_length, aml); | ||
449 | break; | ||
450 | |||
451 | case ACPI_RSC_BITMASK: | ||
452 | /* | ||
453 | * 8-bit encoded bitmask (DMA macro) | ||
454 | */ | ||
455 | ACPI_SET8(destination) = (u8) | ||
456 | acpi_rs_encode_bitmask(source, | ||
457 | *ACPI_ADD_PTR(u8, resource, | ||
458 | info->value)); | ||
459 | break; | ||
460 | |||
461 | case ACPI_RSC_BITMASK16: | ||
462 | /* | ||
463 | * 16-bit encoded bitmask (IRQ macro) | ||
464 | */ | ||
465 | temp16 = acpi_rs_encode_bitmask(source, | ||
466 | *ACPI_ADD_PTR(u8, | ||
467 | resource, | ||
468 | info-> | ||
469 | value)); | ||
470 | ACPI_MOVE_16_TO_16(destination, &temp16); | ||
471 | break; | ||
472 | |||
473 | case ACPI_RSC_EXIT_LE: | ||
474 | /* | ||
475 | * Control - Exit conversion if less than or equal | ||
476 | */ | ||
477 | if (item_count <= info->value) { | ||
478 | goto exit; | ||
479 | } | ||
480 | break; | ||
481 | |||
482 | case ACPI_RSC_EXIT_NE: | ||
483 | /* | ||
484 | * Control - Exit conversion if not equal | ||
485 | */ | ||
486 | switch (COMPARE_OPCODE(info)) { | ||
487 | case ACPI_RSC_COMPARE_VALUE: | ||
488 | |||
489 | if (*ACPI_ADD_PTR(u8, resource, | ||
490 | COMPARE_TARGET(info)) != | ||
491 | COMPARE_VALUE(info)) { | ||
492 | goto exit; | ||
493 | } | ||
494 | break; | ||
495 | |||
496 | default: | ||
497 | acpi_os_printf | ||
498 | ("*** Invalid conversion sub-opcode\n"); | ||
499 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
500 | } | ||
501 | break; | ||
502 | |||
503 | default: | ||
504 | |||
505 | acpi_os_printf("*** Invalid conversion opcode\n"); | ||
506 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
368 | } | 507 | } |
369 | } else { | ||
370 | output_struct->data.start_dpf.compatibility_priority = | ||
371 | ACPI_ACCEPTABLE_CONFIGURATION; | ||
372 | 508 | ||
373 | output_struct->data.start_dpf.performance_robustness = | 509 | count--; |
374 | ACPI_ACCEPTABLE_CONFIGURATION; | 510 | info++; |
375 | } | 511 | } |
376 | 512 | ||
377 | /* Set the Length parameter */ | 513 | exit: |
378 | |||
379 | output_struct->length = (u32) struct_size; | ||
380 | |||
381 | /* Return the final size of the structure */ | ||
382 | |||
383 | *structure_size = struct_size; | ||
384 | return_ACPI_STATUS(AE_OK); | 514 | return_ACPI_STATUS(AE_OK); |
385 | } | 515 | } |
386 | 516 | ||
387 | /******************************************************************************* | 517 | #if 0 |
388 | * | 518 | /* Previous resource validations */ |
389 | * FUNCTION: acpi_rs_end_depend_fns_resource | ||
390 | * | ||
391 | * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte | ||
392 | * stream | ||
393 | * bytes_consumed - Pointer to where the number of bytes | ||
394 | * consumed the byte_stream_buffer is | ||
395 | * returned | ||
396 | * output_buffer - Pointer to the return data buffer | ||
397 | * structure_size - Pointer to where the number of bytes | ||
398 | * in the return data struct is returned | ||
399 | * | ||
400 | * RETURN: Status | ||
401 | * | ||
402 | * DESCRIPTION: Take the resource byte stream and fill out the appropriate | ||
403 | * structure pointed to by the output_buffer. Return the | ||
404 | * number of bytes consumed from the byte stream. | ||
405 | * | ||
406 | ******************************************************************************/ | ||
407 | |||
408 | acpi_status | ||
409 | acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer, | ||
410 | acpi_size * bytes_consumed, | ||
411 | u8 ** output_buffer, acpi_size * structure_size) | ||
412 | { | ||
413 | struct acpi_resource *output_struct = (void *)*output_buffer; | ||
414 | acpi_size struct_size = ACPI_RESOURCE_LENGTH; | ||
415 | |||
416 | ACPI_FUNCTION_TRACE("rs_end_depend_fns_resource"); | ||
417 | |||
418 | /* The number of bytes consumed is static */ | ||
419 | |||
420 | *bytes_consumed = 1; | ||
421 | 519 | ||
422 | /* Fill out the structure */ | 520 | if (aml->ext_address64.revision_iD != AML_RESOURCE_EXTENDED_ADDRESS_REVISION) { |
423 | 521 | return_ACPI_STATUS(AE_SUPPORT); | |
424 | output_struct->id = ACPI_RSTYPE_END_DPF; | ||
425 | |||
426 | /* Set the Length parameter */ | ||
427 | |||
428 | output_struct->length = (u32) struct_size; | ||
429 | |||
430 | /* Return the final size of the structure */ | ||
431 | |||
432 | *structure_size = struct_size; | ||
433 | return_ACPI_STATUS(AE_OK); | ||
434 | } | 522 | } |
435 | 523 | ||
436 | /******************************************************************************* | 524 | if (resource->data.start_dpf.performance_robustness >= 3) { |
437 | * | 525 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE); |
438 | * FUNCTION: acpi_rs_start_depend_fns_stream | 526 | } |
439 | * | ||
440 | * PARAMETERS: linked_list - Pointer to the resource linked list | ||
441 | * output_buffer - Pointer to the user's return buffer | ||
442 | * bytes_consumed - u32 pointer that is filled with | ||
443 | * the number of bytes of the | ||
444 | * output_buffer used | ||
445 | * | ||
446 | * RETURN: Status | ||
447 | * | ||
448 | * DESCRIPTION: Take the linked list resource structure and fills in the | ||
449 | * the appropriate bytes in a byte stream | ||
450 | * | ||
451 | ******************************************************************************/ | ||
452 | |||
453 | acpi_status | ||
454 | acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list, | ||
455 | u8 ** output_buffer, acpi_size * bytes_consumed) | ||
456 | { | ||
457 | u8 *buffer = *output_buffer; | ||
458 | u8 temp8 = 0; | ||
459 | |||
460 | ACPI_FUNCTION_TRACE("rs_start_depend_fns_stream"); | ||
461 | 527 | ||
528 | if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) { | ||
462 | /* | 529 | /* |
463 | * The descriptor field is set based upon whether a byte is needed | 530 | * Only [active_high, edge_sensitive] or [active_low, level_sensitive] |
464 | * to contain Priority data. | 531 | * polarity/trigger interrupts are allowed (ACPI spec, section |
532 | * "IRQ Format"), so 0x00 and 0x09 are illegal. | ||
465 | */ | 533 | */ |
466 | if (ACPI_ACCEPTABLE_CONFIGURATION == | 534 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
467 | linked_list->data.start_dpf.compatibility_priority && | 535 | "Invalid interrupt polarity/trigger in resource list, %X\n", |
468 | ACPI_ACCEPTABLE_CONFIGURATION == | 536 | aml->irq.flags)); |
469 | linked_list->data.start_dpf.performance_robustness) { | 537 | return_ACPI_STATUS(AE_BAD_DATA); |
470 | *buffer = 0x30; | ||
471 | } else { | ||
472 | *buffer = 0x31; | ||
473 | buffer += 1; | ||
474 | |||
475 | /* Set the Priority Byte Definition */ | ||
476 | |||
477 | temp8 = 0; | ||
478 | temp8 = | ||
479 | (u8) ((linked_list->data.start_dpf. | ||
480 | performance_robustness & 0x03) << 2); | ||
481 | temp8 |= | ||
482 | (linked_list->data.start_dpf.compatibility_priority & 0x03); | ||
483 | *buffer = temp8; | ||
484 | } | ||
485 | |||
486 | buffer += 1; | ||
487 | |||
488 | /* Return the number of bytes consumed in this operation */ | ||
489 | |||
490 | *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); | ||
491 | return_ACPI_STATUS(AE_OK); | ||
492 | } | 538 | } |
493 | 539 | ||
494 | /******************************************************************************* | 540 | resource->data.extended_irq.interrupt_count = temp8; |
495 | * | 541 | if (temp8 < 1) { |
496 | * FUNCTION: acpi_rs_end_depend_fns_stream | 542 | /* Must have at least one IRQ */ |
497 | * | ||
498 | * PARAMETERS: linked_list - Pointer to the resource linked list | ||
499 | * output_buffer - Pointer to the user's return buffer | ||
500 | * bytes_consumed - Pointer to where the number of bytes | ||
501 | * used in the output_buffer is returned | ||
502 | * | ||
503 | * RETURN: Status | ||
504 | * | ||
505 | * DESCRIPTION: Take the linked list resource structure and fills in the | ||
506 | * the appropriate bytes in a byte stream | ||
507 | * | ||
508 | ******************************************************************************/ | ||
509 | |||
510 | acpi_status | ||
511 | acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list, | ||
512 | u8 ** output_buffer, acpi_size * bytes_consumed) | ||
513 | { | ||
514 | u8 *buffer = *output_buffer; | ||
515 | |||
516 | ACPI_FUNCTION_TRACE("rs_end_depend_fns_stream"); | ||
517 | |||
518 | /* The descriptor field is static */ | ||
519 | |||
520 | *buffer = 0x38; | ||
521 | buffer += 1; | ||
522 | 543 | ||
523 | /* Return the number of bytes consumed in this operation */ | 544 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); |
545 | } | ||
524 | 546 | ||
525 | *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); | 547 | if (resource->data.dma.transfer == 0x03) { |
526 | return_ACPI_STATUS(AE_OK); | 548 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
549 | "Invalid DMA.Transfer preference (3)\n")); | ||
550 | return_ACPI_STATUS(AE_BAD_DATA); | ||
527 | } | 551 | } |
552 | #endif | ||
diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index 4446778eaf79..2236a0c90daa 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c | |||
@@ -50,6 +50,389 @@ ACPI_MODULE_NAME("rsutils") | |||
50 | 50 | ||
51 | /******************************************************************************* | 51 | /******************************************************************************* |
52 | * | 52 | * |
53 | * FUNCTION: acpi_rs_decode_bitmask | ||
54 | * | ||
55 | * PARAMETERS: Mask - Bitmask to decode | ||
56 | * List - Where the converted list is returned | ||
57 | * | ||
58 | * RETURN: Count of bits set (length of list) | ||
59 | * | ||
60 | * DESCRIPTION: Convert a bit mask into a list of values | ||
61 | * | ||
62 | ******************************************************************************/ | ||
63 | u8 acpi_rs_decode_bitmask(u16 mask, u8 * list) | ||
64 | { | ||
65 | acpi_native_uint i; | ||
66 | u8 bit_count; | ||
67 | |||
68 | ACPI_FUNCTION_ENTRY(); | ||
69 | |||
70 | /* Decode the mask bits */ | ||
71 | |||
72 | for (i = 0, bit_count = 0; mask; i++) { | ||
73 | if (mask & 0x0001) { | ||
74 | list[bit_count] = (u8) i; | ||
75 | bit_count++; | ||
76 | } | ||
77 | |||
78 | mask >>= 1; | ||
79 | } | ||
80 | |||
81 | return (bit_count); | ||
82 | } | ||
83 | |||
84 | /******************************************************************************* | ||
85 | * | ||
86 | * FUNCTION: acpi_rs_encode_bitmask | ||
87 | * | ||
88 | * PARAMETERS: List - List of values to encode | ||
89 | * Count - Length of list | ||
90 | * | ||
91 | * RETURN: Encoded bitmask | ||
92 | * | ||
93 | * DESCRIPTION: Convert a list of values to an encoded bitmask | ||
94 | * | ||
95 | ******************************************************************************/ | ||
96 | |||
97 | u16 acpi_rs_encode_bitmask(u8 * list, u8 count) | ||
98 | { | ||
99 | acpi_native_uint i; | ||
100 | u16 mask; | ||
101 | |||
102 | ACPI_FUNCTION_ENTRY(); | ||
103 | |||
104 | /* Encode the list into a single bitmask */ | ||
105 | |||
106 | for (i = 0, mask = 0; i < count; i++) { | ||
107 | mask |= (0x0001 << list[i]); | ||
108 | } | ||
109 | |||
110 | return (mask); | ||
111 | } | ||
112 | |||
113 | /******************************************************************************* | ||
114 | * | ||
115 | * FUNCTION: acpi_rs_move_data | ||
116 | * | ||
117 | * PARAMETERS: Destination - Pointer to the destination descriptor | ||
118 | * Source - Pointer to the source descriptor | ||
119 | * item_count - How many items to move | ||
120 | * move_type - Byte width | ||
121 | * | ||
122 | * RETURN: None | ||
123 | * | ||
124 | * DESCRIPTION: Move multiple data items from one descriptor to another. Handles | ||
125 | * alignment issues and endian issues if necessary, as configured | ||
126 | * via the ACPI_MOVE_* macros. (This is why a memcpy is not used) | ||
127 | * | ||
128 | ******************************************************************************/ | ||
129 | |||
130 | void | ||
131 | acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type) | ||
132 | { | ||
133 | acpi_native_uint i; | ||
134 | |||
135 | ACPI_FUNCTION_ENTRY(); | ||
136 | |||
137 | /* One move per item */ | ||
138 | |||
139 | for (i = 0; i < item_count; i++) { | ||
140 | switch (move_type) { | ||
141 | /* | ||
142 | * For the 8-bit case, we can perform the move all at once | ||
143 | * since there are no alignment or endian issues | ||
144 | */ | ||
145 | case ACPI_RSC_MOVE8: | ||
146 | ACPI_MEMCPY(destination, source, item_count); | ||
147 | return; | ||
148 | |||
149 | /* | ||
150 | * 16-, 32-, and 64-bit cases must use the move macros that perform | ||
151 | * endian conversion and/or accomodate hardware that cannot perform | ||
152 | * misaligned memory transfers | ||
153 | */ | ||
154 | case ACPI_RSC_MOVE16: | ||
155 | ACPI_MOVE_16_TO_16(&ACPI_CAST_PTR(u16, destination)[i], | ||
156 | &ACPI_CAST_PTR(u16, source)[i]); | ||
157 | break; | ||
158 | |||
159 | case ACPI_RSC_MOVE32: | ||
160 | ACPI_MOVE_32_TO_32(&ACPI_CAST_PTR(u32, destination)[i], | ||
161 | &ACPI_CAST_PTR(u32, source)[i]); | ||
162 | break; | ||
163 | |||
164 | case ACPI_RSC_MOVE64: | ||
165 | ACPI_MOVE_64_TO_64(&ACPI_CAST_PTR(u64, destination)[i], | ||
166 | &ACPI_CAST_PTR(u64, source)[i]); | ||
167 | break; | ||
168 | |||
169 | default: | ||
170 | return; | ||
171 | } | ||
172 | } | ||
173 | } | ||
174 | |||
175 | /******************************************************************************* | ||
176 | * | ||
177 | * FUNCTION: acpi_rs_set_resource_length | ||
178 | * | ||
179 | * PARAMETERS: total_length - Length of the AML descriptor, including | ||
180 | * the header and length fields. | ||
181 | * Aml - Pointer to the raw AML descriptor | ||
182 | * | ||
183 | * RETURN: None | ||
184 | * | ||
185 | * DESCRIPTION: Set the resource_length field of an AML | ||
186 | * resource descriptor, both Large and Small descriptors are | ||
187 | * supported automatically. Note: Descriptor Type field must | ||
188 | * be valid. | ||
189 | * | ||
190 | ******************************************************************************/ | ||
191 | |||
192 | void | ||
193 | acpi_rs_set_resource_length(acpi_rsdesc_size total_length, | ||
194 | union aml_resource *aml) | ||
195 | { | ||
196 | acpi_rs_length resource_length; | ||
197 | |||
198 | ACPI_FUNCTION_ENTRY(); | ||
199 | |||
200 | /* Length is the total descriptor length minus the header length */ | ||
201 | |||
202 | resource_length = (acpi_rs_length) | ||
203 | (total_length - acpi_ut_get_resource_header_length(aml)); | ||
204 | |||
205 | /* Length is stored differently for large and small descriptors */ | ||
206 | |||
207 | if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { | ||
208 | /* Large descriptor -- bytes 1-2 contain the 16-bit length */ | ||
209 | |||
210 | ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, | ||
211 | &resource_length); | ||
212 | } else { | ||
213 | /* Small descriptor -- bits 2:0 of byte 0 contain the length */ | ||
214 | |||
215 | aml->small_header.descriptor_type = (u8) | ||
216 | |||
217 | /* Clear any existing length, preserving descriptor type bits */ | ||
218 | ((aml->small_header. | ||
219 | descriptor_type & ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK) | ||
220 | |||
221 | | resource_length); | ||
222 | } | ||
223 | } | ||
224 | |||
225 | /******************************************************************************* | ||
226 | * | ||
227 | * FUNCTION: acpi_rs_set_resource_header | ||
228 | * | ||
229 | * PARAMETERS: descriptor_type - Byte to be inserted as the type | ||
230 | * total_length - Length of the AML descriptor, including | ||
231 | * the header and length fields. | ||
232 | * Aml - Pointer to the raw AML descriptor | ||
233 | * | ||
234 | * RETURN: None | ||
235 | * | ||
236 | * DESCRIPTION: Set the descriptor_type and resource_length fields of an AML | ||
237 | * resource descriptor, both Large and Small descriptors are | ||
238 | * supported automatically | ||
239 | * | ||
240 | ******************************************************************************/ | ||
241 | |||
242 | void | ||
243 | acpi_rs_set_resource_header(u8 descriptor_type, | ||
244 | acpi_rsdesc_size total_length, | ||
245 | union aml_resource *aml) | ||
246 | { | ||
247 | ACPI_FUNCTION_ENTRY(); | ||
248 | |||
249 | /* Set the Resource Type */ | ||
250 | |||
251 | aml->small_header.descriptor_type = descriptor_type; | ||
252 | |||
253 | /* Set the Resource Length */ | ||
254 | |||
255 | acpi_rs_set_resource_length(total_length, aml); | ||
256 | } | ||
257 | |||
258 | /******************************************************************************* | ||
259 | * | ||
260 | * FUNCTION: acpi_rs_strcpy | ||
261 | * | ||
262 | * PARAMETERS: Destination - Pointer to the destination string | ||
263 | * Source - Pointer to the source string | ||
264 | * | ||
265 | * RETURN: String length, including NULL terminator | ||
266 | * | ||
267 | * DESCRIPTION: Local string copy that returns the string length, saving a | ||
268 | * strcpy followed by a strlen. | ||
269 | * | ||
270 | ******************************************************************************/ | ||
271 | |||
272 | static u16 acpi_rs_strcpy(char *destination, char *source) | ||
273 | { | ||
274 | u16 i; | ||
275 | |||
276 | ACPI_FUNCTION_ENTRY(); | ||
277 | |||
278 | for (i = 0; source[i]; i++) { | ||
279 | destination[i] = source[i]; | ||
280 | } | ||
281 | |||
282 | destination[i] = 0; | ||
283 | |||
284 | /* Return string length including the NULL terminator */ | ||
285 | |||
286 | return ((u16) (i + 1)); | ||
287 | } | ||
288 | |||
289 | /******************************************************************************* | ||
290 | * | ||
291 | * FUNCTION: acpi_rs_get_resource_source | ||
292 | * | ||
293 | * PARAMETERS: resource_length - Length field of the descriptor | ||
294 | * minimum_length - Minimum length of the descriptor (minus | ||
295 | * any optional fields) | ||
296 | * resource_source - Where the resource_source is returned | ||
297 | * Aml - Pointer to the raw AML descriptor | ||
298 | * string_ptr - (optional) where to store the actual | ||
299 | * resource_source string | ||
300 | * | ||
301 | * RETURN: Length of the string plus NULL terminator, rounded up to 32 bit | ||
302 | * | ||
303 | * DESCRIPTION: Copy the optional resource_source data from a raw AML descriptor | ||
304 | * to an internal resource descriptor | ||
305 | * | ||
306 | ******************************************************************************/ | ||
307 | |||
308 | acpi_rs_length | ||
309 | acpi_rs_get_resource_source(acpi_rs_length resource_length, | ||
310 | acpi_rs_length minimum_length, | ||
311 | struct acpi_resource_source * resource_source, | ||
312 | union aml_resource * aml, char *string_ptr) | ||
313 | { | ||
314 | acpi_rsdesc_size total_length; | ||
315 | u8 *aml_resource_source; | ||
316 | |||
317 | ACPI_FUNCTION_ENTRY(); | ||
318 | |||
319 | total_length = | ||
320 | resource_length + sizeof(struct aml_resource_large_header); | ||
321 | aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length); | ||
322 | |||
323 | /* | ||
324 | * resource_source is present if the length of the descriptor is longer than | ||
325 | * the minimum length. | ||
326 | * | ||
327 | * Note: Some resource descriptors will have an additional null, so | ||
328 | * we add 1 to the minimum length. | ||
329 | */ | ||
330 | if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) { | ||
331 | /* Get the resource_source_index */ | ||
332 | |||
333 | resource_source->index = aml_resource_source[0]; | ||
334 | |||
335 | resource_source->string_ptr = string_ptr; | ||
336 | if (!string_ptr) { | ||
337 | /* | ||
338 | * String destination pointer is not specified; Set the String | ||
339 | * pointer to the end of the current resource_source structure. | ||
340 | */ | ||
341 | resource_source->string_ptr = | ||
342 | ACPI_ADD_PTR(char, resource_source, | ||
343 | sizeof(struct acpi_resource_source)); | ||
344 | } | ||
345 | |||
346 | /* | ||
347 | * In order for the struct_size to fall on a 32-bit boundary, calculate | ||
348 | * the length of the string (+1 for the NULL terminator) and expand the | ||
349 | * struct_size to the next 32-bit boundary. | ||
350 | * | ||
351 | * Zero the entire area of the buffer. | ||
352 | */ | ||
353 | total_length = | ||
354 | ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN | ||
355 | ((char *)&aml_resource_source[1]) + | ||
356 | 1); | ||
357 | ACPI_MEMSET(resource_source->string_ptr, 0, total_length); | ||
358 | |||
359 | /* Copy the resource_source string to the destination */ | ||
360 | |||
361 | resource_source->string_length = | ||
362 | acpi_rs_strcpy(resource_source->string_ptr, | ||
363 | (char *)&aml_resource_source[1]); | ||
364 | |||
365 | return ((acpi_rs_length) total_length); | ||
366 | } | ||
367 | |||
368 | /* resource_source is not present */ | ||
369 | |||
370 | resource_source->index = 0; | ||
371 | resource_source->string_length = 0; | ||
372 | resource_source->string_ptr = NULL; | ||
373 | return (0); | ||
374 | } | ||
375 | |||
376 | /******************************************************************************* | ||
377 | * | ||
378 | * FUNCTION: acpi_rs_set_resource_source | ||
379 | * | ||
380 | * PARAMETERS: Aml - Pointer to the raw AML descriptor | ||
381 | * minimum_length - Minimum length of the descriptor (minus | ||
382 | * any optional fields) | ||
383 | * resource_source - Internal resource_source | ||
384 | |||
385 | * | ||
386 | * RETURN: Total length of the AML descriptor | ||
387 | * | ||
388 | * DESCRIPTION: Convert an optional resource_source from internal format to a | ||
389 | * raw AML resource descriptor | ||
390 | * | ||
391 | ******************************************************************************/ | ||
392 | |||
393 | acpi_rsdesc_size | ||
394 | acpi_rs_set_resource_source(union aml_resource * aml, | ||
395 | acpi_rs_length minimum_length, | ||
396 | struct acpi_resource_source * resource_source) | ||
397 | { | ||
398 | u8 *aml_resource_source; | ||
399 | acpi_rsdesc_size descriptor_length; | ||
400 | |||
401 | ACPI_FUNCTION_ENTRY(); | ||
402 | |||
403 | descriptor_length = minimum_length; | ||
404 | |||
405 | /* Non-zero string length indicates presence of a resource_source */ | ||
406 | |||
407 | if (resource_source->string_length) { | ||
408 | /* Point to the end of the AML descriptor */ | ||
409 | |||
410 | aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length); | ||
411 | |||
412 | /* Copy the resource_source_index */ | ||
413 | |||
414 | aml_resource_source[0] = (u8) resource_source->index; | ||
415 | |||
416 | /* Copy the resource_source string */ | ||
417 | |||
418 | ACPI_STRCPY((char *)&aml_resource_source[1], | ||
419 | resource_source->string_ptr); | ||
420 | |||
421 | /* | ||
422 | * Add the length of the string (+ 1 for null terminator) to the | ||
423 | * final descriptor length | ||
424 | */ | ||
425 | descriptor_length += | ||
426 | ((acpi_rsdesc_size) resource_source->string_length + 1); | ||
427 | } | ||
428 | |||
429 | /* Return the new total length of the AML descriptor */ | ||
430 | |||
431 | return (descriptor_length); | ||
432 | } | ||
433 | |||
434 | /******************************************************************************* | ||
435 | * | ||
53 | * FUNCTION: acpi_rs_get_prt_method_data | 436 | * FUNCTION: acpi_rs_get_prt_method_data |
54 | * | 437 | * |
55 | * PARAMETERS: Handle - a handle to the containing object | 438 | * PARAMETERS: Handle - a handle to the containing object |
@@ -65,8 +448,9 @@ ACPI_MODULE_NAME("rsutils") | |||
65 | * and the contents of the callers buffer is undefined. | 448 | * and the contents of the callers buffer is undefined. |
66 | * | 449 | * |
67 | ******************************************************************************/ | 450 | ******************************************************************************/ |
451 | |||
68 | acpi_status | 452 | acpi_status |
69 | acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | 453 | acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer) |
70 | { | 454 | { |
71 | union acpi_operand_object *obj_desc; | 455 | union acpi_operand_object *obj_desc; |
72 | acpi_status status; | 456 | acpi_status status; |
@@ -284,7 +668,7 @@ acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer) | |||
284 | * Convert the linked list into a byte stream | 668 | * Convert the linked list into a byte stream |
285 | */ | 669 | */ |
286 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 670 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; |
287 | status = acpi_rs_create_byte_stream(in_buffer->pointer, &buffer); | 671 | status = acpi_rs_create_aml_resources(in_buffer->pointer, &buffer); |
288 | if (ACPI_FAILURE(status)) { | 672 | if (ACPI_FAILURE(status)) { |
289 | return_ACPI_STATUS(status); | 673 | return_ACPI_STATUS(status); |
290 | } | 674 | } |
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index ee5a5c509199..5408e5d10cc3 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c | |||
@@ -57,13 +57,17 @@ ACPI_MODULE_NAME("rsxface") | |||
57 | ACPI_COPY_FIELD(out, in, decode); \ | 57 | ACPI_COPY_FIELD(out, in, decode); \ |
58 | ACPI_COPY_FIELD(out, in, min_address_fixed); \ | 58 | ACPI_COPY_FIELD(out, in, min_address_fixed); \ |
59 | ACPI_COPY_FIELD(out, in, max_address_fixed); \ | 59 | ACPI_COPY_FIELD(out, in, max_address_fixed); \ |
60 | ACPI_COPY_FIELD(out, in, attribute); \ | 60 | ACPI_COPY_FIELD(out, in, info); \ |
61 | ACPI_COPY_FIELD(out, in, granularity); \ | 61 | ACPI_COPY_FIELD(out, in, granularity); \ |
62 | ACPI_COPY_FIELD(out, in, min_address_range); \ | 62 | ACPI_COPY_FIELD(out, in, minimum); \ |
63 | ACPI_COPY_FIELD(out, in, max_address_range); \ | 63 | ACPI_COPY_FIELD(out, in, maximum); \ |
64 | ACPI_COPY_FIELD(out, in, address_translation_offset); \ | 64 | ACPI_COPY_FIELD(out, in, translation_offset); \ |
65 | ACPI_COPY_FIELD(out, in, address_length); \ | 65 | ACPI_COPY_FIELD(out, in, address_length); \ |
66 | ACPI_COPY_FIELD(out, in, resource_source); | 66 | ACPI_COPY_FIELD(out, in, resource_source); |
67 | /* Local prototypes */ | ||
68 | static acpi_status | ||
69 | acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context); | ||
70 | |||
67 | /******************************************************************************* | 71 | /******************************************************************************* |
68 | * | 72 | * |
69 | * FUNCTION: acpi_get_irq_routing_table | 73 | * FUNCTION: acpi_get_irq_routing_table |
@@ -86,6 +90,7 @@ ACPI_MODULE_NAME("rsxface") | |||
86 | * the object indicated by the passed device_handle. | 90 | * the object indicated by the passed device_handle. |
87 | * | 91 | * |
88 | ******************************************************************************/ | 92 | ******************************************************************************/ |
93 | |||
89 | acpi_status | 94 | acpi_status |
90 | acpi_get_irq_routing_table(acpi_handle device_handle, | 95 | acpi_get_irq_routing_table(acpi_handle device_handle, |
91 | struct acpi_buffer *ret_buffer) | 96 | struct acpi_buffer *ret_buffer) |
@@ -222,12 +227,12 @@ EXPORT_SYMBOL(acpi_get_possible_resources); | |||
222 | * | 227 | * |
223 | * FUNCTION: acpi_walk_resources | 228 | * FUNCTION: acpi_walk_resources |
224 | * | 229 | * |
225 | * PARAMETERS: device_handle - a handle to the device object for the | 230 | * PARAMETERS: device_handle - Handle to the device object for the |
226 | * device we are querying | 231 | * device we are querying |
227 | * Path - method name of the resources we want | 232 | * Name - Method name of the resources we want |
228 | * (METHOD_NAME__CRS or METHOD_NAME__PRS) | 233 | * (METHOD_NAME__CRS or METHOD_NAME__PRS) |
229 | * user_function - called for each resource | 234 | * user_function - Called for each resource |
230 | * Context - passed to user_function | 235 | * Context - Passed to user_function |
231 | * | 236 | * |
232 | * RETURN: Status | 237 | * RETURN: Status |
233 | * | 238 | * |
@@ -239,79 +244,74 @@ EXPORT_SYMBOL(acpi_get_possible_resources); | |||
239 | 244 | ||
240 | acpi_status | 245 | acpi_status |
241 | acpi_walk_resources(acpi_handle device_handle, | 246 | acpi_walk_resources(acpi_handle device_handle, |
242 | char *path, | 247 | char *name, |
243 | ACPI_WALK_RESOURCE_CALLBACK user_function, void *context) | 248 | ACPI_WALK_RESOURCE_CALLBACK user_function, void *context) |
244 | { | 249 | { |
245 | acpi_status status; | 250 | acpi_status status; |
246 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 251 | struct acpi_buffer buffer; |
247 | struct acpi_resource *resource; | 252 | struct acpi_resource *resource; |
248 | struct acpi_resource *buffer_end; | 253 | struct acpi_resource *resource_end; |
249 | 254 | ||
250 | ACPI_FUNCTION_TRACE("acpi_walk_resources"); | 255 | ACPI_FUNCTION_TRACE("acpi_walk_resources"); |
251 | 256 | ||
252 | if (!device_handle || | 257 | /* Parameter validation */ |
253 | (ACPI_STRNCMP(path, METHOD_NAME__CRS, sizeof(METHOD_NAME__CRS)) && | 258 | |
254 | ACPI_STRNCMP(path, METHOD_NAME__PRS, sizeof(METHOD_NAME__PRS)))) { | 259 | if (!device_handle || !user_function || !name || |
260 | (ACPI_STRNCMP(name, METHOD_NAME__CRS, sizeof(METHOD_NAME__CRS)) && | ||
261 | ACPI_STRNCMP(name, METHOD_NAME__PRS, sizeof(METHOD_NAME__PRS)))) { | ||
255 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 262 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
256 | } | 263 | } |
257 | 264 | ||
258 | status = acpi_rs_get_method_data(device_handle, path, &buffer); | 265 | /* Get the _CRS or _PRS resource list */ |
266 | |||
267 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | ||
268 | status = acpi_rs_get_method_data(device_handle, name, &buffer); | ||
259 | if (ACPI_FAILURE(status)) { | 269 | if (ACPI_FAILURE(status)) { |
260 | return_ACPI_STATUS(status); | 270 | return_ACPI_STATUS(status); |
261 | } | 271 | } |
262 | 272 | ||
263 | /* Setup pointers */ | 273 | /* Buffer now contains the resource list */ |
264 | 274 | ||
265 | resource = (struct acpi_resource *)buffer.pointer; | 275 | resource = ACPI_CAST_PTR(struct acpi_resource, buffer.pointer); |
266 | buffer_end = ACPI_CAST_PTR(struct acpi_resource, | 276 | resource_end = |
267 | ((u8 *) buffer.pointer + buffer.length)); | 277 | ACPI_ADD_PTR(struct acpi_resource, buffer.pointer, buffer.length); |
268 | 278 | ||
269 | /* Walk the resource list */ | 279 | /* Walk the resource list until the end_tag is found (or buffer end) */ |
270 | 280 | ||
271 | for (;;) { | 281 | while (resource < resource_end) { |
272 | if (!resource || resource->id == ACPI_RSTYPE_END_TAG) { | 282 | /* Sanity check the resource */ |
283 | |||
284 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { | ||
285 | status = AE_AML_INVALID_RESOURCE_TYPE; | ||
273 | break; | 286 | break; |
274 | } | 287 | } |
275 | 288 | ||
276 | status = user_function(resource, context); | 289 | /* end_tag indicates end-of-list */ |
277 | |||
278 | switch (status) { | ||
279 | case AE_OK: | ||
280 | case AE_CTRL_DEPTH: | ||
281 | 290 | ||
282 | /* Just keep going */ | 291 | if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { |
283 | |||
284 | status = AE_OK; | ||
285 | break; | 292 | break; |
293 | } | ||
286 | 294 | ||
287 | case AE_CTRL_TERMINATE: | 295 | /* Invoke the user function, abort on any error returned */ |
288 | |||
289 | /* Exit now, with OK stats */ | ||
290 | |||
291 | status = AE_OK; | ||
292 | goto cleanup; | ||
293 | |||
294 | default: | ||
295 | 296 | ||
296 | /* All others are valid exceptions */ | 297 | status = user_function(resource, context); |
298 | if (ACPI_FAILURE(status)) { | ||
299 | if (status == AE_CTRL_TERMINATE) { | ||
300 | /* This is an OK termination by the user function */ | ||
297 | 301 | ||
298 | goto cleanup; | 302 | status = AE_OK; |
303 | } | ||
304 | break; | ||
299 | } | 305 | } |
300 | 306 | ||
301 | /* Get the next resource descriptor */ | 307 | /* Get the next resource descriptor */ |
302 | 308 | ||
303 | resource = ACPI_NEXT_RESOURCE(resource); | 309 | resource = |
304 | 310 | ACPI_ADD_PTR(struct acpi_resource, resource, | |
305 | /* Check for end-of-buffer */ | 311 | resource->length); |
306 | |||
307 | if (resource >= buffer_end) { | ||
308 | goto cleanup; | ||
309 | } | ||
310 | } | 312 | } |
311 | 313 | ||
312 | cleanup: | 314 | ACPI_MEM_FREE(buffer.pointer); |
313 | |||
314 | acpi_os_free(buffer.pointer); | ||
315 | return_ACPI_STATUS(status); | 315 | return_ACPI_STATUS(status); |
316 | } | 316 | } |
317 | 317 | ||
@@ -360,8 +360,8 @@ EXPORT_SYMBOL(acpi_set_current_resources); | |||
360 | * | 360 | * |
361 | * FUNCTION: acpi_resource_to_address64 | 361 | * FUNCTION: acpi_resource_to_address64 |
362 | * | 362 | * |
363 | * PARAMETERS: resource - Pointer to a resource | 363 | * PARAMETERS: Resource - Pointer to a resource |
364 | * out - Pointer to the users's return | 364 | * Out - Pointer to the users's return |
365 | * buffer (a struct | 365 | * buffer (a struct |
366 | * struct acpi_resource_address64) | 366 | * struct acpi_resource_address64) |
367 | * | 367 | * |
@@ -381,20 +381,26 @@ acpi_resource_to_address64(struct acpi_resource *resource, | |||
381 | struct acpi_resource_address16 *address16; | 381 | struct acpi_resource_address16 *address16; |
382 | struct acpi_resource_address32 *address32; | 382 | struct acpi_resource_address32 *address32; |
383 | 383 | ||
384 | switch (resource->id) { | 384 | if (!resource || !out) { |
385 | case ACPI_RSTYPE_ADDRESS16: | 385 | return (AE_BAD_PARAMETER); |
386 | } | ||
387 | |||
388 | /* Convert 16 or 32 address descriptor to 64 */ | ||
389 | |||
390 | switch (resource->type) { | ||
391 | case ACPI_RESOURCE_TYPE_ADDRESS16: | ||
386 | 392 | ||
387 | address16 = (struct acpi_resource_address16 *)&resource->data; | 393 | address16 = (struct acpi_resource_address16 *)&resource->data; |
388 | ACPI_COPY_ADDRESS(out, address16); | 394 | ACPI_COPY_ADDRESS(out, address16); |
389 | break; | 395 | break; |
390 | 396 | ||
391 | case ACPI_RSTYPE_ADDRESS32: | 397 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
392 | 398 | ||
393 | address32 = (struct acpi_resource_address32 *)&resource->data; | 399 | address32 = (struct acpi_resource_address32 *)&resource->data; |
394 | ACPI_COPY_ADDRESS(out, address32); | 400 | ACPI_COPY_ADDRESS(out, address32); |
395 | break; | 401 | break; |
396 | 402 | ||
397 | case ACPI_RSTYPE_ADDRESS64: | 403 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
398 | 404 | ||
399 | /* Simple copy for 64 bit source */ | 405 | /* Simple copy for 64 bit source */ |
400 | 406 | ||
@@ -410,3 +416,113 @@ acpi_resource_to_address64(struct acpi_resource *resource, | |||
410 | } | 416 | } |
411 | 417 | ||
412 | EXPORT_SYMBOL(acpi_resource_to_address64); | 418 | EXPORT_SYMBOL(acpi_resource_to_address64); |
419 | |||
420 | /******************************************************************************* | ||
421 | * | ||
422 | * FUNCTION: acpi_get_vendor_resource | ||
423 | * | ||
424 | * PARAMETERS: device_handle - Handle for the parent device object | ||
425 | * Name - Method name for the parent resource | ||
426 | * (METHOD_NAME__CRS or METHOD_NAME__PRS) | ||
427 | * Uuid - Pointer to the UUID to be matched. | ||
428 | * includes both subtype and 16-byte UUID | ||
429 | * ret_buffer - Where the vendor resource is returned | ||
430 | * | ||
431 | * RETURN: Status | ||
432 | * | ||
433 | * DESCRIPTION: Walk a resource template for the specified evice to find a | ||
434 | * vendor-defined resource that matches the supplied UUID and | ||
435 | * UUID subtype. Returns a struct acpi_resource of type Vendor. | ||
436 | * | ||
437 | ******************************************************************************/ | ||
438 | |||
439 | acpi_status | ||
440 | acpi_get_vendor_resource(acpi_handle device_handle, | ||
441 | char *name, | ||
442 | struct acpi_vendor_uuid * uuid, | ||
443 | struct acpi_buffer * ret_buffer) | ||
444 | { | ||
445 | struct acpi_vendor_walk_info info; | ||
446 | acpi_status status; | ||
447 | |||
448 | /* Other parameters are validated by acpi_walk_resources */ | ||
449 | |||
450 | if (!uuid || !ret_buffer) { | ||
451 | return (AE_BAD_PARAMETER); | ||
452 | } | ||
453 | |||
454 | info.uuid = uuid; | ||
455 | info.buffer = ret_buffer; | ||
456 | info.status = AE_NOT_EXIST; | ||
457 | |||
458 | /* Walk the _CRS or _PRS resource list for this device */ | ||
459 | |||
460 | status = | ||
461 | acpi_walk_resources(device_handle, name, | ||
462 | acpi_rs_match_vendor_resource, &info); | ||
463 | if (ACPI_FAILURE(status)) { | ||
464 | return (status); | ||
465 | } | ||
466 | |||
467 | return (info.status); | ||
468 | } | ||
469 | |||
470 | /******************************************************************************* | ||
471 | * | ||
472 | * FUNCTION: acpi_rs_match_vendor_resource | ||
473 | * | ||
474 | * PARAMETERS: ACPI_WALK_RESOURCE_CALLBACK | ||
475 | * | ||
476 | * RETURN: Status | ||
477 | * | ||
478 | * DESCRIPTION: Match a vendor resource via the ACPI 3.0 UUID | ||
479 | * | ||
480 | ******************************************************************************/ | ||
481 | |||
482 | static acpi_status | ||
483 | acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context) | ||
484 | { | ||
485 | struct acpi_vendor_walk_info *info = context; | ||
486 | struct acpi_resource_vendor_typed *vendor; | ||
487 | struct acpi_buffer *buffer; | ||
488 | acpi_status status; | ||
489 | |||
490 | /* Ignore all descriptors except Vendor */ | ||
491 | |||
492 | if (resource->type != ACPI_RESOURCE_TYPE_VENDOR) { | ||
493 | return (AE_OK); | ||
494 | } | ||
495 | |||
496 | vendor = &resource->data.vendor_typed; | ||
497 | |||
498 | /* | ||
499 | * For a valid match, these conditions must hold: | ||
500 | * | ||
501 | * 1) Length of descriptor data must be at least as long as a UUID struct | ||
502 | * 2) The UUID subtypes must match | ||
503 | * 3) The UUID data must match | ||
504 | */ | ||
505 | if ((vendor->byte_length < (ACPI_UUID_LENGTH + 1)) || | ||
506 | (vendor->uuid_subtype != info->uuid->subtype) || | ||
507 | (ACPI_MEMCMP(vendor->uuid, info->uuid->data, ACPI_UUID_LENGTH))) { | ||
508 | return (AE_OK); | ||
509 | } | ||
510 | |||
511 | /* Validate/Allocate/Clear caller buffer */ | ||
512 | |||
513 | buffer = info->buffer; | ||
514 | status = acpi_ut_initialize_buffer(buffer, resource->length); | ||
515 | if (ACPI_FAILURE(status)) { | ||
516 | return (status); | ||
517 | } | ||
518 | |||
519 | /* Found the correct resource, copy and return it */ | ||
520 | |||
521 | ACPI_MEMCPY(buffer->pointer, resource, resource->length); | ||
522 | buffer->length = resource->length; | ||
523 | |||
524 | /* Found the desired descriptor, terminate resource walk */ | ||
525 | |||
526 | info->status = AE_OK; | ||
527 | return (AE_CTRL_TERMINATE); | ||
528 | } | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 0745d20afb8c..c60516d0f66b 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -844,7 +844,7 @@ static void acpi_device_set_id(struct acpi_device *device, | |||
844 | * ---- | 844 | * ---- |
845 | * Fix for the system root bus device -- the only root-level device. | 845 | * Fix for the system root bus device -- the only root-level device. |
846 | */ | 846 | */ |
847 | if ((parent == ACPI_ROOT_OBJECT) && (type == ACPI_BUS_TYPE_DEVICE)) { | 847 | if (((acpi_handle)parent == ACPI_ROOT_OBJECT) && (type == ACPI_BUS_TYPE_DEVICE)) { |
848 | hid = ACPI_BUS_HID; | 848 | hid = ACPI_BUS_HID; |
849 | strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME); | 849 | strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME); |
850 | strcpy(device->pnp.device_class, ACPI_BUS_CLASS); | 850 | strcpy(device->pnp.device_class, ACPI_BUS_CLASS); |
diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c index a03939399fa9..cd33397d9231 100644 --- a/drivers/acpi/tables/tbconvrt.c +++ b/drivers/acpi/tables/tbconvrt.c | |||
@@ -554,7 +554,9 @@ acpi_status acpi_tb_convert_table_fadt(void) | |||
554 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, | 554 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, |
555 | "Hex dump of common internal FADT, size %d (%X)\n", | 555 | "Hex dump of common internal FADT, size %d (%X)\n", |
556 | acpi_gbl_FADT->length, acpi_gbl_FADT->length)); | 556 | acpi_gbl_FADT->length, acpi_gbl_FADT->length)); |
557 | ACPI_DUMP_BUFFER((u8 *) (acpi_gbl_FADT), acpi_gbl_FADT->length); | 557 | |
558 | ACPI_DUMP_BUFFER(ACPI_CAST_PTR(u8, acpi_gbl_FADT), | ||
559 | acpi_gbl_FADT->length); | ||
558 | 560 | ||
559 | return_ACPI_STATUS(AE_OK); | 561 | return_ACPI_STATUS(AE_OK); |
560 | } | 562 | } |
diff --git a/drivers/acpi/tables/tbgetall.c b/drivers/acpi/tables/tbgetall.c index 8d72343537e7..33c9ed8a6f99 100644 --- a/drivers/acpi/tables/tbgetall.c +++ b/drivers/acpi/tables/tbgetall.c | |||
@@ -292,7 +292,9 @@ acpi_status acpi_tb_get_required_tables(void) | |||
292 | "Hex dump of entire DSDT, size %d (0x%X), Integer width = %d\n", | 292 | "Hex dump of entire DSDT, size %d (0x%X), Integer width = %d\n", |
293 | acpi_gbl_DSDT->length, acpi_gbl_DSDT->length, | 293 | acpi_gbl_DSDT->length, acpi_gbl_DSDT->length, |
294 | acpi_gbl_integer_bit_width)); | 294 | acpi_gbl_integer_bit_width)); |
295 | ACPI_DUMP_BUFFER((u8 *) acpi_gbl_DSDT, acpi_gbl_DSDT->length); | 295 | |
296 | ACPI_DUMP_BUFFER(ACPI_CAST_PTR(u8, acpi_gbl_DSDT), | ||
297 | acpi_gbl_DSDT->length); | ||
296 | 298 | ||
297 | /* Always delete the RSDP mapping, we are done with it */ | 299 | /* Always delete the RSDP mapping, we are done with it */ |
298 | 300 | ||
diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c index ad0252c2f7db..3cee0cee4cc2 100644 --- a/drivers/acpi/tables/tbrsdt.c +++ b/drivers/acpi/tables/tbrsdt.c | |||
@@ -251,7 +251,7 @@ acpi_status acpi_tb_get_table_rsdt(void) | |||
251 | } | 251 | } |
252 | 252 | ||
253 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 253 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
254 | "RSDP located at %p, points to RSDT physical=%8.8X%8.8X \n", | 254 | "RSDP located at %p, points to RSDT physical=%8.8X%8.8X\n", |
255 | acpi_gbl_RSDP, | 255 | acpi_gbl_RSDP, |
256 | ACPI_FORMAT_UINT64(address.pointer.value))); | 256 | ACPI_FORMAT_UINT64(address.pointer.value))); |
257 | 257 | ||
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index 4b2fbb592f49..9d0bf536d674 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c | |||
@@ -94,9 +94,8 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc) | |||
94 | new_table_desc->pointer->length) | 94 | new_table_desc->pointer->length) |
95 | && | 95 | && |
96 | (!ACPI_MEMCMP | 96 | (!ACPI_MEMCMP |
97 | ((const char *)table_desc->pointer, | 97 | (table_desc->pointer, new_table_desc->pointer, |
98 | (const char *)new_table_desc->pointer, | 98 | new_table_desc->pointer->length))) { |
99 | (acpi_size) new_table_desc->pointer->length))) { | ||
100 | /* Match: this table is already installed */ | 99 | /* Match: this table is already installed */ |
101 | 100 | ||
102 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, | 101 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, |
@@ -241,16 +240,16 @@ acpi_tb_verify_table_checksum(struct acpi_table_header * table_header) | |||
241 | 240 | ||
242 | u8 acpi_tb_generate_checksum(void *buffer, u32 length) | 241 | u8 acpi_tb_generate_checksum(void *buffer, u32 length) |
243 | { | 242 | { |
244 | const u8 *limit; | 243 | u8 *end_buffer; |
245 | const u8 *rover; | 244 | u8 *rover; |
246 | u8 sum = 0; | 245 | u8 sum = 0; |
247 | 246 | ||
248 | if (buffer && length) { | 247 | if (buffer && length) { |
249 | /* Buffer and Length are valid */ | 248 | /* Buffer and Length are valid */ |
250 | 249 | ||
251 | limit = (u8 *) buffer + length; | 250 | end_buffer = ACPI_ADD_PTR(u8, buffer, length); |
252 | 251 | ||
253 | for (rover = buffer; rover < limit; rover++) { | 252 | for (rover = buffer; rover < end_buffer; rover++) { |
254 | sum = (u8) (sum + *rover); | 253 | sum = (u8) (sum + *rover); |
255 | } | 254 | } |
256 | } | 255 | } |
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index 3b8a7e063e8a..b01a4b2ae7da 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c | |||
@@ -251,7 +251,7 @@ acpi_get_firmware_table(acpi_string signature, | |||
251 | 251 | ||
252 | acpi_tb_get_rsdt_address(&address); | 252 | acpi_tb_get_rsdt_address(&address); |
253 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 253 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
254 | "RSDP located at %p, RSDT physical=%8.8X%8.8X \n", | 254 | "RSDP located at %p, RSDT physical=%8.8X%8.8X\n", |
255 | acpi_gbl_RSDP, | 255 | acpi_gbl_RSDP, |
256 | ACPI_FORMAT_UINT64(address.pointer.value))); | 256 | ACPI_FORMAT_UINT64(address.pointer.value))); |
257 | 257 | ||
diff --git a/drivers/acpi/utilities/Makefile b/drivers/acpi/utilities/Makefile index e87108b7338a..88eff14c4894 100644 --- a/drivers/acpi/utilities/Makefile +++ b/drivers/acpi/utilities/Makefile | |||
@@ -2,7 +2,8 @@ | |||
2 | # Makefile for all Linux ACPI interpreter subdirectories | 2 | # Makefile for all Linux ACPI interpreter subdirectories |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ | 5 | obj-y := utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ |
6 | utcopy.o utdelete.o utglobal.o utmath.o utobject.o utstate.o utmutex.o utobject.o utcache.o | 6 | utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ |
7 | utstate.o utmutex.o utobject.o utcache.o utresrc.o | ||
7 | 8 | ||
8 | EXTRA_CFLAGS += $(ACPI_CFLAGS) | 9 | EXTRA_CFLAGS += $(ACPI_CFLAGS) |
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 068450b36475..b11b7ed788c6 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c | |||
@@ -47,7 +47,7 @@ | |||
47 | ACPI_MODULE_NAME("utalloc") | 47 | ACPI_MODULE_NAME("utalloc") |
48 | 48 | ||
49 | /* Local prototypes */ | 49 | /* Local prototypes */ |
50 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | 50 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
51 | static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation); | 51 | static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation); |
52 | 52 | ||
53 | static acpi_status | 53 | static acpi_status |
@@ -58,9 +58,7 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *address, | |||
58 | static acpi_status | 58 | static acpi_status |
59 | acpi_ut_remove_allocation(struct acpi_debug_mem_block *address, | 59 | acpi_ut_remove_allocation(struct acpi_debug_mem_block *address, |
60 | u32 component, char *module, u32 line); | 60 | u32 component, char *module, u32 line); |
61 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ | ||
62 | 61 | ||
63 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
64 | static acpi_status | 62 | static acpi_status |
65 | acpi_ut_create_list(char *list_name, | 63 | acpi_ut_create_list(char *list_name, |
66 | u16 object_size, struct acpi_memory_list **return_cache); | 64 | u16 object_size, struct acpi_memory_list **return_cache); |
@@ -304,7 +302,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) | |||
304 | 302 | ||
305 | if (!size) { | 303 | if (!size) { |
306 | _ACPI_REPORT_ERROR(module, line, component, | 304 | _ACPI_REPORT_ERROR(module, line, component, |
307 | ("ut_allocate: Attempt to allocate zero bytes\n")); | 305 | ("ut_allocate: Attempt to allocate zero bytes, allocating 1 byte\n")); |
308 | size = 1; | 306 | size = 1; |
309 | } | 307 | } |
310 | 308 | ||
@@ -347,8 +345,8 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) | |||
347 | 345 | ||
348 | if (!size) { | 346 | if (!size) { |
349 | _ACPI_REPORT_ERROR(module, line, component, | 347 | _ACPI_REPORT_ERROR(module, line, component, |
350 | ("ut_callocate: Attempt to allocate zero bytes\n")); | 348 | ("ut_callocate: Attempt to allocate zero bytes, allocating 1 byte\n")); |
351 | return_PTR(NULL); | 349 | size = 1; |
352 | } | 350 | } |
353 | 351 | ||
354 | allocation = acpi_os_allocate(size); | 352 | allocation = acpi_os_allocate(size); |
@@ -866,7 +864,7 @@ void acpi_ut_dump_allocations(u32 component, char *module) | |||
866 | 864 | ||
867 | if (!num_outstanding) { | 865 | if (!num_outstanding) { |
868 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 866 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
869 | "No outstanding allocations.\n")); | 867 | "No outstanding allocations\n")); |
870 | } else { | 868 | } else { |
871 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 869 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
872 | "%d(%X) Outstanding allocations\n", | 870 | "%d(%X) Outstanding allocations\n", |
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index 5442b32de611..568df9e42f89 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c | |||
@@ -398,14 +398,17 @@ acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object, | |||
398 | * Build a simple object (no nested objects) | 398 | * Build a simple object (no nested objects) |
399 | */ | 399 | */ |
400 | status = acpi_ut_copy_isimple_to_esimple(internal_object, | 400 | status = acpi_ut_copy_isimple_to_esimple(internal_object, |
401 | (union acpi_object *) | 401 | ACPI_CAST_PTR(union |
402 | ret_buffer->pointer, | 402 | acpi_object, |
403 | ((u8 *) ret_buffer-> | 403 | ret_buffer-> |
404 | pointer + | 404 | pointer), |
405 | ACPI_ROUND_UP_TO_NATIVE_WORD | 405 | ACPI_ADD_PTR(u8, |
406 | (sizeof | 406 | ret_buffer-> |
407 | (union | 407 | pointer, |
408 | acpi_object))), | 408 | ACPI_ROUND_UP_TO_NATIVE_WORD |
409 | (sizeof | ||
410 | (union | ||
411 | acpi_object))), | ||
409 | &ret_buffer->length); | 412 | &ret_buffer->length); |
410 | /* | 413 | /* |
411 | * build simple does not include the object size in the length | 414 | * build simple does not include the object size in the length |
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index 7b81d5ef3c32..cd63a2d93fe3 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c | |||
@@ -95,7 +95,9 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | |||
95 | 95 | ||
96 | for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) { | 96 | for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) { |
97 | if (!ACPI_STRCMP(string_desc->string.pointer, | 97 | if (!ACPI_STRCMP(string_desc->string.pointer, |
98 | (char *)acpi_gbl_valid_osi_strings[i])) { | 98 | ACPI_CAST_PTR(char, |
99 | acpi_gbl_valid_osi_strings[i]))) | ||
100 | { | ||
99 | /* This string is supported */ | 101 | /* This string is supported */ |
100 | 102 | ||
101 | return_desc->integer.value = 0xFFFFFFFF; | 103 | return_desc->integer.value = 0xFFFFFFFF; |
@@ -592,7 +594,7 @@ acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags) | |||
592 | "_STA on %4.4s was not found, assuming device is present\n", | 594 | "_STA on %4.4s was not found, assuming device is present\n", |
593 | acpi_ut_get_node_name(device_node))); | 595 | acpi_ut_get_node_name(device_node))); |
594 | 596 | ||
595 | *flags = 0x0F; | 597 | *flags = ACPI_UINT32_MAX; |
596 | status = AE_OK; | 598 | status = AE_OK; |
597 | } | 599 | } |
598 | 600 | ||
@@ -637,17 +639,17 @@ acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest) | |||
637 | for (i = 0; i < 4; i++) { | 639 | for (i = 0; i < 4; i++) { |
638 | highest[i] = 0xFF; | 640 | highest[i] = 0xFF; |
639 | status = acpi_ut_evaluate_object(device_node, | 641 | status = acpi_ut_evaluate_object(device_node, |
640 | (char *) | 642 | ACPI_CAST_PTR(char, |
641 | acpi_gbl_highest_dstate_names | 643 | acpi_gbl_highest_dstate_names |
642 | [i], ACPI_BTYPE_INTEGER, | 644 | [i]), |
643 | &obj_desc); | 645 | ACPI_BTYPE_INTEGER, &obj_desc); |
644 | if (ACPI_FAILURE(status)) { | 646 | if (ACPI_FAILURE(status)) { |
645 | if (status != AE_NOT_FOUND) { | 647 | if (status != AE_NOT_FOUND) { |
646 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 648 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
647 | "%s on Device %4.4s, %s\n", | 649 | "%s on Device %4.4s, %s\n", |
648 | (char *) | 650 | ACPI_CAST_PTR(char, |
649 | acpi_gbl_highest_dstate_names | 651 | acpi_gbl_highest_dstate_names |
650 | [i], | 652 | [i]), |
651 | acpi_ut_get_node_name | 653 | acpi_ut_get_node_name |
652 | (device_node), | 654 | (device_node), |
653 | acpi_format_exception | 655 | acpi_format_exception |
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 399e64b51886..7c59c2b0d953 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c | |||
@@ -217,23 +217,23 @@ const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = { | |||
217 | * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to | 217 | * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to |
218 | * perform a Notify() operation on it. | 218 | * perform a Notify() operation on it. |
219 | */ | 219 | */ |
220 | const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = | 220 | const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = { |
221 | { {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, | 221 | {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, |
222 | {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, | 222 | {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, |
223 | {"_SB_", ACPI_TYPE_DEVICE, NULL}, | 223 | {"_SB_", ACPI_TYPE_DEVICE, NULL}, |
224 | {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, | 224 | {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, |
225 | {"_TZ_", ACPI_TYPE_THERMAL, NULL}, | 225 | {"_TZ_", ACPI_TYPE_THERMAL, NULL}, |
226 | {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, | 226 | {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, |
227 | {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, | 227 | {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, |
228 | {"_GL_", ACPI_TYPE_MUTEX, (char *)1}, | 228 | {"_GL_", ACPI_TYPE_MUTEX, (char *)1}, |
229 | 229 | ||
230 | #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) | 230 | #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) |
231 | {"_OSI", ACPI_TYPE_METHOD, (char *)1}, | 231 | {"_OSI", ACPI_TYPE_METHOD, (char *)1}, |
232 | #endif | 232 | #endif |
233 | 233 | ||
234 | /* Table terminator */ | 234 | /* Table terminator */ |
235 | 235 | ||
236 | {NULL, ACPI_TYPE_ANY, NULL} | 236 | {NULL, ACPI_TYPE_ANY, NULL} |
237 | }; | 237 | }; |
238 | 238 | ||
239 | /* | 239 | /* |
@@ -485,7 +485,7 @@ char *acpi_ut_get_region_name(u8 space_id) | |||
485 | return ("invalid_space_id"); | 485 | return ("invalid_space_id"); |
486 | } | 486 | } |
487 | 487 | ||
488 | return ((char *)acpi_gbl_region_types[space_id]); | 488 | return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); |
489 | } | 489 | } |
490 | 490 | ||
491 | /******************************************************************************* | 491 | /******************************************************************************* |
@@ -503,11 +503,13 @@ char *acpi_ut_get_region_name(u8 space_id) | |||
503 | /* Event type decoding */ | 503 | /* Event type decoding */ |
504 | 504 | ||
505 | static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { | 505 | static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { |
506 | /*! [Begin] no source code translation (keep these strings as-is) */ | ||
506 | "PM_Timer", | 507 | "PM_Timer", |
507 | "global_lock", | 508 | "GlobalLock", |
508 | "power_button", | 509 | "PowerButton", |
509 | "sleep_button", | 510 | "SleepButton", |
510 | "real_time_clock", | 511 | "RealTimeClock", |
512 | /*! [End] no source code translation !*/ | ||
511 | }; | 513 | }; |
512 | 514 | ||
513 | char *acpi_ut_get_event_name(u32 event_id) | 515 | char *acpi_ut_get_event_name(u32 event_id) |
@@ -545,12 +547,13 @@ static const char acpi_gbl_bad_type[] = "UNDEFINED"; | |||
545 | /* Printable names of the ACPI object types */ | 547 | /* Printable names of the ACPI object types */ |
546 | 548 | ||
547 | static const char *acpi_gbl_ns_type_names[] = { | 549 | static const char *acpi_gbl_ns_type_names[] = { |
550 | /*! [Begin] no source code translation (keep these strings as-is) */ | ||
548 | /* 00 */ "Untyped", | 551 | /* 00 */ "Untyped", |
549 | /* 01 */ "Integer", | 552 | /* 01 */ "Integer", |
550 | /* 02 */ "String", | 553 | /* 02 */ "String", |
551 | /* 03 */ "Buffer", | 554 | /* 03 */ "Buffer", |
552 | /* 04 */ "Package", | 555 | /* 04 */ "Package", |
553 | /* 05 */ "field_unit", | 556 | /* 05 */ "FieldUnit", |
554 | /* 06 */ "Device", | 557 | /* 06 */ "Device", |
555 | /* 07 */ "Event", | 558 | /* 07 */ "Event", |
556 | /* 08 */ "Method", | 559 | /* 08 */ "Method", |
@@ -559,23 +562,24 @@ static const char *acpi_gbl_ns_type_names[] = { | |||
559 | /* 11 */ "Power", | 562 | /* 11 */ "Power", |
560 | /* 12 */ "Processor", | 563 | /* 12 */ "Processor", |
561 | /* 13 */ "Thermal", | 564 | /* 13 */ "Thermal", |
562 | /* 14 */ "buffer_field", | 565 | /* 14 */ "BufferField", |
563 | /* 15 */ "ddb_handle", | 566 | /* 15 */ "DdbHandle", |
564 | /* 16 */ "debug_object", | 567 | /* 16 */ "DebugObject", |
565 | /* 17 */ "region_field", | 568 | /* 17 */ "RegionField", |
566 | /* 18 */ "bank_field", | 569 | /* 18 */ "BankField", |
567 | /* 19 */ "index_field", | 570 | /* 19 */ "IndexField", |
568 | /* 20 */ "Reference", | 571 | /* 20 */ "Reference", |
569 | /* 21 */ "Alias", | 572 | /* 21 */ "Alias", |
570 | /* 22 */ "method_alias", | 573 | /* 22 */ "MethodAlias", |
571 | /* 23 */ "Notify", | 574 | /* 23 */ "Notify", |
572 | /* 24 */ "addr_handler", | 575 | /* 24 */ "AddrHandler", |
573 | /* 25 */ "resource_desc", | 576 | /* 25 */ "ResourceDesc", |
574 | /* 26 */ "resource_fld", | 577 | /* 26 */ "ResourceFld", |
575 | /* 27 */ "Scope", | 578 | /* 27 */ "Scope", |
576 | /* 28 */ "Extra", | 579 | /* 28 */ "Extra", |
577 | /* 29 */ "Data", | 580 | /* 29 */ "Data", |
578 | /* 30 */ "Invalid" | 581 | /* 30 */ "Invalid" |
582 | /*! [End] no source code translation !*/ | ||
579 | }; | 583 | }; |
580 | 584 | ||
581 | char *acpi_ut_get_type_name(acpi_object_type type) | 585 | char *acpi_ut_get_type_name(acpi_object_type type) |
@@ -634,7 +638,7 @@ char *acpi_ut_get_node_name(void *object) | |||
634 | 638 | ||
635 | /* Name must be a valid ACPI name */ | 639 | /* Name must be a valid ACPI name */ |
636 | 640 | ||
637 | if (!acpi_ut_valid_acpi_name(*(u32 *) node->name.ascii)) { | 641 | if (!acpi_ut_valid_acpi_name(node->name.integer)) { |
638 | return ("????"); | 642 | return ("????"); |
639 | } | 643 | } |
640 | 644 | ||
@@ -658,15 +662,16 @@ char *acpi_ut_get_node_name(void *object) | |||
658 | /* Printable names of object descriptor types */ | 662 | /* Printable names of object descriptor types */ |
659 | 663 | ||
660 | static const char *acpi_gbl_desc_type_names[] = { | 664 | static const char *acpi_gbl_desc_type_names[] = { |
665 | /*! [Begin] no source code translation (keep these ASL Keywords as-is) */ | ||
661 | /* 00 */ "Invalid", | 666 | /* 00 */ "Invalid", |
662 | /* 01 */ "Cached", | 667 | /* 01 */ "Cached", |
663 | /* 02 */ "State-Generic", | 668 | /* 02 */ "State-Generic", |
664 | /* 03 */ "State-Update", | 669 | /* 03 */ "State-Update", |
665 | /* 04 */ "State-Package", | 670 | /* 04 */ "State-Package", |
666 | /* 05 */ "State-Control", | 671 | /* 05 */ "State-Control", |
667 | /* 06 */ "State-root_parse_scope", | 672 | /* 06 */ "State-RootParseScope", |
668 | /* 07 */ "State-parse_scope", | 673 | /* 07 */ "State-ParseScope", |
669 | /* 08 */ "State-walk_scope", | 674 | /* 08 */ "State-WalkScope", |
670 | /* 09 */ "State-Result", | 675 | /* 09 */ "State-Result", |
671 | /* 10 */ "State-Notify", | 676 | /* 10 */ "State-Notify", |
672 | /* 11 */ "State-Thread", | 677 | /* 11 */ "State-Thread", |
@@ -674,6 +679,7 @@ static const char *acpi_gbl_desc_type_names[] = { | |||
674 | /* 13 */ "Parser", | 679 | /* 13 */ "Parser", |
675 | /* 14 */ "Operand", | 680 | /* 14 */ "Operand", |
676 | /* 15 */ "Node" | 681 | /* 15 */ "Node" |
682 | /*! [End] no source code translation !*/ | ||
677 | }; | 683 | }; |
678 | 684 | ||
679 | char *acpi_ut_get_descriptor_name(void *object) | 685 | char *acpi_ut_get_descriptor_name(void *object) |
@@ -684,11 +690,12 @@ char *acpi_ut_get_descriptor_name(void *object) | |||
684 | } | 690 | } |
685 | 691 | ||
686 | if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) { | 692 | if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) { |
687 | return ((char *)acpi_gbl_bad_type); | 693 | return (ACPI_CAST_PTR(char, acpi_gbl_bad_type)); |
688 | } | 694 | } |
689 | 695 | ||
690 | return ((char *) | 696 | return (ACPI_CAST_PTR(char, |
691 | acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE(object)]); | 697 | acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE |
698 | (object)])); | ||
692 | 699 | ||
693 | } | 700 | } |
694 | 701 | ||
@@ -787,6 +794,11 @@ void acpi_ut_init_globals(void) | |||
787 | acpi_gbl_mutex_info[i].use_count = 0; | 794 | acpi_gbl_mutex_info[i].use_count = 0; |
788 | } | 795 | } |
789 | 796 | ||
797 | for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) { | ||
798 | acpi_gbl_owner_id_mask[i] = 0; | ||
799 | } | ||
800 | acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */ | ||
801 | |||
790 | /* GPE support */ | 802 | /* GPE support */ |
791 | 803 | ||
792 | acpi_gbl_gpe_xrupt_list_head = NULL; | 804 | acpi_gbl_gpe_xrupt_list_head = NULL; |
@@ -824,7 +836,11 @@ void acpi_ut_init_globals(void) | |||
824 | acpi_gbl_ns_lookup_count = 0; | 836 | acpi_gbl_ns_lookup_count = 0; |
825 | acpi_gbl_ps_find_count = 0; | 837 | acpi_gbl_ps_find_count = 0; |
826 | acpi_gbl_acpi_hardware_present = TRUE; | 838 | acpi_gbl_acpi_hardware_present = TRUE; |
827 | acpi_gbl_owner_id_mask = 0; | 839 | acpi_gbl_last_owner_id_index = 0; |
840 | acpi_gbl_next_owner_id_offset = 0; | ||
841 | acpi_gbl_trace_method_name = 0; | ||
842 | acpi_gbl_trace_dbg_level = 0; | ||
843 | acpi_gbl_trace_dbg_layer = 0; | ||
828 | acpi_gbl_debugger_configuration = DEBUGGER_THREADING; | 844 | acpi_gbl_debugger_configuration = DEBUGGER_THREADING; |
829 | acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; | 845 | acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; |
830 | 846 | ||
@@ -836,7 +852,6 @@ void acpi_ut_init_globals(void) | |||
836 | /* Namespace */ | 852 | /* Namespace */ |
837 | 853 | ||
838 | acpi_gbl_root_node = NULL; | 854 | acpi_gbl_root_node = NULL; |
839 | |||
840 | acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; | 855 | acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; |
841 | acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED; | 856 | acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED; |
842 | acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; | 857 | acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; |
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 2ce872d75890..48d511d5c04b 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c | |||
@@ -63,6 +63,8 @@ ACPI_MODULE_NAME("utmisc") | |||
63 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | 63 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) |
64 | { | 64 | { |
65 | acpi_native_uint i; | 65 | acpi_native_uint i; |
66 | acpi_native_uint j; | ||
67 | acpi_native_uint k; | ||
66 | acpi_status status; | 68 | acpi_status status; |
67 | 69 | ||
68 | ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); | 70 | ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); |
@@ -82,31 +84,66 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
82 | return_ACPI_STATUS(status); | 84 | return_ACPI_STATUS(status); |
83 | } | 85 | } |
84 | 86 | ||
85 | /* Find a free owner ID */ | 87 | /* |
88 | * Find a free owner ID, cycle through all possible IDs on repeated | ||
89 | * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index may have | ||
90 | * to be scanned twice. | ||
91 | */ | ||
92 | for (i = 0, j = acpi_gbl_last_owner_id_index; | ||
93 | i < (ACPI_NUM_OWNERID_MASKS + 1); i++, j++) { | ||
94 | if (j >= ACPI_NUM_OWNERID_MASKS) { | ||
95 | j = 0; /* Wraparound to start of mask array */ | ||
96 | } | ||
97 | |||
98 | for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) { | ||
99 | if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) { | ||
100 | /* There are no free IDs in this mask */ | ||
101 | |||
102 | break; | ||
103 | } | ||
104 | |||
105 | if (!(acpi_gbl_owner_id_mask[j] & (1 << k))) { | ||
106 | /* | ||
107 | * Found a free ID. The actual ID is the bit index plus one, | ||
108 | * making zero an invalid Owner ID. Save this as the last ID | ||
109 | * allocated and update the global ID mask. | ||
110 | */ | ||
111 | acpi_gbl_owner_id_mask[j] |= (1 << k); | ||
112 | |||
113 | acpi_gbl_last_owner_id_index = (u8) j; | ||
114 | acpi_gbl_next_owner_id_offset = (u8) (k + 1); | ||
86 | 115 | ||
87 | for (i = 0; i < 64; i++) { | 116 | /* |
88 | if (!(acpi_gbl_owner_id_mask & (1ULL << i))) { | 117 | * Construct encoded ID from the index and bit position |
89 | ACPI_DEBUG_PRINT((ACPI_DB_VALUES, | 118 | * |
90 | "Current owner_id mask: %16.16LX New ID: %2.2X\n", | 119 | * Note: Last [j].k (bit 255) is never used and is marked |
91 | acpi_gbl_owner_id_mask, | 120 | * permanently allocated (prevents +1 overflow) |
92 | (unsigned int)(i + 1))); | 121 | */ |
122 | *owner_id = | ||
123 | (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j)); | ||
93 | 124 | ||
94 | acpi_gbl_owner_id_mask |= (1ULL << i); | 125 | ACPI_DEBUG_PRINT((ACPI_DB_VALUES, |
95 | *owner_id = (acpi_owner_id) (i + 1); | 126 | "Allocated owner_id: %2.2X\n", |
96 | goto exit; | 127 | (unsigned int)*owner_id)); |
128 | goto exit; | ||
129 | } | ||
97 | } | 130 | } |
131 | |||
132 | acpi_gbl_next_owner_id_offset = 0; | ||
98 | } | 133 | } |
99 | 134 | ||
100 | /* | 135 | /* |
101 | * If we are here, all owner_ids have been allocated. This probably should | 136 | * All owner_ids have been allocated. This typically should |
102 | * not happen since the IDs are reused after deallocation. The IDs are | 137 | * not happen since the IDs are reused after deallocation. The IDs are |
103 | * allocated upon table load (one per table) and method execution, and | 138 | * allocated upon table load (one per table) and method execution, and |
104 | * they are released when a table is unloaded or a method completes | 139 | * they are released when a table is unloaded or a method completes |
105 | * execution. | 140 | * execution. |
141 | * | ||
142 | * If this error happens, there may be very deep nesting of invoked control | ||
143 | * methods, or there may be a bug where the IDs are not released. | ||
106 | */ | 144 | */ |
107 | *owner_id = 0; | ||
108 | status = AE_OWNER_ID_LIMIT; | 145 | status = AE_OWNER_ID_LIMIT; |
109 | ACPI_REPORT_ERROR(("Could not allocate new owner_id (64 max), AE_OWNER_ID_LIMIT\n")); | 146 | ACPI_REPORT_ERROR(("Could not allocate new owner_id (255 max), AE_OWNER_ID_LIMIT\n")); |
110 | 147 | ||
111 | exit: | 148 | exit: |
112 | (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); | 149 | (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); |
@@ -123,7 +160,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
123 | * control method or unloading a table. Either way, we would | 160 | * control method or unloading a table. Either way, we would |
124 | * ignore any error anyway. | 161 | * ignore any error anyway. |
125 | * | 162 | * |
126 | * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 64 | 163 | * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255 |
127 | * | 164 | * |
128 | ******************************************************************************/ | 165 | ******************************************************************************/ |
129 | 166 | ||
@@ -131,6 +168,8 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) | |||
131 | { | 168 | { |
132 | acpi_owner_id owner_id = *owner_id_ptr; | 169 | acpi_owner_id owner_id = *owner_id_ptr; |
133 | acpi_status status; | 170 | acpi_status status; |
171 | acpi_native_uint index; | ||
172 | u32 bit; | ||
134 | 173 | ||
135 | ACPI_FUNCTION_TRACE_U32("ut_release_owner_id", owner_id); | 174 | ACPI_FUNCTION_TRACE_U32("ut_release_owner_id", owner_id); |
136 | 175 | ||
@@ -140,7 +179,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) | |||
140 | 179 | ||
141 | /* Zero is not a valid owner_iD */ | 180 | /* Zero is not a valid owner_iD */ |
142 | 181 | ||
143 | if ((owner_id == 0) || (owner_id > 64)) { | 182 | if (owner_id == 0) { |
144 | ACPI_REPORT_ERROR(("Invalid owner_id: %2.2X\n", owner_id)); | 183 | ACPI_REPORT_ERROR(("Invalid owner_id: %2.2X\n", owner_id)); |
145 | return_VOID; | 184 | return_VOID; |
146 | } | 185 | } |
@@ -156,10 +195,18 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) | |||
156 | 195 | ||
157 | owner_id--; | 196 | owner_id--; |
158 | 197 | ||
198 | /* Decode ID to index/offset pair */ | ||
199 | |||
200 | index = ACPI_DIV_32(owner_id); | ||
201 | bit = 1 << ACPI_MOD_32(owner_id); | ||
202 | |||
159 | /* Free the owner ID only if it is valid */ | 203 | /* Free the owner ID only if it is valid */ |
160 | 204 | ||
161 | if (acpi_gbl_owner_id_mask & (1ULL << owner_id)) { | 205 | if (acpi_gbl_owner_id_mask[index] & bit) { |
162 | acpi_gbl_owner_id_mask ^= (1ULL << owner_id); | 206 | acpi_gbl_owner_id_mask[index] ^= bit; |
207 | } else { | ||
208 | ACPI_REPORT_ERROR(("Release of non-allocated owner_id: %2.2X\n", | ||
209 | owner_id + 1)); | ||
163 | } | 210 | } |
164 | 211 | ||
165 | (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); | 212 | (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); |
@@ -790,54 +837,6 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) | |||
790 | 837 | ||
791 | /******************************************************************************* | 838 | /******************************************************************************* |
792 | * | 839 | * |
793 | * FUNCTION: acpi_ut_get_resource_end_tag | ||
794 | * | ||
795 | * PARAMETERS: obj_desc - The resource template buffer object | ||
796 | * | ||
797 | * RETURN: Pointer to the end tag | ||
798 | * | ||
799 | * DESCRIPTION: Find the END_TAG resource descriptor in a resource template | ||
800 | * | ||
801 | ******************************************************************************/ | ||
802 | |||
803 | u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc) | ||
804 | { | ||
805 | u8 buffer_byte; | ||
806 | u8 *buffer; | ||
807 | u8 *end_buffer; | ||
808 | |||
809 | buffer = obj_desc->buffer.pointer; | ||
810 | end_buffer = buffer + obj_desc->buffer.length; | ||
811 | |||
812 | while (buffer < end_buffer) { | ||
813 | buffer_byte = *buffer; | ||
814 | if (buffer_byte & ACPI_RDESC_TYPE_MASK) { | ||
815 | /* Large Descriptor - Length is next 2 bytes */ | ||
816 | |||
817 | buffer += ((*(buffer + 1) | (*(buffer + 2) << 8)) + 3); | ||
818 | } else { | ||
819 | /* Small Descriptor. End Tag will be found here */ | ||
820 | |||
821 | if ((buffer_byte & ACPI_RDESC_SMALL_MASK) == | ||
822 | ACPI_RDESC_TYPE_END_TAG) { | ||
823 | /* Found the end tag descriptor, all done. */ | ||
824 | |||
825 | return (buffer); | ||
826 | } | ||
827 | |||
828 | /* Length is in the header */ | ||
829 | |||
830 | buffer += ((buffer_byte & 0x07) + 1); | ||
831 | } | ||
832 | } | ||
833 | |||
834 | /* End tag not found */ | ||
835 | |||
836 | return (NULL); | ||
837 | } | ||
838 | |||
839 | /******************************************************************************* | ||
840 | * | ||
841 | * FUNCTION: acpi_ut_report_error | 840 | * FUNCTION: acpi_ut_report_error |
842 | * | 841 | * |
843 | * PARAMETERS: module_name - Caller's module name (for error output) | 842 | * PARAMETERS: module_name - Caller's module name (for error output) |
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c index 90134c56ece9..e158b1b6313b 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/utilities/utmutex.c | |||
@@ -214,7 +214,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
214 | * the ACPI subsystem code. | 214 | * the ACPI subsystem code. |
215 | */ | 215 | */ |
216 | for (i = mutex_id; i < MAX_MUTEX; i++) { | 216 | for (i = mutex_id; i < MAX_MUTEX; i++) { |
217 | if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { | 217 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { |
218 | if (i == mutex_id) { | 218 | if (i == mutex_id) { |
219 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 219 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
220 | "Mutex [%s] already acquired by this thread [%X]\n", | 220 | "Mutex [%s] already acquired by this thread [%X]\n", |
@@ -313,7 +313,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) | |||
313 | * the ACPI subsystem code. | 313 | * the ACPI subsystem code. |
314 | */ | 314 | */ |
315 | for (i = mutex_id; i < MAX_MUTEX; i++) { | 315 | for (i = mutex_id; i < MAX_MUTEX; i++) { |
316 | if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { | 316 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { |
317 | if (i == mutex_id) { | 317 | if (i == mutex_id) { |
318 | continue; | 318 | continue; |
319 | } | 319 | } |
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c new file mode 100644 index 000000000000..eaf0edec6efe --- /dev/null +++ b/drivers/acpi/utilities/utresrc.c | |||
@@ -0,0 +1,538 @@ | |||
1 | /******************************************************************************* | ||
2 | * | ||
3 | * Module Name: utresrc - Resource managment utilities | ||
4 | * | ||
5 | ******************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include <acpi/amlresrc.h> | ||
46 | |||
47 | #define _COMPONENT ACPI_UTILITIES | ||
48 | ACPI_MODULE_NAME("utmisc") | ||
49 | |||
50 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) | ||
51 | /* | ||
52 | * Strings used to decode resource descriptors. | ||
53 | * Used by both the disasssembler and the debugger resource dump routines | ||
54 | */ | ||
55 | const char *acpi_gbl_BMdecode[2] = { | ||
56 | "not_bus_master", | ||
57 | "bus_master" | ||
58 | }; | ||
59 | |||
60 | const char *acpi_gbl_config_decode[4] = { | ||
61 | "0 - Good Configuration", | ||
62 | "1 - Acceptable Configuration", | ||
63 | "2 - Suboptimal Configuration", | ||
64 | "3 - ***Invalid Configuration***", | ||
65 | }; | ||
66 | |||
67 | const char *acpi_gbl_consume_decode[2] = { | ||
68 | "resource_producer", | ||
69 | "resource_consumer" | ||
70 | }; | ||
71 | |||
72 | const char *acpi_gbl_DECdecode[2] = { | ||
73 | "pos_decode", | ||
74 | "sub_decode" | ||
75 | }; | ||
76 | |||
77 | const char *acpi_gbl_HEdecode[2] = { | ||
78 | "Level", | ||
79 | "Edge" | ||
80 | }; | ||
81 | |||
82 | const char *acpi_gbl_io_decode[2] = { | ||
83 | "Decode10", | ||
84 | "Decode16" | ||
85 | }; | ||
86 | |||
87 | const char *acpi_gbl_LLdecode[2] = { | ||
88 | "active_high", | ||
89 | "active_low" | ||
90 | }; | ||
91 | |||
92 | const char *acpi_gbl_max_decode[2] = { | ||
93 | "max_not_fixed", | ||
94 | "max_fixed" | ||
95 | }; | ||
96 | |||
97 | const char *acpi_gbl_MEMdecode[4] = { | ||
98 | "non_cacheable", | ||
99 | "Cacheable", | ||
100 | "write_combining", | ||
101 | "Prefetchable" | ||
102 | }; | ||
103 | |||
104 | const char *acpi_gbl_min_decode[2] = { | ||
105 | "min_not_fixed", | ||
106 | "min_fixed" | ||
107 | }; | ||
108 | |||
109 | const char *acpi_gbl_MTPdecode[4] = { | ||
110 | "address_range_memory", | ||
111 | "address_range_reserved", | ||
112 | "address_range_aCPI", | ||
113 | "address_range_nVS" | ||
114 | }; | ||
115 | |||
116 | const char *acpi_gbl_RNGdecode[4] = { | ||
117 | "invalid_ranges", | ||
118 | "non_iSAonly_ranges", | ||
119 | "ISAonly_ranges", | ||
120 | "entire_range" | ||
121 | }; | ||
122 | |||
123 | const char *acpi_gbl_RWdecode[2] = { | ||
124 | "read_only", | ||
125 | "read_write" | ||
126 | }; | ||
127 | |||
128 | const char *acpi_gbl_SHRdecode[2] = { | ||
129 | "Exclusive", | ||
130 | "Shared" | ||
131 | }; | ||
132 | |||
133 | const char *acpi_gbl_SIZdecode[4] = { | ||
134 | "Transfer8", | ||
135 | "Transfer8_16", | ||
136 | "Transfer16", | ||
137 | "invalid_size" | ||
138 | }; | ||
139 | |||
140 | const char *acpi_gbl_TRSdecode[2] = { | ||
141 | "dense_translation", | ||
142 | "sparse_translation" | ||
143 | }; | ||
144 | |||
145 | const char *acpi_gbl_TTPdecode[2] = { | ||
146 | "type_static", | ||
147 | "type_translation" | ||
148 | }; | ||
149 | |||
150 | const char *acpi_gbl_TYPdecode[4] = { | ||
151 | "Compatibility", | ||
152 | "type_a", | ||
153 | "type_b", | ||
154 | "type_f" | ||
155 | }; | ||
156 | |||
157 | #endif | ||
158 | |||
159 | /* | ||
160 | * Base sizes of the raw AML resource descriptors, indexed by resource type. | ||
161 | * Zero indicates a reserved (and therefore invalid) resource type. | ||
162 | */ | ||
163 | const u8 acpi_gbl_resource_aml_sizes[] = { | ||
164 | /* Small descriptors */ | ||
165 | |||
166 | 0, | ||
167 | 0, | ||
168 | 0, | ||
169 | 0, | ||
170 | ACPI_AML_SIZE_SMALL(struct aml_resource_irq), | ||
171 | ACPI_AML_SIZE_SMALL(struct aml_resource_dma), | ||
172 | ACPI_AML_SIZE_SMALL(struct aml_resource_start_dependent), | ||
173 | ACPI_AML_SIZE_SMALL(struct aml_resource_end_dependent), | ||
174 | ACPI_AML_SIZE_SMALL(struct aml_resource_io), | ||
175 | ACPI_AML_SIZE_SMALL(struct aml_resource_fixed_io), | ||
176 | 0, | ||
177 | 0, | ||
178 | 0, | ||
179 | 0, | ||
180 | ACPI_AML_SIZE_SMALL(struct aml_resource_vendor_small), | ||
181 | ACPI_AML_SIZE_SMALL(struct aml_resource_end_tag), | ||
182 | |||
183 | /* Large descriptors */ | ||
184 | |||
185 | 0, | ||
186 | ACPI_AML_SIZE_LARGE(struct aml_resource_memory24), | ||
187 | ACPI_AML_SIZE_LARGE(struct aml_resource_generic_register), | ||
188 | 0, | ||
189 | ACPI_AML_SIZE_LARGE(struct aml_resource_vendor_large), | ||
190 | ACPI_AML_SIZE_LARGE(struct aml_resource_memory32), | ||
191 | ACPI_AML_SIZE_LARGE(struct aml_resource_fixed_memory32), | ||
192 | ACPI_AML_SIZE_LARGE(struct aml_resource_address32), | ||
193 | ACPI_AML_SIZE_LARGE(struct aml_resource_address16), | ||
194 | ACPI_AML_SIZE_LARGE(struct aml_resource_extended_irq), | ||
195 | ACPI_AML_SIZE_LARGE(struct aml_resource_address64), | ||
196 | ACPI_AML_SIZE_LARGE(struct aml_resource_extended_address64) | ||
197 | }; | ||
198 | |||
199 | /* | ||
200 | * Resource types, used to validate the resource length field. | ||
201 | * The length of fixed-length types must match exactly, variable | ||
202 | * lengths must meet the minimum required length, etc. | ||
203 | * Zero indicates a reserved (and therefore invalid) resource type. | ||
204 | */ | ||
205 | static const u8 acpi_gbl_resource_types[] = { | ||
206 | /* Small descriptors */ | ||
207 | |||
208 | 0, | ||
209 | 0, | ||
210 | 0, | ||
211 | 0, | ||
212 | ACPI_SMALL_VARIABLE_LENGTH, | ||
213 | ACPI_FIXED_LENGTH, | ||
214 | ACPI_SMALL_VARIABLE_LENGTH, | ||
215 | ACPI_FIXED_LENGTH, | ||
216 | ACPI_FIXED_LENGTH, | ||
217 | ACPI_FIXED_LENGTH, | ||
218 | 0, | ||
219 | 0, | ||
220 | 0, | ||
221 | 0, | ||
222 | ACPI_VARIABLE_LENGTH, | ||
223 | ACPI_FIXED_LENGTH, | ||
224 | |||
225 | /* Large descriptors */ | ||
226 | |||
227 | 0, | ||
228 | ACPI_FIXED_LENGTH, | ||
229 | ACPI_FIXED_LENGTH, | ||
230 | 0, | ||
231 | ACPI_VARIABLE_LENGTH, | ||
232 | ACPI_FIXED_LENGTH, | ||
233 | ACPI_FIXED_LENGTH, | ||
234 | ACPI_VARIABLE_LENGTH, | ||
235 | ACPI_VARIABLE_LENGTH, | ||
236 | ACPI_VARIABLE_LENGTH, | ||
237 | ACPI_VARIABLE_LENGTH, | ||
238 | ACPI_FIXED_LENGTH | ||
239 | }; | ||
240 | |||
241 | /******************************************************************************* | ||
242 | * | ||
243 | * FUNCTION: acpi_ut_validate_resource | ||
244 | * | ||
245 | * PARAMETERS: Aml - Pointer to the raw AML resource descriptor | ||
246 | * return_index - Where the resource index is returned. NULL | ||
247 | * if the index is not required. | ||
248 | * | ||
249 | * RETURN: Status, and optionally the Index into the global resource tables | ||
250 | * | ||
251 | * DESCRIPTION: Validate an AML resource descriptor by checking the Resource | ||
252 | * Type and Resource Length. Returns an index into the global | ||
253 | * resource information/dispatch tables for later use. | ||
254 | * | ||
255 | ******************************************************************************/ | ||
256 | |||
257 | acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index) | ||
258 | { | ||
259 | u8 resource_type; | ||
260 | u8 resource_index; | ||
261 | acpi_rs_length resource_length; | ||
262 | acpi_rs_length minimum_resource_length; | ||
263 | |||
264 | ACPI_FUNCTION_ENTRY(); | ||
265 | |||
266 | /* | ||
267 | * 1) Validate the resource_type field (Byte 0) | ||
268 | */ | ||
269 | resource_type = ACPI_GET8(aml); | ||
270 | |||
271 | /* | ||
272 | * Byte 0 contains the descriptor name (Resource Type) | ||
273 | * Examine the large/small bit in the resource header | ||
274 | */ | ||
275 | if (resource_type & ACPI_RESOURCE_NAME_LARGE) { | ||
276 | /* Verify the large resource type (name) against the max */ | ||
277 | |||
278 | if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { | ||
279 | return (AE_AML_INVALID_RESOURCE_TYPE); | ||
280 | } | ||
281 | |||
282 | /* | ||
283 | * Large Resource Type -- bits 6:0 contain the name | ||
284 | * Translate range 0x80-0x8B to index range 0x10-0x1B | ||
285 | */ | ||
286 | resource_index = (u8) (resource_type - 0x70); | ||
287 | } else { | ||
288 | /* | ||
289 | * Small Resource Type -- bits 6:3 contain the name | ||
290 | * Shift range to index range 0x00-0x0F | ||
291 | */ | ||
292 | resource_index = (u8) | ||
293 | ((resource_type & ACPI_RESOURCE_NAME_SMALL_MASK) >> 3); | ||
294 | } | ||
295 | |||
296 | /* Check validity of the resource type, zero indicates name is invalid */ | ||
297 | |||
298 | if (!acpi_gbl_resource_types[resource_index]) { | ||
299 | return (AE_AML_INVALID_RESOURCE_TYPE); | ||
300 | } | ||
301 | |||
302 | /* | ||
303 | * 2) Validate the resource_length field. This ensures that the length | ||
304 | * is at least reasonable, and guarantees that it is non-zero. | ||
305 | */ | ||
306 | resource_length = acpi_ut_get_resource_length(aml); | ||
307 | minimum_resource_length = acpi_gbl_resource_aml_sizes[resource_index]; | ||
308 | |||
309 | /* Validate based upon the type of resource - fixed length or variable */ | ||
310 | |||
311 | switch (acpi_gbl_resource_types[resource_index]) { | ||
312 | case ACPI_FIXED_LENGTH: | ||
313 | |||
314 | /* Fixed length resource, length must match exactly */ | ||
315 | |||
316 | if (resource_length != minimum_resource_length) { | ||
317 | return (AE_AML_BAD_RESOURCE_LENGTH); | ||
318 | } | ||
319 | break; | ||
320 | |||
321 | case ACPI_VARIABLE_LENGTH: | ||
322 | |||
323 | /* Variable length resource, length must be at least the minimum */ | ||
324 | |||
325 | if (resource_length < minimum_resource_length) { | ||
326 | return (AE_AML_BAD_RESOURCE_LENGTH); | ||
327 | } | ||
328 | break; | ||
329 | |||
330 | case ACPI_SMALL_VARIABLE_LENGTH: | ||
331 | |||
332 | /* Small variable length resource, length can be (Min) or (Min-1) */ | ||
333 | |||
334 | if ((resource_length > minimum_resource_length) || | ||
335 | (resource_length < (minimum_resource_length - 1))) { | ||
336 | return (AE_AML_BAD_RESOURCE_LENGTH); | ||
337 | } | ||
338 | break; | ||
339 | |||
340 | default: | ||
341 | |||
342 | /* Shouldn't happen (because of validation earlier), but be sure */ | ||
343 | |||
344 | return (AE_AML_INVALID_RESOURCE_TYPE); | ||
345 | } | ||
346 | |||
347 | /* Optionally return the resource table index */ | ||
348 | |||
349 | if (return_index) { | ||
350 | *return_index = resource_index; | ||
351 | } | ||
352 | |||
353 | return (AE_OK); | ||
354 | } | ||
355 | |||
356 | /******************************************************************************* | ||
357 | * | ||
358 | * FUNCTION: acpi_ut_get_resource_type | ||
359 | * | ||
360 | * PARAMETERS: Aml - Pointer to the raw AML resource descriptor | ||
361 | * | ||
362 | * RETURN: The Resource Type with no extraneous bits (except the | ||
363 | * Large/Small descriptor bit -- this is left alone) | ||
364 | * | ||
365 | * DESCRIPTION: Extract the Resource Type/Name from the first byte of | ||
366 | * a resource descriptor. | ||
367 | * | ||
368 | ******************************************************************************/ | ||
369 | |||
370 | u8 acpi_ut_get_resource_type(void *aml) | ||
371 | { | ||
372 | ACPI_FUNCTION_ENTRY(); | ||
373 | |||
374 | /* | ||
375 | * Byte 0 contains the descriptor name (Resource Type) | ||
376 | * Examine the large/small bit in the resource header | ||
377 | */ | ||
378 | if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { | ||
379 | /* Large Resource Type -- bits 6:0 contain the name */ | ||
380 | |||
381 | return (ACPI_GET8(aml)); | ||
382 | } else { | ||
383 | /* Small Resource Type -- bits 6:3 contain the name */ | ||
384 | |||
385 | return ((u8) (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_SMALL_MASK)); | ||
386 | } | ||
387 | } | ||
388 | |||
389 | /******************************************************************************* | ||
390 | * | ||
391 | * FUNCTION: acpi_ut_get_resource_length | ||
392 | * | ||
393 | * PARAMETERS: Aml - Pointer to the raw AML resource descriptor | ||
394 | * | ||
395 | * RETURN: Byte Length | ||
396 | * | ||
397 | * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By | ||
398 | * definition, this does not include the size of the descriptor | ||
399 | * header or the length field itself. | ||
400 | * | ||
401 | ******************************************************************************/ | ||
402 | |||
403 | u16 acpi_ut_get_resource_length(void *aml) | ||
404 | { | ||
405 | acpi_rs_length resource_length; | ||
406 | |||
407 | ACPI_FUNCTION_ENTRY(); | ||
408 | |||
409 | /* | ||
410 | * Byte 0 contains the descriptor name (Resource Type) | ||
411 | * Examine the large/small bit in the resource header | ||
412 | */ | ||
413 | if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { | ||
414 | /* Large Resource type -- bytes 1-2 contain the 16-bit length */ | ||
415 | |||
416 | ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1)); | ||
417 | |||
418 | } else { | ||
419 | /* Small Resource type -- bits 2:0 of byte 0 contain the length */ | ||
420 | |||
421 | resource_length = (u16) (ACPI_GET8(aml) & | ||
422 | ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); | ||
423 | } | ||
424 | |||
425 | return (resource_length); | ||
426 | } | ||
427 | |||
428 | /******************************************************************************* | ||
429 | * | ||
430 | * FUNCTION: acpi_ut_get_resource_header_length | ||
431 | * | ||
432 | * PARAMETERS: Aml - Pointer to the raw AML resource descriptor | ||
433 | * | ||
434 | * RETURN: Length of the AML header (depends on large/small descriptor) | ||
435 | * | ||
436 | * DESCRIPTION: Get the length of the header for this resource. | ||
437 | * | ||
438 | ******************************************************************************/ | ||
439 | |||
440 | u8 acpi_ut_get_resource_header_length(void *aml) | ||
441 | { | ||
442 | ACPI_FUNCTION_ENTRY(); | ||
443 | |||
444 | /* Examine the large/small bit in the resource header */ | ||
445 | |||
446 | if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { | ||
447 | return (sizeof(struct aml_resource_large_header)); | ||
448 | } else { | ||
449 | return (sizeof(struct aml_resource_small_header)); | ||
450 | } | ||
451 | } | ||
452 | |||
453 | /******************************************************************************* | ||
454 | * | ||
455 | * FUNCTION: acpi_ut_get_descriptor_length | ||
456 | * | ||
457 | * PARAMETERS: Aml - Pointer to the raw AML resource descriptor | ||
458 | * | ||
459 | * RETURN: Byte length | ||
460 | * | ||
461 | * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the | ||
462 | * length of the descriptor header and the length field itself. | ||
463 | * Used to walk descriptor lists. | ||
464 | * | ||
465 | ******************************************************************************/ | ||
466 | |||
467 | u32 acpi_ut_get_descriptor_length(void *aml) | ||
468 | { | ||
469 | ACPI_FUNCTION_ENTRY(); | ||
470 | |||
471 | /* | ||
472 | * Get the Resource Length (does not include header length) and add | ||
473 | * the header length (depends on if this is a small or large resource) | ||
474 | */ | ||
475 | return (acpi_ut_get_resource_length(aml) + | ||
476 | acpi_ut_get_resource_header_length(aml)); | ||
477 | } | ||
478 | |||
479 | /******************************************************************************* | ||
480 | * | ||
481 | * FUNCTION: acpi_ut_get_resource_end_tag | ||
482 | * | ||
483 | * PARAMETERS: obj_desc - The resource template buffer object | ||
484 | * end_tag - Where the pointer to the end_tag is returned | ||
485 | * | ||
486 | * RETURN: Status, pointer to the end tag | ||
487 | * | ||
488 | * DESCRIPTION: Find the end_tag resource descriptor in an AML resource template | ||
489 | * | ||
490 | ******************************************************************************/ | ||
491 | |||
492 | acpi_status | ||
493 | acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc, | ||
494 | u8 ** end_tag) | ||
495 | { | ||
496 | acpi_status status; | ||
497 | u8 *aml; | ||
498 | u8 *end_aml; | ||
499 | |||
500 | ACPI_FUNCTION_TRACE("ut_get_resource_end_tag"); | ||
501 | |||
502 | /* Get start and end pointers */ | ||
503 | |||
504 | aml = obj_desc->buffer.pointer; | ||
505 | end_aml = aml + obj_desc->buffer.length; | ||
506 | |||
507 | /* Walk the resource template, one descriptor per iteration */ | ||
508 | |||
509 | while (aml < end_aml) { | ||
510 | /* Validate the Resource Type and Resource Length */ | ||
511 | |||
512 | status = acpi_ut_validate_resource(aml, NULL); | ||
513 | if (ACPI_FAILURE(status)) { | ||
514 | return_ACPI_STATUS(status); | ||
515 | } | ||
516 | |||
517 | /* end_tag resource indicates the end of the resource template */ | ||
518 | |||
519 | if (acpi_ut_get_resource_type(aml) == | ||
520 | ACPI_RESOURCE_NAME_END_TAG) { | ||
521 | /* Return the pointer to the end_tag */ | ||
522 | |||
523 | *end_tag = aml; | ||
524 | return_ACPI_STATUS(AE_OK); | ||
525 | } | ||
526 | |||
527 | /* | ||
528 | * Point to the next resource descriptor in the AML buffer. The | ||
529 | * descriptor length is guaranteed to be non-zero by resource | ||
530 | * validation above. | ||
531 | */ | ||
532 | aml += acpi_ut_get_descriptor_length(aml); | ||
533 | } | ||
534 | |||
535 | /* Did not find an end_tag resource descriptor */ | ||
536 | |||
537 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | ||
538 | } | ||
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c index c1cb27583be8..6ff1d7073349 100644 --- a/drivers/acpi/utilities/utstate.c +++ b/drivers/acpi/utilities/utstate.c | |||
@@ -63,7 +63,7 @@ acpi_status | |||
63 | acpi_ut_create_pkg_state_and_push(void *internal_object, | 63 | acpi_ut_create_pkg_state_and_push(void *internal_object, |
64 | void *external_object, | 64 | void *external_object, |
65 | u16 index, | 65 | u16 index, |
66 | union acpi_generic_state ** state_list) | 66 | union acpi_generic_state **state_list) |
67 | { | 67 | { |
68 | union acpi_generic_state *state; | 68 | union acpi_generic_state *state; |
69 | 69 | ||
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index f06bd5e5e9d1..57adc5bc02f3 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c | |||
@@ -178,10 +178,14 @@ acpi_status acpi_enable_subsystem(u32 flags) | |||
178 | /* | 178 | /* |
179 | * Initialize ACPI Event handling (Fixed and General Purpose) | 179 | * Initialize ACPI Event handling (Fixed and General Purpose) |
180 | * | 180 | * |
181 | * NOTE: We must have the hardware AND events initialized before we can | 181 | * Note1: We must have the hardware and events initialized before we can |
182 | * execute ANY control methods SAFELY. Any control method can require | 182 | * execute any control methods safely. Any control method can require |
183 | * ACPI hardware support, so the hardware MUST be initialized before | 183 | * ACPI hardware support, so the hardware must be fully initialized before |
184 | * execution! | 184 | * any method execution! |
185 | * | ||
186 | * Note2: Fixed events are initialized and enabled here. GPEs are | ||
187 | * initialized, but cannot be enabled until after the hardware is | ||
188 | * completely initialized (SCI and global_lock activated) | ||
185 | */ | 189 | */ |
186 | if (!(flags & ACPI_NO_EVENT_INIT)) { | 190 | if (!(flags & ACPI_NO_EVENT_INIT)) { |
187 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 191 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
@@ -193,8 +197,10 @@ acpi_status acpi_enable_subsystem(u32 flags) | |||
193 | } | 197 | } |
194 | } | 198 | } |
195 | 199 | ||
196 | /* Install the SCI handler and Global Lock handler */ | 200 | /* |
197 | 201 | * Install the SCI handler and Global Lock handler. This completes the | |
202 | * hardware initialization. | ||
203 | */ | ||
198 | if (!(flags & ACPI_NO_HANDLER_INIT)) { | 204 | if (!(flags & ACPI_NO_HANDLER_INIT)) { |
199 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 205 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
200 | "[Init] Installing SCI/GL handlers\n")); | 206 | "[Init] Installing SCI/GL handlers\n")); |
@@ -205,6 +211,24 @@ acpi_status acpi_enable_subsystem(u32 flags) | |||
205 | } | 211 | } |
206 | } | 212 | } |
207 | 213 | ||
214 | /* | ||
215 | * Complete the GPE initialization for the GPE blocks defined in the FADT | ||
216 | * (GPE block 0 and 1). | ||
217 | * | ||
218 | * Note1: This is where the _PRW methods are executed for the GPEs. These | ||
219 | * methods can only be executed after the SCI and Global Lock handlers are | ||
220 | * installed and initialized. | ||
221 | * | ||
222 | * Note2: Currently, there seems to be no need to run the _REG methods | ||
223 | * before execution of the _PRW methods and enabling of the GPEs. | ||
224 | */ | ||
225 | if (!(flags & ACPI_NO_EVENT_INIT)) { | ||
226 | status = acpi_ev_install_fadt_gpes(); | ||
227 | if (ACPI_FAILURE(status)) { | ||
228 | return (status); | ||
229 | } | ||
230 | } | ||
231 | |||
208 | return_ACPI_STATUS(status); | 232 | return_ACPI_STATUS(status); |
209 | } | 233 | } |
210 | 234 | ||
@@ -230,9 +254,9 @@ acpi_status acpi_initialize_objects(u32 flags) | |||
230 | /* | 254 | /* |
231 | * Run all _REG methods | 255 | * Run all _REG methods |
232 | * | 256 | * |
233 | * NOTE: Any objects accessed | 257 | * Note: Any objects accessed by the _REG methods will be automatically |
234 | * by the _REG methods will be automatically initialized, even if they | 258 | * initialized, even if they contain executable AML (see the call to |
235 | * contain executable AML (see call to acpi_ns_initialize_objects below). | 259 | * acpi_ns_initialize_objects below). |
236 | */ | 260 | */ |
237 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | 261 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { |
238 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 262 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
@@ -245,9 +269,9 @@ acpi_status acpi_initialize_objects(u32 flags) | |||
245 | } | 269 | } |
246 | 270 | ||
247 | /* | 271 | /* |
248 | * Initialize the objects that remain uninitialized. This | 272 | * Initialize the objects that remain uninitialized. This runs the |
249 | * runs the executable AML that may be part of the declaration of these | 273 | * executable AML that may be part of the declaration of these objects: |
250 | * objects: operation_regions, buffer_fields, Buffers, and Packages. | 274 | * operation_regions, buffer_fields, Buffers, and Packages. |
251 | */ | 275 | */ |
252 | if (!(flags & ACPI_NO_OBJECT_INIT)) { | 276 | if (!(flags & ACPI_NO_OBJECT_INIT)) { |
253 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 277 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
@@ -260,8 +284,8 @@ acpi_status acpi_initialize_objects(u32 flags) | |||
260 | } | 284 | } |
261 | 285 | ||
262 | /* | 286 | /* |
263 | * Initialize all device objects in the namespace | 287 | * Initialize all device objects in the namespace. This runs the device |
264 | * This runs the _STA and _INI methods. | 288 | * _STA and _INI methods. |
265 | */ | 289 | */ |
266 | if (!(flags & ACPI_NO_DEVICE_INIT)) { | 290 | if (!(flags & ACPI_NO_DEVICE_INIT)) { |
267 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 291 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 3808d9572619..66a2fee06eb9 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -927,9 +927,9 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) | |||
927 | if (ACPI_SUCCESS(status)) { | 927 | if (ACPI_SUCCESS(status)) { |
928 | unsigned long size; | 928 | unsigned long size; |
929 | 929 | ||
930 | size = addr.max_address_range - addr.min_address_range + 1; | 930 | size = addr.maximum - addr.minimum + 1; |
931 | hdp->hd_phys_address = addr.min_address_range; | 931 | hdp->hd_phys_address = addr.minimum; |
932 | hdp->hd_address = ioremap(addr.min_address_range, size); | 932 | hdp->hd_address = ioremap(addr.minimum, size); |
933 | 933 | ||
934 | if (hpet_is_known(hdp)) { | 934 | if (hpet_is_known(hdp)) { |
935 | printk(KERN_DEBUG "%s: 0x%lx is busy\n", | 935 | printk(KERN_DEBUG "%s: 0x%lx is busy\n", |
@@ -937,15 +937,15 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) | |||
937 | iounmap(hdp->hd_address); | 937 | iounmap(hdp->hd_address); |
938 | return -EBUSY; | 938 | return -EBUSY; |
939 | } | 939 | } |
940 | } else if (res->id == ACPI_RSTYPE_FIXED_MEM32) { | 940 | } else if (res->type == ACPI_RESOURCE_TYPE_FIXED_MEMORY32) { |
941 | struct acpi_resource_fixed_mem32 *fixmem32; | 941 | struct acpi_resource_fixed_memory32 *fixmem32; |
942 | 942 | ||
943 | fixmem32 = &res->data.fixed_memory32; | 943 | fixmem32 = &res->data.fixed_memory32; |
944 | if (!fixmem32) | 944 | if (!fixmem32) |
945 | return -EINVAL; | 945 | return -EINVAL; |
946 | 946 | ||
947 | hdp->hd_phys_address = fixmem32->range_base_address; | 947 | hdp->hd_phys_address = fixmem32->address; |
948 | hdp->hd_address = ioremap(fixmem32->range_base_address, | 948 | hdp->hd_address = ioremap(fixmem32->address, |
949 | HPET_RANGE_SIZE); | 949 | HPET_RANGE_SIZE); |
950 | 950 | ||
951 | if (hpet_is_known(hdp)) { | 951 | if (hpet_is_known(hdp)) { |
@@ -954,20 +954,20 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) | |||
954 | iounmap(hdp->hd_address); | 954 | iounmap(hdp->hd_address); |
955 | return -EBUSY; | 955 | return -EBUSY; |
956 | } | 956 | } |
957 | } else if (res->id == ACPI_RSTYPE_EXT_IRQ) { | 957 | } else if (res->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) { |
958 | struct acpi_resource_ext_irq *irqp; | 958 | struct acpi_resource_extended_irq *irqp; |
959 | int i; | 959 | int i; |
960 | 960 | ||
961 | irqp = &res->data.extended_irq; | 961 | irqp = &res->data.extended_irq; |
962 | 962 | ||
963 | if (irqp->number_of_interrupts > 0) { | 963 | if (irqp->interrupt_count > 0) { |
964 | hdp->hd_nirqs = irqp->number_of_interrupts; | 964 | hdp->hd_nirqs = irqp->interrupt_count; |
965 | 965 | ||
966 | for (i = 0; i < hdp->hd_nirqs; i++) { | 966 | for (i = 0; i < hdp->hd_nirqs; i++) { |
967 | int rc = | 967 | int rc = |
968 | acpi_register_gsi(irqp->interrupts[i], | 968 | acpi_register_gsi(irqp->interrupts[i], |
969 | irqp->edge_level, | 969 | irqp->triggering, |
970 | irqp->active_high_low); | 970 | irqp->polarity); |
971 | if (rc < 0) | 971 | if (rc < 0) |
972 | return AE_ERROR; | 972 | return AE_ERROR; |
973 | hdp->hd_irq[i] = rc; | 973 | hdp->hd_irq[i] = rc; |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 2424bd3620dc..c6db14d30ed6 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (c) 2004 Matthieu Castet <castet.matthieu@free.fr> | 4 | * Copyright (c) 2004 Matthieu Castet <castet.matthieu@free.fr> |
5 | * Copyright (c) 2004 Li Shaohua <shaohua.li@intel.com> | 5 | * Copyright (c) 2004 Li Shaohua <shaohua.li@intel.com> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
8 | * under the terms of the GNU General Public License as published by the | 8 | * under the terms of the GNU General Public License as published by the |
9 | * Free Software Foundation; either version 2, or (at your option) any | 9 | * Free Software Foundation; either version 2, or (at your option) any |
@@ -32,17 +32,17 @@ | |||
32 | /* | 32 | /* |
33 | * Allocated Resources | 33 | * Allocated Resources |
34 | */ | 34 | */ |
35 | static int irq_flags(int edge_level, int active_high_low) | 35 | static int irq_flags(int triggering, int polarity) |
36 | { | 36 | { |
37 | int flag; | 37 | int flag; |
38 | if (edge_level == ACPI_LEVEL_SENSITIVE) { | 38 | if (triggering == ACPI_LEVEL_SENSITIVE) { |
39 | if(active_high_low == ACPI_ACTIVE_LOW) | 39 | if(polarity == ACPI_ACTIVE_LOW) |
40 | flag = IORESOURCE_IRQ_LOWLEVEL; | 40 | flag = IORESOURCE_IRQ_LOWLEVEL; |
41 | else | 41 | else |
42 | flag = IORESOURCE_IRQ_HIGHLEVEL; | 42 | flag = IORESOURCE_IRQ_HIGHLEVEL; |
43 | } | 43 | } |
44 | else { | 44 | else { |
45 | if(active_high_low == ACPI_ACTIVE_LOW) | 45 | if(polarity == ACPI_ACTIVE_LOW) |
46 | flag = IORESOURCE_IRQ_LOWEDGE; | 46 | flag = IORESOURCE_IRQ_LOWEDGE; |
47 | else | 47 | else |
48 | flag = IORESOURCE_IRQ_HIGHEDGE; | 48 | flag = IORESOURCE_IRQ_HIGHEDGE; |
@@ -50,31 +50,31 @@ static int irq_flags(int edge_level, int active_high_low) | |||
50 | return flag; | 50 | return flag; |
51 | } | 51 | } |
52 | 52 | ||
53 | static void decode_irq_flags(int flag, int *edge_level, int *active_high_low) | 53 | static void decode_irq_flags(int flag, int *triggering, int *polarity) |
54 | { | 54 | { |
55 | switch (flag) { | 55 | switch (flag) { |
56 | case IORESOURCE_IRQ_LOWLEVEL: | 56 | case IORESOURCE_IRQ_LOWLEVEL: |
57 | *edge_level = ACPI_LEVEL_SENSITIVE; | 57 | *triggering = ACPI_LEVEL_SENSITIVE; |
58 | *active_high_low = ACPI_ACTIVE_LOW; | 58 | *polarity = ACPI_ACTIVE_LOW; |
59 | break; | 59 | break; |
60 | case IORESOURCE_IRQ_HIGHLEVEL: | 60 | case IORESOURCE_IRQ_HIGHLEVEL: |
61 | *edge_level = ACPI_LEVEL_SENSITIVE; | 61 | *triggering = ACPI_LEVEL_SENSITIVE; |
62 | *active_high_low = ACPI_ACTIVE_HIGH; | 62 | *polarity = ACPI_ACTIVE_HIGH; |
63 | break; | 63 | break; |
64 | case IORESOURCE_IRQ_LOWEDGE: | 64 | case IORESOURCE_IRQ_LOWEDGE: |
65 | *edge_level = ACPI_EDGE_SENSITIVE; | 65 | *triggering = ACPI_EDGE_SENSITIVE; |
66 | *active_high_low = ACPI_ACTIVE_LOW; | 66 | *polarity = ACPI_ACTIVE_LOW; |
67 | break; | 67 | break; |
68 | case IORESOURCE_IRQ_HIGHEDGE: | 68 | case IORESOURCE_IRQ_HIGHEDGE: |
69 | *edge_level = ACPI_EDGE_SENSITIVE; | 69 | *triggering = ACPI_EDGE_SENSITIVE; |
70 | *active_high_low = ACPI_ACTIVE_HIGH; | 70 | *polarity = ACPI_ACTIVE_HIGH; |
71 | break; | 71 | break; |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | static void | 75 | static void |
76 | pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, | 76 | pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, |
77 | int edge_level, int active_high_low) | 77 | int triggering, int polarity) |
78 | { | 78 | { |
79 | int i = 0; | 79 | int i = 0; |
80 | int irq; | 80 | int irq; |
@@ -89,7 +89,7 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, | |||
89 | return; | 89 | return; |
90 | 90 | ||
91 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag | 91 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag |
92 | irq = acpi_register_gsi(gsi, edge_level, active_high_low); | 92 | irq = acpi_register_gsi(gsi, triggering, polarity); |
93 | if (irq < 0) { | 93 | if (irq < 0) { |
94 | res->irq_resource[i].flags |= IORESOURCE_DISABLED; | 94 | res->irq_resource[i].flags |= IORESOURCE_DISABLED; |
95 | return; | 95 | return; |
@@ -163,77 +163,77 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
163 | struct pnp_resource_table * res_table = (struct pnp_resource_table *)data; | 163 | struct pnp_resource_table * res_table = (struct pnp_resource_table *)data; |
164 | int i; | 164 | int i; |
165 | 165 | ||
166 | switch (res->id) { | 166 | switch (res->type) { |
167 | case ACPI_RSTYPE_IRQ: | 167 | case ACPI_RESOURCE_TYPE_IRQ: |
168 | /* | 168 | /* |
169 | * Per spec, only one interrupt per descriptor is allowed in | 169 | * Per spec, only one interrupt per descriptor is allowed in |
170 | * _CRS, but some firmware violates this, so parse them all. | 170 | * _CRS, but some firmware violates this, so parse them all. |
171 | */ | 171 | */ |
172 | for (i = 0; i < res->data.irq.number_of_interrupts; i++) { | 172 | for (i = 0; i < res->data.irq.interrupt_count; i++) { |
173 | pnpacpi_parse_allocated_irqresource(res_table, | 173 | pnpacpi_parse_allocated_irqresource(res_table, |
174 | res->data.irq.interrupts[i], | 174 | res->data.irq.interrupts[i], |
175 | res->data.irq.edge_level, | 175 | res->data.irq.triggering, |
176 | res->data.irq.active_high_low); | 176 | res->data.irq.polarity); |
177 | } | 177 | } |
178 | break; | 178 | break; |
179 | 179 | ||
180 | case ACPI_RSTYPE_EXT_IRQ: | 180 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
181 | for (i = 0; i < res->data.extended_irq.number_of_interrupts; i++) { | 181 | for (i = 0; i < res->data.extended_irq.interrupt_count; i++) { |
182 | pnpacpi_parse_allocated_irqresource(res_table, | 182 | pnpacpi_parse_allocated_irqresource(res_table, |
183 | res->data.extended_irq.interrupts[i], | 183 | res->data.extended_irq.interrupts[i], |
184 | res->data.extended_irq.edge_level, | 184 | res->data.extended_irq.triggering, |
185 | res->data.extended_irq.active_high_low); | 185 | res->data.extended_irq.polarity); |
186 | } | 186 | } |
187 | break; | 187 | break; |
188 | case ACPI_RSTYPE_DMA: | 188 | case ACPI_RESOURCE_TYPE_DMA: |
189 | if (res->data.dma.number_of_channels > 0) | 189 | if (res->data.dma.channel_count > 0) |
190 | pnpacpi_parse_allocated_dmaresource(res_table, | 190 | pnpacpi_parse_allocated_dmaresource(res_table, |
191 | res->data.dma.channels[0]); | 191 | res->data.dma.channels[0]); |
192 | break; | 192 | break; |
193 | case ACPI_RSTYPE_IO: | 193 | case ACPI_RESOURCE_TYPE_IO: |
194 | pnpacpi_parse_allocated_ioresource(res_table, | 194 | pnpacpi_parse_allocated_ioresource(res_table, |
195 | res->data.io.min_base_address, | 195 | res->data.io.minimum, |
196 | res->data.io.range_length); | 196 | res->data.io.address_length); |
197 | break; | 197 | break; |
198 | case ACPI_RSTYPE_FIXED_IO: | 198 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
199 | pnpacpi_parse_allocated_ioresource(res_table, | 199 | pnpacpi_parse_allocated_ioresource(res_table, |
200 | res->data.fixed_io.base_address, | 200 | res->data.fixed_io.address, |
201 | res->data.fixed_io.range_length); | 201 | res->data.fixed_io.address_length); |
202 | break; | 202 | break; |
203 | case ACPI_RSTYPE_MEM24: | 203 | case ACPI_RESOURCE_TYPE_MEMORY24: |
204 | pnpacpi_parse_allocated_memresource(res_table, | 204 | pnpacpi_parse_allocated_memresource(res_table, |
205 | res->data.memory24.min_base_address, | 205 | res->data.memory24.minimum, |
206 | res->data.memory24.range_length); | 206 | res->data.memory24.address_length); |
207 | break; | 207 | break; |
208 | case ACPI_RSTYPE_MEM32: | 208 | case ACPI_RESOURCE_TYPE_MEMORY32: |
209 | pnpacpi_parse_allocated_memresource(res_table, | 209 | pnpacpi_parse_allocated_memresource(res_table, |
210 | res->data.memory32.min_base_address, | 210 | res->data.memory32.minimum, |
211 | res->data.memory32.range_length); | 211 | res->data.memory32.address_length); |
212 | break; | 212 | break; |
213 | case ACPI_RSTYPE_FIXED_MEM32: | 213 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
214 | pnpacpi_parse_allocated_memresource(res_table, | 214 | pnpacpi_parse_allocated_memresource(res_table, |
215 | res->data.fixed_memory32.range_base_address, | 215 | res->data.fixed_memory32.address, |
216 | res->data.fixed_memory32.range_length); | 216 | res->data.fixed_memory32.address_length); |
217 | break; | 217 | break; |
218 | case ACPI_RSTYPE_ADDRESS16: | 218 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
219 | pnpacpi_parse_allocated_memresource(res_table, | 219 | pnpacpi_parse_allocated_memresource(res_table, |
220 | res->data.address16.min_address_range, | 220 | res->data.address16.minimum, |
221 | res->data.address16.address_length); | 221 | res->data.address16.address_length); |
222 | break; | 222 | break; |
223 | case ACPI_RSTYPE_ADDRESS32: | 223 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
224 | pnpacpi_parse_allocated_memresource(res_table, | 224 | pnpacpi_parse_allocated_memresource(res_table, |
225 | res->data.address32.min_address_range, | 225 | res->data.address32.minimum, |
226 | res->data.address32.address_length); | 226 | res->data.address32.address_length); |
227 | break; | 227 | break; |
228 | case ACPI_RSTYPE_ADDRESS64: | 228 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
229 | pnpacpi_parse_allocated_memresource(res_table, | 229 | pnpacpi_parse_allocated_memresource(res_table, |
230 | res->data.address64.min_address_range, | 230 | res->data.address64.minimum, |
231 | res->data.address64.address_length); | 231 | res->data.address64.address_length); |
232 | break; | 232 | break; |
233 | case ACPI_RSTYPE_VENDOR: | 233 | case ACPI_RESOURCE_TYPE_VENDOR: |
234 | break; | 234 | break; |
235 | default: | 235 | default: |
236 | pnp_warn("PnPACPI: unknown resource type %d", res->id); | 236 | pnp_warn("PnPACPI: unknown resource type %d", res->type); |
237 | return AE_ERROR; | 237 | return AE_ERROR; |
238 | } | 238 | } |
239 | 239 | ||
@@ -253,13 +253,13 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso | |||
253 | int i; | 253 | int i; |
254 | struct pnp_dma * dma; | 254 | struct pnp_dma * dma; |
255 | 255 | ||
256 | if (p->number_of_channels == 0) | 256 | if (p->channel_count == 0) |
257 | return; | 257 | return; |
258 | dma = kcalloc(1, sizeof(struct pnp_dma), GFP_KERNEL); | 258 | dma = kcalloc(1, sizeof(struct pnp_dma), GFP_KERNEL); |
259 | if (!dma) | 259 | if (!dma) |
260 | return; | 260 | return; |
261 | 261 | ||
262 | for(i = 0; i < p->number_of_channels; i++) | 262 | for(i = 0; i < p->channel_count; i++) |
263 | dma->map |= 1 << p->channels[i]; | 263 | dma->map |= 1 << p->channels[i]; |
264 | dma->flags = 0; | 264 | dma->flags = 0; |
265 | if (p->bus_master) | 265 | if (p->bus_master) |
@@ -309,37 +309,37 @@ static void pnpacpi_parse_irq_option(struct pnp_option *option, | |||
309 | int i; | 309 | int i; |
310 | struct pnp_irq * irq; | 310 | struct pnp_irq * irq; |
311 | 311 | ||
312 | if (p->number_of_interrupts == 0) | 312 | if (p->interrupt_count == 0) |
313 | return; | 313 | return; |
314 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); | 314 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); |
315 | if (!irq) | 315 | if (!irq) |
316 | return; | 316 | return; |
317 | 317 | ||
318 | for(i = 0; i < p->number_of_interrupts; i++) | 318 | for(i = 0; i < p->interrupt_count; i++) |
319 | if (p->interrupts[i]) | 319 | if (p->interrupts[i]) |
320 | __set_bit(p->interrupts[i], irq->map); | 320 | __set_bit(p->interrupts[i], irq->map); |
321 | irq->flags = irq_flags(p->edge_level, p->active_high_low); | 321 | irq->flags = irq_flags(p->triggering, p->polarity); |
322 | 322 | ||
323 | pnp_register_irq_resource(option, irq); | 323 | pnp_register_irq_resource(option, irq); |
324 | return; | 324 | return; |
325 | } | 325 | } |
326 | 326 | ||
327 | static void pnpacpi_parse_ext_irq_option(struct pnp_option *option, | 327 | static void pnpacpi_parse_ext_irq_option(struct pnp_option *option, |
328 | struct acpi_resource_ext_irq *p) | 328 | struct acpi_resource_extended_irq *p) |
329 | { | 329 | { |
330 | int i; | 330 | int i; |
331 | struct pnp_irq * irq; | 331 | struct pnp_irq * irq; |
332 | 332 | ||
333 | if (p->number_of_interrupts == 0) | 333 | if (p->interrupt_count == 0) |
334 | return; | 334 | return; |
335 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); | 335 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); |
336 | if (!irq) | 336 | if (!irq) |
337 | return; | 337 | return; |
338 | 338 | ||
339 | for(i = 0; i < p->number_of_interrupts; i++) | 339 | for(i = 0; i < p->interrupt_count; i++) |
340 | if (p->interrupts[i]) | 340 | if (p->interrupts[i]) |
341 | __set_bit(p->interrupts[i], irq->map); | 341 | __set_bit(p->interrupts[i], irq->map); |
342 | irq->flags = irq_flags(p->edge_level, p->active_high_low); | 342 | irq->flags = irq_flags(p->triggering, p->polarity); |
343 | 343 | ||
344 | pnp_register_irq_resource(option, irq); | 344 | pnp_register_irq_resource(option, irq); |
345 | return; | 345 | return; |
@@ -351,16 +351,16 @@ pnpacpi_parse_port_option(struct pnp_option *option, | |||
351 | { | 351 | { |
352 | struct pnp_port * port; | 352 | struct pnp_port * port; |
353 | 353 | ||
354 | if (io->range_length == 0) | 354 | if (io->address_length == 0) |
355 | return; | 355 | return; |
356 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); | 356 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); |
357 | if (!port) | 357 | if (!port) |
358 | return; | 358 | return; |
359 | port->min = io->min_base_address; | 359 | port->min = io->minimum; |
360 | port->max = io->max_base_address; | 360 | port->max = io->maximum; |
361 | port->align = io->alignment; | 361 | port->align = io->alignment; |
362 | port->size = io->range_length; | 362 | port->size = io->address_length; |
363 | port->flags = ACPI_DECODE_16 == io->io_decode ? | 363 | port->flags = ACPI_DECODE_16 == io->io_decode ? |
364 | PNP_PORT_FLAG_16BITADDR : 0; | 364 | PNP_PORT_FLAG_16BITADDR : 0; |
365 | pnp_register_port_resource(option,port); | 365 | pnp_register_port_resource(option,port); |
366 | return; | 366 | return; |
@@ -372,13 +372,13 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option, | |||
372 | { | 372 | { |
373 | struct pnp_port * port; | 373 | struct pnp_port * port; |
374 | 374 | ||
375 | if (io->range_length == 0) | 375 | if (io->address_length == 0) |
376 | return; | 376 | return; |
377 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); | 377 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); |
378 | if (!port) | 378 | if (!port) |
379 | return; | 379 | return; |
380 | port->min = port->max = io->base_address; | 380 | port->min = port->max = io->address; |
381 | port->size = io->range_length; | 381 | port->size = io->address_length; |
382 | port->align = 0; | 382 | port->align = 0; |
383 | port->flags = PNP_PORT_FLAG_FIXED; | 383 | port->flags = PNP_PORT_FLAG_FIXED; |
384 | pnp_register_port_resource(option,port); | 384 | pnp_register_port_resource(option,port); |
@@ -387,21 +387,21 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option, | |||
387 | 387 | ||
388 | static void | 388 | static void |
389 | pnpacpi_parse_mem24_option(struct pnp_option *option, | 389 | pnpacpi_parse_mem24_option(struct pnp_option *option, |
390 | struct acpi_resource_mem24 *p) | 390 | struct acpi_resource_memory24 *p) |
391 | { | 391 | { |
392 | struct pnp_mem * mem; | 392 | struct pnp_mem * mem; |
393 | 393 | ||
394 | if (p->range_length == 0) | 394 | if (p->address_length == 0) |
395 | return; | 395 | return; |
396 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); | 396 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); |
397 | if (!mem) | 397 | if (!mem) |
398 | return; | 398 | return; |
399 | mem->min = p->min_base_address; | 399 | mem->min = p->minimum; |
400 | mem->max = p->max_base_address; | 400 | mem->max = p->maximum; |
401 | mem->align = p->alignment; | 401 | mem->align = p->alignment; |
402 | mem->size = p->range_length; | 402 | mem->size = p->address_length; |
403 | 403 | ||
404 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? | 404 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? |
405 | IORESOURCE_MEM_WRITEABLE : 0; | 405 | IORESOURCE_MEM_WRITEABLE : 0; |
406 | 406 | ||
407 | pnp_register_mem_resource(option,mem); | 407 | pnp_register_mem_resource(option,mem); |
@@ -410,21 +410,21 @@ pnpacpi_parse_mem24_option(struct pnp_option *option, | |||
410 | 410 | ||
411 | static void | 411 | static void |
412 | pnpacpi_parse_mem32_option(struct pnp_option *option, | 412 | pnpacpi_parse_mem32_option(struct pnp_option *option, |
413 | struct acpi_resource_mem32 *p) | 413 | struct acpi_resource_memory32 *p) |
414 | { | 414 | { |
415 | struct pnp_mem * mem; | 415 | struct pnp_mem * mem; |
416 | 416 | ||
417 | if (p->range_length == 0) | 417 | if (p->address_length == 0) |
418 | return; | 418 | return; |
419 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); | 419 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); |
420 | if (!mem) | 420 | if (!mem) |
421 | return; | 421 | return; |
422 | mem->min = p->min_base_address; | 422 | mem->min = p->minimum; |
423 | mem->max = p->max_base_address; | 423 | mem->max = p->maximum; |
424 | mem->align = p->alignment; | 424 | mem->align = p->alignment; |
425 | mem->size = p->range_length; | 425 | mem->size = p->address_length; |
426 | 426 | ||
427 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? | 427 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? |
428 | IORESOURCE_MEM_WRITEABLE : 0; | 428 | IORESOURCE_MEM_WRITEABLE : 0; |
429 | 429 | ||
430 | pnp_register_mem_resource(option,mem); | 430 | pnp_register_mem_resource(option,mem); |
@@ -433,20 +433,20 @@ pnpacpi_parse_mem32_option(struct pnp_option *option, | |||
433 | 433 | ||
434 | static void | 434 | static void |
435 | pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, | 435 | pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, |
436 | struct acpi_resource_fixed_mem32 *p) | 436 | struct acpi_resource_fixed_memory32 *p) |
437 | { | 437 | { |
438 | struct pnp_mem * mem; | 438 | struct pnp_mem * mem; |
439 | 439 | ||
440 | if (p->range_length == 0) | 440 | if (p->address_length == 0) |
441 | return; | 441 | return; |
442 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); | 442 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); |
443 | if (!mem) | 443 | if (!mem) |
444 | return; | 444 | return; |
445 | mem->min = mem->max = p->range_base_address; | 445 | mem->min = mem->max = p->address; |
446 | mem->size = p->range_length; | 446 | mem->size = p->address_length; |
447 | mem->align = 0; | 447 | mem->align = 0; |
448 | 448 | ||
449 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? | 449 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? |
450 | IORESOURCE_MEM_WRITEABLE : 0; | 450 | IORESOURCE_MEM_WRITEABLE : 0; |
451 | 451 | ||
452 | pnp_register_mem_resource(option,mem); | 452 | pnp_register_mem_resource(option,mem); |
@@ -463,7 +463,7 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) | |||
463 | 463 | ||
464 | status = acpi_resource_to_address64(r, p); | 464 | status = acpi_resource_to_address64(r, p); |
465 | if (!ACPI_SUCCESS(status)) { | 465 | if (!ACPI_SUCCESS(status)) { |
466 | pnp_warn("PnPACPI: failed to convert resource type %d", r->id); | 466 | pnp_warn("PnPACPI: failed to convert resource type %d", r->type); |
467 | return; | 467 | return; |
468 | } | 468 | } |
469 | 469 | ||
@@ -474,17 +474,17 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) | |||
474 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); | 474 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); |
475 | if (!mem) | 475 | if (!mem) |
476 | return; | 476 | return; |
477 | mem->min = mem->max = p->min_address_range; | 477 | mem->min = mem->max = p->minimum; |
478 | mem->size = p->address_length; | 478 | mem->size = p->address_length; |
479 | mem->align = 0; | 479 | mem->align = 0; |
480 | mem->flags = (p->attribute.memory.read_write_attribute == | 480 | mem->flags = (p->info.mem.write_protect == |
481 | ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0; | 481 | ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0; |
482 | pnp_register_mem_resource(option,mem); | 482 | pnp_register_mem_resource(option,mem); |
483 | } else if (p->resource_type == ACPI_IO_RANGE) { | 483 | } else if (p->resource_type == ACPI_IO_RANGE) { |
484 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); | 484 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); |
485 | if (!port) | 485 | if (!port) |
486 | return; | 486 | return; |
487 | port->min = port->max = p->min_address_range; | 487 | port->min = port->max = p->minimum; |
488 | port->size = p->address_length; | 488 | port->size = p->address_length; |
489 | port->align = 0; | 489 | port->align = 0; |
490 | port->flags = PNP_PORT_FLAG_FIXED; | 490 | port->flags = PNP_PORT_FLAG_FIXED; |
@@ -498,7 +498,7 @@ struct acpipnp_parse_option_s { | |||
498 | struct pnp_dev *dev; | 498 | struct pnp_dev *dev; |
499 | }; | 499 | }; |
500 | 500 | ||
501 | static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | 501 | static acpi_status pnpacpi_option_resource(struct acpi_resource *res, |
502 | void *data) | 502 | void *data) |
503 | { | 503 | { |
504 | int priority = 0; | 504 | int priority = 0; |
@@ -506,40 +506,40 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
506 | struct pnp_dev *dev = parse_data->dev; | 506 | struct pnp_dev *dev = parse_data->dev; |
507 | struct pnp_option *option = parse_data->option; | 507 | struct pnp_option *option = parse_data->option; |
508 | 508 | ||
509 | switch (res->id) { | 509 | switch (res->type) { |
510 | case ACPI_RSTYPE_IRQ: | 510 | case ACPI_RESOURCE_TYPE_IRQ: |
511 | pnpacpi_parse_irq_option(option, &res->data.irq); | 511 | pnpacpi_parse_irq_option(option, &res->data.irq); |
512 | break; | 512 | break; |
513 | case ACPI_RSTYPE_EXT_IRQ: | 513 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
514 | pnpacpi_parse_ext_irq_option(option, | 514 | pnpacpi_parse_ext_irq_option(option, |
515 | &res->data.extended_irq); | 515 | &res->data.extended_irq); |
516 | break; | 516 | break; |
517 | case ACPI_RSTYPE_DMA: | 517 | case ACPI_RESOURCE_TYPE_DMA: |
518 | pnpacpi_parse_dma_option(option, &res->data.dma); | 518 | pnpacpi_parse_dma_option(option, &res->data.dma); |
519 | break; | 519 | break; |
520 | case ACPI_RSTYPE_IO: | 520 | case ACPI_RESOURCE_TYPE_IO: |
521 | pnpacpi_parse_port_option(option, &res->data.io); | 521 | pnpacpi_parse_port_option(option, &res->data.io); |
522 | break; | 522 | break; |
523 | case ACPI_RSTYPE_FIXED_IO: | 523 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
524 | pnpacpi_parse_fixed_port_option(option, | 524 | pnpacpi_parse_fixed_port_option(option, |
525 | &res->data.fixed_io); | 525 | &res->data.fixed_io); |
526 | break; | 526 | break; |
527 | case ACPI_RSTYPE_MEM24: | 527 | case ACPI_RESOURCE_TYPE_MEMORY24: |
528 | pnpacpi_parse_mem24_option(option, &res->data.memory24); | 528 | pnpacpi_parse_mem24_option(option, &res->data.memory24); |
529 | break; | 529 | break; |
530 | case ACPI_RSTYPE_MEM32: | 530 | case ACPI_RESOURCE_TYPE_MEMORY32: |
531 | pnpacpi_parse_mem32_option(option, &res->data.memory32); | 531 | pnpacpi_parse_mem32_option(option, &res->data.memory32); |
532 | break; | 532 | break; |
533 | case ACPI_RSTYPE_FIXED_MEM32: | 533 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
534 | pnpacpi_parse_fixed_mem32_option(option, | 534 | pnpacpi_parse_fixed_mem32_option(option, |
535 | &res->data.fixed_memory32); | 535 | &res->data.fixed_memory32); |
536 | break; | 536 | break; |
537 | case ACPI_RSTYPE_ADDRESS16: | 537 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
538 | case ACPI_RSTYPE_ADDRESS32: | 538 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
539 | case ACPI_RSTYPE_ADDRESS64: | 539 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
540 | pnpacpi_parse_address_option(option, res); | 540 | pnpacpi_parse_address_option(option, res); |
541 | break; | 541 | break; |
542 | case ACPI_RSTYPE_START_DPF: | 542 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: |
543 | switch (res->data.start_dpf.compatibility_priority) { | 543 | switch (res->data.start_dpf.compatibility_priority) { |
544 | case ACPI_GOOD_CONFIGURATION: | 544 | case ACPI_GOOD_CONFIGURATION: |
545 | priority = PNP_RES_PRIORITY_PREFERRED; | 545 | priority = PNP_RES_PRIORITY_PREFERRED; |
@@ -562,7 +562,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
562 | return AE_ERROR; | 562 | return AE_ERROR; |
563 | parse_data->option = option; | 563 | parse_data->option = option; |
564 | break; | 564 | break; |
565 | case ACPI_RSTYPE_END_DPF: | 565 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: |
566 | /*only one EndDependentFn is allowed*/ | 566 | /*only one EndDependentFn is allowed*/ |
567 | if (!parse_data->option_independent) { | 567 | if (!parse_data->option_independent) { |
568 | pnp_warn("PnPACPI: more than one EndDependentFn"); | 568 | pnp_warn("PnPACPI: more than one EndDependentFn"); |
@@ -572,14 +572,14 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
572 | parse_data->option_independent = NULL; | 572 | parse_data->option_independent = NULL; |
573 | break; | 573 | break; |
574 | default: | 574 | default: |
575 | pnp_warn("PnPACPI: unknown resource type %d", res->id); | 575 | pnp_warn("PnPACPI: unknown resource type %d", res->type); |
576 | return AE_ERROR; | 576 | return AE_ERROR; |
577 | } | 577 | } |
578 | 578 | ||
579 | return AE_OK; | 579 | return AE_OK; |
580 | } | 580 | } |
581 | 581 | ||
582 | acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, | 582 | acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, |
583 | struct pnp_dev *dev) | 583 | struct pnp_dev *dev) |
584 | { | 584 | { |
585 | acpi_status status; | 585 | acpi_status status; |
@@ -590,7 +590,7 @@ acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, | |||
590 | return AE_ERROR; | 590 | return AE_ERROR; |
591 | parse_data.option_independent = parse_data.option; | 591 | parse_data.option_independent = parse_data.option; |
592 | parse_data.dev = dev; | 592 | parse_data.dev = dev; |
593 | status = acpi_walk_resources(handle, METHOD_NAME__PRS, | 593 | status = acpi_walk_resources(handle, METHOD_NAME__PRS, |
594 | pnpacpi_option_resource, &parse_data); | 594 | pnpacpi_option_resource, &parse_data); |
595 | 595 | ||
596 | return status; | 596 | return status; |
@@ -603,18 +603,18 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res, | |||
603 | void *data) | 603 | void *data) |
604 | { | 604 | { |
605 | int *res_cnt = (int *)data; | 605 | int *res_cnt = (int *)data; |
606 | switch (res->id) { | 606 | switch (res->type) { |
607 | case ACPI_RSTYPE_IRQ: | 607 | case ACPI_RESOURCE_TYPE_IRQ: |
608 | case ACPI_RSTYPE_EXT_IRQ: | 608 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
609 | case ACPI_RSTYPE_DMA: | 609 | case ACPI_RESOURCE_TYPE_DMA: |
610 | case ACPI_RSTYPE_IO: | 610 | case ACPI_RESOURCE_TYPE_IO: |
611 | case ACPI_RSTYPE_FIXED_IO: | 611 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
612 | case ACPI_RSTYPE_MEM24: | 612 | case ACPI_RESOURCE_TYPE_MEMORY24: |
613 | case ACPI_RSTYPE_MEM32: | 613 | case ACPI_RESOURCE_TYPE_MEMORY32: |
614 | case ACPI_RSTYPE_FIXED_MEM32: | 614 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
615 | case ACPI_RSTYPE_ADDRESS16: | 615 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
616 | case ACPI_RSTYPE_ADDRESS32: | 616 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
617 | case ACPI_RSTYPE_ADDRESS64: | 617 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
618 | (*res_cnt) ++; | 618 | (*res_cnt) ++; |
619 | default: | 619 | default: |
620 | return AE_OK; | 620 | return AE_OK; |
@@ -626,19 +626,19 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, | |||
626 | void *data) | 626 | void *data) |
627 | { | 627 | { |
628 | struct acpi_resource **resource = (struct acpi_resource **)data; | 628 | struct acpi_resource **resource = (struct acpi_resource **)data; |
629 | switch (res->id) { | 629 | switch (res->type) { |
630 | case ACPI_RSTYPE_IRQ: | 630 | case ACPI_RESOURCE_TYPE_IRQ: |
631 | case ACPI_RSTYPE_EXT_IRQ: | 631 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
632 | case ACPI_RSTYPE_DMA: | 632 | case ACPI_RESOURCE_TYPE_DMA: |
633 | case ACPI_RSTYPE_IO: | 633 | case ACPI_RESOURCE_TYPE_IO: |
634 | case ACPI_RSTYPE_FIXED_IO: | 634 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
635 | case ACPI_RSTYPE_MEM24: | 635 | case ACPI_RESOURCE_TYPE_MEMORY24: |
636 | case ACPI_RSTYPE_MEM32: | 636 | case ACPI_RESOURCE_TYPE_MEMORY32: |
637 | case ACPI_RSTYPE_FIXED_MEM32: | 637 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
638 | case ACPI_RSTYPE_ADDRESS16: | 638 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
639 | case ACPI_RSTYPE_ADDRESS32: | 639 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
640 | case ACPI_RSTYPE_ADDRESS64: | 640 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
641 | (*resource)->id = res->id; | 641 | (*resource)->type = res->type; |
642 | (*resource)++; | 642 | (*resource)++; |
643 | default: | 643 | default: |
644 | return AE_OK; | 644 | return AE_OK; |
@@ -647,14 +647,14 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, | |||
647 | return AE_OK; | 647 | return AE_OK; |
648 | } | 648 | } |
649 | 649 | ||
650 | int pnpacpi_build_resource_template(acpi_handle handle, | 650 | int pnpacpi_build_resource_template(acpi_handle handle, |
651 | struct acpi_buffer *buffer) | 651 | struct acpi_buffer *buffer) |
652 | { | 652 | { |
653 | struct acpi_resource *resource; | 653 | struct acpi_resource *resource; |
654 | int res_cnt = 0; | 654 | int res_cnt = 0; |
655 | acpi_status status; | 655 | acpi_status status; |
656 | 656 | ||
657 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | 657 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, |
658 | pnpacpi_count_resources, &res_cnt); | 658 | pnpacpi_count_resources, &res_cnt); |
659 | if (ACPI_FAILURE(status)) { | 659 | if (ACPI_FAILURE(status)) { |
660 | pnp_err("Evaluate _CRS failed"); | 660 | pnp_err("Evaluate _CRS failed"); |
@@ -668,7 +668,7 @@ int pnpacpi_build_resource_template(acpi_handle handle, | |||
668 | return -ENOMEM; | 668 | return -ENOMEM; |
669 | pnp_dbg("Res cnt %d", res_cnt); | 669 | pnp_dbg("Res cnt %d", res_cnt); |
670 | resource = (struct acpi_resource *)buffer->pointer; | 670 | resource = (struct acpi_resource *)buffer->pointer; |
671 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | 671 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, |
672 | pnpacpi_type_resources, &resource); | 672 | pnpacpi_type_resources, &resource); |
673 | if (ACPI_FAILURE(status)) { | 673 | if (ACPI_FAILURE(status)) { |
674 | kfree(buffer->pointer); | 674 | kfree(buffer->pointer); |
@@ -676,54 +676,54 @@ int pnpacpi_build_resource_template(acpi_handle handle, | |||
676 | return -EINVAL; | 676 | return -EINVAL; |
677 | } | 677 | } |
678 | /* resource will pointer the end resource now */ | 678 | /* resource will pointer the end resource now */ |
679 | resource->id = ACPI_RSTYPE_END_TAG; | 679 | resource->type = ACPI_RESOURCE_TYPE_END_TAG; |
680 | 680 | ||
681 | return 0; | 681 | return 0; |
682 | } | 682 | } |
683 | 683 | ||
684 | static void pnpacpi_encode_irq(struct acpi_resource *resource, | 684 | static void pnpacpi_encode_irq(struct acpi_resource *resource, |
685 | struct resource *p) | 685 | struct resource *p) |
686 | { | 686 | { |
687 | int edge_level, active_high_low; | 687 | int triggering, polarity; |
688 | 688 | ||
689 | decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, | 689 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, |
690 | &active_high_low); | 690 | &polarity); |
691 | resource->id = ACPI_RSTYPE_IRQ; | 691 | resource->type = ACPI_RESOURCE_TYPE_IRQ; |
692 | resource->length = sizeof(struct acpi_resource); | 692 | resource->length = sizeof(struct acpi_resource); |
693 | resource->data.irq.edge_level = edge_level; | 693 | resource->data.irq.triggering = triggering; |
694 | resource->data.irq.active_high_low = active_high_low; | 694 | resource->data.irq.polarity = polarity; |
695 | if (edge_level == ACPI_EDGE_SENSITIVE) | 695 | if (triggering == ACPI_EDGE_SENSITIVE) |
696 | resource->data.irq.shared_exclusive = ACPI_EXCLUSIVE; | 696 | resource->data.irq.sharable = ACPI_EXCLUSIVE; |
697 | else | 697 | else |
698 | resource->data.irq.shared_exclusive = ACPI_SHARED; | 698 | resource->data.irq.sharable = ACPI_SHARED; |
699 | resource->data.irq.number_of_interrupts = 1; | 699 | resource->data.irq.interrupt_count = 1; |
700 | resource->data.irq.interrupts[0] = p->start; | 700 | resource->data.irq.interrupts[0] = p->start; |
701 | } | 701 | } |
702 | 702 | ||
703 | static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, | 703 | static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, |
704 | struct resource *p) | 704 | struct resource *p) |
705 | { | 705 | { |
706 | int edge_level, active_high_low; | 706 | int triggering, polarity; |
707 | 707 | ||
708 | decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, | 708 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, |
709 | &active_high_low); | 709 | &polarity); |
710 | resource->id = ACPI_RSTYPE_EXT_IRQ; | 710 | resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; |
711 | resource->length = sizeof(struct acpi_resource); | 711 | resource->length = sizeof(struct acpi_resource); |
712 | resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; | 712 | resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; |
713 | resource->data.extended_irq.edge_level = edge_level; | 713 | resource->data.extended_irq.triggering = triggering; |
714 | resource->data.extended_irq.active_high_low = active_high_low; | 714 | resource->data.extended_irq.polarity = polarity; |
715 | if (edge_level == ACPI_EDGE_SENSITIVE) | 715 | if (triggering == ACPI_EDGE_SENSITIVE) |
716 | resource->data.irq.shared_exclusive = ACPI_EXCLUSIVE; | 716 | resource->data.irq.sharable = ACPI_EXCLUSIVE; |
717 | else | 717 | else |
718 | resource->data.irq.shared_exclusive = ACPI_SHARED; | 718 | resource->data.irq.sharable = ACPI_SHARED; |
719 | resource->data.extended_irq.number_of_interrupts = 1; | 719 | resource->data.extended_irq.interrupt_count = 1; |
720 | resource->data.extended_irq.interrupts[0] = p->start; | 720 | resource->data.extended_irq.interrupts[0] = p->start; |
721 | } | 721 | } |
722 | 722 | ||
723 | static void pnpacpi_encode_dma(struct acpi_resource *resource, | 723 | static void pnpacpi_encode_dma(struct acpi_resource *resource, |
724 | struct resource *p) | 724 | struct resource *p) |
725 | { | 725 | { |
726 | resource->id = ACPI_RSTYPE_DMA; | 726 | resource->type = ACPI_RESOURCE_TYPE_DMA; |
727 | resource->length = sizeof(struct acpi_resource); | 727 | resource->length = sizeof(struct acpi_resource); |
728 | /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ | 728 | /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ |
729 | if (p->flags & IORESOURCE_DMA_COMPATIBLE) | 729 | if (p->flags & IORESOURCE_DMA_COMPATIBLE) |
@@ -741,75 +741,75 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource, | |||
741 | else if (p->flags & IORESOURCE_DMA_16BIT) | 741 | else if (p->flags & IORESOURCE_DMA_16BIT) |
742 | resource->data.dma.transfer = ACPI_TRANSFER_16; | 742 | resource->data.dma.transfer = ACPI_TRANSFER_16; |
743 | resource->data.dma.bus_master = p->flags & IORESOURCE_DMA_MASTER; | 743 | resource->data.dma.bus_master = p->flags & IORESOURCE_DMA_MASTER; |
744 | resource->data.dma.number_of_channels = 1; | 744 | resource->data.dma.channel_count = 1; |
745 | resource->data.dma.channels[0] = p->start; | 745 | resource->data.dma.channels[0] = p->start; |
746 | } | 746 | } |
747 | 747 | ||
748 | static void pnpacpi_encode_io(struct acpi_resource *resource, | 748 | static void pnpacpi_encode_io(struct acpi_resource *resource, |
749 | struct resource *p) | 749 | struct resource *p) |
750 | { | 750 | { |
751 | resource->id = ACPI_RSTYPE_IO; | 751 | resource->type = ACPI_RESOURCE_TYPE_IO; |
752 | resource->length = sizeof(struct acpi_resource); | 752 | resource->length = sizeof(struct acpi_resource); |
753 | /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */ | 753 | /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */ |
754 | resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? | 754 | resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? |
755 | ACPI_DECODE_16 : ACPI_DECODE_10; | 755 | ACPI_DECODE_16 : ACPI_DECODE_10; |
756 | resource->data.io.min_base_address = p->start; | 756 | resource->data.io.minimum = p->start; |
757 | resource->data.io.max_base_address = p->end; | 757 | resource->data.io.maximum = p->end; |
758 | resource->data.io.alignment = 0; /* Correct? */ | 758 | resource->data.io.alignment = 0; /* Correct? */ |
759 | resource->data.io.range_length = p->end - p->start + 1; | 759 | resource->data.io.address_length = p->end - p->start + 1; |
760 | } | 760 | } |
761 | 761 | ||
762 | static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, | 762 | static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, |
763 | struct resource *p) | 763 | struct resource *p) |
764 | { | 764 | { |
765 | resource->id = ACPI_RSTYPE_FIXED_IO; | 765 | resource->type = ACPI_RESOURCE_TYPE_FIXED_IO; |
766 | resource->length = sizeof(struct acpi_resource); | 766 | resource->length = sizeof(struct acpi_resource); |
767 | resource->data.fixed_io.base_address = p->start; | 767 | resource->data.fixed_io.address = p->start; |
768 | resource->data.fixed_io.range_length = p->end - p->start + 1; | 768 | resource->data.fixed_io.address_length = p->end - p->start + 1; |
769 | } | 769 | } |
770 | 770 | ||
771 | static void pnpacpi_encode_mem24(struct acpi_resource *resource, | 771 | static void pnpacpi_encode_mem24(struct acpi_resource *resource, |
772 | struct resource *p) | 772 | struct resource *p) |
773 | { | 773 | { |
774 | resource->id = ACPI_RSTYPE_MEM24; | 774 | resource->type = ACPI_RESOURCE_TYPE_MEMORY24; |
775 | resource->length = sizeof(struct acpi_resource); | 775 | resource->length = sizeof(struct acpi_resource); |
776 | /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ | 776 | /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ |
777 | resource->data.memory24.read_write_attribute = | 777 | resource->data.memory24.write_protect = |
778 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 778 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
779 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 779 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
780 | resource->data.memory24.min_base_address = p->start; | 780 | resource->data.memory24.minimum = p->start; |
781 | resource->data.memory24.max_base_address = p->end; | 781 | resource->data.memory24.maximum = p->end; |
782 | resource->data.memory24.alignment = 0; | 782 | resource->data.memory24.alignment = 0; |
783 | resource->data.memory24.range_length = p->end - p->start + 1; | 783 | resource->data.memory24.address_length = p->end - p->start + 1; |
784 | } | 784 | } |
785 | 785 | ||
786 | static void pnpacpi_encode_mem32(struct acpi_resource *resource, | 786 | static void pnpacpi_encode_mem32(struct acpi_resource *resource, |
787 | struct resource *p) | 787 | struct resource *p) |
788 | { | 788 | { |
789 | resource->id = ACPI_RSTYPE_MEM32; | 789 | resource->type = ACPI_RESOURCE_TYPE_MEMORY32; |
790 | resource->length = sizeof(struct acpi_resource); | 790 | resource->length = sizeof(struct acpi_resource); |
791 | resource->data.memory32.read_write_attribute = | 791 | resource->data.memory32.write_protect = |
792 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 792 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
793 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 793 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
794 | resource->data.memory32.min_base_address = p->start; | 794 | resource->data.memory32.minimum = p->start; |
795 | resource->data.memory32.max_base_address = p->end; | 795 | resource->data.memory32.maximum = p->end; |
796 | resource->data.memory32.alignment = 0; | 796 | resource->data.memory32.alignment = 0; |
797 | resource->data.memory32.range_length = p->end - p->start + 1; | 797 | resource->data.memory32.address_length = p->end - p->start + 1; |
798 | } | 798 | } |
799 | 799 | ||
800 | static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, | 800 | static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, |
801 | struct resource *p) | 801 | struct resource *p) |
802 | { | 802 | { |
803 | resource->id = ACPI_RSTYPE_FIXED_MEM32; | 803 | resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; |
804 | resource->length = sizeof(struct acpi_resource); | 804 | resource->length = sizeof(struct acpi_resource); |
805 | resource->data.fixed_memory32.read_write_attribute = | 805 | resource->data.fixed_memory32.write_protect = |
806 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 806 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
807 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 807 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
808 | resource->data.fixed_memory32.range_base_address = p->start; | 808 | resource->data.fixed_memory32.address = p->start; |
809 | resource->data.fixed_memory32.range_length = p->end - p->start + 1; | 809 | resource->data.fixed_memory32.address_length = p->end - p->start + 1; |
810 | } | 810 | } |
811 | 811 | ||
812 | int pnpacpi_encode_resources(struct pnp_resource_table *res_table, | 812 | int pnpacpi_encode_resources(struct pnp_resource_table *res_table, |
813 | struct acpi_buffer *buffer) | 813 | struct acpi_buffer *buffer) |
814 | { | 814 | { |
815 | int i = 0; | 815 | int i = 0; |
@@ -820,58 +820,58 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, | |||
820 | 820 | ||
821 | pnp_dbg("res cnt %d", res_cnt); | 821 | pnp_dbg("res cnt %d", res_cnt); |
822 | while (i < res_cnt) { | 822 | while (i < res_cnt) { |
823 | switch(resource->id) { | 823 | switch(resource->type) { |
824 | case ACPI_RSTYPE_IRQ: | 824 | case ACPI_RESOURCE_TYPE_IRQ: |
825 | pnp_dbg("Encode irq"); | 825 | pnp_dbg("Encode irq"); |
826 | pnpacpi_encode_irq(resource, | 826 | pnpacpi_encode_irq(resource, |
827 | &res_table->irq_resource[irq]); | 827 | &res_table->irq_resource[irq]); |
828 | irq++; | 828 | irq++; |
829 | break; | 829 | break; |
830 | 830 | ||
831 | case ACPI_RSTYPE_EXT_IRQ: | 831 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
832 | pnp_dbg("Encode ext irq"); | 832 | pnp_dbg("Encode ext irq"); |
833 | pnpacpi_encode_ext_irq(resource, | 833 | pnpacpi_encode_ext_irq(resource, |
834 | &res_table->irq_resource[irq]); | 834 | &res_table->irq_resource[irq]); |
835 | irq++; | 835 | irq++; |
836 | break; | 836 | break; |
837 | case ACPI_RSTYPE_DMA: | 837 | case ACPI_RESOURCE_TYPE_DMA: |
838 | pnp_dbg("Encode dma"); | 838 | pnp_dbg("Encode dma"); |
839 | pnpacpi_encode_dma(resource, | 839 | pnpacpi_encode_dma(resource, |
840 | &res_table->dma_resource[dma]); | 840 | &res_table->dma_resource[dma]); |
841 | dma ++; | 841 | dma ++; |
842 | break; | 842 | break; |
843 | case ACPI_RSTYPE_IO: | 843 | case ACPI_RESOURCE_TYPE_IO: |
844 | pnp_dbg("Encode io"); | 844 | pnp_dbg("Encode io"); |
845 | pnpacpi_encode_io(resource, | 845 | pnpacpi_encode_io(resource, |
846 | &res_table->port_resource[port]); | 846 | &res_table->port_resource[port]); |
847 | port ++; | 847 | port ++; |
848 | break; | 848 | break; |
849 | case ACPI_RSTYPE_FIXED_IO: | 849 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
850 | pnp_dbg("Encode fixed io"); | 850 | pnp_dbg("Encode fixed io"); |
851 | pnpacpi_encode_fixed_io(resource, | 851 | pnpacpi_encode_fixed_io(resource, |
852 | &res_table->port_resource[port]); | 852 | &res_table->port_resource[port]); |
853 | port ++; | 853 | port ++; |
854 | break; | 854 | break; |
855 | case ACPI_RSTYPE_MEM24: | 855 | case ACPI_RESOURCE_TYPE_MEMORY24: |
856 | pnp_dbg("Encode mem24"); | 856 | pnp_dbg("Encode mem24"); |
857 | pnpacpi_encode_mem24(resource, | 857 | pnpacpi_encode_mem24(resource, |
858 | &res_table->mem_resource[mem]); | 858 | &res_table->mem_resource[mem]); |
859 | mem ++; | 859 | mem ++; |
860 | break; | 860 | break; |
861 | case ACPI_RSTYPE_MEM32: | 861 | case ACPI_RESOURCE_TYPE_MEMORY32: |
862 | pnp_dbg("Encode mem32"); | 862 | pnp_dbg("Encode mem32"); |
863 | pnpacpi_encode_mem32(resource, | 863 | pnpacpi_encode_mem32(resource, |
864 | &res_table->mem_resource[mem]); | 864 | &res_table->mem_resource[mem]); |
865 | mem ++; | 865 | mem ++; |
866 | break; | 866 | break; |
867 | case ACPI_RSTYPE_FIXED_MEM32: | 867 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
868 | pnp_dbg("Encode fixed mem32"); | 868 | pnp_dbg("Encode fixed mem32"); |
869 | pnpacpi_encode_fixed_mem32(resource, | 869 | pnpacpi_encode_fixed_mem32(resource, |
870 | &res_table->mem_resource[mem]); | 870 | &res_table->mem_resource[mem]); |
871 | mem ++; | 871 | mem ++; |
872 | break; | 872 | break; |
873 | default: /* other type */ | 873 | default: /* other type */ |
874 | pnp_warn("unknown resource type %d", resource->id); | 874 | pnp_warn("unknown resource type %d", resource->type); |
875 | return -EINVAL; | 875 | return -EINVAL; |
876 | } | 876 | } |
877 | resource ++; | 877 | resource ++; |
diff --git a/drivers/serial/8250_acpi.c b/drivers/serial/8250_acpi.c index a802bdce6e5d..809f89ab965c 100644 --- a/drivers/serial/8250_acpi.c +++ b/drivers/serial/8250_acpi.c | |||
@@ -27,7 +27,7 @@ struct serial_private { | |||
27 | static acpi_status acpi_serial_mmio(struct uart_port *port, | 27 | static acpi_status acpi_serial_mmio(struct uart_port *port, |
28 | struct acpi_resource_address64 *addr) | 28 | struct acpi_resource_address64 *addr) |
29 | { | 29 | { |
30 | port->mapbase = addr->min_address_range; | 30 | port->mapbase = addr->minimum; |
31 | port->iotype = UPIO_MEM; | 31 | port->iotype = UPIO_MEM; |
32 | port->flags |= UPF_IOREMAP; | 32 | port->flags |= UPF_IOREMAP; |
33 | return AE_OK; | 33 | return AE_OK; |
@@ -36,8 +36,8 @@ static acpi_status acpi_serial_mmio(struct uart_port *port, | |||
36 | static acpi_status acpi_serial_port(struct uart_port *port, | 36 | static acpi_status acpi_serial_port(struct uart_port *port, |
37 | struct acpi_resource_io *io) | 37 | struct acpi_resource_io *io) |
38 | { | 38 | { |
39 | if (io->range_length) { | 39 | if (io->address_length) { |
40 | port->iobase = io->min_base_address; | 40 | port->iobase = io->minimum; |
41 | port->iotype = UPIO_PORT; | 41 | port->iotype = UPIO_PORT; |
42 | } else | 42 | } else |
43 | printk(KERN_ERR "%s: zero-length IO port range?\n", __FUNCTION__); | 43 | printk(KERN_ERR "%s: zero-length IO port range?\n", __FUNCTION__); |
@@ -45,13 +45,13 @@ static acpi_status acpi_serial_port(struct uart_port *port, | |||
45 | } | 45 | } |
46 | 46 | ||
47 | static acpi_status acpi_serial_ext_irq(struct uart_port *port, | 47 | static acpi_status acpi_serial_ext_irq(struct uart_port *port, |
48 | struct acpi_resource_ext_irq *ext_irq) | 48 | struct acpi_resource_extended_irq *ext_irq) |
49 | { | 49 | { |
50 | int rc; | 50 | int rc; |
51 | 51 | ||
52 | if (ext_irq->number_of_interrupts > 0) { | 52 | if (ext_irq->interrupt_count > 0) { |
53 | rc = acpi_register_gsi(ext_irq->interrupts[0], | 53 | rc = acpi_register_gsi(ext_irq->interrupts[0], |
54 | ext_irq->edge_level, ext_irq->active_high_low); | 54 | ext_irq->triggering, ext_irq->polarity); |
55 | if (rc < 0) | 55 | if (rc < 0) |
56 | return AE_ERROR; | 56 | return AE_ERROR; |
57 | port->irq = rc; | 57 | port->irq = rc; |
@@ -64,9 +64,9 @@ static acpi_status acpi_serial_irq(struct uart_port *port, | |||
64 | { | 64 | { |
65 | int rc; | 65 | int rc; |
66 | 66 | ||
67 | if (irq->number_of_interrupts > 0) { | 67 | if (irq->interrupt_count > 0) { |
68 | rc = acpi_register_gsi(irq->interrupts[0], | 68 | rc = acpi_register_gsi(irq->interrupts[0], |
69 | irq->edge_level, irq->active_high_low); | 69 | irq->triggering, irq->polarity); |
70 | if (rc < 0) | 70 | if (rc < 0) |
71 | return AE_ERROR; | 71 | return AE_ERROR; |
72 | port->irq = rc; | 72 | port->irq = rc; |
@@ -83,11 +83,11 @@ static acpi_status acpi_serial_resource(struct acpi_resource *res, void *data) | |||
83 | status = acpi_resource_to_address64(res, &addr); | 83 | status = acpi_resource_to_address64(res, &addr); |
84 | if (ACPI_SUCCESS(status)) | 84 | if (ACPI_SUCCESS(status)) |
85 | return acpi_serial_mmio(port, &addr); | 85 | return acpi_serial_mmio(port, &addr); |
86 | else if (res->id == ACPI_RSTYPE_IO) | 86 | else if (res->type == ACPI_RESOURCE_TYPE_IO) |
87 | return acpi_serial_port(port, &res->data.io); | 87 | return acpi_serial_port(port, &res->data.io); |
88 | else if (res->id == ACPI_RSTYPE_EXT_IRQ) | 88 | else if (res->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) |
89 | return acpi_serial_ext_irq(port, &res->data.extended_irq); | 89 | return acpi_serial_ext_irq(port, &res->data.extended_irq); |
90 | else if (res->id == ACPI_RSTYPE_IRQ) | 90 | else if (res->type == ACPI_RESOURCE_TYPE_IRQ) |
91 | return acpi_serial_irq(port, &res->data.irq); | 91 | return acpi_serial_irq(port, &res->data.irq); |
92 | return AE_OK; | 92 | return AE_OK; |
93 | } | 93 | } |
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 427cff1a3f83..1f2477eb95fe 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h | |||
@@ -61,9 +61,9 @@ | |||
61 | * | 61 | * |
62 | */ | 62 | */ |
63 | 63 | ||
64 | /* Version string */ | 64 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
65 | 65 | ||
66 | #define ACPI_CA_VERSION 0x20050902 | 66 | #define ACPI_CA_VERSION 0x20051216 |
67 | 67 | ||
68 | /* | 68 | /* |
69 | * OS name, used for the _OS object. The _OS object is essentially obsolete, | 69 | * OS name, used for the _OS object. The _OS object is essentially obsolete, |
@@ -98,11 +98,6 @@ | |||
98 | 98 | ||
99 | #define ACPI_CA_SUPPORT_LEVEL 3 | 99 | #define ACPI_CA_SUPPORT_LEVEL 3 |
100 | 100 | ||
101 | /* String size constants */ | ||
102 | |||
103 | #define ACPI_MAX_STRING_LENGTH 512 | ||
104 | #define ACPI_PATHNAME_MAX 256 /* A full namespace pathname */ | ||
105 | |||
106 | /* Maximum count for a semaphore object */ | 101 | /* Maximum count for a semaphore object */ |
107 | 102 | ||
108 | #define ACPI_MAX_SEMAPHORE_COUNT 256 | 103 | #define ACPI_MAX_SEMAPHORE_COUNT 256 |
@@ -115,6 +110,10 @@ | |||
115 | 110 | ||
116 | #define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096 | 111 | #define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096 |
117 | 112 | ||
113 | /* owner_id tracking. 8 entries allows for 255 owner_ids */ | ||
114 | |||
115 | #define ACPI_NUM_OWNERID_MASKS 8 | ||
116 | |||
118 | /****************************************************************************** | 117 | /****************************************************************************** |
119 | * | 118 | * |
120 | * ACPI Specification constants (Do not change unless the specification changes) | 119 | * ACPI Specification constants (Do not change unless the specification changes) |
@@ -134,14 +133,11 @@ | |||
134 | #define ACPI_METHOD_NUM_ARGS 7 | 133 | #define ACPI_METHOD_NUM_ARGS 7 |
135 | #define ACPI_METHOD_MAX_ARG 6 | 134 | #define ACPI_METHOD_MAX_ARG 6 |
136 | 135 | ||
137 | /* Maximum length of resulting string when converting from a buffer */ | 136 | /* Length of _HID, _UID, _CID, and UUID values */ |
138 | |||
139 | #define ACPI_MAX_STRING_CONVERSION 200 | ||
140 | |||
141 | /* Length of _HID, _UID, and _CID values */ | ||
142 | 137 | ||
143 | #define ACPI_DEVICE_ID_LENGTH 0x09 | 138 | #define ACPI_DEVICE_ID_LENGTH 0x09 |
144 | #define ACPI_MAX_CID_LENGTH 48 | 139 | #define ACPI_MAX_CID_LENGTH 48 |
140 | #define ACPI_UUID_LENGTH 16 | ||
145 | 141 | ||
146 | /* | 142 | /* |
147 | * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG | 143 | * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG |
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index 3d96dcb1bb4b..0a8f49f5d2f1 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h | |||
@@ -57,26 +57,11 @@ struct acpi_external_list { | |||
57 | }; | 57 | }; |
58 | 58 | ||
59 | extern struct acpi_external_list *acpi_gbl_external_list; | 59 | extern struct acpi_external_list *acpi_gbl_external_list; |
60 | extern const char *acpi_gbl_io_decode[2]; | 60 | |
61 | /* Strings used for decoding flags to ASL keywords */ | ||
62 | |||
61 | extern const char *acpi_gbl_word_decode[4]; | 63 | extern const char *acpi_gbl_word_decode[4]; |
62 | extern const char *acpi_gbl_consume_decode[2]; | ||
63 | extern const char *acpi_gbl_min_decode[2]; | ||
64 | extern const char *acpi_gbl_max_decode[2]; | ||
65 | extern const char *acpi_gbl_DECdecode[2]; | ||
66 | extern const char *acpi_gbl_RNGdecode[4]; | ||
67 | extern const char *acpi_gbl_MEMdecode[4]; | ||
68 | extern const char *acpi_gbl_RWdecode[2]; | ||
69 | extern const char *acpi_gbl_irq_decode[2]; | 64 | extern const char *acpi_gbl_irq_decode[2]; |
70 | extern const char *acpi_gbl_HEdecode[2]; | ||
71 | extern const char *acpi_gbl_LLdecode[2]; | ||
72 | extern const char *acpi_gbl_SHRdecode[2]; | ||
73 | extern const char *acpi_gbl_TYPdecode[4]; | ||
74 | extern const char *acpi_gbl_BMdecode[2]; | ||
75 | extern const char *acpi_gbl_SIZdecode[4]; | ||
76 | extern const char *acpi_gbl_TTPdecode[2]; | ||
77 | extern const char *acpi_gbl_MTPdecode[4]; | ||
78 | extern const char *acpi_gbl_TRSdecode[2]; | ||
79 | |||
80 | extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES]; | 65 | extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES]; |
81 | extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES]; | 66 | extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES]; |
82 | extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES]; | 67 | extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES]; |
@@ -171,11 +156,19 @@ u8 acpi_dm_is_string_buffer(union acpi_parse_object *op); | |||
171 | /* | 156 | /* |
172 | * dmresrc | 157 | * dmresrc |
173 | */ | 158 | */ |
159 | void acpi_dm_dump_integer8(u8 value, char *name); | ||
160 | |||
161 | void acpi_dm_dump_integer16(u16 value, char *name); | ||
162 | |||
163 | void acpi_dm_dump_integer32(u32 value, char *name); | ||
164 | |||
165 | void acpi_dm_dump_integer64(u64 value, char *name); | ||
166 | |||
174 | void | 167 | void |
175 | acpi_dm_resource_descriptor(struct acpi_op_walk_info *info, | 168 | acpi_dm_resource_template(struct acpi_op_walk_info *info, |
176 | u8 * byte_data, u32 byte_count); | 169 | u8 * byte_data, u32 byte_count); |
177 | 170 | ||
178 | u8 acpi_dm_is_resource_descriptor(union acpi_parse_object *op); | 171 | u8 acpi_dm_is_resource_template(union acpi_parse_object *op); |
179 | 172 | ||
180 | void acpi_dm_indent(u32 level); | 173 | void acpi_dm_indent(u32 level); |
181 | 174 | ||
@@ -187,73 +180,69 @@ void acpi_dm_decode_attribute(u8 attribute); | |||
187 | * dmresrcl | 180 | * dmresrcl |
188 | */ | 181 | */ |
189 | void | 182 | void |
190 | acpi_dm_word_descriptor(struct asl_word_address_desc *resource, | 183 | acpi_dm_word_descriptor(union aml_resource *resource, u32 length, u32 level); |
191 | u32 length, u32 level); | ||
192 | 184 | ||
193 | void | 185 | void |
194 | acpi_dm_dword_descriptor(struct asl_dword_address_desc *resource, | 186 | acpi_dm_dword_descriptor(union aml_resource *resource, u32 length, u32 level); |
195 | u32 length, u32 level); | ||
196 | 187 | ||
197 | void | 188 | void |
198 | acpi_dm_extended_descriptor(struct asl_extended_address_desc *resource, | 189 | acpi_dm_extended_descriptor(union aml_resource *resource, |
199 | u32 length, u32 level); | 190 | u32 length, u32 level); |
200 | 191 | ||
201 | void | 192 | void |
202 | acpi_dm_qword_descriptor(struct asl_qword_address_desc *resource, | 193 | acpi_dm_qword_descriptor(union aml_resource *resource, u32 length, u32 level); |
203 | u32 length, u32 level); | ||
204 | 194 | ||
205 | void | 195 | void |
206 | acpi_dm_memory24_descriptor(struct asl_memory_24_desc *resource, | 196 | acpi_dm_memory24_descriptor(union aml_resource *resource, |
207 | u32 length, u32 level); | 197 | u32 length, u32 level); |
208 | 198 | ||
209 | void | 199 | void |
210 | acpi_dm_memory32_descriptor(struct asl_memory_32_desc *resource, | 200 | acpi_dm_memory32_descriptor(union aml_resource *resource, |
211 | u32 length, u32 level); | 201 | u32 length, u32 level); |
212 | 202 | ||
213 | void | 203 | void |
214 | acpi_dm_fixed_mem32_descriptor(struct asl_fixed_memory_32_desc *resource, | 204 | acpi_dm_fixed_memory32_descriptor(union aml_resource *resource, |
215 | u32 length, u32 level); | 205 | u32 length, u32 level); |
216 | 206 | ||
217 | void | 207 | void |
218 | acpi_dm_generic_register_descriptor(struct asl_general_register_desc *resource, | 208 | acpi_dm_generic_register_descriptor(union aml_resource *resource, |
219 | u32 length, u32 level); | 209 | u32 length, u32 level); |
220 | 210 | ||
221 | void | 211 | void |
222 | acpi_dm_interrupt_descriptor(struct asl_extended_xrupt_desc *resource, | 212 | acpi_dm_interrupt_descriptor(union aml_resource *resource, |
223 | u32 length, u32 level); | 213 | u32 length, u32 level); |
224 | 214 | ||
225 | void | 215 | void |
226 | acpi_dm_vendor_large_descriptor(struct asl_large_vendor_desc *resource, | 216 | acpi_dm_vendor_large_descriptor(union aml_resource *resource, |
227 | u32 length, u32 level); | 217 | u32 length, u32 level); |
228 | 218 | ||
219 | void acpi_dm_vendor_common(char *name, u8 * byte_data, u32 length, u32 level); | ||
220 | |||
229 | /* | 221 | /* |
230 | * dmresrcs | 222 | * dmresrcs |
231 | */ | 223 | */ |
232 | void | 224 | void |
233 | acpi_dm_irq_descriptor(struct asl_irq_format_desc *resource, | 225 | acpi_dm_irq_descriptor(union aml_resource *resource, u32 length, u32 level); |
234 | u32 length, u32 level); | ||
235 | 226 | ||
236 | void | 227 | void |
237 | acpi_dm_dma_descriptor(struct asl_dma_format_desc *resource, | 228 | acpi_dm_dma_descriptor(union aml_resource *resource, u32 length, u32 level); |
238 | u32 length, u32 level); | ||
239 | 229 | ||
240 | void | 230 | void acpi_dm_io_descriptor(union aml_resource *resource, u32 length, u32 level); |
241 | acpi_dm_io_descriptor(struct asl_io_port_desc *resource, u32 length, u32 level); | ||
242 | 231 | ||
243 | void | 232 | void |
244 | acpi_dm_fixed_io_descriptor(struct asl_fixed_io_port_desc *resource, | 233 | acpi_dm_fixed_io_descriptor(union aml_resource *resource, |
245 | u32 length, u32 level); | 234 | u32 length, u32 level); |
246 | 235 | ||
247 | void | 236 | void |
248 | acpi_dm_start_dependent_descriptor(struct asl_start_dependent_desc *resource, | 237 | acpi_dm_start_dependent_descriptor(union aml_resource *resource, |
249 | u32 length, u32 level); | 238 | u32 length, u32 level); |
250 | 239 | ||
251 | void | 240 | void |
252 | acpi_dm_end_dependent_descriptor(struct asl_start_dependent_desc *resource, | 241 | acpi_dm_end_dependent_descriptor(union aml_resource *resource, |
253 | u32 length, u32 level); | 242 | u32 length, u32 level); |
254 | 243 | ||
255 | void | 244 | void |
256 | acpi_dm_vendor_small_descriptor(struct asl_small_vendor_desc *resource, | 245 | acpi_dm_vendor_small_descriptor(union aml_resource *resource, |
257 | u32 length, u32 level); | 246 | u32 length, u32 level); |
258 | 247 | ||
259 | /* | 248 | /* |
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h index 065f24a77cfc..cc6407eef701 100644 --- a/include/acpi/acdispat.h +++ b/include/acpi/acdispat.h | |||
@@ -201,6 +201,9 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
201 | union acpi_operand_object *obj_desc, | 201 | union acpi_operand_object *obj_desc, |
202 | struct acpi_namespace_node *calling_method_node); | 202 | struct acpi_namespace_node *calling_method_node); |
203 | 203 | ||
204 | acpi_status | ||
205 | acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state); | ||
206 | |||
204 | /* | 207 | /* |
205 | * dsinit | 208 | * dsinit |
206 | */ | 209 | */ |
diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h index bfa54600ecd9..b40062c3ba7a 100644 --- a/include/acpi/acevents.h +++ b/include/acpi/acevents.h | |||
@@ -51,6 +51,8 @@ acpi_status acpi_ev_initialize_events(void); | |||
51 | 51 | ||
52 | acpi_status acpi_ev_install_xrupt_handlers(void); | 52 | acpi_status acpi_ev_install_xrupt_handlers(void); |
53 | 53 | ||
54 | acpi_status acpi_ev_install_fadt_gpes(void); | ||
55 | |||
54 | u32 acpi_ev_fixed_event_detect(void); | 56 | u32 acpi_ev_fixed_event_detect(void); |
55 | 57 | ||
56 | /* | 58 | /* |
@@ -105,6 +107,10 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
105 | u32 interrupt_number, | 107 | u32 interrupt_number, |
106 | struct acpi_gpe_block_info **return_gpe_block); | 108 | struct acpi_gpe_block_info **return_gpe_block); |
107 | 109 | ||
110 | acpi_status | ||
111 | acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | ||
112 | struct acpi_gpe_block_info *gpe_block); | ||
113 | |||
108 | acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block); | 114 | acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block); |
109 | 115 | ||
110 | u32 | 116 | u32 |
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index 4ab2ca18b8df..dfb3b2493ae5 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h | |||
@@ -80,6 +80,15 @@ extern u32 acpi_dbg_layer; | |||
80 | 80 | ||
81 | extern u32 acpi_gbl_nesting_level; | 81 | extern u32 acpi_gbl_nesting_level; |
82 | 82 | ||
83 | /* Support for dynamic control method tracing mechanism */ | ||
84 | |||
85 | ACPI_EXTERN u32 acpi_gbl_original_dbg_level; | ||
86 | ACPI_EXTERN u32 acpi_gbl_original_dbg_layer; | ||
87 | ACPI_EXTERN acpi_name acpi_gbl_trace_method_name; | ||
88 | ACPI_EXTERN u32 acpi_gbl_trace_dbg_level; | ||
89 | ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer; | ||
90 | ACPI_EXTERN u32 acpi_gbl_trace_flags; | ||
91 | |||
83 | /***************************************************************************** | 92 | /***************************************************************************** |
84 | * | 93 | * |
85 | * Runtime configuration (static defaults that can be overriden at runtime) | 94 | * Runtime configuration (static defaults that can be overriden at runtime) |
@@ -89,11 +98,15 @@ extern u32 acpi_gbl_nesting_level; | |||
89 | /* | 98 | /* |
90 | * Enable "slack" in the AML interpreter? Default is FALSE, and the | 99 | * Enable "slack" in the AML interpreter? Default is FALSE, and the |
91 | * interpreter strictly follows the ACPI specification. Setting to TRUE | 100 | * interpreter strictly follows the ACPI specification. Setting to TRUE |
92 | * allows the interpreter to forgive certain bad AML constructs. Currently: | 101 | * allows the interpreter to ignore certain errors and/or bad AML constructs. |
102 | * | ||
103 | * Currently, these features are enabled by this flag: | ||
104 | * | ||
93 | * 1) Allow "implicit return" of last value in a control method | 105 | * 1) Allow "implicit return" of last value in a control method |
94 | * 2) Allow access beyond end of operation region | 106 | * 2) Allow access beyond the end of an operation region |
95 | * 3) Allow access to uninitialized locals/args (auto-init to integer 0) | 107 | * 3) Allow access to uninitialized locals/args (auto-init to integer 0) |
96 | * 4) Allow ANY object type to be a source operand for the Store() operator | 108 | * 4) Allow ANY object type to be a source operand for the Store() operator |
109 | * 5) Allow unresolved references (invalid target name) in package objects | ||
97 | */ | 110 | */ |
98 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); | 111 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); |
99 | 112 | ||
@@ -211,9 +224,11 @@ ACPI_EXTERN u32 acpi_gbl_original_mode; | |||
211 | ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; | 224 | ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; |
212 | ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; | 225 | ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; |
213 | ACPI_EXTERN u32 acpi_gbl_ps_find_count; | 226 | ACPI_EXTERN u32 acpi_gbl_ps_find_count; |
214 | ACPI_EXTERN u64 acpi_gbl_owner_id_mask; | 227 | ACPI_EXTERN u32 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS]; |
215 | ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; | 228 | ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; |
216 | ACPI_EXTERN u16 acpi_gbl_global_lock_handle; | 229 | ACPI_EXTERN u16 acpi_gbl_global_lock_handle; |
230 | ACPI_EXTERN u8 acpi_gbl_last_owner_id_index; | ||
231 | ACPI_EXTERN u8 acpi_gbl_next_owner_id_offset; | ||
217 | ACPI_EXTERN u8 acpi_gbl_debugger_configuration; | 232 | ACPI_EXTERN u8 acpi_gbl_debugger_configuration; |
218 | ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; | 233 | ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; |
219 | ACPI_EXTERN u8 acpi_gbl_step_to_next_call; | 234 | ACPI_EXTERN u8 acpi_gbl_step_to_next_call; |
diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h index 2c9c1a1d1b7f..87e5e44572ca 100644 --- a/include/acpi/acinterp.h +++ b/include/acpi/acinterp.h | |||
@@ -44,7 +44,49 @@ | |||
44 | #ifndef __ACINTERP_H__ | 44 | #ifndef __ACINTERP_H__ |
45 | #define __ACINTERP_H__ | 45 | #define __ACINTERP_H__ |
46 | 46 | ||
47 | #define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1])) | 47 | #define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1])) |
48 | |||
49 | /* Macros for tables used for debug output */ | ||
50 | |||
51 | #define ACPI_EXD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_operand_object,f) | ||
52 | #define ACPI_EXD_NSOFFSET(f) (u8) ACPI_OFFSET (struct acpi_namespace_node,f) | ||
53 | #define ACPI_EXD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_exdump_info)) | ||
54 | |||
55 | /* | ||
56 | * If possible, pack the following structure to byte alignment, since we | ||
57 | * don't care about performance for debug output | ||
58 | */ | ||
59 | #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED | ||
60 | #pragma pack(1) | ||
61 | #endif | ||
62 | |||
63 | typedef const struct acpi_exdump_info { | ||
64 | u8 opcode; | ||
65 | u8 offset; | ||
66 | char *name; | ||
67 | |||
68 | } acpi_exdump_info; | ||
69 | |||
70 | /* Values for the Opcode field above */ | ||
71 | |||
72 | #define ACPI_EXD_INIT 0 | ||
73 | #define ACPI_EXD_TYPE 1 | ||
74 | #define ACPI_EXD_UINT8 2 | ||
75 | #define ACPI_EXD_UINT16 3 | ||
76 | #define ACPI_EXD_UINT32 4 | ||
77 | #define ACPI_EXD_UINT64 5 | ||
78 | #define ACPI_EXD_LITERAL 6 | ||
79 | #define ACPI_EXD_POINTER 7 | ||
80 | #define ACPI_EXD_ADDRESS 8 | ||
81 | #define ACPI_EXD_STRING 9 | ||
82 | #define ACPI_EXD_BUFFER 10 | ||
83 | #define ACPI_EXD_PACKAGE 11 | ||
84 | #define ACPI_EXD_FIELD 12 | ||
85 | #define ACPI_EXD_REFERENCE 13 | ||
86 | |||
87 | /* restore default alignment */ | ||
88 | |||
89 | #pragma pack() | ||
48 | 90 | ||
49 | /* | 91 | /* |
50 | * exconvrt - object conversion | 92 | * exconvrt - object conversion |
@@ -327,7 +369,7 @@ acpi_ex_dump_operands(union acpi_operand_object **operands, | |||
327 | void | 369 | void |
328 | acpi_ex_dump_object_descriptor(union acpi_operand_object *object, u32 flags); | 370 | acpi_ex_dump_object_descriptor(union acpi_operand_object *object, u32 flags); |
329 | 371 | ||
330 | void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags); | 372 | void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags); |
331 | #endif /* ACPI_FUTURE_USAGE */ | 373 | #endif /* ACPI_FUTURE_USAGE */ |
332 | 374 | ||
333 | /* | 375 | /* |
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 9fba0fddda90..da7f1cb96f5d 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h | |||
@@ -276,6 +276,37 @@ struct acpi_create_field_info { | |||
276 | u8 field_type; | 276 | u8 field_type; |
277 | }; | 277 | }; |
278 | 278 | ||
279 | /* | ||
280 | * Bitmapped ACPI types. Used internally only | ||
281 | */ | ||
282 | #define ACPI_BTYPE_ANY 0x00000000 | ||
283 | #define ACPI_BTYPE_INTEGER 0x00000001 | ||
284 | #define ACPI_BTYPE_STRING 0x00000002 | ||
285 | #define ACPI_BTYPE_BUFFER 0x00000004 | ||
286 | #define ACPI_BTYPE_PACKAGE 0x00000008 | ||
287 | #define ACPI_BTYPE_FIELD_UNIT 0x00000010 | ||
288 | #define ACPI_BTYPE_DEVICE 0x00000020 | ||
289 | #define ACPI_BTYPE_EVENT 0x00000040 | ||
290 | #define ACPI_BTYPE_METHOD 0x00000080 | ||
291 | #define ACPI_BTYPE_MUTEX 0x00000100 | ||
292 | #define ACPI_BTYPE_REGION 0x00000200 | ||
293 | #define ACPI_BTYPE_POWER 0x00000400 | ||
294 | #define ACPI_BTYPE_PROCESSOR 0x00000800 | ||
295 | #define ACPI_BTYPE_THERMAL 0x00001000 | ||
296 | #define ACPI_BTYPE_BUFFER_FIELD 0x00002000 | ||
297 | #define ACPI_BTYPE_DDB_HANDLE 0x00004000 | ||
298 | #define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 | ||
299 | #define ACPI_BTYPE_REFERENCE 0x00010000 | ||
300 | #define ACPI_BTYPE_RESOURCE 0x00020000 | ||
301 | |||
302 | #define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) | ||
303 | |||
304 | #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) | ||
305 | #define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) | ||
306 | #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) | ||
307 | #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ | ||
308 | #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF | ||
309 | |||
279 | /***************************************************************************** | 310 | /***************************************************************************** |
280 | * | 311 | * |
281 | * Event typedefs and structs | 312 | * Event typedefs and structs |
@@ -573,6 +604,8 @@ struct acpi_parse_obj_named { | |||
573 | 604 | ||
574 | /* The parse node is the fundamental element of the parse tree */ | 605 | /* The parse node is the fundamental element of the parse tree */ |
575 | 606 | ||
607 | #define ACPI_MAX_PARSEOP_NAME 20 | ||
608 | |||
576 | struct acpi_parse_obj_asl { | 609 | struct acpi_parse_obj_asl { |
577 | ACPI_PARSE_COMMON union acpi_parse_object *child; | 610 | ACPI_PARSE_COMMON union acpi_parse_object *child; |
578 | union acpi_parse_object *parent_method; | 611 | union acpi_parse_object *parent_method; |
@@ -597,7 +630,7 @@ struct acpi_parse_obj_asl { | |||
597 | u8 aml_opcode_length; | 630 | u8 aml_opcode_length; |
598 | u8 aml_pkg_len_bytes; | 631 | u8 aml_pkg_len_bytes; |
599 | u8 extra; | 632 | u8 extra; |
600 | char parse_op_name[12]; | 633 | char parse_op_name[ACPI_MAX_PARSEOP_NAME]; |
601 | }; | 634 | }; |
602 | 635 | ||
603 | union acpi_parse_object { | 636 | union acpi_parse_object { |
@@ -735,44 +768,52 @@ struct acpi_bit_register_info { | |||
735 | 768 | ||
736 | /* resource_type values */ | 769 | /* resource_type values */ |
737 | 770 | ||
738 | #define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0 | 771 | #define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0 |
739 | #define ACPI_RESOURCE_TYPE_IO_RANGE 1 | 772 | #define ACPI_ADDRESS_TYPE_IO_RANGE 1 |
740 | #define ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE 2 | 773 | #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2 |
741 | 774 | ||
742 | /* Resource descriptor types and masks */ | 775 | /* Resource descriptor types and masks */ |
743 | 776 | ||
744 | #define ACPI_RDESC_TYPE_LARGE 0x80 | 777 | #define ACPI_RESOURCE_NAME_LARGE 0x80 |
745 | #define ACPI_RDESC_TYPE_SMALL 0x00 | 778 | #define ACPI_RESOURCE_NAME_SMALL 0x00 |
746 | 779 | ||
747 | #define ACPI_RDESC_TYPE_MASK 0x80 | 780 | #define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */ |
748 | #define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */ | 781 | #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */ |
782 | #define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */ | ||
749 | 783 | ||
750 | /* | 784 | /* |
751 | * Small resource descriptor types | 785 | * Small resource descriptor "names" as defined by the ACPI specification. |
752 | * Note: The 3 length bits (2:0) must be zero | 786 | * Note: Bits 2:0 are used for the descriptor length |
753 | */ | 787 | */ |
754 | #define ACPI_RDESC_TYPE_IRQ_FORMAT 0x20 | 788 | #define ACPI_RESOURCE_NAME_IRQ 0x20 |
755 | #define ACPI_RDESC_TYPE_DMA_FORMAT 0x28 | 789 | #define ACPI_RESOURCE_NAME_DMA 0x28 |
756 | #define ACPI_RDESC_TYPE_START_DEPENDENT 0x30 | 790 | #define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30 |
757 | #define ACPI_RDESC_TYPE_END_DEPENDENT 0x38 | 791 | #define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38 |
758 | #define ACPI_RDESC_TYPE_IO_PORT 0x40 | 792 | #define ACPI_RESOURCE_NAME_IO 0x40 |
759 | #define ACPI_RDESC_TYPE_FIXED_IO_PORT 0x48 | 793 | #define ACPI_RESOURCE_NAME_FIXED_IO 0x48 |
760 | #define ACPI_RDESC_TYPE_SMALL_VENDOR 0x70 | 794 | #define ACPI_RESOURCE_NAME_RESERVED_S1 0x50 |
761 | #define ACPI_RDESC_TYPE_END_TAG 0x78 | 795 | #define ACPI_RESOURCE_NAME_RESERVED_S2 0x58 |
796 | #define ACPI_RESOURCE_NAME_RESERVED_S3 0x60 | ||
797 | #define ACPI_RESOURCE_NAME_RESERVED_S4 0x68 | ||
798 | #define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70 | ||
799 | #define ACPI_RESOURCE_NAME_END_TAG 0x78 | ||
762 | 800 | ||
763 | /* | 801 | /* |
764 | * Large resource descriptor types | 802 | * Large resource descriptor "names" as defined by the ACPI specification. |
803 | * Note: includes the Large Descriptor bit in bit[7] | ||
765 | */ | 804 | */ |
766 | #define ACPI_RDESC_TYPE_MEMORY_24 0x81 | 805 | #define ACPI_RESOURCE_NAME_MEMORY24 0x81 |
767 | #define ACPI_RDESC_TYPE_GENERAL_REGISTER 0x82 | 806 | #define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82 |
768 | #define ACPI_RDESC_TYPE_LARGE_VENDOR 0x84 | 807 | #define ACPI_RESOURCE_NAME_RESERVED_L1 0x83 |
769 | #define ACPI_RDESC_TYPE_MEMORY_32 0x85 | 808 | #define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84 |
770 | #define ACPI_RDESC_TYPE_FIXED_MEMORY_32 0x86 | 809 | #define ACPI_RESOURCE_NAME_MEMORY32 0x85 |
771 | #define ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE 0x87 | 810 | #define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86 |
772 | #define ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE 0x88 | 811 | #define ACPI_RESOURCE_NAME_ADDRESS32 0x87 |
773 | #define ACPI_RDESC_TYPE_EXTENDED_XRUPT 0x89 | 812 | #define ACPI_RESOURCE_NAME_ADDRESS16 0x88 |
774 | #define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A | 813 | #define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89 |
775 | #define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE 0x8B | 814 | #define ACPI_RESOURCE_NAME_ADDRESS64 0x8A |
815 | #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B | ||
816 | #define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B | ||
776 | 817 | ||
777 | /***************************************************************************** | 818 | /***************************************************************************** |
778 | * | 819 | * |
@@ -780,7 +821,7 @@ struct acpi_bit_register_info { | |||
780 | * | 821 | * |
781 | ****************************************************************************/ | 822 | ****************************************************************************/ |
782 | 823 | ||
783 | #define ACPI_ASCII_ZERO 0x30 | 824 | #define ACPI_ASCII_ZERO 0x30 |
784 | 825 | ||
785 | /***************************************************************************** | 826 | /***************************************************************************** |
786 | * | 827 | * |
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 702cc4e57f5f..0fa8f72dbace 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h | |||
@@ -60,7 +60,7 @@ | |||
60 | 60 | ||
61 | /* | 61 | /* |
62 | * For 16-bit addresses, we have to assume that the upper 32 bits | 62 | * For 16-bit addresses, we have to assume that the upper 32 bits |
63 | * are zero. | 63 | * (out of 64) are zero. |
64 | */ | 64 | */ |
65 | #define ACPI_LODWORD(l) ((u32)(l)) | 65 | #define ACPI_LODWORD(l) ((u32)(l)) |
66 | #define ACPI_HIDWORD(l) ((u32)(0)) | 66 | #define ACPI_HIDWORD(l) ((u32)(0)) |
@@ -104,30 +104,38 @@ | |||
104 | #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) | 104 | #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) |
105 | 105 | ||
106 | /* | 106 | /* |
107 | * Extract a byte of data using a pointer. Any more than a byte and we | 107 | * Extract data using a pointer. Any more than a byte and we |
108 | * get into potential aligment issues -- see the STORE macros below | 108 | * get into potential aligment issues -- see the STORE macros below. |
109 | * Use with care. | ||
109 | */ | 110 | */ |
110 | #define ACPI_GET8(addr) (*(u8*)(addr)) | 111 | #define ACPI_GET8(ptr) *ACPI_CAST_PTR (u8, ptr) |
112 | #define ACPI_GET16(ptr) *ACPI_CAST_PTR (u16, ptr) | ||
113 | #define ACPI_GET32(ptr) *ACPI_CAST_PTR (u32, ptr) | ||
114 | #define ACPI_GET64(ptr) *ACPI_CAST_PTR (u64, ptr) | ||
115 | #define ACPI_SET8(ptr) *ACPI_CAST_PTR (u8, ptr) | ||
116 | #define ACPI_SET16(ptr) *ACPI_CAST_PTR (u16, ptr) | ||
117 | #define ACPI_SET32(ptr) *ACPI_CAST_PTR (u32, ptr) | ||
118 | #define ACPI_SET64(ptr) *ACPI_CAST_PTR (u64, ptr) | ||
111 | 119 | ||
112 | /* Pointer arithmetic */ | 120 | /* |
113 | 121 | * Pointer manipulation | |
114 | #define ACPI_PTR_ADD(t,a,b) (t *) (void *)((char *)(a) + (acpi_native_uint)(b)) | 122 | */ |
115 | #define ACPI_PTR_DIFF(a,b) (acpi_native_uint) ((char *)(a) - (char *)(b)) | 123 | #define ACPI_CAST_PTR(t, p) ((t *) (acpi_uintptr_t) (p)) |
124 | #define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (acpi_uintptr_t) (p)) | ||
125 | #define ACPI_ADD_PTR(t,a,b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8,(a)) + (acpi_native_uint)(b))) | ||
126 | #define ACPI_PTR_DIFF(a,b) (acpi_native_uint) (ACPI_CAST_PTR (u8,(a)) - ACPI_CAST_PTR (u8,(b))) | ||
116 | 127 | ||
117 | /* Pointer/Integer type conversions */ | 128 | /* Pointer/Integer type conversions */ |
118 | 129 | ||
119 | #define ACPI_TO_POINTER(i) ACPI_PTR_ADD (void, (void *) NULL,(acpi_native_uint)i) | 130 | #define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void,(void *) NULL,(acpi_native_uint) i) |
120 | #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) | 131 | #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) |
121 | #define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) | 132 | #define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) |
122 | #define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f) | 133 | #define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f) |
123 | 134 | ||
124 | #define ACPI_CAST_PTR(t, p) ((t *)(void *)(p)) | ||
125 | #define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p)) | ||
126 | |||
127 | #if ACPI_MACHINE_WIDTH == 16 | 135 | #if ACPI_MACHINE_WIDTH == 16 |
128 | #define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s) | 136 | #define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s) |
129 | #define ACPI_PHYSADDR_TO_PTR(i) (void *)(i) | 137 | #define ACPI_PHYSADDR_TO_PTR(i) (void *)(i) |
130 | #define ACPI_PTR_TO_PHYSADDR(i) (u32) (char *)(i) | 138 | #define ACPI_PTR_TO_PHYSADDR(i) (u32) ACPI_CAST_PTR (u8,(i)) |
131 | #else | 139 | #else |
132 | #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) | 140 | #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) |
133 | #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) | 141 | #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) |
@@ -202,7 +210,7 @@ | |||
202 | 210 | ||
203 | #define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) (buf_offset) | 211 | #define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) (buf_offset) |
204 | 212 | ||
205 | #ifdef ACPI_MISALIGNED_TRANSFERS | 213 | #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED |
206 | 214 | ||
207 | /* The hardware supports unaligned transfers, just do the little-endian move */ | 215 | /* The hardware supports unaligned transfers, just do the little-endian move */ |
208 | 216 | ||
@@ -326,6 +334,10 @@ | |||
326 | #define ACPI_MUL_16(a) _ACPI_MUL(a,4) | 334 | #define ACPI_MUL_16(a) _ACPI_MUL(a,4) |
327 | #define ACPI_MOD_16(a) _ACPI_MOD(a,16) | 335 | #define ACPI_MOD_16(a) _ACPI_MOD(a,16) |
328 | 336 | ||
337 | #define ACPI_DIV_32(a) _ACPI_DIV(a,5) | ||
338 | #define ACPI_MUL_32(a) _ACPI_MUL(a,5) | ||
339 | #define ACPI_MOD_32(a) _ACPI_MOD(a,32) | ||
340 | |||
329 | /* | 341 | /* |
330 | * Rounding macros (Power of two boundaries only) | 342 | * Rounding macros (Power of two boundaries only) |
331 | */ | 343 | */ |
@@ -365,6 +377,13 @@ | |||
365 | #define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask) | 377 | #define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask) |
366 | #define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask) | 378 | #define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask) |
367 | 379 | ||
380 | /* Generate a UUID */ | ||
381 | |||
382 | #define ACPI_INIT_UUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) (a) & 0xFF, ((a) >> 8) & 0xFF, ((a) >> 16) & 0xFF, ((a) >> 24) & 0xFF, \ | ||
383 | (b) & 0xFF, ((b) >> 8) & 0xFF, \ | ||
384 | (c) & 0xFF, ((c) >> 8) & 0xFF, \ | ||
385 | (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) | ||
386 | |||
368 | /* | 387 | /* |
369 | * An struct acpi_namespace_node * can appear in some contexts, | 388 | * An struct acpi_namespace_node * can appear in some contexts, |
370 | * where a pointer to an union acpi_operand_object can also | 389 | * where a pointer to an union acpi_operand_object can also |
@@ -525,6 +544,9 @@ | |||
525 | * bad form, but having a separate exit macro is very ugly and difficult to maintain. | 544 | * bad form, but having a separate exit macro is very ugly and difficult to maintain. |
526 | * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros | 545 | * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros |
527 | * so that "_acpi_function_name" is defined. | 546 | * so that "_acpi_function_name" is defined. |
547 | * | ||
548 | * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining | ||
549 | * about these constructs. | ||
528 | */ | 550 | */ |
529 | #ifdef ACPI_USE_DO_WHILE_0 | 551 | #ifdef ACPI_USE_DO_WHILE_0 |
530 | #define ACPI_DO_WHILE0(a) do a while(0) | 552 | #define ACPI_DO_WHILE0(a) do a while(0) |
@@ -532,10 +554,55 @@ | |||
532 | #define ACPI_DO_WHILE0(a) a | 554 | #define ACPI_DO_WHILE0(a) a |
533 | #endif | 555 | #endif |
534 | 556 | ||
535 | #define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(ACPI_DEBUG_PARAMETERS);return;}) | 557 | #define return_VOID ACPI_DO_WHILE0 ({ \ |
536 | #define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(ACPI_DEBUG_PARAMETERS,(s));return((s));}) | 558 | acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \ |
537 | #define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(ACPI_DEBUG_PARAMETERS,(acpi_integer)(s));return((s));}) | 559 | return;}) |
538 | #define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(ACPI_DEBUG_PARAMETERS,(u8 *)(s));return((s));}) | 560 | /* |
561 | * There are two versions of most of the return macros. The default version is | ||
562 | * safer, since it avoids side-effects by guaranteeing that the argument will | ||
563 | * not be evaluated twice. | ||
564 | * | ||
565 | * A less-safe version of the macros is provided for optional use if the | ||
566 | * compiler uses excessive CPU stack (for example, this may happen in the | ||
567 | * debug case if code optimzation is disabled.) | ||
568 | */ | ||
569 | #ifndef ACPI_SIMPLE_RETURN_MACROS | ||
570 | |||
571 | #define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ | ||
572 | register acpi_status _s = (s); \ | ||
573 | acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, _s); \ | ||
574 | return (_s); }) | ||
575 | #define return_PTR(s) ACPI_DO_WHILE0 ({ \ | ||
576 | register void *_s = (void *) (s); \ | ||
577 | acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \ | ||
578 | return (_s); }) | ||
579 | #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ | ||
580 | register acpi_integer _s = (s); \ | ||
581 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ | ||
582 | return (_s); }) | ||
583 | #define return_UINT8(s) ACPI_DO_WHILE0 ({ \ | ||
584 | register u8 _s = (u8) (s); \ | ||
585 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \ | ||
586 | return (_s); }) | ||
587 | #define return_UINT32(s) ACPI_DO_WHILE0 ({ \ | ||
588 | register u32 _s = (u32) (s); \ | ||
589 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \ | ||
590 | return (_s); }) | ||
591 | #else /* Use original less-safe macros */ | ||
592 | |||
593 | #define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ | ||
594 | acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, (s)); \ | ||
595 | return((s)); }) | ||
596 | #define return_PTR(s) ACPI_DO_WHILE0 ({ \ | ||
597 | acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \ | ||
598 | return((s)); }) | ||
599 | #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ | ||
600 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) (s)); \ | ||
601 | return((s)); }) | ||
602 | #define return_UINT8(s) return_VALUE(s) | ||
603 | #define return_UINT32(s) return_VALUE(s) | ||
604 | |||
605 | #endif /* ACPI_SIMPLE_RETURN_MACROS */ | ||
539 | 606 | ||
540 | /* Conditional execution */ | 607 | /* Conditional execution */ |
541 | 608 | ||
@@ -612,6 +679,8 @@ | |||
612 | #define return_VOID return | 679 | #define return_VOID return |
613 | #define return_ACPI_STATUS(s) return(s) | 680 | #define return_ACPI_STATUS(s) return(s) |
614 | #define return_VALUE(s) return(s) | 681 | #define return_VALUE(s) return(s) |
682 | #define return_UINT8(s) return(s) | ||
683 | #define return_UINT32(s) return(s) | ||
615 | #define return_PTR(s) return(s) | 684 | #define return_PTR(s) return(s) |
616 | 685 | ||
617 | #endif | 686 | #endif |
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index c1b4e1f882e4..b425f9bb6d43 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h | |||
@@ -52,8 +52,8 @@ | |||
52 | /* ACPI PCI Interrupt Link (pci_link.c) */ | 52 | /* ACPI PCI Interrupt Link (pci_link.c) */ |
53 | 53 | ||
54 | int acpi_irq_penalty_init(void); | 54 | int acpi_irq_penalty_init(void); |
55 | int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *edge_level, | 55 | int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *triggering, |
56 | int *active_high_low, char **name); | 56 | int *polarity, char **name); |
57 | int acpi_pci_link_free_irq(acpi_handle handle); | 57 | int acpi_pci_link_free_irq(acpi_handle handle); |
58 | 58 | ||
59 | /* ACPI PCI Interrupt Routing (pci_irq.c) */ | 59 | /* ACPI PCI Interrupt Routing (pci_irq.c) */ |
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 98e0b8cd14ed..58473f60755f 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h | |||
@@ -108,9 +108,9 @@ acpi_status acpi_os_create_lock(acpi_handle * out_handle); | |||
108 | 108 | ||
109 | void acpi_os_delete_lock(acpi_handle handle); | 109 | void acpi_os_delete_lock(acpi_handle handle); |
110 | 110 | ||
111 | unsigned long acpi_os_acquire_lock(acpi_handle handle); | 111 | acpi_native_uint acpi_os_acquire_lock(acpi_handle handle); |
112 | 112 | ||
113 | void acpi_os_release_lock(acpi_handle handle, unsigned long flags); | 113 | void acpi_os_release_lock(acpi_handle handle, acpi_native_uint flags); |
114 | 114 | ||
115 | /* | 115 | /* |
116 | * Memory allocation and mapping | 116 | * Memory allocation and mapping |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 2a9dbc13b0f2..2a88429bc4ec 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -149,6 +149,9 @@ acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler); | |||
149 | acpi_status | 149 | acpi_status |
150 | acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data); | 150 | acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data); |
151 | 151 | ||
152 | acpi_status | ||
153 | acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags); | ||
154 | |||
152 | /* | 155 | /* |
153 | * Object manipulation and enumeration | 156 | * Object manipulation and enumeration |
154 | */ | 157 | */ |
@@ -269,6 +272,12 @@ acpi_status(*ACPI_WALK_RESOURCE_CALLBACK) (struct acpi_resource * resource, | |||
269 | void *context); | 272 | void *context); |
270 | 273 | ||
271 | acpi_status | 274 | acpi_status |
275 | acpi_get_vendor_resource(acpi_handle device_handle, | ||
276 | char *name, | ||
277 | struct acpi_vendor_uuid *uuid, | ||
278 | struct acpi_buffer *ret_buffer); | ||
279 | |||
280 | acpi_status | ||
272 | acpi_get_current_resources(acpi_handle device_handle, | 281 | acpi_get_current_resources(acpi_handle device_handle, |
273 | struct acpi_buffer *ret_buffer); | 282 | struct acpi_buffer *ret_buffer); |
274 | 283 | ||
@@ -280,7 +289,7 @@ acpi_get_possible_resources(acpi_handle device_handle, | |||
280 | 289 | ||
281 | acpi_status | 290 | acpi_status |
282 | acpi_walk_resources(acpi_handle device_handle, | 291 | acpi_walk_resources(acpi_handle device_handle, |
283 | char *path, | 292 | char *name, |
284 | ACPI_WALK_RESOURCE_CALLBACK user_function, void *context); | 293 | ACPI_WALK_RESOURCE_CALLBACK user_function, void *context); |
285 | 294 | ||
286 | acpi_status | 295 | acpi_status |
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h index 38e798b05d08..ba281f7740a0 100644 --- a/include/acpi/acresrc.h +++ b/include/acpi/acresrc.h | |||
@@ -44,216 +44,284 @@ | |||
44 | #ifndef __ACRESRC_H__ | 44 | #ifndef __ACRESRC_H__ |
45 | #define __ACRESRC_H__ | 45 | #define __ACRESRC_H__ |
46 | 46 | ||
47 | /* | 47 | /* Need the AML resource descriptor structs */ |
48 | * Function prototypes called from Acpi* APIs | ||
49 | */ | ||
50 | acpi_status | ||
51 | acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); | ||
52 | 48 | ||
53 | acpi_status | 49 | #include "amlresrc.h" |
54 | acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); | ||
55 | 50 | ||
56 | #ifdef ACPI_FUTURE_USAGE | 51 | /* |
57 | acpi_status | 52 | * If possible, pack the following structures to byte alignment, since we |
58 | acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); | 53 | * don't care about performance for debug output |
59 | #endif /* ACPI_FUTURE_USAGE */ | 54 | */ |
60 | 55 | #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED | |
61 | acpi_status | 56 | #pragma pack(1) |
62 | acpi_rs_get_method_data(acpi_handle handle, | 57 | #endif |
63 | char *path, struct acpi_buffer *ret_buffer); | ||
64 | 58 | ||
65 | acpi_status | 59 | /* |
66 | acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); | 60 | * Individual entry for the resource conversion tables |
61 | */ | ||
62 | typedef const struct acpi_rsconvert_info { | ||
63 | u8 opcode; | ||
64 | u8 resource_offset; | ||
65 | u8 aml_offset; | ||
66 | u8 value; | ||
67 | |||
68 | } acpi_rsconvert_info; | ||
69 | |||
70 | /* Resource conversion opcodes */ | ||
71 | |||
72 | #define ACPI_RSC_INITGET 0 | ||
73 | #define ACPI_RSC_INITSET 1 | ||
74 | #define ACPI_RSC_FLAGINIT 2 | ||
75 | #define ACPI_RSC_1BITFLAG 3 | ||
76 | #define ACPI_RSC_2BITFLAG 4 | ||
77 | #define ACPI_RSC_COUNT 5 | ||
78 | #define ACPI_RSC_COUNT16 6 | ||
79 | #define ACPI_RSC_LENGTH 7 | ||
80 | #define ACPI_RSC_MOVE8 8 | ||
81 | #define ACPI_RSC_MOVE16 9 | ||
82 | #define ACPI_RSC_MOVE32 10 | ||
83 | #define ACPI_RSC_MOVE64 11 | ||
84 | #define ACPI_RSC_SET8 12 | ||
85 | #define ACPI_RSC_DATA8 13 | ||
86 | #define ACPI_RSC_ADDRESS 14 | ||
87 | #define ACPI_RSC_SOURCE 15 | ||
88 | #define ACPI_RSC_SOURCEX 16 | ||
89 | #define ACPI_RSC_BITMASK 17 | ||
90 | #define ACPI_RSC_BITMASK16 18 | ||
91 | #define ACPI_RSC_EXIT_NE 19 | ||
92 | #define ACPI_RSC_EXIT_LE 20 | ||
93 | |||
94 | /* Resource Conversion sub-opcodes */ | ||
95 | |||
96 | #define ACPI_RSC_COMPARE_AML_LENGTH 0 | ||
97 | #define ACPI_RSC_COMPARE_VALUE 1 | ||
98 | |||
99 | #define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (struct acpi_rsconvert_info)) | ||
100 | |||
101 | #define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f) | ||
102 | #define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f) | ||
103 | |||
104 | typedef const struct acpi_rsdump_info { | ||
105 | u8 opcode; | ||
106 | u8 offset; | ||
107 | char *name; | ||
108 | const char **pointer; | ||
109 | |||
110 | } acpi_rsdump_info; | ||
111 | |||
112 | /* Values for the Opcode field above */ | ||
113 | |||
114 | #define ACPI_RSD_TITLE 0 | ||
115 | #define ACPI_RSD_LITERAL 1 | ||
116 | #define ACPI_RSD_STRING 2 | ||
117 | #define ACPI_RSD_UINT8 3 | ||
118 | #define ACPI_RSD_UINT16 4 | ||
119 | #define ACPI_RSD_UINT32 5 | ||
120 | #define ACPI_RSD_UINT64 6 | ||
121 | #define ACPI_RSD_1BITFLAG 7 | ||
122 | #define ACPI_RSD_2BITFLAG 8 | ||
123 | #define ACPI_RSD_SHORTLIST 9 | ||
124 | #define ACPI_RSD_LONGLIST 10 | ||
125 | #define ACPI_RSD_DWORDLIST 11 | ||
126 | #define ACPI_RSD_ADDRESS 12 | ||
127 | #define ACPI_RSD_SOURCE 13 | ||
128 | |||
129 | /* restore default alignment */ | ||
130 | |||
131 | #pragma pack() | ||
132 | |||
133 | /* Resource tables indexed by internal resource type */ | ||
134 | |||
135 | extern const u8 acpi_gbl_aml_resource_sizes[]; | ||
136 | extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[]; | ||
137 | |||
138 | /* Resource tables indexed by raw AML resource descriptor type */ | ||
139 | |||
140 | extern const u8 acpi_gbl_resource_struct_sizes[]; | ||
141 | extern struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[]; | ||
142 | |||
143 | struct acpi_vendor_walk_info { | ||
144 | struct acpi_vendor_uuid *uuid; | ||
145 | struct acpi_buffer *buffer; | ||
146 | acpi_status status; | ||
147 | }; | ||
67 | 148 | ||
149 | /* | ||
150 | * rscreate | ||
151 | */ | ||
68 | acpi_status | 152 | acpi_status |
69 | acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, | 153 | acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, |
70 | struct acpi_buffer *output_buffer); | 154 | struct acpi_buffer *output_buffer); |
71 | 155 | ||
72 | acpi_status | 156 | acpi_status |
73 | acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, | 157 | acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, |
74 | struct acpi_buffer *output_buffer); | 158 | struct acpi_buffer *output_buffer); |
75 | 159 | ||
76 | acpi_status | 160 | acpi_status |
77 | acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | 161 | acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, |
78 | struct acpi_buffer *output_buffer); | 162 | struct acpi_buffer *output_buffer); |
79 | 163 | ||
80 | /* | 164 | /* |
81 | * rsdump | 165 | * rsutils |
82 | */ | 166 | */ |
83 | #ifdef ACPI_FUTURE_USAGE | ||
84 | void acpi_rs_dump_resource_list(struct acpi_resource *resource); | ||
85 | |||
86 | void acpi_rs_dump_irq_list(u8 * route_table); | ||
87 | #endif /* ACPI_FUTURE_USAGE */ | ||
88 | |||
89 | /* | ||
90 | * rscalc | ||
91 | */ | ||
92 | acpi_status | ||
93 | acpi_rs_get_byte_stream_start(u8 * byte_stream_buffer, | ||
94 | u8 ** byte_stream_start, u32 * size); | ||
95 | |||
96 | acpi_status | ||
97 | acpi_rs_get_list_length(u8 * byte_stream_buffer, | ||
98 | u32 byte_stream_buffer_length, acpi_size * size_needed); | ||
99 | |||
100 | acpi_status | ||
101 | acpi_rs_get_byte_stream_length(struct acpi_resource *linked_list_buffer, | ||
102 | acpi_size * size_needed); | ||
103 | |||
104 | acpi_status | ||
105 | acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | ||
106 | acpi_size * buffer_size_needed); | ||
107 | |||
108 | acpi_status | ||
109 | acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, | ||
110 | u32 byte_stream_buffer_length, u8 * output_buffer); | ||
111 | |||
112 | acpi_status | ||
113 | acpi_rs_list_to_byte_stream(struct acpi_resource *linked_list, | ||
114 | acpi_size byte_stream_size_needed, | ||
115 | u8 * output_buffer); | ||
116 | |||
117 | acpi_status | ||
118 | acpi_rs_io_resource(u8 * byte_stream_buffer, | ||
119 | acpi_size * bytes_consumed, | ||
120 | u8 ** output_buffer, acpi_size * structure_size); | ||
121 | |||
122 | acpi_status | ||
123 | acpi_rs_fixed_io_resource(u8 * byte_stream_buffer, | ||
124 | acpi_size * bytes_consumed, | ||
125 | u8 ** output_buffer, acpi_size * structure_size); | ||
126 | |||
127 | acpi_status | 167 | acpi_status |
128 | acpi_rs_io_stream(struct acpi_resource *linked_list, | 168 | acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); |
129 | u8 ** output_buffer, acpi_size * bytes_consumed); | ||
130 | |||
131 | acpi_status | ||
132 | acpi_rs_fixed_io_stream(struct acpi_resource *linked_list, | ||
133 | u8 ** output_buffer, acpi_size * bytes_consumed); | ||
134 | |||
135 | acpi_status | ||
136 | acpi_rs_irq_resource(u8 * byte_stream_buffer, | ||
137 | acpi_size * bytes_consumed, | ||
138 | u8 ** output_buffer, acpi_size * structure_size); | ||
139 | |||
140 | acpi_status | ||
141 | acpi_rs_irq_stream(struct acpi_resource *linked_list, | ||
142 | u8 ** output_buffer, acpi_size * bytes_consumed); | ||
143 | |||
144 | acpi_status | ||
145 | acpi_rs_dma_resource(u8 * byte_stream_buffer, | ||
146 | acpi_size * bytes_consumed, | ||
147 | u8 ** output_buffer, acpi_size * structure_size); | ||
148 | 169 | ||
149 | acpi_status | 170 | acpi_status |
150 | acpi_rs_dma_stream(struct acpi_resource *linked_list, | 171 | acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); |
151 | u8 ** output_buffer, acpi_size * bytes_consumed); | ||
152 | 172 | ||
173 | #ifdef ACPI_FUTURE_USAGE | ||
153 | acpi_status | 174 | acpi_status |
154 | acpi_rs_address16_resource(u8 * byte_stream_buffer, | 175 | acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); |
155 | acpi_size * bytes_consumed, | 176 | #endif /* ACPI_FUTURE_USAGE */ |
156 | u8 ** output_buffer, acpi_size * structure_size); | ||
157 | 177 | ||
158 | acpi_status | 178 | acpi_status |
159 | acpi_rs_address16_stream(struct acpi_resource *linked_list, | 179 | acpi_rs_get_method_data(acpi_handle handle, |
160 | u8 ** output_buffer, acpi_size * bytes_consumed); | 180 | char *path, struct acpi_buffer *ret_buffer); |
161 | 181 | ||
162 | acpi_status | 182 | acpi_status |
163 | acpi_rs_address32_resource(u8 * byte_stream_buffer, | 183 | acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); |
164 | acpi_size * bytes_consumed, | ||
165 | u8 ** output_buffer, acpi_size * structure_size); | ||
166 | 184 | ||
185 | /* | ||
186 | * rscalc | ||
187 | */ | ||
167 | acpi_status | 188 | acpi_status |
168 | acpi_rs_address32_stream(struct acpi_resource *linked_list, | 189 | acpi_rs_get_list_length(u8 * aml_buffer, |
169 | u8 ** output_buffer, acpi_size * bytes_consumed); | 190 | u32 aml_buffer_length, acpi_size * size_needed); |
170 | 191 | ||
171 | acpi_status | 192 | acpi_status |
172 | acpi_rs_address64_resource(u8 * byte_stream_buffer, | 193 | acpi_rs_get_aml_length(struct acpi_resource *linked_list_buffer, |
173 | acpi_size * bytes_consumed, | 194 | acpi_size * size_needed); |
174 | u8 ** output_buffer, acpi_size * structure_size); | ||
175 | 195 | ||
176 | acpi_status | 196 | acpi_status |
177 | acpi_rs_address64_stream(struct acpi_resource *linked_list, | 197 | acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, |
178 | u8 ** output_buffer, acpi_size * bytes_consumed); | 198 | acpi_size * buffer_size_needed); |
179 | 199 | ||
180 | acpi_status | 200 | acpi_status |
181 | acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer, | 201 | acpi_rs_convert_aml_to_resources(u8 * aml_buffer, |
182 | acpi_size * bytes_consumed, | 202 | u32 aml_buffer_length, u8 * output_buffer); |
183 | u8 ** output_buffer, | ||
184 | acpi_size * structure_size); | ||
185 | 203 | ||
186 | acpi_status | 204 | acpi_status |
187 | acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer, | 205 | acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, |
188 | acpi_size * bytes_consumed, | 206 | acpi_size aml_size_needed, u8 * output_buffer); |
189 | u8 ** output_buffer, | ||
190 | acpi_size * structure_size); | ||
191 | 207 | ||
192 | acpi_status | 208 | /* |
193 | acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list, | 209 | * rsaddr |
194 | u8 ** output_buffer, | 210 | */ |
195 | acpi_size * bytes_consumed); | 211 | void |
212 | acpi_rs_set_address_common(union aml_resource *aml, | ||
213 | struct acpi_resource *resource); | ||
196 | 214 | ||
197 | acpi_status | 215 | u8 |
198 | acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list, | 216 | acpi_rs_get_address_common(struct acpi_resource *resource, |
199 | u8 ** output_buffer, acpi_size * bytes_consumed); | 217 | union aml_resource *aml); |
200 | 218 | ||
219 | /* | ||
220 | * rsmisc | ||
221 | */ | ||
201 | acpi_status | 222 | acpi_status |
202 | acpi_rs_memory24_resource(u8 * byte_stream_buffer, | 223 | acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, |
203 | acpi_size * bytes_consumed, | 224 | union aml_resource *aml, |
204 | u8 ** output_buffer, acpi_size * structure_size); | 225 | struct acpi_rsconvert_info *info); |
205 | 226 | ||
206 | acpi_status | 227 | acpi_status |
207 | acpi_rs_memory24_stream(struct acpi_resource *linked_list, | 228 | acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, |
208 | u8 ** output_buffer, acpi_size * bytes_consumed); | 229 | union aml_resource *aml, |
230 | struct acpi_rsconvert_info *info); | ||
209 | 231 | ||
210 | acpi_status | 232 | /* |
211 | acpi_rs_memory32_range_resource(u8 * byte_stream_buffer, | 233 | * rsutils |
212 | acpi_size * bytes_consumed, | 234 | */ |
213 | u8 ** output_buffer, | 235 | void |
214 | acpi_size * structure_size); | 236 | acpi_rs_move_data(void *destination, |
237 | void *source, u16 item_count, u8 move_type); | ||
215 | 238 | ||
216 | acpi_status | 239 | u8 acpi_rs_decode_bitmask(u16 mask, u8 * list); |
217 | acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer, | ||
218 | acpi_size * bytes_consumed, | ||
219 | u8 ** output_buffer, | ||
220 | acpi_size * structure_size); | ||
221 | 240 | ||
222 | acpi_status | 241 | u16 acpi_rs_encode_bitmask(u8 * list, u8 count); |
223 | acpi_rs_memory32_range_stream(struct acpi_resource *linked_list, | ||
224 | u8 ** output_buffer, acpi_size * bytes_consumed); | ||
225 | 242 | ||
226 | acpi_status | 243 | acpi_rs_length |
227 | acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list, | 244 | acpi_rs_get_resource_source(acpi_rs_length resource_length, |
228 | u8 ** output_buffer, acpi_size * bytes_consumed); | 245 | acpi_rs_length minimum_length, |
246 | struct acpi_resource_source *resource_source, | ||
247 | union aml_resource *aml, char *string_ptr); | ||
229 | 248 | ||
230 | acpi_status | 249 | acpi_rsdesc_size |
231 | acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, | 250 | acpi_rs_set_resource_source(union aml_resource *aml, |
232 | acpi_size * bytes_consumed, | 251 | acpi_rs_length minimum_length, |
233 | u8 ** output_buffer, acpi_size * structure_size); | 252 | struct acpi_resource_source *resource_source); |
234 | 253 | ||
235 | acpi_status | 254 | void |
236 | acpi_rs_extended_irq_stream(struct acpi_resource *linked_list, | 255 | acpi_rs_set_resource_header(u8 descriptor_type, |
237 | u8 ** output_buffer, acpi_size * bytes_consumed); | 256 | acpi_rsdesc_size total_length, |
257 | union aml_resource *aml); | ||
238 | 258 | ||
239 | acpi_status | 259 | void |
240 | acpi_rs_end_tag_resource(u8 * byte_stream_buffer, | 260 | acpi_rs_set_resource_length(acpi_rsdesc_size total_length, |
241 | acpi_size * bytes_consumed, | 261 | union aml_resource *aml); |
242 | u8 ** output_buffer, acpi_size * structure_size); | ||
243 | 262 | ||
244 | acpi_status | 263 | /* |
245 | acpi_rs_end_tag_stream(struct acpi_resource *linked_list, | 264 | * rsdump |
246 | u8 ** output_buffer, acpi_size * bytes_consumed); | 265 | */ |
266 | void acpi_rs_dump_resource_list(struct acpi_resource *resource); | ||
247 | 267 | ||
248 | acpi_status | 268 | void acpi_rs_dump_irq_list(u8 * route_table); |
249 | acpi_rs_vendor_resource(u8 * byte_stream_buffer, | ||
250 | acpi_size * bytes_consumed, | ||
251 | u8 ** output_buffer, acpi_size * structure_size); | ||
252 | 269 | ||
253 | acpi_status | 270 | /* |
254 | acpi_rs_vendor_stream(struct acpi_resource *linked_list, | 271 | * Resource conversion tables |
255 | u8 ** output_buffer, acpi_size * bytes_consumed); | 272 | */ |
273 | extern struct acpi_rsconvert_info acpi_rs_convert_dma[]; | ||
274 | extern struct acpi_rsconvert_info acpi_rs_convert_end_dpf[]; | ||
275 | extern struct acpi_rsconvert_info acpi_rs_convert_io[]; | ||
276 | extern struct acpi_rsconvert_info acpi_rs_convert_fixed_io[]; | ||
277 | extern struct acpi_rsconvert_info acpi_rs_convert_end_tag[]; | ||
278 | extern struct acpi_rsconvert_info acpi_rs_convert_memory24[]; | ||
279 | extern struct acpi_rsconvert_info acpi_rs_convert_generic_reg[]; | ||
280 | extern struct acpi_rsconvert_info acpi_rs_convert_memory32[]; | ||
281 | extern struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[]; | ||
282 | extern struct acpi_rsconvert_info acpi_rs_convert_address32[]; | ||
283 | extern struct acpi_rsconvert_info acpi_rs_convert_address16[]; | ||
284 | extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[]; | ||
285 | extern struct acpi_rsconvert_info acpi_rs_convert_address64[]; | ||
286 | extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[]; | ||
287 | |||
288 | /* These resources require separate get/set tables */ | ||
289 | |||
290 | extern struct acpi_rsconvert_info acpi_rs_get_irq[]; | ||
291 | extern struct acpi_rsconvert_info acpi_rs_get_start_dpf[]; | ||
292 | extern struct acpi_rsconvert_info acpi_rs_get_vendor_small[]; | ||
293 | extern struct acpi_rsconvert_info acpi_rs_get_vendor_large[]; | ||
294 | |||
295 | extern struct acpi_rsconvert_info acpi_rs_set_irq[]; | ||
296 | extern struct acpi_rsconvert_info acpi_rs_set_start_dpf[]; | ||
297 | extern struct acpi_rsconvert_info acpi_rs_set_vendor[]; | ||
298 | |||
299 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
300 | /* | ||
301 | * rsinfo | ||
302 | */ | ||
303 | extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[]; | ||
256 | 304 | ||
257 | u8 acpi_rs_get_resource_type(u8 resource_start_byte); | 305 | /* |
306 | * rsdump | ||
307 | */ | ||
308 | extern struct acpi_rsdump_info acpi_rs_dump_irq[]; | ||
309 | extern struct acpi_rsdump_info acpi_rs_dump_dma[]; | ||
310 | extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[]; | ||
311 | extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[]; | ||
312 | extern struct acpi_rsdump_info acpi_rs_dump_io[]; | ||
313 | extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[]; | ||
314 | extern struct acpi_rsdump_info acpi_rs_dump_vendor[]; | ||
315 | extern struct acpi_rsdump_info acpi_rs_dump_end_tag[]; | ||
316 | extern struct acpi_rsdump_info acpi_rs_dump_memory24[]; | ||
317 | extern struct acpi_rsdump_info acpi_rs_dump_memory32[]; | ||
318 | extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[]; | ||
319 | extern struct acpi_rsdump_info acpi_rs_dump_address16[]; | ||
320 | extern struct acpi_rsdump_info acpi_rs_dump_address32[]; | ||
321 | extern struct acpi_rsdump_info acpi_rs_dump_address64[]; | ||
322 | extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[]; | ||
323 | extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[]; | ||
324 | extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[]; | ||
325 | #endif | ||
258 | 326 | ||
259 | #endif /* __ACRESRC_H__ */ | 327 | #endif /* __ACRESRC_H__ */ |
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index a46f406e1c94..ef2ddcadfe61 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h | |||
@@ -45,6 +45,12 @@ | |||
45 | #define __ACTBL_H__ | 45 | #define __ACTBL_H__ |
46 | 46 | ||
47 | /* | 47 | /* |
48 | * Note about bitfields: The u8 type is used for bitfields in ACPI tables. | ||
49 | * This is the only type that is even remotely portable. Anything else is not | ||
50 | * portable, so do not use any other bitfield types. | ||
51 | */ | ||
52 | |||
53 | /* | ||
48 | * Values for description table header signatures | 54 | * Values for description table header signatures |
49 | */ | 55 | */ |
50 | #define RSDP_NAME "RSDP" | 56 | #define RSDP_NAME "RSDP" |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 6213b27516e8..18e1338c5c7f 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
@@ -44,7 +44,15 @@ | |||
44 | #ifndef __ACTYPES_H__ | 44 | #ifndef __ACTYPES_H__ |
45 | #define __ACTYPES_H__ | 45 | #define __ACTYPES_H__ |
46 | 46 | ||
47 | /*! [Begin] no source code translation (keep the typedefs) */ | 47 | /* |
48 | * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header | ||
49 | * and must be either 16, 32, or 64 | ||
50 | */ | ||
51 | #ifndef ACPI_MACHINE_WIDTH | ||
52 | #error ACPI_MACHINE_WIDTH not defined | ||
53 | #endif | ||
54 | |||
55 | /*! [Begin] no source code translation */ | ||
48 | 56 | ||
49 | /* | 57 | /* |
50 | * Data type ranges | 58 | * Data type ranges |
@@ -58,87 +66,150 @@ | |||
58 | #define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ | 66 | #define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ |
59 | #define ACPI_ASCII_MAX 0x7F | 67 | #define ACPI_ASCII_MAX 0x7F |
60 | 68 | ||
61 | #ifdef DEFINE_ALTERNATE_TYPES | ||
62 | /* | 69 | /* |
63 | * Types used only in translated source, defined here to enable | 70 | * Architecture-specific ACPICA Subsystem Data Types |
64 | * cross-platform compilation only. | 71 | * |
72 | * The goal of these types is to provide source code portability across | ||
73 | * 16-bit, 32-bit, and 64-bit targets. | ||
74 | * | ||
75 | * 1) The following types are of fixed size for all targets (16/32/64): | ||
76 | * | ||
77 | * BOOLEAN Logical boolean | ||
78 | * | ||
79 | * UINT8 8-bit (1 byte) unsigned value | ||
80 | * UINT16 16-bit (2 byte) unsigned value | ||
81 | * UINT32 32-bit (4 byte) unsigned value | ||
82 | * UINT64 64-bit (8 byte) unsigned value | ||
83 | * | ||
84 | * INT16 16-bit (2 byte) signed value | ||
85 | * INT32 32-bit (4 byte) signed value | ||
86 | * INT64 64-bit (8 byte) signed value | ||
87 | * | ||
88 | * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the | ||
89 | * compiler-dependent header(s) and were introduced because there is no common | ||
90 | * 64-bit integer type across the various compilation models, as shown in | ||
91 | * the table below. | ||
92 | * | ||
93 | * Datatype LP64 ILP64 LLP64 ILP32 LP32 16bit | ||
94 | * char 8 8 8 8 8 8 | ||
95 | * short 16 16 16 16 16 16 | ||
96 | * _int32 32 | ||
97 | * int 32 64 32 32 16 16 | ||
98 | * long 64 64 32 32 32 32 | ||
99 | * long long 64 64 | ||
100 | * pointer 64 64 64 32 32 32 | ||
101 | * | ||
102 | * Note: ILP64 and LP32 are currently not supported. | ||
103 | * | ||
104 | * | ||
105 | * 2) These types represent the native word size of the target mode of the | ||
106 | * processor, and may be 16-bit, 32-bit, or 64-bit as required. They are | ||
107 | * usually used for memory allocation, efficient loop counters, and array | ||
108 | * indexes. The types are similar to the size_t type in the C library and are | ||
109 | * required because there is no C type that consistently represents the native | ||
110 | * data width. | ||
111 | * | ||
112 | * ACPI_SIZE 16/32/64-bit unsigned value | ||
113 | * ACPI_NATIVE_UINT 16/32/64-bit unsigned value | ||
114 | * ACPI_NATIVE_INT 16/32/64-bit signed value | ||
115 | * | ||
65 | */ | 116 | */ |
66 | typedef int s32; | ||
67 | typedef unsigned char u8; | ||
68 | typedef unsigned short u16; | ||
69 | typedef unsigned int u32; | ||
70 | typedef COMPILER_DEPENDENT_UINT64 u64; | ||
71 | 117 | ||
72 | #endif | 118 | /******************************************************************************* |
73 | |||
74 | /* | ||
75 | * Data types - Fixed across all compilation models (16/32/64) | ||
76 | * | 119 | * |
77 | * BOOLEAN Logical Boolean. | 120 | * Common types for all compilers, all targets |
78 | * INT8 8-bit (1 byte) signed value | 121 | * |
79 | * UINT8 8-bit (1 byte) unsigned value | 122 | ******************************************************************************/ |
80 | * INT16 16-bit (2 byte) signed value | ||
81 | * UINT16 16-bit (2 byte) unsigned value | ||
82 | * INT32 32-bit (4 byte) signed value | ||
83 | * UINT32 32-bit (4 byte) unsigned value | ||
84 | * INT64 64-bit (8 byte) signed value | ||
85 | * UINT64 64-bit (8 byte) unsigned value | ||
86 | * ACPI_NATIVE_INT 32-bit on IA-32, 64-bit on IA-64 signed value | ||
87 | * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value | ||
88 | */ | ||
89 | 123 | ||
90 | #ifndef ACPI_MACHINE_WIDTH | 124 | typedef unsigned char BOOLEAN; |
91 | #error ACPI_MACHINE_WIDTH not defined | 125 | typedef unsigned char UINT8; |
92 | #endif | 126 | typedef unsigned short UINT16; |
127 | typedef COMPILER_DEPENDENT_UINT64 UINT64; | ||
128 | typedef COMPILER_DEPENDENT_INT64 INT64; | ||
129 | |||
130 | /*! [End] no source code translation !*/ | ||
131 | |||
132 | /******************************************************************************* | ||
133 | * | ||
134 | * Types specific to 64-bit targets | ||
135 | * | ||
136 | ******************************************************************************/ | ||
93 | 137 | ||
94 | #if ACPI_MACHINE_WIDTH == 64 | 138 | #if ACPI_MACHINE_WIDTH == 64 |
95 | 139 | ||
96 | /*! [Begin] no source code translation (keep the typedefs) */ | 140 | /*! [Begin] no source code translation (keep the typedefs as-is) */ |
97 | 141 | ||
98 | /* | ||
99 | * 64-bit type definitions | ||
100 | */ | ||
101 | typedef unsigned char UINT8; | ||
102 | typedef unsigned char BOOLEAN; | ||
103 | typedef unsigned short UINT16; | ||
104 | typedef int INT32; | ||
105 | typedef unsigned int UINT32; | 142 | typedef unsigned int UINT32; |
106 | typedef COMPILER_DEPENDENT_INT64 INT64; | 143 | typedef int INT32; |
107 | typedef COMPILER_DEPENDENT_UINT64 UINT64; | ||
108 | 144 | ||
109 | /*! [End] no source code translation !*/ | 145 | /*! [End] no source code translation !*/ |
110 | 146 | ||
111 | typedef s64 acpi_native_int; | ||
112 | typedef u64 acpi_native_uint; | 147 | typedef u64 acpi_native_uint; |
148 | typedef s64 acpi_native_int; | ||
113 | 149 | ||
114 | typedef u64 acpi_table_ptr; | 150 | typedef u64 acpi_table_ptr; |
115 | typedef u64 acpi_io_address; | 151 | typedef u64 acpi_io_address; |
116 | typedef u64 acpi_physical_address; | 152 | typedef u64 acpi_physical_address; |
117 | typedef u64 acpi_size; | ||
118 | 153 | ||
119 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */ | ||
120 | #define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */ | ||
121 | #define ACPI_MAX_PTR ACPI_UINT64_MAX | 154 | #define ACPI_MAX_PTR ACPI_UINT64_MAX |
122 | #define ACPI_SIZE_MAX ACPI_UINT64_MAX | 155 | #define ACPI_SIZE_MAX ACPI_UINT64_MAX |
123 | 156 | ||
124 | #elif ACPI_MACHINE_WIDTH == 16 | 157 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000008 |
125 | 158 | #define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ | |
126 | /*! [Begin] no source code translation (keep the typedefs) */ | ||
127 | 159 | ||
128 | /* | 160 | /* |
129 | * 16-bit type definitions | 161 | * In the case of the Itanium Processor Family (IPF), the hardware does not |
162 | * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag | ||
163 | * to indicate that special precautions must be taken to avoid alignment faults. | ||
164 | * (IA64 or ia64 is currently used by existing compilers to indicate IPF.) | ||
165 | * | ||
166 | * Note: Em64_t and other X86-64 processors support misaligned transfers, | ||
167 | * so there is no need to define this flag. | ||
130 | */ | 168 | */ |
131 | typedef unsigned char UINT8; | 169 | #if defined (__IA64__) || defined (__ia64__) |
132 | typedef unsigned char BOOLEAN; | 170 | #define ACPI_MISALIGNMENT_NOT_SUPPORTED |
133 | typedef unsigned int UINT16; | 171 | #endif |
134 | typedef long INT32; | ||
135 | typedef int INT16; | ||
136 | typedef unsigned long UINT32; | ||
137 | 172 | ||
138 | struct { | 173 | /******************************************************************************* |
139 | UINT32 Lo; | 174 | * |
140 | UINT32 Hi; | 175 | * Types specific to 32-bit targets |
141 | }; | 176 | * |
177 | ******************************************************************************/ | ||
178 | |||
179 | #elif ACPI_MACHINE_WIDTH == 32 | ||
180 | |||
181 | /*! [Begin] no source code translation (keep the typedefs as-is) */ | ||
182 | |||
183 | typedef unsigned int UINT32; | ||
184 | typedef int INT32; | ||
185 | |||
186 | /*! [End] no source code translation !*/ | ||
187 | |||
188 | typedef u32 acpi_native_uint; | ||
189 | typedef s32 acpi_native_int; | ||
190 | |||
191 | typedef u64 acpi_table_ptr; | ||
192 | typedef u32 acpi_io_address; | ||
193 | typedef u64 acpi_physical_address; | ||
194 | |||
195 | #define ACPI_MAX_PTR ACPI_UINT32_MAX | ||
196 | #define ACPI_SIZE_MAX ACPI_UINT32_MAX | ||
197 | |||
198 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000004 | ||
199 | |||
200 | /******************************************************************************* | ||
201 | * | ||
202 | * Types specific to 16-bit targets | ||
203 | * | ||
204 | ******************************************************************************/ | ||
205 | |||
206 | #elif ACPI_MACHINE_WIDTH == 16 | ||
207 | |||
208 | /*! [Begin] no source code translation (keep the typedefs as-is) */ | ||
209 | |||
210 | typedef unsigned long UINT32; | ||
211 | typedef short INT16; | ||
212 | typedef long INT32; | ||
142 | 213 | ||
143 | /*! [End] no source code translation !*/ | 214 | /*! [End] no source code translation !*/ |
144 | 215 | ||
@@ -148,61 +219,57 @@ typedef s16 acpi_native_int; | |||
148 | typedef u32 acpi_table_ptr; | 219 | typedef u32 acpi_table_ptr; |
149 | typedef u32 acpi_io_address; | 220 | typedef u32 acpi_io_address; |
150 | typedef char *acpi_physical_address; | 221 | typedef char *acpi_physical_address; |
151 | typedef u16 acpi_size; | ||
152 | 222 | ||
153 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000002 | ||
154 | #define ACPI_MISALIGNED_TRANSFERS | ||
155 | #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ | ||
156 | #define ACPI_MAX_PTR ACPI_UINT16_MAX | 223 | #define ACPI_MAX_PTR ACPI_UINT16_MAX |
157 | #define ACPI_SIZE_MAX ACPI_UINT16_MAX | 224 | #define ACPI_SIZE_MAX ACPI_UINT16_MAX |
158 | 225 | ||
159 | /* | 226 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000002 |
160 | * (16-bit only) internal integers must be 32-bits, so | 227 | #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ |
161 | * 64-bit integers cannot be supported | ||
162 | */ | ||
163 | #define ACPI_NO_INTEGER64_SUPPORT | ||
164 | |||
165 | #elif ACPI_MACHINE_WIDTH == 32 | ||
166 | 228 | ||
167 | /*! [Begin] no source code translation (keep the typedefs) */ | 229 | /* 64-bit integers cannot be supported */ |
168 | 230 | ||
169 | /* | 231 | #define ACPI_NO_INTEGER64_SUPPORT |
170 | * 32-bit type definitions (default) | ||
171 | */ | ||
172 | typedef unsigned char UINT8; | ||
173 | typedef unsigned char BOOLEAN; | ||
174 | typedef unsigned short UINT16; | ||
175 | typedef int INT32; | ||
176 | typedef unsigned int UINT32; | ||
177 | typedef COMPILER_DEPENDENT_INT64 INT64; | ||
178 | typedef COMPILER_DEPENDENT_UINT64 UINT64; | ||
179 | 232 | ||
180 | /*! [End] no source code translation !*/ | 233 | #else |
181 | 234 | ||
182 | typedef s32 acpi_native_int; | 235 | /* ACPI_MACHINE_WIDTH must be either 64, 32, or 16 */ |
183 | typedef u32 acpi_native_uint; | ||
184 | 236 | ||
185 | typedef u64 acpi_table_ptr; | 237 | #error unknown ACPI_MACHINE_WIDTH |
186 | typedef u32 acpi_io_address; | 238 | #endif |
187 | typedef u64 acpi_physical_address; | ||
188 | typedef u32 acpi_size; | ||
189 | 239 | ||
190 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000004 | 240 | /******************************************************************************* |
191 | #define ACPI_MISALIGNED_TRANSFERS | 241 | * |
192 | #define ACPI_MAX_PTR ACPI_UINT32_MAX | 242 | * OS- or compiler-dependent types |
193 | #define ACPI_SIZE_MAX ACPI_UINT32_MAX | 243 | * |
244 | ******************************************************************************/ | ||
194 | 245 | ||
195 | #else | 246 | /* |
196 | #error unknown ACPI_MACHINE_WIDTH | 247 | * If acpi_uintptr_t was not defined in the OS- or compiler-dependent header, |
248 | * define it now (use C99 uintptr_t for pointer casting if available, | ||
249 | * "void *" otherwise) | ||
250 | */ | ||
251 | #ifndef acpi_uintptr_t | ||
252 | #define acpi_uintptr_t void * | ||
197 | #endif | 253 | #endif |
198 | 254 | ||
199 | /* | 255 | /* |
200 | * This type is used for bitfields in ACPI tables. The only type that is | 256 | * If acpi_cache_t was not defined in the OS-dependent header, |
201 | * even remotely portable is u8. Anything else is not portable, so | 257 | * define it now. This is typically the case where the local cache |
202 | * do not add any more bitfield types. | 258 | * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) |
203 | */ | 259 | */ |
204 | typedef u8 UINT8_BIT; | 260 | #ifndef acpi_cache_t |
205 | typedef acpi_native_uint ACPI_PTRDIFF; | 261 | #define acpi_cache_t struct acpi_memory_list |
262 | #endif | ||
263 | |||
264 | /* Variable-width type, used instead of clib size_t */ | ||
265 | |||
266 | typedef acpi_native_uint acpi_size; | ||
267 | |||
268 | /******************************************************************************* | ||
269 | * | ||
270 | * Independent types | ||
271 | * | ||
272 | ******************************************************************************/ | ||
206 | 273 | ||
207 | /* | 274 | /* |
208 | * Pointer overlays to avoid lots of typecasting for | 275 | * Pointer overlays to avoid lots of typecasting for |
@@ -234,18 +301,8 @@ struct acpi_pointer { | |||
234 | #define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER | 301 | #define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER |
235 | #define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER | 302 | #define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER |
236 | 303 | ||
237 | /* | 304 | /* Logical defines and NULL */ |
238 | * If acpi_cache_t was not defined in the OS-dependent header, | ||
239 | * define it now. This is typically the case where the local cache | ||
240 | * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) | ||
241 | */ | ||
242 | #ifndef acpi_cache_t | ||
243 | #define acpi_cache_t struct acpi_memory_list | ||
244 | #endif | ||
245 | 305 | ||
246 | /* | ||
247 | * Useful defines | ||
248 | */ | ||
249 | #ifdef FALSE | 306 | #ifdef FALSE |
250 | #undef FALSE | 307 | #undef FALSE |
251 | #endif | 308 | #endif |
@@ -261,12 +318,12 @@ struct acpi_pointer { | |||
261 | #endif | 318 | #endif |
262 | 319 | ||
263 | /* | 320 | /* |
264 | * Local datatypes | 321 | * Mescellaneous types |
265 | */ | 322 | */ |
266 | typedef u32 acpi_status; /* All ACPI Exceptions */ | 323 | typedef u32 acpi_status; /* All ACPI Exceptions */ |
267 | typedef u32 acpi_name; /* 4-byte ACPI name */ | 324 | typedef u32 acpi_name; /* 4-byte ACPI name */ |
268 | typedef char *acpi_string; /* Null terminated ASCII string */ | 325 | typedef char *acpi_string; /* Null terminated ASCII string */ |
269 | typedef void *acpi_handle; /* Actually a ptr to an Node */ | 326 | typedef void *acpi_handle; /* Actually a ptr to a NS Node */ |
270 | 327 | ||
271 | struct uint64_struct { | 328 | struct uint64_struct { |
272 | u32 lo; | 329 | u32 lo; |
@@ -323,7 +380,7 @@ typedef u64 acpi_integer; | |||
323 | /* | 380 | /* |
324 | * Constants with special meanings | 381 | * Constants with special meanings |
325 | */ | 382 | */ |
326 | #define ACPI_ROOT_OBJECT (acpi_handle) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR) | 383 | #define ACPI_ROOT_OBJECT ACPI_ADD_PTR (acpi_handle, NULL, ACPI_MAX_PTR) |
327 | 384 | ||
328 | /* | 385 | /* |
329 | * Initialization sequence | 386 | * Initialization sequence |
@@ -470,37 +527,6 @@ typedef u32 acpi_object_type; | |||
470 | #define ACPI_TYPE_NOT_FOUND 0xFF | 527 | #define ACPI_TYPE_NOT_FOUND 0xFF |
471 | 528 | ||
472 | /* | 529 | /* |
473 | * Bitmapped ACPI types. Used internally only | ||
474 | */ | ||
475 | #define ACPI_BTYPE_ANY 0x00000000 | ||
476 | #define ACPI_BTYPE_INTEGER 0x00000001 | ||
477 | #define ACPI_BTYPE_STRING 0x00000002 | ||
478 | #define ACPI_BTYPE_BUFFER 0x00000004 | ||
479 | #define ACPI_BTYPE_PACKAGE 0x00000008 | ||
480 | #define ACPI_BTYPE_FIELD_UNIT 0x00000010 | ||
481 | #define ACPI_BTYPE_DEVICE 0x00000020 | ||
482 | #define ACPI_BTYPE_EVENT 0x00000040 | ||
483 | #define ACPI_BTYPE_METHOD 0x00000080 | ||
484 | #define ACPI_BTYPE_MUTEX 0x00000100 | ||
485 | #define ACPI_BTYPE_REGION 0x00000200 | ||
486 | #define ACPI_BTYPE_POWER 0x00000400 | ||
487 | #define ACPI_BTYPE_PROCESSOR 0x00000800 | ||
488 | #define ACPI_BTYPE_THERMAL 0x00001000 | ||
489 | #define ACPI_BTYPE_BUFFER_FIELD 0x00002000 | ||
490 | #define ACPI_BTYPE_DDB_HANDLE 0x00004000 | ||
491 | #define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 | ||
492 | #define ACPI_BTYPE_REFERENCE 0x00010000 | ||
493 | #define ACPI_BTYPE_RESOURCE 0x00020000 | ||
494 | |||
495 | #define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) | ||
496 | |||
497 | #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) | ||
498 | #define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) | ||
499 | #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) | ||
500 | #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ | ||
501 | #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF | ||
502 | |||
503 | /* | ||
504 | * All I/O | 530 | * All I/O |
505 | */ | 531 | */ |
506 | #define ACPI_READ 0 | 532 | #define ACPI_READ 0 |
@@ -853,6 +879,14 @@ struct acpi_compatible_id_list { | |||
853 | #define ACPI_VALID_CID 0x0010 | 879 | #define ACPI_VALID_CID 0x0010 |
854 | #define ACPI_VALID_SXDS 0x0020 | 880 | #define ACPI_VALID_SXDS 0x0020 |
855 | 881 | ||
882 | /* Flags for _STA method */ | ||
883 | |||
884 | #define ACPI_STA_DEVICE_PRESENT 0x01 | ||
885 | #define ACPI_STA_DEVICE_ENABLED 0x02 | ||
886 | #define ACPI_STA_DEVICE_UI 0x04 | ||
887 | #define ACPI_STA_DEVICE_OK 0x08 | ||
888 | #define ACPI_STA_BATTERY_PRESENT 0x10 | ||
889 | |||
856 | #define ACPI_COMMON_OBJ_INFO \ | 890 | #define ACPI_COMMON_OBJ_INFO \ |
857 | acpi_object_type type; /* ACPI object type */ \ | 891 | acpi_object_type type; /* ACPI object type */ \ |
858 | acpi_name name /* ACPI object Name */ | 892 | acpi_name name /* ACPI object Name */ |
@@ -895,6 +929,8 @@ struct acpi_mem_space_context { | |||
895 | /* | 929 | /* |
896 | * Definitions for Resource Attributes | 930 | * Definitions for Resource Attributes |
897 | */ | 931 | */ |
932 | typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */ | ||
933 | typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (64_k-1)+3 */ | ||
898 | 934 | ||
899 | /* | 935 | /* |
900 | * Memory Attributes | 936 | * Memory Attributes |
@@ -916,7 +952,9 @@ struct acpi_mem_space_context { | |||
916 | #define ACPI_ISA_ONLY_RANGES (u8) 0x02 | 952 | #define ACPI_ISA_ONLY_RANGES (u8) 0x02 |
917 | #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) | 953 | #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) |
918 | 954 | ||
919 | #define ACPI_SPARSE_TRANSLATION (u8) 0x03 | 955 | /* Type of translation - 1=Sparse, 0=Dense */ |
956 | |||
957 | #define ACPI_SPARSE_TRANSLATION (u8) 0x01 | ||
920 | 958 | ||
921 | /* | 959 | /* |
922 | * IO Port Descriptor Decode | 960 | * IO Port Descriptor Decode |
@@ -927,8 +965,8 @@ struct acpi_mem_space_context { | |||
927 | /* | 965 | /* |
928 | * IRQ Attributes | 966 | * IRQ Attributes |
929 | */ | 967 | */ |
930 | #define ACPI_EDGE_SENSITIVE (u8) 0x00 | 968 | #define ACPI_LEVEL_SENSITIVE (u8) 0x00 |
931 | #define ACPI_LEVEL_SENSITIVE (u8) 0x01 | 969 | #define ACPI_EDGE_SENSITIVE (u8) 0x01 |
932 | 970 | ||
933 | #define ACPI_ACTIVE_HIGH (u8) 0x00 | 971 | #define ACPI_ACTIVE_HIGH (u8) 0x00 |
934 | #define ACPI_ACTIVE_LOW (u8) 0x01 | 972 | #define ACPI_ACTIVE_LOW (u8) 0x01 |
@@ -975,27 +1013,45 @@ struct acpi_mem_space_context { | |||
975 | #define ACPI_CONSUMER (u8) 0x01 | 1013 | #define ACPI_CONSUMER (u8) 0x01 |
976 | 1014 | ||
977 | /* | 1015 | /* |
1016 | * If possible, pack the following structures to byte alignment | ||
1017 | */ | ||
1018 | #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED | ||
1019 | #pragma pack(1) | ||
1020 | #endif | ||
1021 | |||
1022 | /* UUID data structures for use in vendor-defined resource descriptors */ | ||
1023 | |||
1024 | struct acpi_uuid { | ||
1025 | u8 data[ACPI_UUID_LENGTH]; | ||
1026 | }; | ||
1027 | |||
1028 | struct acpi_vendor_uuid { | ||
1029 | u8 subtype; | ||
1030 | u8 data[ACPI_UUID_LENGTH]; | ||
1031 | }; | ||
1032 | |||
1033 | /* | ||
978 | * Structures used to describe device resources | 1034 | * Structures used to describe device resources |
979 | */ | 1035 | */ |
980 | struct acpi_resource_irq { | 1036 | struct acpi_resource_irq { |
981 | u32 edge_level; | 1037 | u8 triggering; |
982 | u32 active_high_low; | 1038 | u8 polarity; |
983 | u32 shared_exclusive; | 1039 | u8 sharable; |
984 | u32 number_of_interrupts; | 1040 | u8 interrupt_count; |
985 | u32 interrupts[1]; | 1041 | u8 interrupts[1]; |
986 | }; | 1042 | }; |
987 | 1043 | ||
988 | struct acpi_resource_dma { | 1044 | struct acpi_resource_dma { |
989 | u32 type; | 1045 | u8 type; |
990 | u32 bus_master; | 1046 | u8 bus_master; |
991 | u32 transfer; | 1047 | u8 transfer; |
992 | u32 number_of_channels; | 1048 | u8 channel_count; |
993 | u32 channels[1]; | 1049 | u8 channels[1]; |
994 | }; | 1050 | }; |
995 | 1051 | ||
996 | struct acpi_resource_start_dpf { | 1052 | struct acpi_resource_start_dependent { |
997 | u32 compatibility_priority; | 1053 | u8 compatibility_priority; |
998 | u32 performance_robustness; | 1054 | u8 performance_robustness; |
999 | }; | 1055 | }; |
1000 | 1056 | ||
1001 | /* | 1057 | /* |
@@ -1004,179 +1060,217 @@ struct acpi_resource_start_dpf { | |||
1004 | */ | 1060 | */ |
1005 | 1061 | ||
1006 | struct acpi_resource_io { | 1062 | struct acpi_resource_io { |
1007 | u32 io_decode; | 1063 | u8 io_decode; |
1008 | u32 min_base_address; | 1064 | u8 alignment; |
1009 | u32 max_base_address; | 1065 | u8 address_length; |
1010 | u32 alignment; | 1066 | u16 minimum; |
1011 | u32 range_length; | 1067 | u16 maximum; |
1012 | }; | 1068 | }; |
1013 | 1069 | ||
1014 | struct acpi_resource_fixed_io { | 1070 | struct acpi_resource_fixed_io { |
1015 | u32 base_address; | 1071 | u16 address; |
1016 | u32 range_length; | 1072 | u8 address_length; |
1017 | }; | 1073 | }; |
1018 | 1074 | ||
1019 | struct acpi_resource_vendor { | 1075 | struct acpi_resource_vendor { |
1020 | u32 length; | 1076 | u16 byte_length; |
1021 | u8 reserved[1]; | 1077 | u8 byte_data[1]; |
1078 | }; | ||
1079 | |||
1080 | /* Vendor resource with UUID info (introduced in ACPI 3.0) */ | ||
1081 | |||
1082 | struct acpi_resource_vendor_typed { | ||
1083 | u16 byte_length; | ||
1084 | u8 uuid_subtype; | ||
1085 | u8 uuid[ACPI_UUID_LENGTH]; | ||
1086 | u8 byte_data[1]; | ||
1022 | }; | 1087 | }; |
1023 | 1088 | ||
1024 | struct acpi_resource_end_tag { | 1089 | struct acpi_resource_end_tag { |
1025 | u8 checksum; | 1090 | u8 checksum; |
1026 | }; | 1091 | }; |
1027 | 1092 | ||
1028 | struct acpi_resource_mem24 { | 1093 | struct acpi_resource_memory24 { |
1029 | u32 read_write_attribute; | 1094 | u8 write_protect; |
1030 | u32 min_base_address; | 1095 | u16 minimum; |
1031 | u32 max_base_address; | 1096 | u16 maximum; |
1032 | u32 alignment; | 1097 | u16 alignment; |
1033 | u32 range_length; | 1098 | u16 address_length; |
1034 | }; | 1099 | }; |
1035 | 1100 | ||
1036 | struct acpi_resource_mem32 { | 1101 | struct acpi_resource_memory32 { |
1037 | u32 read_write_attribute; | 1102 | u8 write_protect; |
1038 | u32 min_base_address; | 1103 | u32 minimum; |
1039 | u32 max_base_address; | 1104 | u32 maximum; |
1040 | u32 alignment; | 1105 | u32 alignment; |
1041 | u32 range_length; | 1106 | u32 address_length; |
1042 | }; | 1107 | }; |
1043 | 1108 | ||
1044 | struct acpi_resource_fixed_mem32 { | 1109 | struct acpi_resource_fixed_memory32 { |
1045 | u32 read_write_attribute; | 1110 | u8 write_protect; |
1046 | u32 range_base_address; | 1111 | u32 address; |
1047 | u32 range_length; | 1112 | u32 address_length; |
1048 | }; | 1113 | }; |
1049 | 1114 | ||
1050 | struct acpi_memory_attribute { | 1115 | struct acpi_memory_attribute { |
1051 | u16 cache_attribute; | 1116 | u8 write_protect; |
1052 | u16 read_write_attribute; | 1117 | u8 caching; |
1118 | u8 range_type; | ||
1119 | u8 translation; | ||
1053 | }; | 1120 | }; |
1054 | 1121 | ||
1055 | struct acpi_io_attribute { | 1122 | struct acpi_io_attribute { |
1056 | u16 range_attribute; | 1123 | u8 range_type; |
1057 | u16 translation_attribute; | 1124 | u8 translation; |
1058 | }; | 1125 | u8 translation_type; |
1059 | 1126 | u8 reserved1; | |
1060 | struct acpi_bus_attribute { | ||
1061 | u16 reserved1; | ||
1062 | u16 reserved2; | ||
1063 | }; | 1127 | }; |
1064 | 1128 | ||
1065 | union acpi_resource_attribute { | 1129 | union acpi_resource_attribute { |
1066 | struct acpi_memory_attribute memory; | 1130 | struct acpi_memory_attribute mem; |
1067 | struct acpi_io_attribute io; | 1131 | struct acpi_io_attribute io; |
1068 | struct acpi_bus_attribute bus; | 1132 | |
1133 | /* Used for the *word_space macros */ | ||
1134 | |||
1135 | u8 type_specific; | ||
1069 | }; | 1136 | }; |
1070 | 1137 | ||
1071 | struct acpi_resource_source { | 1138 | struct acpi_resource_source { |
1072 | u32 index; | 1139 | u8 index; |
1073 | u32 string_length; | 1140 | u16 string_length; |
1074 | char *string_ptr; | 1141 | char *string_ptr; |
1075 | }; | 1142 | }; |
1076 | 1143 | ||
1077 | /* Fields common to all address descriptors, 16/32/64 bit */ | 1144 | /* Fields common to all address descriptors, 16/32/64 bit */ |
1078 | 1145 | ||
1079 | #define ACPI_RESOURCE_ADDRESS_COMMON \ | 1146 | #define ACPI_RESOURCE_ADDRESS_COMMON \ |
1080 | u32 resource_type; \ | 1147 | u8 resource_type; \ |
1081 | u32 producer_consumer; \ | 1148 | u8 producer_consumer; \ |
1082 | u32 decode; \ | 1149 | u8 decode; \ |
1083 | u32 min_address_fixed; \ | 1150 | u8 min_address_fixed; \ |
1084 | u32 max_address_fixed; \ | 1151 | u8 max_address_fixed; \ |
1085 | union acpi_resource_attribute attribute; | 1152 | union acpi_resource_attribute info; |
1086 | 1153 | ||
1087 | struct acpi_resource_address { | 1154 | struct acpi_resource_address { |
1088 | ACPI_RESOURCE_ADDRESS_COMMON}; | 1155 | ACPI_RESOURCE_ADDRESS_COMMON}; |
1089 | 1156 | ||
1090 | struct acpi_resource_address16 { | 1157 | struct acpi_resource_address16 { |
1091 | ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; | 1158 | ACPI_RESOURCE_ADDRESS_COMMON u16 granularity; |
1092 | u32 min_address_range; | 1159 | u16 minimum; |
1093 | u32 max_address_range; | 1160 | u16 maximum; |
1094 | u32 address_translation_offset; | 1161 | u16 translation_offset; |
1095 | u32 address_length; | 1162 | u16 address_length; |
1096 | struct acpi_resource_source resource_source; | 1163 | struct acpi_resource_source resource_source; |
1097 | }; | 1164 | }; |
1098 | 1165 | ||
1099 | struct acpi_resource_address32 { | 1166 | struct acpi_resource_address32 { |
1100 | ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; | 1167 | ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; |
1101 | u32 min_address_range; | 1168 | u32 minimum; |
1102 | u32 max_address_range; | 1169 | u32 maximum; |
1103 | u32 address_translation_offset; | 1170 | u32 translation_offset; |
1104 | u32 address_length; | 1171 | u32 address_length; |
1105 | struct acpi_resource_source resource_source; | 1172 | struct acpi_resource_source resource_source; |
1106 | }; | 1173 | }; |
1107 | 1174 | ||
1108 | struct acpi_resource_address64 { | 1175 | struct acpi_resource_address64 { |
1109 | ACPI_RESOURCE_ADDRESS_COMMON u64 granularity; | 1176 | ACPI_RESOURCE_ADDRESS_COMMON u64 granularity; |
1110 | u64 min_address_range; | 1177 | u64 minimum; |
1111 | u64 max_address_range; | 1178 | u64 maximum; |
1112 | u64 address_translation_offset; | 1179 | u64 translation_offset; |
1113 | u64 address_length; | 1180 | u64 address_length; |
1114 | u64 type_specific_attributes; | ||
1115 | struct acpi_resource_source resource_source; | 1181 | struct acpi_resource_source resource_source; |
1116 | }; | 1182 | }; |
1117 | 1183 | ||
1118 | struct acpi_resource_ext_irq { | 1184 | struct acpi_resource_extended_address64 { |
1119 | u32 producer_consumer; | 1185 | ACPI_RESOURCE_ADDRESS_COMMON u8 revision_iD; |
1120 | u32 edge_level; | 1186 | u64 granularity; |
1121 | u32 active_high_low; | 1187 | u64 minimum; |
1122 | u32 shared_exclusive; | 1188 | u64 maximum; |
1123 | u32 number_of_interrupts; | 1189 | u64 translation_offset; |
1190 | u64 address_length; | ||
1191 | u64 type_specific; | ||
1192 | }; | ||
1193 | |||
1194 | struct acpi_resource_extended_irq { | ||
1195 | u8 producer_consumer; | ||
1196 | u8 triggering; | ||
1197 | u8 polarity; | ||
1198 | u8 sharable; | ||
1199 | u8 interrupt_count; | ||
1124 | struct acpi_resource_source resource_source; | 1200 | struct acpi_resource_source resource_source; |
1125 | u32 interrupts[1]; | 1201 | u32 interrupts[1]; |
1126 | }; | 1202 | }; |
1127 | 1203 | ||
1204 | struct acpi_resource_generic_register { | ||
1205 | u8 space_id; | ||
1206 | u8 bit_width; | ||
1207 | u8 bit_offset; | ||
1208 | u8 access_size; | ||
1209 | u64 address; | ||
1210 | }; | ||
1211 | |||
1128 | /* ACPI_RESOURCE_TYPEs */ | 1212 | /* ACPI_RESOURCE_TYPEs */ |
1129 | 1213 | ||
1130 | #define ACPI_RSTYPE_IRQ 0 | 1214 | #define ACPI_RESOURCE_TYPE_IRQ 0 |
1131 | #define ACPI_RSTYPE_DMA 1 | 1215 | #define ACPI_RESOURCE_TYPE_DMA 1 |
1132 | #define ACPI_RSTYPE_START_DPF 2 | 1216 | #define ACPI_RESOURCE_TYPE_START_DEPENDENT 2 |
1133 | #define ACPI_RSTYPE_END_DPF 3 | 1217 | #define ACPI_RESOURCE_TYPE_END_DEPENDENT 3 |
1134 | #define ACPI_RSTYPE_IO 4 | 1218 | #define ACPI_RESOURCE_TYPE_IO 4 |
1135 | #define ACPI_RSTYPE_FIXED_IO 5 | 1219 | #define ACPI_RESOURCE_TYPE_FIXED_IO 5 |
1136 | #define ACPI_RSTYPE_VENDOR 6 | 1220 | #define ACPI_RESOURCE_TYPE_VENDOR 6 |
1137 | #define ACPI_RSTYPE_END_TAG 7 | 1221 | #define ACPI_RESOURCE_TYPE_END_TAG 7 |
1138 | #define ACPI_RSTYPE_MEM24 8 | 1222 | #define ACPI_RESOURCE_TYPE_MEMORY24 8 |
1139 | #define ACPI_RSTYPE_MEM32 9 | 1223 | #define ACPI_RESOURCE_TYPE_MEMORY32 9 |
1140 | #define ACPI_RSTYPE_FIXED_MEM32 10 | 1224 | #define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10 |
1141 | #define ACPI_RSTYPE_ADDRESS16 11 | 1225 | #define ACPI_RESOURCE_TYPE_ADDRESS16 11 |
1142 | #define ACPI_RSTYPE_ADDRESS32 12 | 1226 | #define ACPI_RESOURCE_TYPE_ADDRESS32 12 |
1143 | #define ACPI_RSTYPE_ADDRESS64 13 | 1227 | #define ACPI_RESOURCE_TYPE_ADDRESS64 13 |
1144 | #define ACPI_RSTYPE_EXT_IRQ 14 | 1228 | #define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */ |
1145 | 1229 | #define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15 | |
1146 | typedef u32 acpi_resource_type; | 1230 | #define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16 |
1231 | #define ACPI_RESOURCE_TYPE_MAX 16 | ||
1147 | 1232 | ||
1148 | union acpi_resource_data { | 1233 | union acpi_resource_data { |
1149 | struct acpi_resource_irq irq; | 1234 | struct acpi_resource_irq irq; |
1150 | struct acpi_resource_dma dma; | 1235 | struct acpi_resource_dma dma; |
1151 | struct acpi_resource_start_dpf start_dpf; | 1236 | struct acpi_resource_start_dependent start_dpf; |
1152 | struct acpi_resource_io io; | 1237 | struct acpi_resource_io io; |
1153 | struct acpi_resource_fixed_io fixed_io; | 1238 | struct acpi_resource_fixed_io fixed_io; |
1154 | struct acpi_resource_vendor vendor_specific; | 1239 | struct acpi_resource_vendor vendor; |
1240 | struct acpi_resource_vendor_typed vendor_typed; | ||
1155 | struct acpi_resource_end_tag end_tag; | 1241 | struct acpi_resource_end_tag end_tag; |
1156 | struct acpi_resource_mem24 memory24; | 1242 | struct acpi_resource_memory24 memory24; |
1157 | struct acpi_resource_mem32 memory32; | 1243 | struct acpi_resource_memory32 memory32; |
1158 | struct acpi_resource_fixed_mem32 fixed_memory32; | 1244 | struct acpi_resource_fixed_memory32 fixed_memory32; |
1159 | struct acpi_resource_address address; /* Common 16/32/64 address fields */ | ||
1160 | struct acpi_resource_address16 address16; | 1245 | struct acpi_resource_address16 address16; |
1161 | struct acpi_resource_address32 address32; | 1246 | struct acpi_resource_address32 address32; |
1162 | struct acpi_resource_address64 address64; | 1247 | struct acpi_resource_address64 address64; |
1163 | struct acpi_resource_ext_irq extended_irq; | 1248 | struct acpi_resource_extended_address64 ext_address64; |
1249 | struct acpi_resource_extended_irq extended_irq; | ||
1250 | struct acpi_resource_generic_register generic_reg; | ||
1251 | |||
1252 | /* Common fields */ | ||
1253 | |||
1254 | struct acpi_resource_address address; /* Common 16/32/64 address fields */ | ||
1164 | }; | 1255 | }; |
1165 | 1256 | ||
1166 | struct acpi_resource { | 1257 | struct acpi_resource { |
1167 | acpi_resource_type id; | 1258 | u32 type; |
1168 | u32 length; | 1259 | u32 length; |
1169 | union acpi_resource_data data; | 1260 | union acpi_resource_data data; |
1170 | }; | 1261 | }; |
1171 | 1262 | ||
1172 | #define ACPI_RESOURCE_LENGTH 12 | 1263 | /* restore default alignment */ |
1173 | #define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ | 1264 | |
1265 | #pragma pack() | ||
1174 | 1266 | ||
1175 | #define ACPI_SIZEOF_RESOURCE(type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type)) | 1267 | #define ACPI_RS_SIZE_MIN 12 |
1268 | #define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */ | ||
1269 | #define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type)) | ||
1176 | 1270 | ||
1177 | #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) | 1271 | #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) |
1178 | 1272 | ||
1179 | #ifdef ACPI_MISALIGNED_TRANSFERS | 1273 | #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED |
1180 | #define ACPI_ALIGN_RESOURCE_SIZE(length) (length) | 1274 | #define ACPI_ALIGN_RESOURCE_SIZE(length) (length) |
1181 | #else | 1275 | #else |
1182 | #define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length) | 1276 | #define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length) |
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index c1086452696e..5fa21e03a62f 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h | |||
@@ -44,6 +44,39 @@ | |||
44 | #ifndef _ACUTILS_H | 44 | #ifndef _ACUTILS_H |
45 | #define _ACUTILS_H | 45 | #define _ACUTILS_H |
46 | 46 | ||
47 | extern const u8 acpi_gbl_resource_aml_sizes[]; | ||
48 | |||
49 | /* Strings used by the disassembler and debugger resource dump routines */ | ||
50 | |||
51 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) | ||
52 | |||
53 | extern const char *acpi_gbl_BMdecode[2]; | ||
54 | extern const char *acpi_gbl_config_decode[4]; | ||
55 | extern const char *acpi_gbl_consume_decode[2]; | ||
56 | extern const char *acpi_gbl_DECdecode[2]; | ||
57 | extern const char *acpi_gbl_HEdecode[2]; | ||
58 | extern const char *acpi_gbl_io_decode[2]; | ||
59 | extern const char *acpi_gbl_LLdecode[2]; | ||
60 | extern const char *acpi_gbl_max_decode[2]; | ||
61 | extern const char *acpi_gbl_MEMdecode[4]; | ||
62 | extern const char *acpi_gbl_min_decode[2]; | ||
63 | extern const char *acpi_gbl_MTPdecode[4]; | ||
64 | extern const char *acpi_gbl_RNGdecode[4]; | ||
65 | extern const char *acpi_gbl_RWdecode[2]; | ||
66 | extern const char *acpi_gbl_SHRdecode[2]; | ||
67 | extern const char *acpi_gbl_SIZdecode[4]; | ||
68 | extern const char *acpi_gbl_TRSdecode[2]; | ||
69 | extern const char *acpi_gbl_TTPdecode[2]; | ||
70 | extern const char *acpi_gbl_TYPdecode[4]; | ||
71 | #endif | ||
72 | |||
73 | /* Types for Resource descriptor entries */ | ||
74 | |||
75 | #define ACPI_INVALID_RESOURCE 0 | ||
76 | #define ACPI_FIXED_LENGTH 1 | ||
77 | #define ACPI_VARIABLE_LENGTH 2 | ||
78 | #define ACPI_SMALL_VARIABLE_LENGTH 3 | ||
79 | |||
47 | typedef | 80 | typedef |
48 | acpi_status(*acpi_pkg_callback) (u8 object_type, | 81 | acpi_status(*acpi_pkg_callback) (u8 object_type, |
49 | union acpi_operand_object * source_object, | 82 | union acpi_operand_object * source_object, |
@@ -159,7 +192,6 @@ extern const u8 _acpi_ctype[]; | |||
159 | #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) | 192 | #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) |
160 | #define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU)) | 193 | #define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU)) |
161 | #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) | 194 | #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) |
162 | #define ACPI_IS_ASCII(c) ((c) < 0x80) | ||
163 | 195 | ||
164 | #endif /* ACPI_USE_SYSTEM_CLIBRARY */ | 196 | #endif /* ACPI_USE_SYSTEM_CLIBRARY */ |
165 | 197 | ||
@@ -419,7 +451,19 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); | |||
419 | 451 | ||
420 | #define ACPI_ANY_BASE 0 | 452 | #define ACPI_ANY_BASE 0 |
421 | 453 | ||
422 | u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc); | 454 | acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index); |
455 | |||
456 | u32 acpi_ut_get_descriptor_length(void *aml); | ||
457 | |||
458 | u16 acpi_ut_get_resource_length(void *aml); | ||
459 | |||
460 | u8 acpi_ut_get_resource_header_length(void *aml); | ||
461 | |||
462 | u8 acpi_ut_get_resource_type(void *aml); | ||
463 | |||
464 | acpi_status | ||
465 | acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, | ||
466 | u8 ** end_tag); | ||
423 | 467 | ||
424 | u8 acpi_ut_generate_checksum(u8 * buffer, u32 length); | 468 | u8 acpi_ut_generate_checksum(u8 * buffer, u32 length); |
425 | 469 | ||
diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h index 051786e4b210..2e3382c1e5e3 100644 --- a/include/acpi/amlresrc.h +++ b/include/acpi/amlresrc.h | |||
@@ -92,182 +92,168 @@ struct asl_resource_node { | |||
92 | struct asl_resource_node *next; | 92 | struct asl_resource_node *next; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | /* Macros used to generate AML resource length fields */ | ||
96 | |||
97 | #define ACPI_AML_SIZE_LARGE(r) (sizeof (r) - sizeof (struct aml_resource_large_header)) | ||
98 | #define ACPI_AML_SIZE_SMALL(r) (sizeof (r) - sizeof (struct aml_resource_small_header)) | ||
99 | |||
95 | /* | 100 | /* |
96 | * Resource descriptors defined in the ACPI specification. | 101 | * Resource descriptors defined in the ACPI specification. |
97 | * | 102 | * |
98 | * Packing/alignment must be BYTE because these descriptors | 103 | * Packing/alignment must be BYTE because these descriptors |
99 | * are used to overlay the AML byte stream. | 104 | * are used to overlay the raw AML byte stream. |
100 | */ | 105 | */ |
101 | #pragma pack(1) | 106 | #pragma pack(1) |
102 | 107 | ||
103 | struct asl_irq_format_desc { | 108 | /* |
104 | u8 descriptor_type; | 109 | * SMALL descriptors |
105 | u16 irq_mask; | 110 | */ |
111 | #define AML_RESOURCE_SMALL_HEADER_COMMON \ | ||
112 | u8 descriptor_type; | ||
113 | |||
114 | struct aml_resource_small_header { | ||
115 | AML_RESOURCE_SMALL_HEADER_COMMON}; | ||
116 | |||
117 | struct aml_resource_irq { | ||
118 | AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask; | ||
106 | u8 flags; | 119 | u8 flags; |
107 | }; | 120 | }; |
108 | 121 | ||
109 | struct asl_irq_noflags_desc { | 122 | struct aml_resource_irq_noflags { |
110 | u8 descriptor_type; | 123 | AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask; |
111 | u16 irq_mask; | ||
112 | }; | 124 | }; |
113 | 125 | ||
114 | struct asl_dma_format_desc { | 126 | struct aml_resource_dma { |
115 | u8 descriptor_type; | 127 | AML_RESOURCE_SMALL_HEADER_COMMON u8 dma_channel_mask; |
116 | u8 dma_channel_mask; | ||
117 | u8 flags; | 128 | u8 flags; |
118 | }; | 129 | }; |
119 | 130 | ||
120 | struct asl_start_dependent_desc { | 131 | struct aml_resource_start_dependent { |
121 | u8 descriptor_type; | 132 | AML_RESOURCE_SMALL_HEADER_COMMON u8 flags; |
122 | u8 flags; | ||
123 | }; | 133 | }; |
124 | 134 | ||
125 | struct asl_start_dependent_noprio_desc { | 135 | struct aml_resource_start_dependent_noprio { |
126 | u8 descriptor_type; | 136 | AML_RESOURCE_SMALL_HEADER_COMMON}; |
127 | }; | ||
128 | 137 | ||
129 | struct asl_end_dependent_desc { | 138 | struct aml_resource_end_dependent { |
130 | u8 descriptor_type; | 139 | AML_RESOURCE_SMALL_HEADER_COMMON}; |
131 | }; | ||
132 | 140 | ||
133 | struct asl_io_port_desc { | 141 | struct aml_resource_io { |
134 | u8 descriptor_type; | 142 | AML_RESOURCE_SMALL_HEADER_COMMON u8 flags; |
135 | u8 information; | 143 | u16 minimum; |
136 | u16 address_min; | 144 | u16 maximum; |
137 | u16 address_max; | ||
138 | u8 alignment; | 145 | u8 alignment; |
139 | u8 length; | 146 | u8 address_length; |
140 | }; | 147 | }; |
141 | 148 | ||
142 | struct asl_fixed_io_port_desc { | 149 | struct aml_resource_fixed_io { |
143 | u8 descriptor_type; | 150 | AML_RESOURCE_SMALL_HEADER_COMMON u16 address; |
144 | u16 base_address; | 151 | u8 address_length; |
145 | u8 length; | ||
146 | }; | 152 | }; |
147 | 153 | ||
148 | struct asl_small_vendor_desc { | 154 | struct aml_resource_vendor_small { |
149 | u8 descriptor_type; | 155 | AML_RESOURCE_SMALL_HEADER_COMMON}; |
150 | u8 vendor_defined[7]; | ||
151 | }; | ||
152 | 156 | ||
153 | struct asl_end_tag_desc { | 157 | struct aml_resource_end_tag { |
154 | u8 descriptor_type; | 158 | AML_RESOURCE_SMALL_HEADER_COMMON u8 checksum; |
155 | u8 checksum; | ||
156 | }; | 159 | }; |
157 | 160 | ||
158 | /* LARGE descriptors */ | 161 | /* |
162 | * LARGE descriptors | ||
163 | */ | ||
164 | #define AML_RESOURCE_LARGE_HEADER_COMMON \ | ||
165 | u8 descriptor_type;\ | ||
166 | u16 resource_length; | ||
167 | |||
168 | struct aml_resource_large_header { | ||
169 | AML_RESOURCE_LARGE_HEADER_COMMON}; | ||
159 | 170 | ||
160 | struct asl_memory_24_desc { | 171 | struct aml_resource_memory24 { |
161 | u8 descriptor_type; | 172 | AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; |
162 | u16 length; | 173 | u16 minimum; |
163 | u8 information; | 174 | u16 maximum; |
164 | u16 address_min; | ||
165 | u16 address_max; | ||
166 | u16 alignment; | 175 | u16 alignment; |
167 | u16 range_length; | 176 | u16 address_length; |
168 | }; | 177 | }; |
169 | 178 | ||
170 | struct asl_large_vendor_desc { | 179 | struct aml_resource_vendor_large { |
171 | u8 descriptor_type; | 180 | AML_RESOURCE_LARGE_HEADER_COMMON}; |
172 | u16 length; | ||
173 | u8 vendor_defined[1]; | ||
174 | }; | ||
175 | 181 | ||
176 | struct asl_memory_32_desc { | 182 | struct aml_resource_memory32 { |
177 | u8 descriptor_type; | 183 | AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; |
178 | u16 length; | 184 | u32 minimum; |
179 | u8 information; | 185 | u32 maximum; |
180 | u32 address_min; | ||
181 | u32 address_max; | ||
182 | u32 alignment; | 186 | u32 alignment; |
183 | u32 range_length; | 187 | u32 address_length; |
184 | }; | 188 | }; |
185 | 189 | ||
186 | struct asl_fixed_memory_32_desc { | 190 | struct aml_resource_fixed_memory32 { |
187 | u8 descriptor_type; | 191 | AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; |
188 | u16 length; | 192 | u32 address; |
189 | u8 information; | 193 | u32 address_length; |
190 | u32 base_address; | ||
191 | u32 range_length; | ||
192 | }; | 194 | }; |
193 | 195 | ||
194 | struct asl_extended_address_desc { | 196 | #define AML_RESOURCE_ADDRESS_COMMON \ |
195 | u8 descriptor_type; | 197 | u8 resource_type; \ |
196 | u16 length; | 198 | u8 flags; \ |
197 | u8 resource_type; | 199 | u8 specific_flags; |
198 | u8 flags; | 200 | |
199 | u8 specific_flags; | 201 | struct aml_resource_address { |
200 | u8 revision_iD; | 202 | AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON}; |
203 | |||
204 | struct aml_resource_extended_address64 { | ||
205 | AML_RESOURCE_LARGE_HEADER_COMMON | ||
206 | AML_RESOURCE_ADDRESS_COMMON u8 revision_iD; | ||
201 | u8 reserved; | 207 | u8 reserved; |
202 | u64 granularity; | 208 | u64 granularity; |
203 | u64 address_min; | 209 | u64 minimum; |
204 | u64 address_max; | 210 | u64 maximum; |
205 | u64 translation_offset; | 211 | u64 translation_offset; |
206 | u64 address_length; | 212 | u64 address_length; |
207 | u64 type_specific_attributes; | 213 | u64 type_specific; |
208 | u8 optional_fields[2]; /* Used for length calculation only */ | ||
209 | }; | 214 | }; |
210 | 215 | ||
211 | #define ASL_EXTENDED_ADDRESS_DESC_REVISION 1 /* ACPI 3.0 */ | 216 | #define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */ |
212 | 217 | ||
213 | struct asl_qword_address_desc { | 218 | struct aml_resource_address64 { |
214 | u8 descriptor_type; | 219 | AML_RESOURCE_LARGE_HEADER_COMMON |
215 | u16 length; | 220 | AML_RESOURCE_ADDRESS_COMMON u64 granularity; |
216 | u8 resource_type; | 221 | u64 minimum; |
217 | u8 flags; | 222 | u64 maximum; |
218 | u8 specific_flags; | ||
219 | u64 granularity; | ||
220 | u64 address_min; | ||
221 | u64 address_max; | ||
222 | u64 translation_offset; | 223 | u64 translation_offset; |
223 | u64 address_length; | 224 | u64 address_length; |
224 | u8 optional_fields[2]; | ||
225 | }; | 225 | }; |
226 | 226 | ||
227 | struct asl_dword_address_desc { | 227 | struct aml_resource_address32 { |
228 | u8 descriptor_type; | 228 | AML_RESOURCE_LARGE_HEADER_COMMON |
229 | u16 length; | 229 | AML_RESOURCE_ADDRESS_COMMON u32 granularity; |
230 | u8 resource_type; | 230 | u32 minimum; |
231 | u8 flags; | 231 | u32 maximum; |
232 | u8 specific_flags; | ||
233 | u32 granularity; | ||
234 | u32 address_min; | ||
235 | u32 address_max; | ||
236 | u32 translation_offset; | 232 | u32 translation_offset; |
237 | u32 address_length; | 233 | u32 address_length; |
238 | u8 optional_fields[2]; | ||
239 | }; | 234 | }; |
240 | 235 | ||
241 | struct asl_word_address_desc { | 236 | struct aml_resource_address16 { |
242 | u8 descriptor_type; | 237 | AML_RESOURCE_LARGE_HEADER_COMMON |
243 | u16 length; | 238 | AML_RESOURCE_ADDRESS_COMMON u16 granularity; |
244 | u8 resource_type; | 239 | u16 minimum; |
245 | u8 flags; | 240 | u16 maximum; |
246 | u8 specific_flags; | ||
247 | u16 granularity; | ||
248 | u16 address_min; | ||
249 | u16 address_max; | ||
250 | u16 translation_offset; | 241 | u16 translation_offset; |
251 | u16 address_length; | 242 | u16 address_length; |
252 | u8 optional_fields[2]; | ||
253 | }; | 243 | }; |
254 | 244 | ||
255 | struct asl_extended_xrupt_desc { | 245 | struct aml_resource_extended_irq { |
256 | u8 descriptor_type; | 246 | AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; |
257 | u16 length; | 247 | u8 interrupt_count; |
258 | u8 flags; | 248 | u32 interrupts[1]; |
259 | u8 table_length; | ||
260 | u32 interrupt_number[1]; | ||
261 | /* res_source_index, res_source optional fields follow */ | 249 | /* res_source_index, res_source optional fields follow */ |
262 | }; | 250 | }; |
263 | 251 | ||
264 | struct asl_general_register_desc { | 252 | struct aml_resource_generic_register { |
265 | u8 descriptor_type; | 253 | AML_RESOURCE_LARGE_HEADER_COMMON u8 address_space_id; |
266 | u16 length; | ||
267 | u8 address_space_id; | ||
268 | u8 bit_width; | 254 | u8 bit_width; |
269 | u8 bit_offset; | 255 | u8 bit_offset; |
270 | u8 access_size; /* ACPI 3.0, was Reserved */ | 256 | u8 access_size; /* ACPI 3.0, was previously Reserved */ |
271 | u64 address; | 257 | u64 address; |
272 | }; | 258 | }; |
273 | 259 | ||
@@ -277,26 +263,39 @@ struct asl_general_register_desc { | |||
277 | 263 | ||
278 | /* Union of all resource descriptors, so we can allocate the worst case */ | 264 | /* Union of all resource descriptors, so we can allocate the worst case */ |
279 | 265 | ||
280 | union asl_resource_desc { | 266 | union aml_resource { |
281 | struct asl_irq_format_desc irq; | 267 | /* Descriptor headers */ |
282 | struct asl_dma_format_desc dma; | 268 | |
283 | struct asl_start_dependent_desc std; | 269 | struct aml_resource_small_header small_header; |
284 | struct asl_end_dependent_desc end; | 270 | struct aml_resource_large_header large_header; |
285 | struct asl_io_port_desc iop; | 271 | |
286 | struct asl_fixed_io_port_desc fio; | 272 | /* Small resource descriptors */ |
287 | struct asl_small_vendor_desc smv; | 273 | |
288 | struct asl_end_tag_desc et; | 274 | struct aml_resource_irq irq; |
289 | 275 | struct aml_resource_dma dma; | |
290 | struct asl_memory_24_desc M24; | 276 | struct aml_resource_start_dependent start_dpf; |
291 | struct asl_large_vendor_desc lgv; | 277 | struct aml_resource_end_dependent end_dpf; |
292 | struct asl_memory_32_desc M32; | 278 | struct aml_resource_io io; |
293 | struct asl_fixed_memory_32_desc F32; | 279 | struct aml_resource_fixed_io fixed_io; |
294 | struct asl_qword_address_desc qas; | 280 | struct aml_resource_vendor_small vendor_small; |
295 | struct asl_dword_address_desc das; | 281 | struct aml_resource_end_tag end_tag; |
296 | struct asl_word_address_desc was; | 282 | |
297 | struct asl_extended_address_desc eas; | 283 | /* Large resource descriptors */ |
298 | struct asl_extended_xrupt_desc exx; | 284 | |
299 | struct asl_general_register_desc grg; | 285 | struct aml_resource_memory24 memory24; |
286 | struct aml_resource_generic_register generic_reg; | ||
287 | struct aml_resource_vendor_large vendor_large; | ||
288 | struct aml_resource_memory32 memory32; | ||
289 | struct aml_resource_fixed_memory32 fixed_memory32; | ||
290 | struct aml_resource_address16 address16; | ||
291 | struct aml_resource_address32 address32; | ||
292 | struct aml_resource_address64 address64; | ||
293 | struct aml_resource_extended_address64 ext_address64; | ||
294 | struct aml_resource_extended_irq extended_irq; | ||
295 | |||
296 | /* Utility overlays */ | ||
297 | |||
298 | struct aml_resource_address address; | ||
300 | u32 u32_item; | 299 | u32 u32_item; |
301 | u16 u16_item; | 300 | u16 u16_item; |
302 | u8 U8item; | 301 | u8 U8item; |
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index 16609c1ab2eb..53aa997f05fc 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h | |||
@@ -68,6 +68,7 @@ | |||
68 | #define ACPI_APPLICATION | 68 | #define ACPI_APPLICATION |
69 | #define ACPI_DEBUGGER | 69 | #define ACPI_DEBUGGER |
70 | #define ACPI_DISASSEMBLER | 70 | #define ACPI_DISASSEMBLER |
71 | #define ACPI_MUTEX_DEBUG | ||
71 | #endif | 72 | #endif |
72 | 73 | ||
73 | #ifdef ACPI_ASL_COMPILER | 74 | #ifdef ACPI_ASL_COMPILER |
@@ -205,6 +206,8 @@ | |||
205 | * | 206 | * |
206 | *****************************************************************************/ | 207 | *****************************************************************************/ |
207 | 208 | ||
209 | #define ACPI_IS_ASCII(c) ((c) < 0x80) | ||
210 | |||
208 | #ifdef ACPI_USE_SYSTEM_CLIBRARY | 211 | #ifdef ACPI_USE_SYSTEM_CLIBRARY |
209 | /* | 212 | /* |
210 | * Use the standard C library headers. | 213 | * Use the standard C library headers. |
@@ -234,7 +237,7 @@ | |||
234 | #define ACPI_STRCAT(d,s) (void) strcat((d), (s)) | 237 | #define ACPI_STRCAT(d,s) (void) strcat((d), (s)) |
235 | #define ACPI_STRNCAT(d,s,n) strncat((d), (s), (acpi_size)(n)) | 238 | #define ACPI_STRNCAT(d,s,n) strncat((d), (s), (acpi_size)(n)) |
236 | #define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (acpi_size)(n)) | 239 | #define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (acpi_size)(n)) |
237 | #define ACPI_MEMCMP(s1,s2,n) memcmp((s1), (s2), (acpi_size)(n)) | 240 | #define ACPI_MEMCMP(s1,s2,n) memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n)) |
238 | #define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (acpi_size)(n)) | 241 | #define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (acpi_size)(n)) |
239 | #define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (acpi_size)(n)) | 242 | #define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (acpi_size)(n)) |
240 | 243 | ||
@@ -246,7 +249,6 @@ | |||
246 | #define ACPI_IS_UPPER(i) isupper((int) (i)) | 249 | #define ACPI_IS_UPPER(i) isupper((int) (i)) |
247 | #define ACPI_IS_PRINT(i) isprint((int) (i)) | 250 | #define ACPI_IS_PRINT(i) isprint((int) (i)) |
248 | #define ACPI_IS_ALPHA(i) isalpha((int) (i)) | 251 | #define ACPI_IS_ALPHA(i) isalpha((int) (i)) |
249 | #define ACPI_IS_ASCII(i) isascii((int) (i)) | ||
250 | 252 | ||
251 | #else | 253 | #else |
252 | 254 | ||
@@ -273,8 +275,8 @@ typedef char *va_list; | |||
273 | /* | 275 | /* |
274 | * Storage alignment properties | 276 | * Storage alignment properties |
275 | */ | 277 | */ |
276 | #define _AUPBND (sizeof (acpi_native_int) - 1) | 278 | #define _AUPBND (sizeof (acpi_native_uint) - 1) |
277 | #define _ADNBND (sizeof (acpi_native_int) - 1) | 279 | #define _ADNBND (sizeof (acpi_native_uint) - 1) |
278 | 280 | ||
279 | /* | 281 | /* |
280 | * Variable argument list macro definitions | 282 | * Variable argument list macro definitions |
@@ -296,7 +298,7 @@ typedef char *va_list; | |||
296 | #define ACPI_STRCAT(d,s) (void) acpi_ut_strcat ((d), (s)) | 298 | #define ACPI_STRCAT(d,s) (void) acpi_ut_strcat ((d), (s)) |
297 | #define ACPI_STRNCAT(d,s,n) acpi_ut_strncat ((d), (s), (acpi_size)(n)) | 299 | #define ACPI_STRNCAT(d,s,n) acpi_ut_strncat ((d), (s), (acpi_size)(n)) |
298 | #define ACPI_STRTOUL(d,s,n) acpi_ut_strtoul ((d), (s), (acpi_size)(n)) | 300 | #define ACPI_STRTOUL(d,s,n) acpi_ut_strtoul ((d), (s), (acpi_size)(n)) |
299 | #define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((s1), (s2), (acpi_size)(n)) | 301 | #define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n)) |
300 | #define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n)) | 302 | #define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n)) |
301 | #define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (acpi_size)(n)) | 303 | #define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (acpi_size)(n)) |
302 | #define ACPI_TOUPPER acpi_ut_to_upper | 304 | #define ACPI_TOUPPER acpi_ut_to_upper |
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index c93e6562f0e1..1b9cbf05b79e 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h | |||
@@ -71,6 +71,10 @@ | |||
71 | #define acpi_cache_t kmem_cache_t | 71 | #define acpi_cache_t kmem_cache_t |
72 | #endif | 72 | #endif |
73 | 73 | ||
74 | /* Full namespace pathname length limit - arbitrary */ | ||
75 | |||
76 | #define ACPI_PATHNAME_MAX 256 | ||
77 | |||
74 | #else /* !__KERNEL__ */ | 78 | #else /* !__KERNEL__ */ |
75 | 79 | ||
76 | #include <stdarg.h> | 80 | #include <stdarg.h> |
diff --git a/include/asm-x86_64/mpspec.h b/include/asm-x86_64/mpspec.h index 10248a9a0582..14fc3ddd9031 100644 --- a/include/asm-x86_64/mpspec.h +++ b/include/asm-x86_64/mpspec.h | |||
@@ -188,7 +188,7 @@ extern void mp_register_lapic_address (u64 address); | |||
188 | extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base); | 188 | extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base); |
189 | extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi); | 189 | extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi); |
190 | extern void mp_config_acpi_legacy_irqs (void); | 190 | extern void mp_config_acpi_legacy_irqs (void); |
191 | extern int mp_register_gsi (u32 gsi, int edge_level, int active_high_low); | 191 | extern int mp_register_gsi (u32 gsi, int triggering, int polarity); |
192 | #endif /*CONFIG_X86_IO_APIC*/ | 192 | #endif /*CONFIG_X86_IO_APIC*/ |
193 | #endif | 193 | #endif |
194 | 194 | ||
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 026c3c011dc0..84d3d9f034ce 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -435,7 +435,7 @@ extern int sbf_port ; | |||
435 | 435 | ||
436 | #endif /* !CONFIG_ACPI */ | 436 | #endif /* !CONFIG_ACPI */ |
437 | 437 | ||
438 | int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low); | 438 | int acpi_register_gsi (u32 gsi, int triggering, int polarity); |
439 | int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); | 439 | int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); |
440 | 440 | ||
441 | /* | 441 | /* |