Mercurial > illumos > illumos-gate
changeset 941:49d0d4c2eea8
6328449 acpica: create_d2a_subtree makes nodes for ACPI non-devices
6332549 acpica: update to Intel ACPI CA 20050930 source drop
6333936 vsnprintf: vsnprintf doesn't support 'h' or string-precision modifiers
6335392 psm: psm_common.c incorrectly uses ACPI resource end tags
line wrap: on
line diff
--- a/usr/src/common/util/string.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/common/util/string.c Thu Nov 17 08:46:01 2005 -0800 @@ -20,7 +20,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -65,7 +65,9 @@ { uint64_t ul, tmp; char *bufp = buf; /* current buffer pointer */ - int pad, width, ells, base, sign, c; + int pad, width, base, sign, c, num; + int prec, h_count, l_count, dot_count; + int pad_count, transfer_count, left_align; char *digits, *sp, *bs; char numbuf[65]; /* sufficient for a 64-bit binary value */ va_list args; @@ -84,28 +86,64 @@ continue; } + width = prec = 0; + left_align = base = sign = 0; + h_count = l_count = dot_count = 0; + pad = ' '; + digits = "0123456789abcdef"; +next_fmt: if ((c = *fmt++) == '\0') break; - for (pad = ' '; c == '0'; c = *fmt++) - pad = '0'; - - for (width = 0; c >= '0' && c <= '9'; c = *fmt++) - width = width * 10 + c - '0'; - - for (ells = 0; c == 'l'; c = *fmt++) - ells++; - - digits = "0123456789abcdef"; - if (c >= 'A' && c <= 'Z') { c += 'a' - 'A'; digits = "0123456789ABCDEF"; } - base = sign = 0; + switch (c) { + case '-': + left_align++; + goto next_fmt; + case '0': + if (dot_count == 0) + pad = '0'; + /*FALLTHROUGH*/ + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + num = 0; + for (;;) { + num = 10 * num + c - '0'; + c = *fmt; + if (c < '0' || c > '9') + break; + else + fmt++; + } + if (dot_count > 0) + prec = num; + else + width = num; - switch (c) { + goto next_fmt; + case '.': + dot_count++; + goto next_fmt; + case '*': + width = (int)va_arg(args, int); + goto next_fmt; + case 'l': + l_count++; + goto next_fmt; + case 'h': + h_count++; + goto next_fmt; case 'd': sign = 1; /*FALLTHROUGH*/ @@ -113,7 +151,7 @@ base = 10; break; case 'p': - ells = 1; + l_count = 1; /*FALLTHROUGH*/ case 'x': base = 16; @@ -122,19 +160,49 @@ base = 8; break; case 'b': - ells = 0; + l_count = 0; base = 1; break; case 'c': - ul = (int64_t)va_arg(args, int); - ADDCHAR((int)ul & 0xff); + c = (char)va_arg(args, char); + ADDCHAR(c); break; case 's': sp = va_arg(args, char *); - if (sp == NULL) + if (sp == NULL) { sp = "<null string>"; - while ((c = *sp++) != 0) - ADDCHAR(c); + /* avoid truncation */ + prec = strlen(sp); + } + /* + * Handle simple case specially to avoid + * performance hit of strlen() + */ + if (prec == 0 && width == 0) { + while ((c = *sp++) != 0) + ADDCHAR(c); + break; + } + transfer_count = strlen(sp); + if (prec > 0) { + /* trim string if too long */ + if (transfer_count > prec) + transfer_count = prec; + /* widen field if too narrow */ + if (prec > width) + width = prec; + } + if (width > transfer_count) + pad_count = width - transfer_count; + else + pad_count = 0; + while ((!left_align) && (pad_count-- > 0)) + ADDCHAR(' '); + /* ADDCHAR() evaluates arg at most once */ + while (transfer_count-- > 0) + ADDCHAR(*sp++); + while ((left_align) && (pad_count-- > 0)) + ADDCHAR(' '); break; case '%': ADDCHAR('%'); @@ -144,30 +212,49 @@ if (base == 0) continue; - if (ells == 0) - ul = (int64_t)va_arg(args, int); - else if (ells == 1) - ul = (int64_t)va_arg(args, long); - else - ul = (int64_t)va_arg(args, int64_t); + if (h_count == 0 && l_count == 0) + if (sign) + ul = (int64_t)va_arg(args, int); + else + ul = (int64_t)va_arg(args, unsigned int); + else if (l_count > 1) + if (sign) + ul = (int64_t)va_arg(args, int64_t); + else + ul = (int64_t)va_arg(args, uint64_t); + else if (l_count > 0) + if (sign) + ul = (int64_t)va_arg(args, long); + else + ul = (int64_t)va_arg(args, unsigned long); + else if (h_count > 1) + if (sign) + ul = (int64_t)va_arg(args, char); + else + ul = (int64_t)va_arg(args, unsigned char); + else if (h_count > 0) + if (sign) + ul = (int64_t)va_arg(args, short); + else + ul = (int64_t)va_arg(args, unsigned short); if (sign && (int64_t)ul < 0) ul = -ul; else sign = 0; - if (ells < 8 / sizeof (long)) - ul &= 0xffffffffU; - if (c == 'b') { bs = va_arg(args, char *); base = *bs++; } - tmp = ul; - do { - width--; - } while ((tmp /= base) != 0); + /* avoid repeated division if width is 0 */ + if (width > 0) { + tmp = ul; + do { + width--; + } while ((tmp /= base) != 0); + } if (sign && pad == '0') ADDCHAR('-');
--- a/usr/src/uts/i86pc/Makefile.files Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/Makefile.files Thu Nov 17 08:46:01 2005 -0800 @@ -182,7 +182,7 @@ nsload.o nsnames.o nsobject.o nsparse.o nssearch.o \ nsutils.o nswalk.o nsxfeval.o nsxfname.o nsxfobj.o \ rsaddr.o rscalc.o rscreate.o rsdump.o \ - rsio.o rsirq.o rslist.o rsmemory.o rsmisc.o \ + rsinfo.o rsio.o rsirq.o rslist.o rsmemory.o rsmisc.o \ rsutils.o rsxface.o tbconvrt.o tbget.o tbgetall.o \ tbinstal.o tbrsdt.o tbutils.o tbxface.o tbxfroot.o \ utalloc.o utclib.o utcopy.o utdebug.o utdelete.o \
--- a/usr/src/uts/i86pc/acpica/Makefile Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/acpica/Makefile Thu Nov 17 08:46:01 2005 -0800 @@ -39,7 +39,7 @@ # # Overrides. # -DEBUG_FLGS = +$(NOT_RELEASE_BUILD)DEBUG_FLGS = -DACPI_DEBUG_OUTPUT DEBUG_DEFS += $(DEBUG_FLGS) #
--- a/usr/src/uts/i86pc/io/acpica/acpi_enum.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/acpi_enum.c Thu Nov 17 08:46:01 2005 -0800 @@ -135,7 +135,7 @@ int i; ACPI_RESOURCE_IRQ irq = resource_ptr->Data.Irq; - for (i = 0; i < irq.NumberOfInterrupts; i++) { + for (i = 0; i < irq.InterruptCount; i++) { interrupt[(*interrupt_count)++] = irq.Interrupts[i]; used_interrupts |= 1 << irq.Interrupts[i]; @@ -153,7 +153,7 @@ int i; ACPI_RESOURCE_DMA acpi_dma = resource_ptr->Data.Dma; - for (i = 0; i < acpi_dma.NumberOfChannels; i++) { + for (i = 0; i < acpi_dma.ChannelCount; i++) { dma[(*dma_count)++] = acpi_dma.Channels[i]; used_dmas |= 1 << acpi_dma.Channels[i]; if (acpi_enum_debug & PARSE_RES_DMA) { @@ -171,25 +171,25 @@ ACPI_RESOURCE_IO acpi_io = resource_ptr->Data.Io; io[*io_count].regspec_bustype = 1; /* io */ - io[*io_count].regspec_size = acpi_io.RangeLength; + io[*io_count].regspec_size = acpi_io.AddressLength; /* When Min equals Max, IO is 32-bit */ - if (acpi_io.MinBaseAddress == acpi_io.MaxBaseAddress) { + if (acpi_io.Minimum == acpi_io.Maximum) { io[*io_count].regspec_addr = - acpi_io.MinBaseAddress; + acpi_io.Minimum; } else { /* else IO is 10-bit ISA */ io[*io_count].regspec_addr = - acpi_io.MinBaseAddress & 0x3FF; + acpi_io.Minimum & 0x3FF; cmn_err(CE_NOTE, - "!ACPI source type ACPI_RSTYPE_IO"\ + "!ACPI source type ACPI_RESOURCE_TYPE_IO"\ "10-bit ISA range not supported"); } if (acpi_enum_debug & PARSE_RES_IO) { cmn_err(CE_NOTE, "parse_resources() "\ "IO min 0x%X, max 0x%X, length: 0x%X", - acpi_io.MinBaseAddress, - acpi_io.MaxBaseAddress, - acpi_io.RangeLength); + acpi_io.Minimum, + acpi_io.Maximum, + acpi_io.AddressLength); } (*io_count)++; } @@ -201,12 +201,12 @@ ACPI_RESOURCE_FIXED_IO fixed_io = resource_ptr->Data.FixedIo; io[*io_count].regspec_bustype = 1; /* io */ - io[*io_count].regspec_addr = fixed_io.BaseAddress; - io[*io_count].regspec_size = fixed_io.RangeLength; + io[*io_count].regspec_addr = fixed_io.Address; + io[*io_count].regspec_size = fixed_io.AddressLength; if (acpi_enum_debug & PARSE_RES_IO) { cmn_err(CE_NOTE, "parse_resources() "\ "Fixed IO 0x%X, length: 0x%X", - fixed_io.BaseAddress, fixed_io.RangeLength); + fixed_io.Address, fixed_io.AddressLength); } (*io_count)++; } @@ -215,16 +215,16 @@ parse_resources_fixed_mem32(ACPI_RESOURCE *resource_ptr, struct regspec *io, int *io_count) { - ACPI_RESOURCE_FIXED_MEM32 fixed_mem32 = + ACPI_RESOURCE_FIXED_MEMORY32 fixed_mem32 = resource_ptr->Data.FixedMemory32; io[*io_count].regspec_bustype = 0; /* memory */ - io[*io_count].regspec_addr = fixed_mem32.RangeBaseAddress; - io[*io_count].regspec_size = fixed_mem32.RangeLength; + io[*io_count].regspec_addr = fixed_mem32.Address; + io[*io_count].regspec_size = fixed_mem32.AddressLength; if (acpi_enum_debug & PARSE_RES_MEMORY) { cmn_err(CE_NOTE, "parse_resources() "\ "Fixed Mem 32 %ul, length: %ul", - fixed_mem32.RangeBaseAddress, fixed_mem32.RangeLength); + fixed_mem32.Address, fixed_mem32.AddressLength); } (*io_count)++; } @@ -233,18 +233,18 @@ parse_resources_mem32(ACPI_RESOURCE *resource_ptr, struct regspec *io, int *io_count) { - ACPI_RESOURCE_MEM32 mem32 = resource_ptr->Data.Memory32; + ACPI_RESOURCE_MEMORY32 mem32 = resource_ptr->Data.Memory32; - if (resource_ptr->Data.Memory32.MinBaseAddress == - resource_ptr->Data.Memory32.MaxBaseAddress) { + if (resource_ptr->Data.Memory32.Minimum == + resource_ptr->Data.Memory32.Maximum) { io[*io_count].regspec_bustype = 0; /* memory */ - io[*io_count].regspec_addr = mem32.MinBaseAddress; - io[*io_count].regspec_size = mem32.RangeLength; + io[*io_count].regspec_addr = mem32.Minimum; + io[*io_count].regspec_size = mem32.AddressLength; (*io_count)++; if (acpi_enum_debug & PARSE_RES_MEMORY) { cmn_err(CE_NOTE, "parse_resources() "\ "Mem 32 0x%X, length: 0x%X", - mem32.MinBaseAddress, mem32.RangeLength); + mem32.Minimum, mem32.AddressLength); } return; } @@ -252,8 +252,8 @@ cmn_err(CE_NOTE, "parse_resources() "\ "MEM32 Min Max not equal!"); cmn_err(CE_NOTE, "parse_resources() "\ - "Mem 32 MinBaseAddress 0x%X, MaxBaseAddress: 0x%X", - mem32.MinBaseAddress, mem32.MaxBaseAddress); + "Mem 32 Minimum 0x%X, Maximum: 0x%X", + mem32.Minimum, mem32.Maximum); } } @@ -279,15 +279,15 @@ "%s "\ "MinAddressFixed 0x%X, "\ "MaxAddressFixed 0x%X, "\ - "MinAddressRange 0x%X, "\ - "MaxAddressRange 0x%X, "\ + "Minimum 0x%X, "\ + "Maximum 0x%X, "\ "length: 0x%X\n", addr16.ProducerConsumer == ACPI_CONSUMER ? "CONSUMER" : "PRODUCER", addr16.MinAddressFixed, addr16.MaxAddressFixed, - addr16.MinAddressRange, - addr16.MaxAddressRange, + addr16.Minimum, + addr16.Maximum, addr16.AddressLength); } if (addr16.ResourceType != ACPI_MEMORY_RANGE && @@ -302,7 +302,7 @@ /* io */ io[*io_count].regspec_bustype = 1; } - io[*io_count].regspec_addr = addr16.MinAddressRange; + io[*io_count].regspec_addr = addr16.Minimum; io[*io_count].regspec_size = addr16.AddressLength; (*io_count)++; } @@ -330,15 +330,15 @@ "%s "\ "MinAddressFixed 0x%X, "\ "MaxAddressFixed 0x%X, "\ - "MinAddressRange 0x%X, "\ - "MaxAddressRange 0x%X, "\ + "Minimum 0x%X, "\ + "Maximum 0x%X, "\ "length: 0x%X\n", addr32.ProducerConsumer == ACPI_CONSUMER ? "CONSUMER" : "PRODUCER", addr32.MinAddressFixed, addr32.MaxAddressFixed, - addr32.MinAddressRange, - addr32.MaxAddressRange, + addr32.Minimum, + addr32.Maximum, addr32.AddressLength); } if (addr32.ResourceType != ACPI_MEMORY_RANGE && @@ -353,7 +353,7 @@ /* io */ io[*io_count].regspec_bustype = 1; } - io[*io_count].regspec_addr = addr32.MinAddressRange; + io[*io_count].regspec_addr = addr32.Minimum; io[*io_count].regspec_size = addr32.AddressLength; (*io_count)++; } @@ -382,24 +382,24 @@ "%s "\ "MinAddressFixed 0x%X, "\ "MaxAddressFixed 0x%X, "\ - "MinAddressRange 0x%lX, "\ - "MaxAddressRange 0x%lX, "\ + "Minimum 0x%lX, "\ + "Maximum 0x%lX, "\ "length: 0x%lX\n", #else cmn_err(CE_NOTE, "parse_resources() "\ "%s "\ "MinAddressFixed 0x%X, "\ "MaxAddressFixed 0x%X, "\ - "MinAddressRange 0x%llX, "\ - "MaxAddressRange 0x%llX, "\ + "Minimum 0x%llX, "\ + "Maximum 0x%llX, "\ "length: 0x%llX\n", #endif addr64.ProducerConsumer == ACPI_CONSUMER ? "CONSUMER" : "PRODUCER", addr64.MinAddressFixed, addr64.MaxAddressFixed, - addr64.MinAddressRange, - addr64.MaxAddressRange, + addr64.Minimum, + addr64.Maximum, addr64.AddressLength); } if (addr64.ResourceType != ACPI_MEMORY_RANGE && @@ -414,7 +414,7 @@ /* io */ io[*io_count].regspec_bustype = 1; } - io[*io_count].regspec_addr = addr64.MinAddressRange; + io[*io_count].regspec_addr = addr64.Minimum; io[*io_count].regspec_size = addr64.AddressLength; (*io_count)++; } @@ -446,68 +446,73 @@ } resource_ptr = (ACPI_RESOURCE *)current_ptr; current_ptr += resource_ptr->Length; - switch (resource_ptr->Id) { - case ACPI_RSTYPE_END_TAG: + switch (resource_ptr->Type) { + case ACPI_RESOURCE_TYPE_END_TAG: current_ptr = last_ptr; break; - case ACPI_RSTYPE_IO: + case ACPI_RESOURCE_TYPE_IO: parse_resources_io(resource_ptr, io, &io_count); break; - case ACPI_RSTYPE_FIXED_IO: + case ACPI_RESOURCE_TYPE_FIXED_IO: parse_resources_fixed_io(resource_ptr, io, &io_count); break; - case ACPI_RSTYPE_FIXED_MEM32: + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: parse_resources_fixed_mem32(resource_ptr, io, &io_count); break; - case ACPI_RSTYPE_MEM32: + case ACPI_RESOURCE_TYPE_MEMORY32: parse_resources_mem32(resource_ptr, io, &io_count); break; - case ACPI_RSTYPE_ADDRESS16: + case ACPI_RESOURCE_TYPE_ADDRESS16: parse_resources_addr16(resource_ptr, io, &io_count); break; - case ACPI_RSTYPE_ADDRESS32: + case ACPI_RESOURCE_TYPE_ADDRESS32: parse_resources_addr32(resource_ptr, io, &io_count); break; - case ACPI_RSTYPE_ADDRESS64: + case ACPI_RESOURCE_TYPE_ADDRESS64: parse_resources_addr64(resource_ptr, io, &io_count); break; - case ACPI_RSTYPE_IRQ: + case ACPI_RESOURCE_TYPE_IRQ: parse_resources_irq(resource_ptr, &interrupt_count); break; - case ACPI_RSTYPE_DMA: + case ACPI_RESOURCE_TYPE_DMA: parse_resources_dma(resource_ptr, &dma_count); break; - case ACPI_RSTYPE_START_DPF: + case ACPI_RESOURCE_TYPE_START_DEPENDENT: cmn_err(CE_NOTE, - "!ACPI source type ACPI_RSTYPE_START_DPF not "\ - "supported"); + "!ACPI source type" + " ACPI_RESOURCE_TYPE_START_DEPENDENT" + " not supported"); break; - case ACPI_RSTYPE_END_DPF: + case ACPI_RESOURCE_TYPE_END_DEPENDENT: cmn_err(CE_NOTE, - "!ACPI source type ACPI_RSTYPE_END_DPF not "\ - "supported"); + "!ACPI source type" + " ACPI_RESOURCE_TYPE_END_DEPENDENT" + " not supported"); break; - case ACPI_RSTYPE_VENDOR: + case ACPI_RESOURCE_TYPE_VENDOR: cmn_err(CE_NOTE, - "!ACPI source type ACPI_RSTYPE_VENDOR not "\ - "supported"); + "!ACPI source type" + " ACPI_RESOURCE_TYPE_VENDOR" + " not supported"); break; - case ACPI_RSTYPE_MEM24: + case ACPI_RESOURCE_TYPE_MEMORY24: cmn_err(CE_NOTE, - "!ACPI source type ACPI_RSTYPE_MEM24 not "\ - "supported"); + "!ACPI source type" + " ACPI_RESOURCE_TYPE_MEMORY24" + " not supported"); break; - case ACPI_RSTYPE_EXT_IRQ: + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: cmn_err(CE_NOTE, - "!ACPI source type ACPI_RSTYPE_EXT_IRQ not "\ - "supported"); + "!ACPI source type" + " ACPI_RESOURCE_TYPE_EXT_IRQ" + " not supported"); break; default: /* Some types are not yet implemented (See CA 6.4) */ cmn_err(CE_NOTE, "!ACPI resource type (0X%X) not yet supported", - resource_ptr->Id); + resource_ptr->Type); break; } }
--- a/usr/src/uts/i86pc/io/acpica/acpica.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/acpica.c Thu Nov 17 08:46:01 2005 -0800 @@ -120,23 +120,11 @@ int _fini(void) { - int status; - extern int intr_hooked; - - status = AcpiTerminate(); - if (status != AE_OK) { - cmn_err(CE_WARN, "!acpica: error terminating: %d", status); - return (EBUSY); - } - - if (intr_hooked) { - /* also note this error; terminate should have detached intr */ - cmn_err(CE_WARN, "!acpica: error terminating: SCI attached"); - return (EBUSY); - } - - mutex_destroy(&acpica_module_lock); - return (mod_remove(&modlinkage)); + /* + * acpica module is never unloaded at run-time; there's always + * a PSM depending on it, at the very least + */ + return (EBUSY); } /*
--- a/usr/src/uts/i86pc/io/acpica/changes.txt Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/changes.txt Thu Nov 17 08:46:01 2005 -0800 @@ -1,3 +1,286 @@ +---------------------------------------- +30 September 2005. Summary of changes for version 20050930: + +1) ACPI CA Core Subsystem: + +Completed a major overhaul of the Resource Manager code - +specifically, optimizations in the area of the AML/internal +resource conversion code. The code has been optimized to simplify +and eliminate duplicated code, CPU stack use has been decreased +by optimizing function parameters and local variables, and naming +conventions across the manager have been standardized for clarity +and ease of maintenance (this includes function, parameter, +variable, and struct/typedef names.) The update may force changes +in some driver code, depending on how resources are handled by +the host OS. + +All Resource Manager dispatch and information tables have been +moved to a single location for clarity and ease of maintenance. +One new file was created, named "rsinfo.c". + +The ACPI return macros (return_ACPI_STATUS, etc.) have been +modified to guarantee that the argument is not evaluated twice, +making them less prone to macro side-effects. However, since +there exists the possibility of additional stack use if a +particular compiler cannot optimize them (such as in the debug +generation case), the original macros are optionally available. +Note that some invocations of the return_VALUE macro may now +cause size mismatch warnings; the return_UINT8 and return_UINT32 +macros are provided to eliminate these. (From Randy Dunlap) + +Implemented a new mechanism to enable debug tracing for +individual control methods. A new external interface, +AcpiDebugTrace, is provided to enable this mechanism. The intent +is to allow the host OS to easily enable and disable tracing for +problematic control methods. This interface can be easily exposed +to a user or debugger interface if desired. See the file +psxface.c for details. + +AcpiUtCallocate will now return a valid pointer if a length of +zero is specified - a length of one is used and a warning is +issued. This matches the behavior of AcpiUtAllocate. + +Code and Data Size: The current and previous library sizes for +the core subsystem are shown below. These are the code and data +sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0 +32-bit compiler. These values do not include any ACPI driver or +OSPM code. The debug version of the code includes the debug +output trace mechanism and has a much larger code and data size. +Note that these values will vary depending on the efficiency of +the compiler and the compiler options used during generation. + + Previous Release: + Non-Debug Version: 77.5K Code, 12.0K Data, 89.5K Total + Debug Version: 168.1K Code, 68.4K Data, 236.5K Total + Current Release: + Non-Debug Version: 77.1K Code, 12.1K Data, 89.2K Total + Debug Version: 168.0K Code, 68.3K Data, 236.3K Total + + +2) iASL Compiler/Disassembler: + +A remark is issued if the effective compile-time length of a +package or buffer is zero. Previously, this was a warning. + +---------------------------------------- +16 September 2005. Summary of changes for version 20050916: + +1) ACPI CA Core Subsystem: + +Fixed a problem within the Resource Manager where support for the +Generic Register descriptor was not fully implemented. This +descriptor is now fully recognized, parsed, disassembled, and +displayed. + +Completely restructured the Resource Manager code to utilize +table-driven dispatch and lookup, eliminating many of the large +switch() statements. This reduces overall subsystem code size and +code complexity. Affects the resource parsing and construction, +disassembly, and debug dump output. + +Cleaned up and restructured the debug dump output for all +resource descriptors. Improved readability of the output and +reduced code size. + +Fixed a problem where changes to internal data structures caused +the optional ACPI_MUTEX_DEBUG code to fail compilation if +specified. + +Code and Data Size: The current and previous library sizes for +the core subsystem are shown below. These are the code and data +sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0 +32-bit compiler. These values do not include any ACPI driver or +OSPM code. The debug version of the code includes the debug +output trace mechanism and has a much larger code and data size. +Note that these values will vary depending on the efficiency of +the compiler and the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.4K Code, 11.8K Data, 90.2K Total + Debug Version: 169.6K Code, 69.9K Data, 239.5K Total + Current Release: + Non-Debug Version: 77.5K Code, 12.0K Data, 89.5K Total + Debug Version: 168.1K Code, 68.4K Data, 236.5K Total + + +2) iASL Compiler/Disassembler: + +Updated the disassembler to automatically insert an +EndDependentFn() macro into the ASL stream if this macro is +missing in the original AML code, simplifying compilation of the +resulting ASL module. + +Fixed a problem in the disassembler where a disassembled +ResourceSource string (within a large resource descriptor) was +not surrounded by quotes and not followed by a comma, causing +errors when the resulting ASL module was compiled. Also, escape +sequences within a ResourceSource string are now handled +correctly (especially "\\") + +---------------------------------------- +02 September 2005. Summary of changes for version 20050902: + +1) ACPI CA Core Subsystem: + +Fixed a problem with the internal Owner ID allocation and +deallocation mechanisms for control method execution and +recursive method invocation. This should eliminate the +OWNER_ID_LIMIT exceptions and "Invalid OwnerId" messages seen on +some systems. Recursive method invocation depth is currently +limited to 255. (Alexey Starikovskiy) + +Completely eliminated all vestiges of support for the "module- +level executable code" until this support is fully implemented +and debugged. This should eliminate the NO_RETURN_VALUE +exceptions seen during table load on some systems that invoke +this support. + +Fixed a problem within the resource manager code where the +transaction flags for a 64-bit address descriptor were handled +incorrectly in the type-specific flag byte. + +Consolidated duplicate code within the address descriptor +resource manager code, reducing overall subsystem code size. + +Fixed a fault when using the AML debugger "disassemble" command +to disassemble individual control methods. + +Removed references to the "release_current" directory within the +Unix release package. + +Code and Data Size: The current and previous core subsystem +library sizes are shown below. These are the code and data sizes +for the acpica.lib produced by the Microsoft Visual C++ 6.0 +compiler. These values do not include any ACPI driver or OSPM +code. The debug version of the code includes the debug output +trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the +compiler and the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.6K Code, 11.7K Data, 90.3K Total + Debug Version: 170.0K Code, 69.9K Data, 239.9K Total + Current Release: + Non-Debug Version: 78.4K Code, 11.8K Data, 90.2K Total + Debug Version: 169.6K Code, 69.9K Data, 239.5K Total + + +2) iASL Compiler/Disassembler: + +Implemented an error check for illegal duplicate values in the +interrupt and dma lists for the following ASL macros: Dma(), +Irq(), IrqNoFlags(), and Interrupt(). + +Implemented error checking for the Irq() and IrqNoFlags() macros +to detect too many values in the interrupt list (16 max) and +invalid values in the list (range 0 - 15) + +The maximum length string literal within an ASL file is now +restricted to 200 characters as per the ACPI specification. + +Fixed a fault when using the -ln option (generate namespace +listing). + +Implemented an error check to determine if a DescriptorName +within a resource descriptor has already been used within the +current scope. + +---------------------------------------- +15 August 2005. Summary of changes for version 20050815: + +1) ACPI CA Core Subsystem: + +Implemented a full bytewise compare to determine if a table load +request is attempting to load a duplicate table. The compare is +performed if the table signatures and table lengths match. This +will allow different tables with the same OEM Table ID and +revision to be loaded - probably against the ACPI specification, +but discovered in the field nonetheless. + +Added the changes.txt logfile to each of the zipped release +packages. + +Code and Data Size: Current and previous core subsystem library +sizes are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and +these values do not include any ACPI driver or OSPM code. The +debug version of the code includes the debug output trace +mechanism and has a much larger code and data size. Note that +these values will vary depending on the efficiency of the +compiler and the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.6K Code, 11.7K Data, 90.3K Total + Debug Version: 167.0K Code, 69.9K Data, 236.9K Total + Current Release: + Non-Debug Version: 78.6K Code, 11.7K Data, 90.3K Total + Debug Version: 170.0K Code, 69.9K Data, 239.9K Total + + +2) iASL Compiler/Disassembler: + +Fixed a problem where incorrect AML code could be generated for +Package objects if optimization is disabled (via the -oa switch). + +Fixed a problem with where incorrect AML code is generated for +variable-length packages when the package length is not specified +and the number of initializer values is greater than 255. + +---------------------------------------- +29 July 2005. Summary of changes for version 20050729: + +1) ACPI CA Core Subsystem: + +Implemented support to ignore an attempt to install/load a +particular ACPI table more than once. Apparently there exists +BIOS code that repeatedly attempts to load the same SSDT upon +certain events. With assistance from Venkatesh Pallipadi. + +Restructured the main interface to the AML parser in order to +correctly handle all exceptional conditions. This will prevent +leakage of the OwnerId resource and should eliminate the +AE_OWNER_ID_LIMIT exceptions seen on some machines. With +assistance from Alexey Starikovskiy. + +Support for "module level code" has been disabled in this version +due to a number of issues that have appeared on various machines. +The support can be enabled by defining +ACPI_ENABLE_MODULE_LEVEL_CODE during subsystem compilation. When +the issues are fully resolved, the code will be enabled by +default again. + +Modified the internal functions for debug print support to define +the FunctionName parameter as a (const char *) for compatibility +with compiler built-in macros such as __FUNCTION__, etc. + +Linted the entire ACPICA source tree for both 32-bit and 64-bit. + +Implemented support to display an object count summary for the +AML Debugger commands Object and Methods. + +Code and Data Size: Current and previous core subsystem library +sizes are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and +these values do not include any ACPI driver or OSPM code. The +debug version of the code includes the debug output trace +mechanism and has a much larger code and data size. Note that +these values will vary depending on the efficiency of the +compiler and the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.6K Code, 11.6K Data, 90.2K Total + Debug Version: 170.0K Code, 69.7K Data, 239.7K Total + Current Release: + Non-Debug Version: 78.6K Code, 11.7K Data, 90.3K Total + Debug Version: 167.0K Code, 69.9K Data, 236.9K Total + + +2) iASL Compiler/Disassembler: + +Fixed a regression that appeared in the 20050708 version of the +compiler where an error message was inadvertently emitted for +invocations of the _OSI reserved control method. + ---------------------------------------- 08 July 2005. Summary of changes for version 20050708:
--- a/usr/src/uts/i86pc/io/acpica/debugger/dbcmds.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/debugger/dbcmds.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbcmds - debug commands and output routines - * $Revision: 127 $ + * $Revision: 1.131 $ * ******************************************************************************/ @@ -720,7 +720,7 @@ AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n", - &((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name, SubtreeEntry); + ((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry); /* Display the subtree */ @@ -983,13 +983,12 @@ void *Context, void **ReturnValue) { - ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context; + ACPI_BUFFER Buffer; ACPI_STATUS Status; - ACPI_BUFFER Buffer; - ACPI_WALK_INFO Info; - ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjHandle); + Info->Count++; /* Get and display the full pathname to this object */ @@ -1001,62 +1000,13 @@ return (AE_OK); } - Info.OwnerId = ACPI_OWNER_ID_MAX; - Info.DebugLevel = ACPI_UINT32_MAX; - Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT; - AcpiOsPrintf ("%32s", (char *) Buffer.Pointer); - AcpiNsDumpOneObject (ObjHandle, NestingLevel, &Info, NULL); ACPI_MEM_FREE (Buffer.Pointer); - return (AE_OK); - -#ifdef ACPI_OBSOLETE_CODE - /* Display short information about the object */ - - if (ObjDesc) - { - AcpiOsPrintf (" %p/%p", ObjHandle, ObjDesc); - - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) - { - case ACPI_TYPE_METHOD: - AcpiOsPrintf (" #Args %d Concurrency %X", - ObjDesc->Method.ParamCount, ObjDesc->Method.Concurrency); - break; - - case ACPI_TYPE_INTEGER: - AcpiOsPrintf (" Value %8.8X%8.8X", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); - break; - case ACPI_TYPE_STRING: - AcpiOsPrintf (" \"%s\"", ObjDesc->String.Pointer); - break; - - case ACPI_TYPE_REGION: - AcpiOsPrintf (" SpaceId %X Length %X Address %8.8X%8.8X", - ObjDesc->Region.SpaceId, - ObjDesc->Region.Length, - ACPI_FORMAT_UINT64 (ObjDesc->Region.Address)); - break; + /* Dump short info about the object */ - case ACPI_TYPE_PACKAGE: - AcpiOsPrintf (" #Elements %X", ObjDesc->Package.Count); - break; - - case ACPI_TYPE_BUFFER: - AcpiOsPrintf (" Length %X", ObjDesc->Buffer.Length); - break; - - default: - /* Ignore other object types */ - break; - } - } - - AcpiOsPrintf ("\n"); + (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, Info, NULL); return (AE_OK); -#endif } @@ -1078,6 +1028,7 @@ char *ObjTypeArg, char *DisplayCountArg) { + ACPI_WALK_INFO Info; ACPI_OBJECT_TYPE Type; @@ -1092,15 +1043,24 @@ AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); AcpiOsPrintf ( - "Objects of type [%s] defined in the current ACPI Namespace: \n", + "Objects of type [%s] defined in the current ACPI Namespace:\n", AcpiUtGetTypeName (Type)); AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); + Info.Count = 0; + Info.OwnerId = ACPI_OWNER_ID_MAX; + Info.DebugLevel = ACPI_UINT32_MAX; + Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT; + /* Walk the namespace from the root */ (void) AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbWalkForSpecificObjects, (void *) &Type, NULL); + AcpiDbWalkForSpecificObjects, (void *) &Info, NULL); + + AcpiOsPrintf ( + "\nFound %u objects of type [%s] in the current ACPI Namespace\n", + Info.Count, AcpiUtGetTypeName (Type)); AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); return (AE_OK); @@ -1164,7 +1124,7 @@ Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT; AcpiOsPrintf ("%32s", (char *) Buffer.Pointer); - AcpiNsDumpOneObject (ObjHandle, NestingLevel, &Info, NULL); + (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, &Info, NULL); ACPI_MEM_FREE (Buffer.Pointer); } @@ -1640,7 +1600,7 @@ if (ACPI_SUCCESS (Status)) { AcpiOsPrintf (" _CID=%s", Cid->Id[0].Value); - ACPI_MEM_FREE (Cid); + ACPI_MEM_FREE (Cid); } AcpiOsPrintf ("\n");
--- a/usr/src/uts/i86pc/io/acpica/debugger/dbdisply.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/debugger/dbdisply.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbdisply - debug display commands - * $Revision: 111 $ + * $Revision: 1.112 $ * ******************************************************************************/ @@ -845,7 +845,7 @@ AcpiOsPrintf ("\nBlock %d - Info %p DeviceNode %p [%s]\n", Block, GpeBlock, GpeBlock->Node, Buffer); - AcpiOsPrintf (" Registers: %u (%u GPEs) \n", + AcpiOsPrintf (" Registers: %u (%u GPEs)\n", GpeBlock->RegisterCount, ACPI_MUL_8 (GpeBlock->RegisterCount));
--- a/usr/src/uts/i86pc/io/acpica/debugger/dbexec.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/debugger/dbexec.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbexec - debugger control method execution - * $Revision: 69 $ + * $Revision: 1.70 $ * ******************************************************************************/ @@ -435,7 +435,7 @@ * Allow any handlers in separate threads to complete. * (Such as Notify handlers invoked from AML executed above). */ - AcpiOsSleep (10); + AcpiOsSleep ((ACPI_INTEGER) 10); #ifdef ACPI_DEBUG_OUTPUT
--- a/usr/src/uts/i86pc/io/acpica/debugger/dbfileio.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/debugger/dbfileio.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ * * Module Name: dbfileio - Debugger file I/O commands. These can't usually * be used when running the debugger in Ring 0 (Kernel mode) - * $Revision: 82 $ + * $Revision: 1.84 $ * ******************************************************************************/ @@ -316,7 +316,7 @@ fseek (fp, 0, SEEK_END); - FileSize = ftell (fp); + FileSize = (UINT32) ftell (fp); fseek (fp, 0, SEEK_SET); /* Read the table header */ @@ -450,6 +450,13 @@ Status = AcpiTbInstallTable (&TableInfo); if (ACPI_FAILURE (Status)) { + if (Status == AE_ALREADY_EXISTS) + { + /* Table already exists, no error */ + + Status = AE_OK; + } + /* Free table allocated by AcpiTbGetTable */ AcpiTbDeleteSingleTable (&TableInfo);
--- a/usr/src/uts/i86pc/io/acpica/debugger/dbhistry.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/debugger/dbhistry.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dbhistry - debugger HISTORY command - * $Revision: 32 $ + * $Revision: 1.32 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/debugger/dbinput.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/debugger/dbinput.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbinput - user front-end to the AML debugger - * $Revision: 109 $ + * $Revision: 1.111 $ * ******************************************************************************/ @@ -206,6 +206,7 @@ CMD_TABLES, CMD_TERMINATE, CMD_THREADS, + CMD_TRACE, CMD_TREE, CMD_TYPE, CMD_UNLOAD @@ -266,6 +267,7 @@ {"TABLES", 0}, {"TERMINATE", 0}, {"THREADS", 3}, + {"TRACE", 1}, {"TREE", 0}, {"TYPE", 1}, {"UNLOAD", 1}, @@ -383,6 +385,7 @@ AcpiOsPrintf ("Results Display method result stack\n"); AcpiOsPrintf ("Set <A|L> <#> <Value> Set method data (Arguments/Locals)\n"); AcpiOsPrintf ("Stop Terminate control method\n"); + AcpiOsPrintf ("Trace <method name> Trace method execution\n"); AcpiOsPrintf ("Tree Display control method calling tree\n"); AcpiOsPrintf ("<Enter> Single step next AML opcode (over calls)\n"); return; @@ -654,7 +657,7 @@ break; case CMD_DISASSEMBLE: - AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]); + (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]); break; case CMD_DUMP: @@ -862,6 +865,10 @@ AcpiGbl_DbArgs[3]); break; + case CMD_TRACE: + AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1); + break; + case CMD_TREE: AcpiDbDisplayCallingTree (); break;
--- a/usr/src/uts/i86pc/io/acpica/debugger/dbstats.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/debugger/dbstats.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbstats - Generation and display of ACPI table statistics - * $Revision: 78 $ + * $Revision: 1.79 $ * ******************************************************************************/ @@ -141,6 +141,10 @@ void *Context, void **ReturnValue); +static void +AcpiDbListInfo ( + ACPI_MEMORY_LIST *List); + /* * Statistics subcommands @@ -178,7 +182,7 @@ * ******************************************************************************/ -void +static void AcpiDbListInfo ( ACPI_MEMORY_LIST *List) { @@ -377,7 +381,7 @@ return AE_OK; -#if ACPI_FUTURE_IMPLEMENTATION +#ifdef ACPI_FUTURE_IMPLEMENTATION /* TBD: These need to be counted during the initial parsing phase */
--- a/usr/src/uts/i86pc/io/acpica/debugger/dbutils.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/debugger/dbutils.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbutils - AML debugger utilities - * $Revision: 74 $ + * $Revision: 1.76 $ * ******************************************************************************/ @@ -116,11 +116,8 @@ #include "acpi.h" -#include "acparser.h" -#include "amlcode.h" #include "acnamesp.h" #include "acdebug.h" -#include "acdispat.h" #include "acdisasm.h" @@ -249,7 +246,7 @@ { case ACPI_TYPE_ANY: - AcpiOsPrintf ("[Object Reference] = ", ObjDesc->Reference.Handle); + AcpiOsPrintf ("[Object Reference] = %p", ObjDesc->Reference.Handle); AcpiDmDisplayInternalObject (ObjDesc->Reference.Handle, NULL); break; @@ -289,7 +286,7 @@ case ACPI_TYPE_PACKAGE: - AcpiOsPrintf ("[Package] Contains %d Elements: \n", + AcpiOsPrintf ("[Package] Contains %d Elements:\n", ObjDesc->Package.Count); for (i = 0; i < ObjDesc->Package.Count; i++) @@ -301,7 +298,7 @@ case ACPI_TYPE_LOCAL_REFERENCE: - AcpiOsPrintf ("[Object Reference] = ", ObjDesc->Reference.Handle); + AcpiOsPrintf ("[Object Reference] = %p", ObjDesc->Reference.Handle); AcpiDmDisplayInternalObject (ObjDesc->Reference.Handle, NULL); break;
--- a/usr/src/uts/i86pc/io/acpica/debugger/dbxface.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/debugger/dbxface.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbxface - AML Debugger external interfaces - * $Revision: 75 $ + * $Revision: 1.75 $ * ******************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/events/evevent.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/events/evevent.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evevent - Fixed Event handling and dispatch - * $Revision: 117 $ + * $Revision: 1.117 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/events/evgpe.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/events/evgpe.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evgpe - General Purpose Event handling and dispatch - * $Revision: 50 $ + * $Revision: 1.52 $ * *****************************************************************************/ @@ -728,7 +728,7 @@ ACPI_REPORT_ERROR (( "AcpiEvGpeDispatch: %s, Unable to clear GPE[%2X]\n", AcpiFormatException (Status), GpeNumber)); - return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); + return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); } } @@ -772,7 +772,7 @@ ACPI_REPORT_ERROR (( "AcpiEvGpeDispatch: %s, Unable to clear GPE[%2X]\n", AcpiFormatException (Status), GpeNumber)); - return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); + return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); } } break; @@ -789,7 +789,7 @@ ACPI_REPORT_ERROR (( "AcpiEvGpeDispatch: %s, Unable to disable GPE[%2X]\n", AcpiFormatException (Status), GpeNumber)); - return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); + return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); } /* @@ -824,12 +824,12 @@ ACPI_REPORT_ERROR (( "AcpiEvGpeDispatch: %s, Unable to disable GPE[%2X]\n", AcpiFormatException (Status), GpeNumber)); - return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); + return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); } break; } - return_VALUE (ACPI_INTERRUPT_HANDLED); + return_UINT32 (ACPI_INTERRUPT_HANDLED); }
--- a/usr/src/uts/i86pc/io/acpica/events/evgpeblk.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/events/evgpeblk.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evgpeblk - GPE block creation and initialization. - * $Revision: 45 $ + * $Revision: 1.46 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/events/evmisc.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/events/evmisc.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evmisc - Miscellaneous event manager support functions - * $Revision: 84 $ + * $Revision: 1.86 $ * *****************************************************************************/ @@ -506,6 +506,9 @@ */ if (Status == AE_NO_HARDWARE_RESPONSE) { + ACPI_REPORT_ERROR (( + "No response from Global Lock hardware, disabling lock\n")); + AcpiGbl_GlobalLockPresent = FALSE; Status = AE_OK; }
--- a/usr/src/uts/i86pc/io/acpica/events/evregion.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/events/evregion.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch - * $Revision: 156 $ + * $Revision: 1.156 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/events/evrgnini.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/events/evrgnini.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evrgnini- ACPI AddressSpace (OpRegion) init - * $Revision: 78 $ + * $Revision: 1.78 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/events/evsci.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/events/evsci.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ * * Module Name: evsci - System Control Interrupt configuration and * legacy to ACPI mode state transition functions - * $Revision: 97 $ + * $Revision: 1.98 $ * ******************************************************************************/ @@ -171,7 +171,7 @@ */ InterruptHandled |= AcpiEvGpeDetect (GpeXruptList); - return_VALUE (InterruptHandled); + return_UINT32 (InterruptHandled); } @@ -209,7 +209,7 @@ */ InterruptHandled |= AcpiEvGpeDetect (GpeXruptList); - return_VALUE (InterruptHandled); + return_UINT32 (InterruptHandled); }
--- a/usr/src/uts/i86pc/io/acpica/events/evxface.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/events/evxface.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evxface - External interfaces for ACPI events - * $Revision: 150 $ + * $Revision: 1.151 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/events/evxfevnt.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/events/evxfevnt.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable - * $Revision: 82 $ + * $Revision: 1.82 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/events/evxfregn.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/events/evxfregn.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ * * Module Name: evxfregn - External Interfaces, ACPI Operation Regions and * Address Spaces. - * $Revision: 64 $ + * $Revision: 1.64 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/hardware/hwacpi.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/hardware/hwacpi.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface - * $Revision: 69 $ + * $Revision: 1.70 $ * *****************************************************************************/ @@ -301,21 +301,21 @@ */ if (!AcpiGbl_FADT->SmiCmd) { - return_VALUE (ACPI_SYS_MODE_ACPI); + return_UINT32 (ACPI_SYS_MODE_ACPI); } Status = AcpiGetRegister (ACPI_BITREG_SCI_ENABLE, &Value, ACPI_MTX_LOCK); if (ACPI_FAILURE (Status)) { - return_VALUE (ACPI_SYS_MODE_LEGACY); + return_UINT32 (ACPI_SYS_MODE_LEGACY); } if (Value) { - return_VALUE (ACPI_SYS_MODE_ACPI); + return_UINT32 (ACPI_SYS_MODE_ACPI); } else { - return_VALUE (ACPI_SYS_MODE_LEGACY); + return_UINT32 (ACPI_SYS_MODE_LEGACY); } }
--- a/usr/src/uts/i86pc/io/acpica/hardware/hwgpe.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/hardware/hwgpe.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: hwgpe - Low level GPE enable/disable/clear functions - * $Revision: 70 $ + * $Revision: 1.71 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/hardware/hwregs.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/hardware/hwregs.c Thu Nov 17 08:46:01 2005 -0800 @@ -3,7 +3,7 @@ * * Module Name: hwregs - Read/write access functions for the various ACPI * control and status registers. - * $Revision: 171 $ + * $Revision: 1.172 $ * ******************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/hardware/hwsleep.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/hardware/hwsleep.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface - * $Revision: 75 $ + * $Revision: 1.77 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/hardware/hwtimer.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/hardware/hwtimer.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Name: hwtimer.c - ACPI Power Management Timer Interface - * $Revision: 30 $ + * $Revision: 1.30 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsfield.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsfield.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsfield - Dispatcher field routines - * $Revision: 78 $ + * $Revision: 1.78 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsinit.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsinit.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsinit - Object initialization namespace walk - * $Revision: 16 $ + * $Revision: 1.17 $ * *****************************************************************************/ @@ -160,20 +160,20 @@ void *Context, void **ReturnValue) { + ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context; + ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; ACPI_OBJECT_TYPE Type; ACPI_STATUS Status; - ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context; ACPI_FUNCTION_NAME ("DsInitOneObject"); /* - * We are only interested in objects owned by the table that + * We are only interested in NS nodes owned by the table that * was just loaded */ - if (((ACPI_NAMESPACE_NODE *) ObjHandle)->OwnerId != - Info->TableDesc->OwnerId) + if (Node->OwnerId != Info->TableDesc->OwnerId) { return (AE_OK); } @@ -203,8 +203,6 @@ case ACPI_TYPE_METHOD: - Info->MethodCount++; - /* * Print a dot for each method unless we are going to print * the entire pathname @@ -222,7 +220,7 @@ */ if (Info->TableDesc->Pointer->Revision == 1) { - ((ACPI_NAMESPACE_NODE *) ObjHandle)->Flags |= ANOBJ_DATA_WIDTH_32; + Node->Flags |= ANOBJ_DATA_WIDTH_32; } /* @@ -233,22 +231,14 @@ if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Method %p [%4.4s] - parse failure, %s\n", + "\n+Method %p [%4.4s] - parse failure, %s\n", ObjHandle, AcpiUtGetNodeName (ObjHandle), AcpiFormatException (Status))); /* This parse failed, but we will continue parsing more methods */ - - break; } - /* - * Delete the parse tree. We simply re-parse the method - * for every execution since there isn't much overhead - */ - AcpiNsDeleteNamespaceSubtree (ObjHandle); - AcpiNsDeleteNamespaceByOwner ( - ((ACPI_NAMESPACE_NODE *) ObjHandle)->Object->Method.OwnerId); + Info->MethodCount++; break;
--- a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsmethod.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsmethod.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsmethod - Parser/Interpreter interface - control method parsing - * $Revision: 107 $ + * $Revision: 1.110 $ * *****************************************************************************/ @@ -132,12 +132,11 @@ * * FUNCTION: AcpiDsParseMethod * - * PARAMETERS: ObjHandle - Method node + * PARAMETERS: Node - Method node * * RETURN: Status * - * DESCRIPTION: Call the parser and parse the AML that is associated with the - * method. + * DESCRIPTION: Parse the AML that is associated with the method. * * MUTEX: Assumes parser is locked * @@ -145,31 +144,29 @@ ACPI_STATUS AcpiDsParseMethod ( - ACPI_HANDLE ObjHandle) + ACPI_NAMESPACE_NODE *Node) { ACPI_STATUS Status; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_PARSE_OBJECT *Op; - ACPI_NAMESPACE_NODE *Node; ACPI_WALK_STATE *WalkState; - ACPI_FUNCTION_TRACE_PTR ("DsParseMethod", ObjHandle); + ACPI_FUNCTION_TRACE_PTR ("DsParseMethod", Node); /* Parameter Validation */ - if (!ObjHandle) + if (!Node) { return_ACPI_STATUS (AE_NULL_ENTRY); } ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** NamedObj=%p\n", - AcpiUtGetNodeName (ObjHandle), ObjHandle)); + AcpiUtGetNodeName (Node), Node)); /* Extract the method object from the method Node */ - Node = (ACPI_NAMESPACE_NODE *) ObjHandle; ObjDesc = AcpiNsGetAttachedObject (Node); if (!ObjDesc) { @@ -252,10 +249,18 @@ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n", - AcpiUtGetNodeName (ObjHandle), ObjHandle, Op)); + AcpiUtGetNodeName (Node), Node, Op)); + + /* + * Delete the parse tree. We simply re-parse the method for every + * execution since there isn't much overhead (compared to keeping lots + * of parse trees around) + */ + AcpiNsDeleteNamespaceSubtree (Node); + AcpiNsDeleteNamespaceByOwner (ObjDesc->Method.OwnerId); Cleanup2: - (void) AcpiUtReleaseOwnerId (ObjDesc->Method.OwnerId); + AcpiUtReleaseOwnerId (&ObjDesc->Method.OwnerId); Cleanup: AcpiPsDeleteParseTree (Op); @@ -296,6 +301,15 @@ return_ACPI_STATUS (AE_NULL_ENTRY); } + /* Prevent wraparound of thread count */ + + if (ObjDesc->Method.ThreadCount == ACPI_UINT8_MAX) + { + ACPI_REPORT_ERROR (( + "Method reached maximum reentrancy limit (255)\n")); + return_ACPI_STATUS (AE_AML_METHOD_LIMIT); + } + /* * If there is a concurrency limit on this method, we need to * obtain a unit from the method semaphore. @@ -327,6 +341,20 @@ } /* + * Allocate an Owner ID for this method, only if this is the first thread + * to begin concurrent execution. We only need one OwnerId, even if the + * method is invoked recursively. + */ + if (!ObjDesc->Method.OwnerId) + { + Status = AcpiUtAllocateOwnerId (&ObjDesc->Method.OwnerId); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + + /* * Increment the method parse tree thread count since it has been * reentered one more time (even if it is the same thread) */ @@ -383,12 +411,6 @@ return_ACPI_STATUS (AE_NULL_OBJECT); } - Status = AcpiUtAllocateOwnerId (&ObjDesc->Method.OwnerId); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Init for new method, wait on concurrency semaphore */ Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc, @@ -444,9 +466,8 @@ } /* * The resolved arguments were put on the previous walk state's operand - * stack. Operands on the previous walk state stack always - * start at index 0. - * Null terminate the list of arguments + * stack. Operands on the previous walk state stack always + * start at index 0. Also, null terminate the list of arguments */ ThisWalkState->Operands [ThisWalkState->NumOperands] = NULL; @@ -481,23 +502,22 @@ if (ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY) { Status = ObjDesc->Method.Implementation (NextWalkState); - return_ACPI_STATUS (Status); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS (Status); + +Cleanup: + /* Decrement the thread count on the method parse tree */ + + if (NextWalkState && (NextWalkState->MethodDesc)) + { + NextWalkState->MethodDesc->Method.ThreadCount--; + } /* On error, we must delete the new walk state */ -Cleanup: - (void) AcpiUtReleaseOwnerId (ObjDesc->Method.OwnerId); - if (NextWalkState && (NextWalkState->MethodDesc)) - { - /* Decrement the thread count on the method parse tree */ - - NextWalkState->MethodDesc->Method.ThreadCount--; - } - (void) AcpiDsTerminateControlMethod (NextWalkState); + AcpiDsTerminateControlMethod (NextWalkState); AcpiDsDeleteWalkState (NextWalkState); return_ACPI_STATUS (Status); } @@ -590,7 +610,7 @@ * * PARAMETERS: WalkState - State of the method * - * RETURN: Status + * RETURN: None * * DESCRIPTION: Terminate a control method. Delete everything that the method * created, delete all locals and arguments, and delete the parse @@ -598,7 +618,7 @@ * ******************************************************************************/ -ACPI_STATUS +void AcpiDsTerminateControlMethod ( ACPI_WALK_STATE *WalkState) { @@ -612,7 +632,7 @@ if (!WalkState) { - return (AE_BAD_PARAMETER); + return_VOID; } /* The current method object was saved in the walk state */ @@ -620,7 +640,7 @@ ObjDesc = WalkState->MethodDesc; if (!ObjDesc) { - return_ACPI_STATUS (AE_OK); + return_VOID; } /* Delete all arguments and locals */ @@ -635,7 +655,7 @@ Status = AcpiUtAcquireMutex (ACPI_MTX_PARSER); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + return_VOID; } /* Signal completion of the execution of this method if necessary */ @@ -647,7 +667,6 @@ if (ACPI_FAILURE (Status)) { ACPI_REPORT_ERROR (("Could not signal method semaphore\n")); - Status = AE_OK; /* Ignore error and continue cleanup */ } @@ -659,8 +678,7 @@ "*** Not deleting method namespace, there are still %d threads\n", WalkState->MethodDesc->Method.ThreadCount)); } - - if (!WalkState->MethodDesc->Method.ThreadCount) + else /* This is the last executing thread */ { /* * Support to dynamically change a method from NotSerialized to @@ -675,9 +693,8 @@ if ((WalkState->MethodDesc->Method.Concurrency == 1) && (!WalkState->MethodDesc->Method.Semaphore)) { - Status = AcpiOsCreateSemaphore (1, - 1, - &WalkState->MethodDesc->Method.Semaphore); + Status = AcpiOsCreateSemaphore (1, 1, + &WalkState->MethodDesc->Method.Semaphore); } /* @@ -695,7 +712,7 @@ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto Exit; } if (MethodNode->Child) @@ -709,14 +726,12 @@ */ AcpiNsDeleteNamespaceByOwner (WalkState->MethodDesc->Method.OwnerId); Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } + AcpiUtReleaseOwnerId (&WalkState->MethodDesc->Method.OwnerId); } - Status = AcpiUtReleaseMutex (ACPI_MTX_PARSER); - return_ACPI_STATUS (Status); +Exit: + (void) AcpiUtReleaseMutex (ACPI_MTX_PARSER); + return_VOID; }
--- a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsmthdat.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsmthdat.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dsmthdat - control method arguments and local variables - * $Revision: 85 $ + * $Revision: 1.85 $ * ******************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsobject.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsobject.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsobject - Dispatcher object management routines - * $Revision: 124 $ + * $Revision: 1.124 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsopcode.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsopcode.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ * * Module Name: dsopcode - Dispatcher Op Region support and handling of * "control" opcodes - * $Revision: 103 $ + * $Revision: 1.103 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsutils.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dsutils.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dsutils - Dispatcher utilities - * $Revision: 113 $ + * $Revision: 1.115 $ * ******************************************************************************/ @@ -273,7 +273,7 @@ if (!Op) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n")); - return_VALUE (TRUE); + return_UINT8 (TRUE); } /* @@ -303,7 +303,7 @@ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "At Method level, result of [%s] not used\n", AcpiPsGetOpcodeName (Op->Common.AmlOpcode))); - return_VALUE (FALSE); + return_UINT8 (FALSE); } /* Get info on the parent. The RootOp is AML_SCOPE */ @@ -313,7 +313,7 @@ { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", Op)); - return_VALUE (FALSE); + return_UINT8 (FALSE); } /* @@ -402,7 +402,7 @@ AcpiPsGetOpcodeName (Op->Common.AmlOpcode), AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op)); - return_VALUE (TRUE); + return_UINT8 (TRUE); ResultNotUsed: @@ -411,7 +411,7 @@ AcpiPsGetOpcodeName (Op->Common.AmlOpcode), AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op)); - return_VALUE (FALSE); + return_UINT8 (FALSE); } @@ -744,7 +744,7 @@ if (OpInfo->Flags & AML_HAS_RETVAL) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Argument previously created, already stacked \n")); + "Argument previously created, already stacked\n")); ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject ( WalkState->Operands [WalkState->NumOperands - 1], WalkState));
--- a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dswexec.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dswexec.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ * * Module Name: dswexec - Dispatcher method execution callbacks; * dispatch to interpreter. - * $Revision: 120 $ + * $Revision: 1.120 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dswload.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dswload.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dswload - Dispatcher namespace load callbacks - * $Revision: 96 $ + * $Revision: 1.98 $ * *****************************************************************************/ @@ -594,9 +594,11 @@ (WalkState->Opcode != AML_INT_NAMEPATH_OP)) || (!(WalkState->OpInfo->Flags & AML_NAMED))) { +#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) || (WalkState->OpInfo->Class == AML_CLASS_CONTROL)) { + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Begin/EXEC: %s (fl %8.8X)\n", WalkState->OpInfo->Name, WalkState->OpInfo->Flags)); @@ -606,6 +608,7 @@ Status = AcpiDsExecBeginOp (WalkState, OutOp); return_ACPI_STATUS (Status); } +#endif return_ACPI_STATUS (AE_OK); } @@ -861,6 +864,7 @@ if (!(WalkState->OpInfo->Flags & AML_NSOBJECT)) { #ifndef ACPI_NO_METHOD_EXECUTION +#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE /* No namespace object. Executable opcode? */ if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) || @@ -876,6 +880,7 @@ return_ACPI_STATUS (Status); } #endif +#endif return_ACPI_STATUS (AE_OK); }
--- a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dswscope.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dswscope.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dswscope - Scope stack manipulation - * $Revision: 63 $ + * $Revision: 1.63 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dswstate.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/dispatcher/dswstate.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dswstate - Dispatcher parse tree walk management routines - * $Revision: 89 $ + * $Revision: 1.90 $ * *****************************************************************************/ @@ -844,7 +844,7 @@ UINT8 *AmlStart, UINT32 AmlLength, ACPI_PARAMETER_INFO *Info, - UINT32 PassNumber) + UINT8 PassNumber) { ACPI_STATUS Status; ACPI_PARSE_STATE *ParserState = &WalkState->ParserState; @@ -862,7 +862,7 @@ /* The NextOp of the NextWalk will be the beginning of the method */ WalkState->NextOp = NULL; - WalkState->PassNumber = (UINT8) PassNumber; + WalkState->PassNumber = PassNumber; if (Info) {
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exconfig.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exconfig.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes) - * $Revision: 85 $ + * $Revision: 1.87 $ * *****************************************************************************/ @@ -175,6 +175,11 @@ return_ACPI_STATUS (AE_NO_MEMORY); } + /* Init the table handle */ + + ObjDesc->Reference.Opcode = AML_LOAD_OP; + *DdbHandle = ObjDesc; + /* Install the new table into the local data structures */ ACPI_MEMSET (&TableInfo, 0, sizeof (ACPI_TABLE_DESC)); @@ -185,8 +190,16 @@ TableInfo.Allocation = ACPI_MEM_ALLOCATED; Status = AcpiTbInstallTable (&TableInfo); + ObjDesc->Reference.Object = TableInfo.InstalledDesc; + if (ACPI_FAILURE (Status)) { + if (Status == AE_ALREADY_EXISTS) + { + /* Table already exists, just return the handle */ + + return_ACPI_STATUS (AE_OK); + } goto Cleanup; } @@ -201,16 +214,12 @@ goto Cleanup; } - /* Init the table handle */ - - ObjDesc->Reference.Opcode = AML_LOAD_OP; - ObjDesc->Reference.Object = TableInfo.InstalledDesc; - *DdbHandle = ObjDesc; return_ACPI_STATUS (AE_OK); Cleanup: AcpiUtRemoveReference (ObjDesc); + *DdbHandle = NULL; return_ACPI_STATUS (Status); } @@ -594,6 +603,7 @@ * (Offset contains the TableId) */ AcpiNsDeleteNamespaceByOwner (TableInfo->OwnerId); + AcpiUtReleaseOwnerId (&TableInfo->OwnerId); /* Delete the table itself */
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exconvrt.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exconvrt.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exconvrt - Object conversion routines - * $Revision: 67 $ + * $Revision: 1.67 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/excreate.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/excreate.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: excreate - Named object creation - * $Revision: 106 $ + * $Revision: 1.106 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exdump.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exdump.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exdump - Interpreter debug output routines - * $Revision: 186 $ + * $Revision: 1.188 $ * *****************************************************************************/ @@ -321,7 +321,7 @@ case ACPI_TYPE_BUFFER: - AcpiOsPrintf ("Buffer len %X @ %p \n", + AcpiOsPrintf ("Buffer len %X @ %p\n", ObjDesc->Buffer.Length, ObjDesc->Buffer.Pointer); Length = ObjDesc->Buffer.Length; @@ -437,19 +437,19 @@ case ACPI_TYPE_BUFFER_FIELD: AcpiOsPrintf ( - "BufferField: %X bits at byte %X bit %X of \n", + "BufferField: %X bits at byte %X bit %X of\n", ObjDesc->BufferField.BitLength, ObjDesc->BufferField.BaseByteOffset, ObjDesc->BufferField.StartFieldBitOffset); if (!ObjDesc->BufferField.BufferObj) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n")); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL*\n")); } else if (ACPI_GET_OBJECT_TYPE (ObjDesc->BufferField.BufferObj) != ACPI_TYPE_BUFFER) { - AcpiOsPrintf ("*not a Buffer* \n"); + AcpiOsPrintf ("*not a Buffer*\n"); } else { @@ -699,7 +699,7 @@ } else { - AcpiOsPrintf ("%s\n", RetBuf.Pointer); + AcpiOsPrintf ("%s\n", (char *) RetBuf.Pointer); ACPI_MEM_FREE (RetBuf.Pointer); } } @@ -792,7 +792,7 @@ case ACPI_TYPE_PACKAGE: - AcpiOsPrintf ("[Package] Contains %d Elements: \n", + AcpiOsPrintf ("[Package] Contains %d Elements:\n", ObjDesc->Package.Count); for (i = 0; i < ObjDesc->Package.Count; i++)
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exfield.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exfield.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exfield - ACPI AML (p-code) execution - field manipulation - * $Revision: 124 $ + * $Revision: 1.124 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exfldio.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exfldio.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exfldio - Aml Field I/O - * $Revision: 116 $ + * $Revision: 1.116 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exmisc.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exmisc.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes - * $Revision: 131 $ + * $Revision: 1.131 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exmutex.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exmutex.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exmutex - ASL Mutex Acquire/Release functions - * $Revision: 28 $ + * $Revision: 1.28 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exnames.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exnames.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exnames - interpreter/scanner name load/execute - * $Revision: 102 $ + * $Revision: 1.103 $ * *****************************************************************************/ @@ -298,12 +298,12 @@ { ACPI_STRCAT (NameString, CharBuf); ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Appended to - %s \n", NameString)); + "Appended to - %s\n", NameString)); } else { ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "No Name string - %s \n", CharBuf)); + "No Name string - %s\n", CharBuf)); } } else if (Index == 0)
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exoparg1.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exoparg1.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exoparg1 - AML execution - opcodes with 1 argument - * $Revision: 171 $ + * $Revision: 1.172 $ * *****************************************************************************/ @@ -1080,7 +1080,7 @@ ReturnDesc = *(Operand[0]->Reference.Where); if (ReturnDesc) { - AcpiUtAddReference (ReturnDesc); + AcpiUtAddReference (ReturnDesc); } break;
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exoparg2.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exoparg2.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exoparg2 - AML execution - opcodes with 2 arguments - * $Revision: 134 $ + * $Revision: 1.134 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exoparg3.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exoparg3.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exoparg3 - AML execution - opcodes with 3 arguments - * $Revision: 27 $ + * $Revision: 1.27 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exoparg6.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exoparg6.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exoparg6 - AML execution - opcodes with 6 arguments - * $Revision: 23 $ + * $Revision: 1.23 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exprep.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exprep.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities - * $Revision: 134 $ + * $Revision: 1.135 $ * *****************************************************************************/ @@ -364,7 +364,7 @@ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown field access type %X\n", Access)); - return_VALUE (0); + return_UINT32 (0); } if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD) @@ -378,7 +378,7 @@ } *ReturnByteAlignment = ByteAlignment; - return_VALUE (BitLength); + return_UINT32 (BitLength); }
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exregion.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exregion.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exregion - ACPI default OpRegion (address space) handlers - * $Revision: 90 $ + * $Revision: 1.90 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exresnte.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exresnte.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exresnte - AML Interpreter object resolution - * $Revision: 68 $ + * $Revision: 1.68 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exresolv.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exresolv.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exresolv - AML Interpreter object resolution - * $Revision: 132 $ + * $Revision: 1.132 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exresop.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exresop.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exresop - AML Interpreter operand/object resolution - * $Revision: 85 $ + * $Revision: 1.86 $ * *****************************************************************************/ @@ -250,7 +250,7 @@ } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Opcode %X [%s] RequiredOperandTypes=%8.8X \n", + "Opcode %X [%s] RequiredOperandTypes=%8.8X\n", Opcode, OpInfo->Name, ArgTypes)); /*
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exstore.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exstore.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exstore - AML Interpreter object store support - * $Revision: 196 $ + * $Revision: 1.196 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exstoren.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exstoren.c Thu Nov 17 08:46:01 2005 -0800 @@ -3,7 +3,7 @@ * * Module Name: exstoren - AML Interpreter object store support, * Store to Node (namespace object) - * $Revision: 64 $ + * $Revision: 1.64 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exstorob.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exstorob.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exstorob - AML Interpreter object store support, store to object - * $Revision: 57 $ + * $Revision: 1.57 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exsystem.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exsystem.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exsystem - Interface to OS services - * $Revision: 84 $ + * $Revision: 1.84 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/executer/exutils.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/executer/exutils.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exutils - interpreter/scanner utilities - * $Revision: 117 $ + * $Revision: 1.118 $ * *****************************************************************************/ @@ -311,7 +311,7 @@ } } - return_VALUE (Locked); + return_UINT8 (Locked); } @@ -388,7 +388,7 @@ if (Value == 0) { - return_VALUE (1); + return_UINT32 (1); } CurrentValue = Value; @@ -402,7 +402,7 @@ NumDigits++; } - return_VALUE (NumDigits); + return_UINT32 (NumDigits); }
--- a/usr/src/uts/i86pc/io/acpica/interpreter/parser/psargs.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/parser/psargs.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psargs - Parse AML opcode arguments - * $Revision: 80 $ + * $Revision: 1.81 $ * *****************************************************************************/ @@ -202,7 +202,7 @@ break; } - return_VALUE (Length); + return_UINT32 (Length); }
--- a/usr/src/uts/i86pc/io/acpica/interpreter/parser/psloop.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/parser/psloop.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psloop - Main AML parse loop - * $Revision: 3 $ + * $Revision: 1.5 $ * *****************************************************************************/ @@ -128,8 +128,6 @@ #include "acparser.h" #include "acdispat.h" #include "amlcode.h" -#include "acnamesp.h" -#include "acinterp.h" #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME ("psloop") @@ -519,7 +517,7 @@ /* TBD (remove): Temporary mechanism to disable this code if needed */ -#ifndef ACPI_NO_MODULE_LEVEL_CODE +#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE if ((WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS1) && ((WalkState->ParseFlags & ACPI_PARSE_DISASSEMBLE) == 0)) @@ -538,6 +536,9 @@ case AML_ELSE_OP: case AML_WHILE_OP: + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + "Pass1: Skipping an If/Else/While body\n")); + /* Skip body of if/else/while in pass 1 */ ParserState->Aml = ParserState->PkgEnd;
--- a/usr/src/uts/i86pc/io/acpica/interpreter/parser/psopcode.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/parser/psopcode.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psopcode - Parser/Interpreter opcode information table - * $Revision: 93 $ + * $Revision: 1.93 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/parser/psparse.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/parser/psparse.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psparse - Parser top level AML parse routines - * $Revision: 157 $ + * $Revision: 1.158 $ * *****************************************************************************/ @@ -533,7 +533,6 @@ ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status; - ACPI_STATUS TerminateStatus; ACPI_THREAD_STATE *Thread; ACPI_THREAD_STATE *PrevWalkList = AcpiGbl_CurrentWalkList; ACPI_WALK_STATE *PreviousWalkState; @@ -610,6 +609,10 @@ ACPI_REPORT_METHOD_ERROR ("Method execution failed", WalkState->MethodNode, NULL, Status); + /* Ensure proper cleanup */ + + WalkState->ParseFlags |= ACPI_PARSE_EXECUTE; + /* Check for possible multi-thread reentrancy problem */ if ((Status == AE_ALREADY_EXISTS) && @@ -626,16 +629,6 @@ } } - if (WalkState->MethodDesc) - { - /* Decrement the thread count on the method parse tree */ - - if (WalkState->MethodDesc->Method.ThreadCount) - { - WalkState->MethodDesc->Method.ThreadCount--; - } - } - /* We are done with this walk, move on to the parent if any */ WalkState = AcpiDsPopWalkState (Thread); @@ -650,14 +643,14 @@ */ if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) { - TerminateStatus = AcpiDsTerminateControlMethod (WalkState); - if (ACPI_FAILURE (TerminateStatus)) + if (WalkState->MethodDesc) { - ACPI_REPORT_ERROR (( - "Could not terminate control method properly\n")); + /* Decrement the thread count on the method parse tree */ - /* Ignore error and continue */ + WalkState->MethodDesc->Method.ThreadCount--; } + + AcpiDsTerminateControlMethod (WalkState); } /* Delete this walk state and all linked control states */
--- a/usr/src/uts/i86pc/io/acpica/interpreter/parser/psscope.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/parser/psscope.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psscope - Parser scope stack management routines - * $Revision: 42 $ + * $Revision: 1.42 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/parser/pstree.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/parser/pstree.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: pstree - Parser op tree manipulation/traversal/search - * $Revision: 46 $ + * $Revision: 1.46 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/parser/psutils.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/parser/psutils.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psutils - Parser miscellaneous utilities (Parser only) - * $Revision: 65 $ + * $Revision: 1.66 $ * *****************************************************************************/ @@ -280,11 +280,11 @@ if (Op->Common.Flags & ACPI_PARSEOP_GENERIC) { - AcpiOsReleaseObject (AcpiGbl_PsNodeCache, Op); + (void) AcpiOsReleaseObject (AcpiGbl_PsNodeCache, Op); } else { - AcpiOsReleaseObject (AcpiGbl_PsNodeExtCache, Op); + (void) AcpiOsReleaseObject (AcpiGbl_PsNodeExtCache, Op); } }
--- a/usr/src/uts/i86pc/io/acpica/interpreter/parser/pswalk.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/parser/pswalk.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: pswalk - Parser routines to walk parsed op tree(s) - * $Revision: 75 $ + * $Revision: 1.75 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/interpreter/parser/psxface.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/interpreter/parser/psxface.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psxface - Parser external interfaces - * $Revision: 79 $ + * $Revision: 1.84 $ * *****************************************************************************/ @@ -120,19 +120,195 @@ #include "acparser.h" #include "acdispat.h" #include "acinterp.h" -#include "acnamesp.h" #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME ("psxface") +/* Local Prototypes */ + +static void +AcpiPsStartTrace ( + ACPI_PARAMETER_INFO *Info); + +static void +AcpiPsStopTrace ( + ACPI_PARAMETER_INFO *Info); + +static ACPI_STATUS +AcpiPsExecutePass ( + ACPI_PARAMETER_INFO *Info); + +static void +AcpiPsUpdateParameterList ( + ACPI_PARAMETER_INFO *Info, + UINT16 Action); + + +/******************************************************************************* + * + * FUNCTION: AcpiDebugTrace + * + * PARAMETERS: MethodName - Valid ACPI name string + * DebugLevel - Optional level mask. 0 to use default + * DebugLayer - Optional layer mask. 0 to use default + * Flags - bit 1: one shot(1) or persistent(0) + * + * RETURN: Status + * + * DESCRIPTION: External interface to enable debug tracing during control + * method execution + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDebugTrace ( + char *Name, + UINT32 DebugLevel, + UINT32 DebugLayer, + UINT32 Flags) +{ + ACPI_STATUS Status; + + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* TBDs: Validate name, allow full path or just nameseg */ + + AcpiGbl_TraceMethodName = *(UINT32 *) Name; + AcpiGbl_TraceFlags = Flags; + + if (DebugLevel) + { + AcpiGbl_TraceDbgLevel = DebugLevel; + } + if (DebugLayer) + { + AcpiGbl_TraceDbgLayer = DebugLayer; + } + + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + return (AE_OK); +} + /******************************************************************************* * - * FUNCTION: AcpiPsxExecute + * FUNCTION: AcpiPsStartTrace + * + * PARAMETERS: Info - Method info struct + * + * RETURN: None + * + * DESCRIPTION: Start control method execution trace + * + ******************************************************************************/ + +static void +AcpiPsStartTrace ( + ACPI_PARAMETER_INFO *Info) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_ENTRY (); + + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return; + } + + if ((!AcpiGbl_TraceMethodName) || + (AcpiGbl_TraceMethodName != Info->Node->Name.Integer)) + { + goto Exit; + } + + AcpiGbl_OriginalDbgLevel = AcpiDbgLevel; + AcpiGbl_OriginalDbgLayer = AcpiDbgLayer; + + AcpiDbgLevel = 0x00FFFFFF; + AcpiDbgLayer = ACPI_UINT32_MAX; + + if (AcpiGbl_TraceDbgLevel) + { + AcpiDbgLevel = AcpiGbl_TraceDbgLevel; + } + if (AcpiGbl_TraceDbgLayer) + { + AcpiDbgLayer = AcpiGbl_TraceDbgLayer; + } + + +Exit: + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiPsStopTrace + * + * PARAMETERS: Info - Method info struct + * + * RETURN: None + * + * DESCRIPTION: Stop control method execution trace + * + ******************************************************************************/ + +static void +AcpiPsStopTrace ( + ACPI_PARAMETER_INFO *Info) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_ENTRY (); + + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return; + } + + if ((!AcpiGbl_TraceMethodName) || + (AcpiGbl_TraceMethodName != Info->Node->Name.Integer)) + { + goto Exit; + } + + /* Disable further tracing if type is one-shot */ + + if (AcpiGbl_TraceFlags & 1) + { + AcpiGbl_TraceMethodName = 0; + AcpiGbl_TraceDbgLevel = 0; + AcpiGbl_TraceDbgLayer = 0; + } + + AcpiDbgLevel = AcpiGbl_OriginalDbgLevel; + AcpiDbgLayer = AcpiGbl_OriginalDbgLayer; + +Exit: + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiPsExecuteMethod * * PARAMETERS: Info - Method info block, contains: * Node - Method Node to execute + * ObjDesc - Method object * Parameters - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. @@ -141,6 +317,7 @@ * ParameterType - Type of Parameter list * ReturnObject - Where to put method's return value (if * any). If NULL, no value is returned. + * PassNumber - Parse or execute pass * * RETURN: Status * @@ -149,172 +326,76 @@ ******************************************************************************/ ACPI_STATUS -AcpiPsxExecute ( +AcpiPsExecuteMethod ( ACPI_PARAMETER_INFO *Info) { ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ObjDesc; - UINT32 i; - ACPI_PARSE_OBJECT *Op; - ACPI_WALK_STATE *WalkState; - ACPI_FUNCTION_TRACE ("PsxExecute"); + ACPI_FUNCTION_TRACE ("PsExecuteMethod"); - /* Validate the Node and get the attached object */ + /* Validate the Info and method Node */ if (!Info || !Info->Node) { return_ACPI_STATUS (AE_NULL_ENTRY); } - ObjDesc = AcpiNsGetAttachedObject (Info->Node); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NULL_OBJECT); - } - /* Init for new method, wait on concurrency semaphore */ - Status = AcpiDsBeginMethodExecution (Info->Node, ObjDesc, NULL); + Status = AcpiDsBeginMethodExecution (Info->Node, Info->ObjDesc, NULL); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - if ((Info->ParameterType == ACPI_PARAM_ARGS) && - (Info->Parameters)) - { - /* - * The caller "owns" the parameters, so give each one an extra - * reference - */ - for (i = 0; Info->Parameters[i]; i++) - { - AcpiUtAddReference (Info->Parameters[i]); - } - } + /* + * The caller "owns" the parameters, so give each one an extra + * reference + */ + AcpiPsUpdateParameterList (Info, REF_INCREMENT); + + /* Begin tracing if requested */ + + AcpiPsStartTrace (Info); /* * 1) Perform the first pass parse of the method to enter any - * named objects that it creates into the namespace + * named objects that it creates into the namespace */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Begin Method Parse **** Entry=%p obj=%p\n", - Info->Node, ObjDesc)); - - /* Create and init a Root Node */ + Info->Node, Info->ObjDesc)); - Op = AcpiPsCreateScopeOp (); - if (!Op) + Info->PassNumber = 1; + Status = AcpiPsExecutePass (Info); + if (ACPI_FAILURE (Status)) { - Status = AE_NO_MEMORY; - goto Cleanup1; + goto Cleanup; } /* - * Get a new OwnerId for objects created by this method. Namespace - * objects (such as Operation Regions) can be created during the - * first pass parse. - */ - Status = AcpiUtAllocateOwnerId (&ObjDesc->Method.OwnerId); - if (ACPI_FAILURE (Status)) - { - goto Cleanup2; - } - - /* Create and initialize a new walk state */ - - WalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwnerId, - NULL, NULL, NULL); - if (!WalkState) - { - Status = AE_NO_MEMORY; - goto Cleanup2; - } - - Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node, - ObjDesc->Method.AmlStart, - ObjDesc->Method.AmlLength, NULL, 1); - if (ACPI_FAILURE (Status)) - { - goto Cleanup3; - } - - /* Parse the AML */ - - Status = AcpiPsParseAml (WalkState); - AcpiPsDeleteParseTree (Op); - if (ACPI_FAILURE (Status)) - { - goto Cleanup1; /* Walk state is already deleted */ - } - - /* - * 2) Execute the method. Performs second pass parse simultaneously + * 2) Execute the method. Performs second pass parse simultaneously */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Begin Method Execution **** Entry=%p obj=%p\n", - Info->Node, ObjDesc)); - - /* Create and init a Root Node */ - - Op = AcpiPsCreateScopeOp (); - if (!Op) - { - Status = AE_NO_MEMORY; - goto Cleanup1; - } - - /* Init new op with the method name and pointer back to the NS node */ - - AcpiPsSetName (Op, Info->Node->Name.Integer); - Op->Common.Node = Info->Node; - - /* Create and initialize a new walk state */ + Info->Node, Info->ObjDesc)); - WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); - if (!WalkState) - { - Status = AE_NO_MEMORY; - goto Cleanup2; - } - - Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node, - ObjDesc->Method.AmlStart, - ObjDesc->Method.AmlLength, Info, 3); - if (ACPI_FAILURE (Status)) - { - goto Cleanup3; - } - - /* The walk of the parse tree is where we actually execute the method */ - - Status = AcpiPsParseAml (WalkState); - goto Cleanup2; /* Walk state already deleted */ + Info->PassNumber = 3; + Status = AcpiPsExecutePass (Info); -Cleanup3: - AcpiDsDeleteWalkState (WalkState); +Cleanup: + /* End optional tracing */ -Cleanup2: - AcpiPsDeleteParseTree (Op); + AcpiPsStopTrace (Info); -Cleanup1: - if ((Info->ParameterType == ACPI_PARAM_ARGS) && - (Info->Parameters)) - { - /* Take away the extra reference that we gave the parameters above */ + /* Take away the extra reference that we gave the parameters above */ - for (i = 0; Info->Parameters[i]; i++) - { - /* Ignore errors, just do them all */ + AcpiPsUpdateParameterList (Info, REF_DECREMENT); - (void) AcpiUtUpdateObjectReference ( - Info->Parameters[i], REF_DECREMENT); - } - } + /* Exit now if error above */ if (ACPI_FAILURE (Status)) { @@ -338,3 +419,106 @@ } +/******************************************************************************* + * + * FUNCTION: AcpiPsUpdateParameterList + * + * PARAMETERS: Info - See ACPI_PARAMETER_INFO + * (Used: ParameterType and Parameters) + * Action - Add or Remove reference + * + * RETURN: Status + * + * DESCRIPTION: Update reference count on all method parameter objects + * + ******************************************************************************/ + +static void +AcpiPsUpdateParameterList ( + ACPI_PARAMETER_INFO *Info, + UINT16 Action) +{ + ACPI_NATIVE_UINT i; + + + if ((Info->ParameterType == ACPI_PARAM_ARGS) && + (Info->Parameters)) + { + /* Update reference count for each parameter */ + + for (i = 0; Info->Parameters[i]; i++) + { + /* Ignore errors, just do them all */ + + (void) AcpiUtUpdateObjectReference (Info->Parameters[i], Action); + } + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiPsExecutePass + * + * PARAMETERS: Info - See ACPI_PARAMETER_INFO + * (Used: PassNumber, Node, and ObjDesc) + * + * RETURN: Status + * + * DESCRIPTION: Single AML pass: Parse or Execute a control method + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiPsExecutePass ( + ACPI_PARAMETER_INFO *Info) +{ + ACPI_STATUS Status; + ACPI_PARSE_OBJECT *Op; + ACPI_WALK_STATE *WalkState; + + + ACPI_FUNCTION_TRACE ("PsExecutePass"); + + + /* Create and init a Root Node */ + + Op = AcpiPsCreateScopeOp (); + if (!Op) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* Create and initialize a new walk state */ + + WalkState = AcpiDsCreateWalkState ( + Info->ObjDesc->Method.OwnerId, NULL, NULL, NULL); + if (!WalkState) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node, + Info->ObjDesc->Method.AmlStart, + Info->ObjDesc->Method.AmlLength, + Info->PassNumber == 1 ? NULL : Info, + Info->PassNumber); + if (ACPI_FAILURE (Status)) + { + AcpiDsDeleteWalkState (WalkState); + goto Cleanup; + } + + /* Parse the AML */ + + Status = AcpiPsParseAml (WalkState); + + /* Walk state was deleted by ParseAml */ + +Cleanup: + AcpiPsDeleteParseTree (Op); + return_ACPI_STATUS (Status); +} + +
--- a/usr/src/uts/i86pc/io/acpica/namespace/nsaccess.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/namespace/nsaccess.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsaccess - Top-level functions for accessing ACPI namespace - * $Revision: 190 $ + * $Revision: 1.192 $ * ******************************************************************************/ @@ -243,19 +243,20 @@ ObjDesc->Method.ParamCount = (UINT8) ACPI_TO_INTEGER (Val); ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID; -#if defined (ACPI_ASL_COMPILER) || defined (ACPI_DUMP_APP) +#if defined (ACPI_ASL_COMPILER) - /* - * iASL Compiler cheats by putting parameter count - * in the OwnerID (ParamCount max is 7) - */ - NewNode->OwnerId = ObjDesc->Method.ParamCount; + /* Save the parameter count for the iASL compiler */ + + NewNode->Value = ObjDesc->Method.ParamCount; #else /* Mark this as a very SPECIAL method */ ObjDesc->Method.MethodFlags = AML_METHOD_INTERNAL_ONLY; + +#ifndef ACPI_DUMP_APP ObjDesc->Method.Implementation = AcpiUtOsiImplementation; #endif +#endif break; case ACPI_TYPE_INTEGER: @@ -600,7 +601,7 @@ Path++; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Multi Pathname (%d Segments, Flags=%X) \n", + "Multi Pathname (%d Segments, Flags=%X)\n", NumSegments, Flags)); break;
--- a/usr/src/uts/i86pc/io/acpica/namespace/nsalloc.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/namespace/nsalloc.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsalloc - Namespace allocation and deletion utilities - * $Revision: 94 $ + * $Revision: 1.97 $ * ******************************************************************************/ @@ -258,10 +258,9 @@ * DESCRIPTION: Initialize a new namespace node and install it amongst * its peers. * - * Note: Current namespace lookup is linear search. However, the - * nodes are linked in alphabetical order to 1) put all reserved - * names (start with underscore) first, and to 2) make a readable - * namespace dump. + * Note: Current namespace lookup is linear search. This appears + * to be sufficient as namespace searches consume only a small + * fraction of the execution time of the ACPI subsystem. * ******************************************************************************/ @@ -274,10 +273,6 @@ { ACPI_OWNER_ID OwnerId = 0; ACPI_NAMESPACE_NODE *ChildNode; -#ifdef ACPI_ALPHABETIC_NAMESPACE - - ACPI_NAMESPACE_NODE *PreviousChildNode; -#endif ACPI_FUNCTION_TRACE ("NsInstallNode"); @@ -304,62 +299,6 @@ } else { -#ifdef ACPI_ALPHABETIC_NAMESPACE - /* - * Walk the list whilst searching for the correct - * alphabetic placement. - */ - PreviousChildNode = NULL; - while (AcpiNsCompareNames (AcpiUtGetNodeName (ChildNode), - AcpiUtGetNodeName (Node)) < 0) - { - if (ChildNode->Flags & ANOBJ_END_OF_PEER_LIST) - { - /* Last peer; Clear end-of-list flag */ - - ChildNode->Flags &= ~ANOBJ_END_OF_PEER_LIST; - - /* This node is the new peer to the child node */ - - ChildNode->Peer = Node; - - /* This node is the new end-of-list */ - - Node->Flags |= ANOBJ_END_OF_PEER_LIST; - Node->Peer = ParentNode; - break; - } - - /* Get next peer */ - - PreviousChildNode = ChildNode; - ChildNode = ChildNode->Peer; - } - - /* Did the node get inserted at the end-of-list? */ - - if (!(Node->Flags & ANOBJ_END_OF_PEER_LIST)) - { - /* - * Loop above terminated without reaching the end-of-list. - * Insert the new node at the current location - */ - if (PreviousChildNode) - { - /* Insert node alphabetically */ - - Node->Peer = ChildNode; - PreviousChildNode->Peer = Node; - } - else - { - /* Insert node alphabetically at start of list */ - - Node->Peer = ChildNode; - ParentNode->Child = Node; - } - } -#else while (!(ChildNode->Flags & ANOBJ_END_OF_PEER_LIST)) { ChildNode = ChildNode->Peer; @@ -370,9 +309,8 @@ /* Clear end-of-list flag */ ChildNode->Flags &= ~ANOBJ_END_OF_PEER_LIST; - Node->Flags |= ANOBJ_END_OF_PEER_LIST; + Node->Flags |= ANOBJ_END_OF_PEER_LIST; Node->Peer = ParentNode; -#endif } /* Init the new entry */ @@ -675,6 +613,11 @@ ACPI_FUNCTION_TRACE_U32 ("NsDeleteNamespaceByOwner", OwnerId); + if (OwnerId == 0) + { + return_VOID; + } + ParentNode = AcpiGbl_RootNode; ChildNode = NULL; DeletionNode = NULL; @@ -749,62 +692,7 @@ } } - (void) AcpiUtReleaseOwnerId (OwnerId); return_VOID; } -#ifdef ACPI_ALPHABETIC_NAMESPACE -/******************************************************************************* - * - * FUNCTION: AcpiNsCompareNames - * - * PARAMETERS: Name1 - First name to compare - * Name2 - Second name to compare - * - * RETURN: value from strncmp - * - * DESCRIPTION: Compare two ACPI names. Names that are prefixed with an - * underscore are forced to be alphabetically first. - * - ******************************************************************************/ - -int -AcpiNsCompareNames ( - char *Name1, - char *Name2) -{ - char ReversedName1[ACPI_NAME_SIZE]; - char ReversedName2[ACPI_NAME_SIZE]; - UINT32 i; - UINT32 j; - - - /* - * Replace all instances of "underscore" with a value that is smaller so - * that all names that are prefixed with underscore(s) are alphabetically - * first. - * - * Reverse the name bytewise so we can just do a 32-bit compare instead - * of a strncmp. - */ - for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--) - { - ReversedName1[j] = Name1[i]; - if (Name1[i] == '_') - { - ReversedName1[j] = '*'; - } - - ReversedName2[j] = Name2[i]; - if (Name2[i] == '_') - { - ReversedName2[j] = '*'; - } - } - - return (*(int *) ReversedName1 - *(int *) ReversedName2); -} -#endif - -
--- a/usr/src/uts/i86pc/io/acpica/namespace/nsdump.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/namespace/nsdump.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsdump - table dumping routines for debug - * $Revision: 170 $ + * $Revision: 1.172 $ * *****************************************************************************/ @@ -160,6 +160,9 @@ UINT32 NumSegments, char *Pathname) { + ACPI_NATIVE_UINT i; + + ACPI_FUNCTION_NAME ("NsPrintPathname"); @@ -174,9 +177,14 @@ while (NumSegments) { - AcpiOsPrintf ("%4.4s", Pathname); + for (i = 0; i < 4; i++) + { + ACPI_IS_PRINT (Pathname[i]) ? + AcpiOsPrintf ("%c", Pathname[i]) : + AcpiOsPrintf ("?"); + } + Pathname += ACPI_NAME_SIZE; - NumSegments--; if (NumSegments) {
--- a/usr/src/uts/i86pc/io/acpica/namespace/nsdumpdv.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/namespace/nsdumpdv.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsdump - table dumping routines for debug - * $Revision: 16 $ + * $Revision: 1.16 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/namespace/nseval.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/namespace/nseval.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ * * Module Name: nseval - Object evaluation interfaces -- includes control * method lookup and execution. - * $Revision: 133 $ + * $Revision: 1.134 $ * ******************************************************************************/ @@ -458,6 +458,7 @@ * * PARAMETERS: Info - Method info block, contains: * Node - Method Node to execute + * ObjDesc - Method object * Parameters - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. @@ -480,7 +481,6 @@ ACPI_PARAMETER_INFO *Info) { ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ObjDesc; ACPI_FUNCTION_TRACE ("NsExecuteControlMethod"); @@ -488,8 +488,8 @@ /* Verify that there is a method associated with this object */ - ObjDesc = AcpiNsGetAttachedObject (Info->Node); - if (!ObjDesc) + Info->ObjDesc = AcpiNsGetAttachedObject (Info->Node); + if (!Info->ObjDesc) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n")); @@ -501,7 +501,7 @@ ACPI_LV_INFO, _COMPONENT); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n", - ObjDesc->Method.AmlStart + 1, ObjDesc->Method.AmlLength - 1)); + Info->ObjDesc->Method.AmlStart + 1, Info->ObjDesc->Method.AmlLength - 1)); /* * Unlock the namespace before execution. This allows namespace access @@ -526,7 +526,7 @@ return_ACPI_STATUS (Status); } - Status = AcpiPsxExecute (Info); + Status = AcpiPsExecuteMethod (Info); AcpiExExitInterpreter (); return_ACPI_STATUS (Status);
--- a/usr/src/uts/i86pc/io/acpica/namespace/nsinit.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/namespace/nsinit.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsinit - namespace initialization - * $Revision: 68 $ + * $Revision: 1.68 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/namespace/nsload.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/namespace/nsload.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsload - namespace loading/expanding/contracting procedures - * $Revision: 72 $ + * $Revision: 1.73 $ * *****************************************************************************/ @@ -279,7 +279,7 @@ { case ACPI_TABLE_DSDT: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: DSDT\n")); TableDesc = AcpiGbl_TableLists[ACPI_TABLE_DSDT].Next; @@ -301,18 +301,19 @@ case ACPI_TABLE_SSDT: + case ACPI_TABLE_PSDT: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d SSDTs\n", - AcpiGbl_TableLists[ACPI_TABLE_SSDT].Count)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: %d SSDT or PSDTs\n", + AcpiGbl_TableLists[TableType].Count)); /* - * Traverse list of SSDT tables + * Traverse list of SSDT or PSDT tables */ - TableDesc = AcpiGbl_TableLists[ACPI_TABLE_SSDT].Next; - for (i = 0; i < AcpiGbl_TableLists[ACPI_TABLE_SSDT].Count; i++) + TableDesc = AcpiGbl_TableLists[TableType].Next; + for (i = 0; i < AcpiGbl_TableLists[TableType].Count; i++) { /* - * Only attempt to load table if it is not + * Only attempt to load table into namespace if it is not * already loaded! */ if (!TableDesc->LoadedIntoNamespace) @@ -331,36 +332,6 @@ break; - case ACPI_TABLE_PSDT: - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d PSDTs\n", - AcpiGbl_TableLists[ACPI_TABLE_PSDT].Count)); - - /* - * Traverse list of PSDT tables - */ - TableDesc = AcpiGbl_TableLists[ACPI_TABLE_PSDT].Next; - - for (i = 0; i < AcpiGbl_TableLists[ACPI_TABLE_PSDT].Count; i++) - { - /* Only attempt to load table if it is not already loaded! */ - - if (!TableDesc->LoadedIntoNamespace) - { - Status = AcpiNsLoadTable (TableDesc, AcpiGbl_RootNode); - if (ACPI_FAILURE (Status)) - { - break; - } - - TableDesc->LoadedIntoNamespace = TRUE; - } - - TableDesc = TableDesc->Next; - } - break; - - default: Status = AE_SUPPORT; break;
--- a/usr/src/uts/i86pc/io/acpica/namespace/nsnames.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/namespace/nsnames.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsnames - Name manipulation and search - * $Revision: 90 $ + * $Revision: 1.91 $ * ******************************************************************************/ @@ -347,7 +347,7 @@ AcpiNsBuildExternalPath (Node, RequiredSize, Buffer->Pointer); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X]\n", (char *) Buffer->Pointer, (UINT32) RequiredSize)); return_ACPI_STATUS (AE_OK); }
--- a/usr/src/uts/i86pc/io/acpica/namespace/nsobject.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/namespace/nsobject.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ * * Module Name: nsobject - Utilities for objects attached to namespace * table entries - * $Revision: 93 $ + * $Revision: 1.93 $ * ******************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/namespace/nsparse.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/namespace/nsparse.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsparse - namespace interface to AML parser - * $Revision: 9 $ + * $Revision: 1.10 $ * *****************************************************************************/ @@ -141,7 +141,7 @@ ACPI_STATUS AcpiNsOneCompleteParse ( - UINT32 PassNumber, + UINT8 PassNumber, ACPI_TABLE_DESC *TableDesc) { ACPI_PARSE_OBJECT *ParseRoot;
--- a/usr/src/uts/i86pc/io/acpica/namespace/nssearch.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/namespace/nssearch.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nssearch - Namespace search - * $Revision: 106 $ + * $Revision: 1.106 $ * ******************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/namespace/nsutils.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/namespace/nsutils.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ * * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing * parents and siblings and Scope manipulation - * $Revision: 140 $ + * $Revision: 1.141 $ * *****************************************************************************/ @@ -363,10 +363,10 @@ if (!Node) { ACPI_REPORT_WARNING (("NsGetType: Null Node input pointer\n")); - return_VALUE (ACPI_TYPE_ANY); + return_UINT32 (ACPI_TYPE_ANY); } - return_VALUE ((ACPI_OBJECT_TYPE) Node->Type); + return_UINT32 ((ACPI_OBJECT_TYPE) Node->Type); } @@ -395,10 +395,10 @@ /* Type code out of range */ ACPI_REPORT_WARNING (("NsLocal: Invalid Object Type\n")); - return_VALUE (ACPI_NS_NORMAL); + return_UINT32 (ACPI_NS_NORMAL); } - return_VALUE ((UINT32) AcpiGbl_NsProperties[Type] & ACPI_NS_LOCAL); + return_UINT32 ((UINT32) AcpiGbl_NsProperties[Type] & ACPI_NS_LOCAL); } @@ -1018,10 +1018,10 @@ /* type code out of range */ ACPI_REPORT_WARNING (("NsOpensScope: Invalid Object Type %X\n", Type)); - return_VALUE (ACPI_NS_NORMAL); + return_UINT32 (ACPI_NS_NORMAL); } - return_VALUE (((UINT32) AcpiGbl_NsProperties[Type]) & ACPI_NS_NEWSCOPE); + return_UINT32 (((UINT32) AcpiGbl_NsProperties[Type]) & ACPI_NS_NEWSCOPE); }
--- a/usr/src/uts/i86pc/io/acpica/namespace/nswalk.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/namespace/nswalk.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nswalk - Functions for walking the ACPI namespace - * $Revision: 39 $ + * $Revision: 1.39 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/namespace/nsxfeval.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/namespace/nsxfeval.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ * * Module Name: nsxfeval - Public interfaces to the ACPI subsystem * ACPI Object evaluation interfaces - * $Revision: 17 $ + * $Revision: 1.17 $ * ******************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/namespace/nsxfname.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/namespace/nsxfname.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ * * Module Name: nsxfname - Public interfaces to the ACPI subsystem * ACPI Namespace oriented interfaces - * $Revision: 104 $ + * $Revision: 1.104 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/namespace/nsxfobj.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/namespace/nsxfobj.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ * * Module Name: nsxfobj - Public interfaces to the ACPI subsystem * ACPI Object oriented interfaces - * $Revision: 119 $ + * $Revision: 1.119 $ * ******************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/osl.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/osl.c Thu Nov 17 08:46:01 2005 -0800 @@ -423,7 +423,7 @@ } } -int intr_hooked = 0; +static int acpi_intr_hooked = 0; ACPI_STATUS AcpiOsInstallInterruptHandler(UINT32 InterruptNumber, @@ -451,11 +451,10 @@ retval = add_avintr(NULL, SCI_IPL, (avfunc)acpi_wrapper_isr, "ACPI SCI", sci_vect, NULL, NULL, NULL, NULL); if (retval) { - intr_hooked = 1; + acpi_intr_hooked = 1; return (AE_OK); - } else { + } else return (AE_BAD_PARAMETER); - } } ACPI_STATUS @@ -467,10 +466,10 @@ #ifdef DEBUG cmn_err(CE_NOTE, "!acpica: detaching SCI %d", InterruptNumber); #endif - if (intr_hooked) { + if (acpi_intr_hooked) { rem_avintr(NULL, LOCK_LEVEL - 1, (avfunc)acpi_wrapper_isr, InterruptNumber); - intr_hooked = 0; + acpi_intr_hooked = 0; } return (AE_OK); } @@ -919,6 +918,63 @@ AcpiOsPrintf(const char *Format, ...) { va_list ap; + + va_start(ap, Format); + AcpiOsVprintf(Format, ap); + va_end(ap); +} + +/* + * When != 0, sends output to console + * Patchable with kmdb or /etc/system. + */ +int acpica_console_out = 0; + +#define ACPICA_OUTBUF_LEN 160 +char acpica_outbuf[ACPICA_OUTBUF_LEN]; +int acpica_outbuf_offset; + +/* + * + */ +static void +acpica_pr_buf(char *buf, int buflen) +{ + char c, *bufp, *outp; + int out_remaining; + + /* + * copy the supplied buffer into the output buffer + * when we hit a '\n' or overflow the output buffer, + * output and reset the output buffer + */ + bufp = buf; + outp = acpica_outbuf + acpica_outbuf_offset; + out_remaining = ACPICA_OUTBUF_LEN - acpica_outbuf_offset - 1; + while (c = *bufp++) { + *outp++ = c; + if (c == '\n' || --out_remaining == 0) { + *outp = '\0'; + if (acpica_console_out) + printf(acpica_outbuf); + else + (void) strlog(0, 0, 0, + SL_CONSOLE | SL_NOTE | SL_LOGONLY, + acpica_outbuf); + acpica_outbuf_offset = 0; + outp = acpica_outbuf; + out_remaining = ACPICA_OUTBUF_LEN - 1; + } + } + + acpica_outbuf_offset = outp - acpica_outbuf; + kmem_free(buf, buflen); +} + +void +AcpiOsVprintf(const char *Format, va_list Args) +{ + va_list save; int buflen; char *buf; @@ -931,29 +987,15 @@ * If we fail to allocate a string buffer, we resort * to printf(). */ - va_start(ap, Format); - buflen = vsnprintf(NULL, 0, Format, ap) + 1; - va_end(ap); - + va_copy(save, Args); + buflen = vsnprintf(NULL, 0, Format, save) + 1; buf = kmem_alloc(buflen, KM_NOSLEEP); if (buf == NULL) { - va_start(ap, Format); - vprintf(Format, ap); - va_end(ap); + vprintf(Format, Args); return; } - va_start(ap, Format); - (void) vsnprintf(buf, buflen, Format, ap); - va_end(ap); - - (void) strlog(0, 0, 0, SL_CONSOLE | SL_NOTE | SL_LOGONLY, buf); - kmem_free(buf, buflen); -} - -void -AcpiOsVprintf(const char *Format, va_list Args) -{ - vprintf(Format, Args); + (void) vsnprintf(buf, buflen, Format, Args); + acpica_pr_buf(buf, buflen); } void @@ -1351,7 +1393,7 @@ int dev, func; acld = NULL; - while (AcpiGetNextObject(ACPI_TYPE_ANY, acpiobj, acld, &acld) + while (AcpiGetNextObject(ACPI_TYPE_DEVICE, acpiobj, acld, &acld) == AE_OK) { /*
--- a/usr/src/uts/i86pc/io/acpica/resources/rsaddr.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/resources/rsaddr.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsaddr - Address resource descriptors (16/32/64) - * $Revision: 40 $ + * $Revision: 1.47 $ * ******************************************************************************/ @@ -123,1147 +123,743 @@ ACPI_MODULE_NAME ("rsaddr") +/* Local prototypes */ + +static void +AcpiRsDecodeGeneralFlags ( + ACPI_RESOURCE_DATA *Resource, + UINT8 Flags); + +static UINT8 +AcpiRsEncodeGeneralFlags ( + ACPI_RESOURCE_DATA *Resource); + +static void +AcpiRsDecodeSpecificFlags ( + ACPI_RESOURCE_DATA *Resource, + UINT8 Flags); + +static UINT8 +AcpiRsEncodeSpecificFlags ( + ACPI_RESOURCE_DATA *Resource); + +static void +AcpiRsSetAddressCommon ( + AML_RESOURCE *Aml, + ACPI_RESOURCE *Resource); + +static BOOLEAN +AcpiRsGetAddressCommon ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml); + + /******************************************************************************* * - * FUNCTION: AcpiRsAddress16Resource + * FUNCTION: AcpiRsDecodeGeneralFlags * - * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream - * BytesConsumed - Pointer to where the number of bytes - * consumed the ByteStreamBuffer is - * returned - * OutputBuffer - Pointer to the return data buffer - * StructureSize - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Resource - Address resource data struct + * Flags - Raw AML flag byte * - * RETURN: Status + * RETURN: Decoded flag bits in resource struct * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Decode a general flag byte to an address resource struct * ******************************************************************************/ -ACPI_STATUS -AcpiRsAddress16Resource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize) +static void +AcpiRsDecodeGeneralFlags ( + ACPI_RESOURCE_DATA *Resource, + UINT8 Flags) { - UINT32 Index; - UINT16 Temp16; - UINT8 Temp8; - UINT8 *TempPtr; - UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; - ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE ( - ACPI_RESOURCE_ADDRESS16); + ACPI_FUNCTION_ENTRY (); - ACPI_FUNCTION_TRACE ("RsAddress16Resource"); + /* Producer / Consumer - flag bit[0] */ + + Resource->Address.ProducerConsumer = (UINT32) (Flags & 0x01); + + /* Decode (_DEC) - flag bit[1] */ + + Resource->Address.Decode = (UINT32) ((Flags >> 1) & 0x01); + + /* Min Address Fixed (_MIF) - flag bit[2] */ + + Resource->Address.MinAddressFixed = (UINT32) ((Flags >> 2) & 0x01); + + /* Max Address Fixed (_MAF) - flag bit[3] */ + + Resource->Address.MaxAddressFixed = (UINT32) ((Flags >> 3) & 0x01); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsEncodeGeneralFlags + * + * PARAMETERS: Resource - Address resource data struct + * + * RETURN: Encoded general flag byte + * + * DESCRIPTION: Construct a general flag byte from an address resource struct + * + ******************************************************************************/ + +static UINT8 +AcpiRsEncodeGeneralFlags ( + ACPI_RESOURCE_DATA *Resource) +{ + ACPI_FUNCTION_ENTRY (); - /* Point past the Descriptor to get the number of bytes consumed */ - - Buffer += 1; - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - - /* Validate minimum descriptor length */ + return ((UINT8) - if (Temp16 < 13) - { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); - } - - *BytesConsumed = Temp16 + 3; - OutputStruct->Id = ACPI_RSTYPE_ADDRESS16; - - /* Get the Resource Type (Byte3) */ - - Buffer += 2; - Temp8 = *Buffer; - - /* Values 0-2 and 0xC0-0xFF are valid */ + /* Producer / Consumer - flag bit[0] */ - if ((Temp8 > 2) && (Temp8 < 0xC0)) - { - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); - } - - OutputStruct->Data.Address16.ResourceType = Temp8; - - /* Get the General Flags (Byte4) */ + ((Resource->Address.ProducerConsumer & 0x01) | - Buffer += 1; - Temp8 = *Buffer; - - /* Producer / Consumer */ + /* Decode (_DEC) - flag bit[1] */ - OutputStruct->Data.Address16.ProducerConsumer = Temp8 & 0x01; - - /* Decode */ - - OutputStruct->Data.Address16.Decode = (Temp8 >> 1) & 0x01; - - /* Min Address Fixed */ + ((Resource->Address.Decode & 0x01) << 1) | - OutputStruct->Data.Address16.MinAddressFixed = (Temp8 >> 2) & 0x01; - - /* Max Address Fixed */ + /* Min Address Fixed (_MIF) - flag bit[2] */ - OutputStruct->Data.Address16.MaxAddressFixed = (Temp8 >> 3) & 0x01; - - /* Get the Type Specific Flags (Byte5) */ - - Buffer += 1; - Temp8 = *Buffer; + ((Resource->Address.MinAddressFixed & 0x01) << 2) | - if (ACPI_MEMORY_RANGE == OutputStruct->Data.Address16.ResourceType) - { - OutputStruct->Data.Address16.Attribute.Memory.ReadWriteAttribute = - (UINT16) (Temp8 & 0x01); - OutputStruct->Data.Address16.Attribute.Memory.CacheAttribute = - (UINT16) ((Temp8 >> 1) & 0x03); - } - else - { - if (ACPI_IO_RANGE == OutputStruct->Data.Address16.ResourceType) - { - OutputStruct->Data.Address16.Attribute.Io.RangeAttribute = - (UINT16) (Temp8 & 0x03); - OutputStruct->Data.Address16.Attribute.Io.TranslationAttribute = - (UINT16) ((Temp8 >> 4) & 0x03); - } - else - { - /* BUS_NUMBER_RANGE == Address16.Data->ResourceType */ - /* Nothing needs to be filled in */ - } - } + /* Max Address Fixed (_MAF) - flag bit[3] */ - /* Get Granularity (Bytes 6-7) */ - - Buffer += 1; - ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.Granularity, Buffer); + ((Resource->Address.MaxAddressFixed & 0x01) << 3)) + ); +} - /* Get MinAddressRange (Bytes 8-9) */ - - Buffer += 2; - ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.MinAddressRange, Buffer); - - /* Get MaxAddressRange (Bytes 10-11) */ - Buffer += 2; - ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.MaxAddressRange, Buffer); - - /* Get AddressTranslationOffset (Bytes 12-13) */ - - Buffer += 2; - ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.AddressTranslationOffset, - Buffer); - - /* Get AddressLength (Bytes 14-15) */ - - Buffer += 2; - ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.AddressLength, Buffer); - - /* Resource Source Index (if present) */ - - Buffer += 2; +/******************************************************************************* + * + * FUNCTION: AcpiRsDecodeSpecificFlags + * + * PARAMETERS: Resource - Address resource data struct + * Flags - Raw AML flag byte + * + * RETURN: Decoded flag bits in attribute struct + * + * DESCRIPTION: Decode a type-specific flag byte to an attribute struct. + * Type-specific flags are only defined for the Memory and IO + * resource types. + * + ******************************************************************************/ - /* - * This will leave us pointing to the Resource Source Index - * If it is present, then save it off and calculate the - * pointer to where the null terminated string goes: - * Each Interrupt takes 32-bits + the 5 bytes of the - * stream that are default. - * - * Note: Some resource descriptors will have an additional null, so - * we add 1 to the length. - */ - if (*BytesConsumed > (16 + 1)) - { - /* Dereference the Index */ +static void +AcpiRsDecodeSpecificFlags ( + ACPI_RESOURCE_DATA *Resource, + UINT8 Flags) +{ + ACPI_FUNCTION_ENTRY (); - Temp8 = *Buffer; - OutputStruct->Data.Address16.ResourceSource.Index = (UINT32) Temp8; - - /* Point to the String */ - - Buffer += 1; - - /* Point the String pointer to the end of this structure */ - - OutputStruct->Data.Address16.ResourceSource.StringPtr = - (char *)((UINT8 * )OutputStruct + StructSize); - TempPtr = (UINT8 *) - OutputStruct->Data.Address16.ResourceSource.StringPtr; - - /* Copy the string into the buffer */ - - Index = 0; - - while (0x00 != *Buffer) - { - *TempPtr = *Buffer; + if (Resource->Address.ResourceType == ACPI_MEMORY_RANGE) + { + /* Write Status (_RW) - flag bit[0] */ - TempPtr += 1; - Buffer += 1; - Index += 1; - } + Resource->Address.Attribute.Memory.ReadWriteAttribute = + (UINT16) (Flags & 0x01); - /* Add the terminating null */ - - *TempPtr = 0x00; - - OutputStruct->Data.Address16.ResourceSource.StringLength = Index + 1; + /* Memory Attributes (_MEM) - flag bits[2:1] */ - /* - * In order for the StructSize to fall on a 32-bit boundary, - * calculate the length of the string and expand the - * StructSize to the next 32-bit boundary. - */ - Temp8 = (UINT8) (Index + 1); - StructSize += ACPI_ROUND_UP_TO_32BITS (Temp8); + Resource->Address.Attribute.Memory.CacheAttribute = + (UINT16) ((Flags >> 1) & 0x03); } - else + else if (Resource->Address.ResourceType == ACPI_IO_RANGE) { - OutputStruct->Data.Address16.ResourceSource.Index = 0x00; - OutputStruct->Data.Address16.ResourceSource.StringLength = 0; - OutputStruct->Data.Address16.ResourceSource.StringPtr = NULL; - } + /* Ranges (_RNG) - flag bits[1:0] */ - /* Set the Length parameter */ + Resource->Address.Attribute.Io.RangeAttribute = + (UINT16) (Flags & 0x03); - OutputStruct->Length = (UINT32) StructSize; + /* Translations (_TTP and _TRS) - flag bits[5:4] */ - /* Return the final size of the structure */ - - *StructureSize = StructSize; - return_ACPI_STATUS (AE_OK); + Resource->Address.Attribute.Io.TranslationAttribute = + (UINT16) ((Flags >> 4) & 0x03); + } } /******************************************************************************* * - * FUNCTION: AcpiRsAddress16Stream + * FUNCTION: AcpiRsEncodeSpecificFlags + * + * PARAMETERS: Resource - Address resource data struct + * + * RETURN: Encoded type-specific flag byte + * + * DESCRIPTION: Construct a type-specific flag byte from an attribute struct. + * Type-specific flags are only defined for the Memory and IO + * resource types. + * + ******************************************************************************/ + +static UINT8 +AcpiRsEncodeSpecificFlags ( + ACPI_RESOURCE_DATA *Resource) +{ + ACPI_FUNCTION_ENTRY (); + + + if (Resource->Address.ResourceType == ACPI_MEMORY_RANGE) + { + return ((UINT8) + + /* Write Status (_RW) - flag bit[0] */ + + ((Resource->Address.Attribute.Memory.ReadWriteAttribute & 0x01) | + + /* Memory Attributes (_MEM) - flag bits[2:1] */ + + ((Resource->Address.Attribute.Memory.CacheAttribute & 0x03) << 1))); + } + else if (Resource->Address.ResourceType == ACPI_IO_RANGE) + { + return ((UINT8) + + /* Ranges (_RNG) - flag bits[1:0] */ + + ((Resource->Address.Attribute.Io.RangeAttribute & 0x03) | + + /* Translations (_TTP and _TRS) - flag bits[5:4] */ + + ((Resource->Address.Attribute.Io.TranslationAttribute & 0x03) << 4))); + } + + return (0); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsSetAddressCommon + * + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * Resource - Pointer to the internal resource struct + * + * RETURN: None + * + * DESCRIPTION: Convert common flag fields from a resource descriptor to an + * AML descriptor * - * PARAMETERS: LinkedList - Pointer to the resource linked list - * OutputBuffer - Pointer to the user's return buffer - * BytesConsumed - Pointer to where the number of bytes - * used in the OutputBuffer is returned + ******************************************************************************/ + +static void +AcpiRsSetAddressCommon ( + AML_RESOURCE *Aml, + ACPI_RESOURCE *Resource) +{ + ACPI_FUNCTION_ENTRY (); + + + /* Set the Resource Type (Memory, Io, BusNumber, etc.) */ + + Aml->Address.ResourceType = (UINT8) Resource->Data.Address.ResourceType; + + /* Set the general flags */ + + Aml->Address.Flags = AcpiRsEncodeGeneralFlags (&Resource->Data); + + /* Set the type-specific flags */ + + Aml->Address.SpecificFlags = AcpiRsEncodeSpecificFlags (&Resource->Data); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsGetAddressCommon + * + * PARAMETERS: Resource - Pointer to the internal resource struct + * Aml - Pointer to the AML resource descriptor + * + * RETURN: TRUE if the ResourceType field is OK, FALSE otherwise + * + * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor + * to an internal resource descriptor + * + ******************************************************************************/ + +static BOOLEAN +AcpiRsGetAddressCommon ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml) +{ + ACPI_FUNCTION_ENTRY (); + + + /* Validate resource type */ + + if ((Aml->Address.ResourceType > 2) && (Aml->Address.ResourceType < 0xC0)) + { + return (FALSE); + } + + /* Get the Resource Type (Memory, Io, BusNumber, etc.) */ + + Resource->Data.Address.ResourceType = Aml->Address.ResourceType; + + /* Get the General Flags */ + + AcpiRsDecodeGeneralFlags (&Resource->Data, Aml->Address.Flags); + + /* Get the Type-Specific Flags */ + + AcpiRsDecodeSpecificFlags (&Resource->Data, Aml->Address.SpecificFlags); + return (TRUE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsGetAddress16 + * + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * AmlResourceLength - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ ACPI_STATUS -AcpiRsAddress16Stream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed) +AcpiRsGetAddress16 ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource) { - UINT8 *Buffer = *OutputBuffer; - UINT8 *LengthField; - UINT8 Temp8; - char *TempPointer = NULL; - ACPI_SIZE ActualBytes; - - - ACPI_FUNCTION_TRACE ("RsAddress16Stream"); + ACPI_FUNCTION_TRACE ("RsGetAddress16"); - /* The descriptor field is static */ - - *Buffer = 0x88; - Buffer += 1; - - /* Save a pointer to the Length field - to be filled in later */ - - LengthField = Buffer; - Buffer += 2; - - /* Set the Resource Type (Memory, Io, BusNumber) */ - - Temp8 = (UINT8) (LinkedList->Data.Address16.ResourceType & 0x03); - *Buffer = Temp8; - Buffer += 1; - - /* Set the general flags */ - - Temp8 = (UINT8) (LinkedList->Data.Address16.ProducerConsumer & 0x01); - - Temp8 |= (LinkedList->Data.Address16.Decode & 0x01) << 1; - Temp8 |= (LinkedList->Data.Address16.MinAddressFixed & 0x01) << 2; - Temp8 |= (LinkedList->Data.Address16.MaxAddressFixed & 0x01) << 3; + /* Get the Resource Type, general flags, and type-specific flags */ - *Buffer = Temp8; - Buffer += 1; - - /* Set the type specific flags */ - - Temp8 = 0; - - if (ACPI_MEMORY_RANGE == LinkedList->Data.Address16.ResourceType) + if (!AcpiRsGetAddressCommon (Resource, Aml)) { - Temp8 = (UINT8) - (LinkedList->Data.Address16.Attribute.Memory.ReadWriteAttribute & - 0x01); - - Temp8 |= - (LinkedList->Data.Address16.Attribute.Memory.CacheAttribute & - 0x03) << 1; - } - else if (ACPI_IO_RANGE == LinkedList->Data.Address16.ResourceType) - { - Temp8 = (UINT8) - (LinkedList->Data.Address16.Attribute.Io.RangeAttribute & - 0x03); - Temp8 |= - (LinkedList->Data.Address16.Attribute.Io.TranslationAttribute & - 0x03) << 4; + return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); } - *Buffer = Temp8; - Buffer += 1; - - /* Set the address space granularity */ - - ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.Granularity); - Buffer += 2; - - /* Set the address range minimum */ - - ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.MinAddressRange); - Buffer += 2; - - /* Set the address range maximum */ - - ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.MaxAddressRange); - Buffer += 2; - - /* Set the address translation offset */ - - ACPI_MOVE_32_TO_16 (Buffer, - &LinkedList->Data.Address16.AddressTranslationOffset); - Buffer += 2; - - /* Set the address length */ - - ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.AddressLength); - Buffer += 2; - - /* Resource Source Index and Resource Source are optional */ + /* + * Get the following contiguous fields from the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length + */ + AcpiRsMoveData (&Resource->Data.Address16.Granularity, + &Aml->Address16.Granularity, 5, ACPI_MOVE_TYPE_16_TO_32); - if (0 != LinkedList->Data.Address16.ResourceSource.StringLength) - { - Temp8 = (UINT8) LinkedList->Data.Address16.ResourceSource.Index; - - *Buffer = Temp8; - Buffer += 1; + /* Get the optional ResourceSource (index and string) */ - TempPointer = (char *) Buffer; - - /* Copy the string */ - - ACPI_STRCPY (TempPointer, - LinkedList->Data.Address16.ResourceSource.StringPtr); + Resource->Length = + ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS16) + - /* - * Buffer needs to be set to the length of the sting + one for the - * terminating null - */ - Buffer += (ACPI_SIZE)(ACPI_STRLEN ( - LinkedList->Data.Address16.ResourceSource.StringPtr) + 1); - } - - /* Return the number of bytes consumed in this operation */ + AcpiRsGetResourceSource (AmlResourceLength, + sizeof (AML_RESOURCE_ADDRESS16), + &Resource->Data.Address16.ResourceSource, Aml, NULL); - ActualBytes = ACPI_PTR_DIFF (Buffer, *OutputBuffer); - *BytesConsumed = ActualBytes; + /* Complete the resource header */ - /* - * Set the length field to the number of bytes consumed - * minus the header size (3 bytes) - */ - ActualBytes -= 3; - ACPI_MOVE_SIZE_TO_16 (LengthField, &ActualBytes); + Resource->Type = ACPI_RESOURCE_TYPE_ADDRESS16; return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsAddress32Resource + * FUNCTION: AcpiRsSetAddress16 * - * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream - * BytesConsumed - Pointer to where the number of bytes - * consumed the ByteStreamBuffer is - * returned - * OutputBuffer - Pointer to the return data buffer - * StructureSize - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ ACPI_STATUS -AcpiRsAddress32Resource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize) +AcpiRsSetAddress16 ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml) { - UINT8 *Buffer; - ACPI_RESOURCE *OutputStruct= (void *) *OutputBuffer; - UINT16 Temp16; - UINT8 Temp8; - UINT8 *TempPtr; - ACPI_SIZE StructSize; - UINT32 Index; + ACPI_SIZE DescriptorLength; - ACPI_FUNCTION_TRACE ("RsAddress32Resource"); + ACPI_FUNCTION_TRACE ("RsSetAddress16"); - Buffer = ByteStreamBuffer; - StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32); - - /* Point past the Descriptor to get the number of bytes consumed */ - - Buffer += 1; - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - - /* Validate minimum descriptor length */ - - if (Temp16 < 23) - { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); - } - - *BytesConsumed = Temp16 + 3; - OutputStruct->Id = ACPI_RSTYPE_ADDRESS32; - - /* Get the Resource Type (Byte3) */ - - Buffer += 2; - Temp8 = *Buffer; - - /* Values 0-2 and 0xC0-0xFF are valid */ - - if ((Temp8 > 2) && (Temp8 < 0xC0)) - { - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); - } - - OutputStruct->Data.Address32.ResourceType = Temp8; - - /* Get the General Flags (Byte4) */ - - Buffer += 1; - Temp8 = *Buffer; - - /* Producer / Consumer */ - - OutputStruct->Data.Address32.ProducerConsumer = Temp8 & 0x01; - - /* Decode */ - - OutputStruct->Data.Address32.Decode = (Temp8 >> 1) & 0x01; - - /* Min Address Fixed */ - - OutputStruct->Data.Address32.MinAddressFixed = (Temp8 >> 2) & 0x01; - - /* Max Address Fixed */ - - OutputStruct->Data.Address32.MaxAddressFixed = (Temp8 >> 3) & 0x01; - - /* Get the Type Specific Flags (Byte5) */ + /* Set the Resource Type, General Flags, and Type-Specific Flags */ - Buffer += 1; - Temp8 = *Buffer; - - if (ACPI_MEMORY_RANGE == OutputStruct->Data.Address32.ResourceType) - { - OutputStruct->Data.Address32.Attribute.Memory.ReadWriteAttribute = - (UINT16) (Temp8 & 0x01); - - OutputStruct->Data.Address32.Attribute.Memory.CacheAttribute = - (UINT16) ((Temp8 >> 1) & 0x03); - } - else - { - if (ACPI_IO_RANGE == OutputStruct->Data.Address32.ResourceType) - { - OutputStruct->Data.Address32.Attribute.Io.RangeAttribute = - (UINT16) (Temp8 & 0x03); - OutputStruct->Data.Address32.Attribute.Io.TranslationAttribute = - (UINT16) ((Temp8 >> 4) & 0x03); - } - else - { - /* BUS_NUMBER_RANGE == OutputStruct->Data.Address32.ResourceType */ - /* Nothing needs to be filled in */ - } - } - - /* Get Granularity (Bytes 6-9) */ - - Buffer += 1; - ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.Granularity, Buffer); - - /* Get MinAddressRange (Bytes 10-13) */ - - Buffer += 4; - ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.MinAddressRange, Buffer); - - /* Get MaxAddressRange (Bytes 14-17) */ - - Buffer += 4; - ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.MaxAddressRange, Buffer); - - /* Get AddressTranslationOffset (Bytes 18-21) */ - - Buffer += 4; - ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.AddressTranslationOffset, - Buffer); - - /* Get AddressLength (Bytes 22-25) */ - - Buffer += 4; - ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.AddressLength, Buffer); - - /* Resource Source Index (if present) */ - - Buffer += 4; + AcpiRsSetAddressCommon (Aml, Resource); /* - * This will leave us pointing to the Resource Source Index - * If it is present, then save it off and calculate the - * pointer to where the null terminated string goes: - * - * Note: Some resource descriptors will have an additional null, so - * we add 1 to the length. + * Set the following contiguous fields in the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length */ - if (*BytesConsumed > (26 + 1)) - { - /* Dereference the Index */ - - Temp8 = *Buffer; - OutputStruct->Data.Address32.ResourceSource.Index = - (UINT32) Temp8; - - /* Point to the String */ - - Buffer += 1; - - /* Point the String pointer to the end of this structure */ - - OutputStruct->Data.Address32.ResourceSource.StringPtr = - (char *)((UINT8 *)OutputStruct + StructSize); - - TempPtr = (UINT8 *) - OutputStruct->Data.Address32.ResourceSource.StringPtr; - - /* Copy the string into the buffer */ + AcpiRsMoveData (&Aml->Address16.Granularity, + &Resource->Data.Address16.Granularity, 5, ACPI_MOVE_TYPE_32_TO_16); - Index = 0; - while (0x00 != *Buffer) - { - *TempPtr = *Buffer; - - TempPtr += 1; - Buffer += 1; - Index += 1; - } - - /* Add the terminating null */ - - *TempPtr = 0x00; - OutputStruct->Data.Address32.ResourceSource.StringLength = Index + 1; + /* Resource Source Index and Resource Source are optional */ - /* - * In order for the StructSize to fall on a 32-bit boundary, - * calculate the length of the string and expand the - * StructSize to the next 32-bit boundary. - */ - Temp8 = (UINT8) (Index + 1); - StructSize += ACPI_ROUND_UP_TO_32BITS (Temp8); - } - else - { - OutputStruct->Data.Address32.ResourceSource.Index = 0x00; - OutputStruct->Data.Address32.ResourceSource.StringLength = 0; - OutputStruct->Data.Address32.ResourceSource.StringPtr = NULL; - } + DescriptorLength = AcpiRsSetResourceSource (Aml, + sizeof (AML_RESOURCE_ADDRESS16), + &Resource->Data.Address16.ResourceSource); - /* Set the Length parameter */ - - OutputStruct->Length = (UINT32) StructSize; + /* Complete the AML descriptor header */ - /* Return the final size of the structure */ - - *StructureSize = StructSize; + AcpiRsSetResourceHeader (ACPI_RESOURCE_NAME_ADDRESS16, DescriptorLength, Aml); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsAddress32Stream + * FUNCTION: AcpiRsGetAddress32 * - * PARAMETERS: LinkedList - Pointer to the resource linked list - * OutputBuffer - Pointer to the user's return buffer - * BytesConsumed - Pointer to where the number of bytes - * used in the OutputBuffer is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * AmlResourceLength - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ ACPI_STATUS -AcpiRsAddress32Stream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed) +AcpiRsGetAddress32 ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource) { - UINT8 *Buffer; - UINT16 *LengthField; - UINT8 Temp8; - char *TempPointer; - - ACPI_FUNCTION_TRACE ("RsAddress32Stream"); + ACPI_FUNCTION_TRACE ("RsGetAddress32"); - Buffer = *OutputBuffer; - - /* The descriptor field is static */ - - *Buffer = 0x87; - Buffer += 1; - - /* Set a pointer to the Length field - to be filled in later */ - - LengthField = ACPI_CAST_PTR (UINT16, Buffer); - Buffer += 2; - - /* Set the Resource Type (Memory, Io, BusNumber) */ - - Temp8 = (UINT8) (LinkedList->Data.Address32.ResourceType & 0x03); - - *Buffer = Temp8; - Buffer += 1; - - /* Set the general flags */ - - Temp8 = (UINT8) (LinkedList->Data.Address32.ProducerConsumer & 0x01); - Temp8 |= (LinkedList->Data.Address32.Decode & 0x01) << 1; - Temp8 |= (LinkedList->Data.Address32.MinAddressFixed & 0x01) << 2; - Temp8 |= (LinkedList->Data.Address32.MaxAddressFixed & 0x01) << 3; + /* Get the Resource Type, general flags, and type-specific flags */ - *Buffer = Temp8; - Buffer += 1; - - /* Set the type specific flags */ - - Temp8 = 0; - - if (ACPI_MEMORY_RANGE == LinkedList->Data.Address32.ResourceType) + if (!AcpiRsGetAddressCommon (Resource, (void *) Aml)) { - Temp8 = (UINT8) - (LinkedList->Data.Address32.Attribute.Memory.ReadWriteAttribute & - 0x01); - - Temp8 |= - (LinkedList->Data.Address32.Attribute.Memory.CacheAttribute & - 0x03) << 1; - } - else if (ACPI_IO_RANGE == LinkedList->Data.Address32.ResourceType) - { - Temp8 = (UINT8) - (LinkedList->Data.Address32.Attribute.Io.RangeAttribute & - 0x03); - Temp8 |= - (LinkedList->Data.Address32.Attribute.Io.TranslationAttribute & - 0x03) << 4; + return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); } - *Buffer = Temp8; - Buffer += 1; + /* + * Get the following contiguous fields from the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length + */ + AcpiRsMoveData (&Resource->Data.Address32.Granularity, + &Aml->Address32.Granularity, 5, ACPI_MOVE_TYPE_32_TO_32); - /* Set the address space granularity */ + /* Get the optional ResourceSource (index and string) */ - ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.Granularity); - Buffer += 4; + Resource->Length = + ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32) + + + AcpiRsGetResourceSource (AmlResourceLength, + sizeof (AML_RESOURCE_ADDRESS32), + &Resource->Data.Address32.ResourceSource, Aml, NULL); - /* Set the address range minimum */ + /* Complete the resource header */ - ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.MinAddressRange); - Buffer += 4; + Resource->Type = ACPI_RESOURCE_TYPE_ADDRESS32; + return_ACPI_STATUS (AE_OK); +} + - /* Set the address range maximum */ - - ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.MaxAddressRange); - Buffer += 4; - - /* Set the address translation offset */ +/******************************************************************************* + * + * FUNCTION: AcpiRsSetAddress32 + * + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. + * + ******************************************************************************/ - ACPI_MOVE_32_TO_32 (Buffer, - &LinkedList->Data.Address32.AddressTranslationOffset); - Buffer += 4; +ACPI_STATUS +AcpiRsSetAddress32 ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml) +{ + ACPI_SIZE DescriptorLength; + + + ACPI_FUNCTION_TRACE ("RsSetAddress32"); + + + /* Set the Resource Type, General Flags, and Type-Specific Flags */ - /* Set the address length */ + AcpiRsSetAddressCommon (Aml, Resource); - ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.AddressLength); - Buffer += 4; + /* + * Set the following contiguous fields in the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length + */ + AcpiRsMoveData (&Aml->Address32.Granularity, + &Resource->Data.Address32.Granularity, 5, ACPI_MOVE_TYPE_32_TO_32); /* Resource Source Index and Resource Source are optional */ - if (0 != LinkedList->Data.Address32.ResourceSource.StringLength) - { - Temp8 = (UINT8) LinkedList->Data.Address32.ResourceSource.Index; - - *Buffer = Temp8; - Buffer += 1; - - TempPointer = (char *) Buffer; - - /* Copy the string */ - - ACPI_STRCPY (TempPointer, - LinkedList->Data.Address32.ResourceSource.StringPtr); + DescriptorLength = AcpiRsSetResourceSource (Aml, + sizeof (AML_RESOURCE_ADDRESS32), + &Resource->Data.Address32.ResourceSource); - /* - * Buffer needs to be set to the length of the sting + one for the - * terminating null - */ - Buffer += (ACPI_SIZE)(ACPI_STRLEN ( - LinkedList->Data.Address32.ResourceSource.StringPtr) + 1); - } + /* Complete the AML descriptor header */ - /* Return the number of bytes consumed in this operation */ - - *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer); - - /* - * Set the length field to the number of bytes consumed - * minus the header size (3 bytes) - */ - *LengthField = (UINT16) (*BytesConsumed - 3); + AcpiRsSetResourceHeader (ACPI_RESOURCE_NAME_ADDRESS32, DescriptorLength, Aml); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsAddress64Resource + * FUNCTION: AcpiRsGetAddress64 * - * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream - * BytesConsumed - Pointer to where the number of bytes - * consumed the ByteStreamBuffer is - * returned - * OutputBuffer - Pointer to the return data buffer - * StructureSize - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * AmlResourceLength - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ ACPI_STATUS -AcpiRsAddress64Resource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize) +AcpiRsGetAddress64 ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource) { - UINT8 *Buffer; - ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; - UINT16 Temp16; - UINT8 Temp8; - UINT8 ResourceType; - UINT8 *TempPtr; - ACPI_SIZE StructSize; - UINT32 Index; - - - ACPI_FUNCTION_TRACE ("RsAddress64Resource"); + ACPI_FUNCTION_TRACE ("RsGetAddress64"); - Buffer = ByteStreamBuffer; - StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64); - ResourceType = *Buffer; - - /* Point past the Descriptor to get the number of bytes consumed */ - - Buffer += 1; - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - - /* Validate minimum descriptor length */ + /* Get the Resource Type, general Flags, and type-specific Flags */ - if (Temp16 < 43) - { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); - } - - *BytesConsumed = Temp16 + 3; - OutputStruct->Id = ACPI_RSTYPE_ADDRESS64; - - /* Get the Resource Type (Byte3) */ - - Buffer += 2; - Temp8 = *Buffer; - - /* Values 0-2 and 0xC0-0xFF are valid */ - - if ((Temp8 > 2) && (Temp8 < 0xC0)) + if (!AcpiRsGetAddressCommon (Resource, Aml)) { return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); } - OutputStruct->Data.Address64.ResourceType = Temp8; - - /* Get the General Flags (Byte4) */ - - Buffer += 1; - Temp8 = *Buffer; - - /* Producer / Consumer */ - - OutputStruct->Data.Address64.ProducerConsumer = Temp8 & 0x01; - - /* Decode */ - - OutputStruct->Data.Address64.Decode = (Temp8 >> 1) & 0x01; + /* + * Get the following contiguous fields from the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length + */ + AcpiRsMoveData (&Resource->Data.Address64.Granularity, + &Aml->Address64.Granularity, 5, ACPI_MOVE_TYPE_64_TO_64); - /* Min Address Fixed */ - - OutputStruct->Data.Address64.MinAddressFixed = (Temp8 >> 2) & 0x01; - - /* Max Address Fixed */ - - OutputStruct->Data.Address64.MaxAddressFixed = (Temp8 >> 3) & 0x01; - - /* Get the Type Specific Flags (Byte5) */ - - Buffer += 1; - Temp8 = *Buffer; - - if (ACPI_MEMORY_RANGE == OutputStruct->Data.Address64.ResourceType) - { - OutputStruct->Data.Address64.Attribute.Memory.ReadWriteAttribute = - (UINT16) (Temp8 & 0x01); + /* Get the optional ResourceSource (index and string) */ - OutputStruct->Data.Address64.Attribute.Memory.CacheAttribute = - (UINT16) ((Temp8 >> 1) & 0x03); - } - else - { - if (ACPI_IO_RANGE == OutputStruct->Data.Address64.ResourceType) - { - OutputStruct->Data.Address64.Attribute.Io.RangeAttribute = - (UINT16) (Temp8 & 0x03); - OutputStruct->Data.Address64.Attribute.Io.TranslationAttribute = - (UINT16) ((Temp8 >> 4) & 0x03); - } - else - { - /* BUS_NUMBER_RANGE == OutputStruct->Data.Address64.ResourceType */ - /* Nothing needs to be filled in */ - } - } + Resource->Length = + ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64) + - if (ResourceType == ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE) - { - /* Move past RevisionId and Reserved byte */ - - Buffer += 2; - } + AcpiRsGetResourceSource (AmlResourceLength, + sizeof (AML_RESOURCE_ADDRESS64), + &Resource->Data.Address64.ResourceSource, Aml, NULL); - /* Get Granularity (Bytes 6-13) or (Bytes 8-15) */ - - Buffer += 1; - ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.Granularity, Buffer); - - /* Get MinAddressRange (Bytes 14-21) or (Bytes 16-23) */ - - Buffer += 8; - ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.MinAddressRange, Buffer); - - /* Get MaxAddressRange (Bytes 22-29) or (Bytes 24-31) */ + /* Complete the resource header */ - Buffer += 8; - ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.MaxAddressRange, Buffer); - - /* Get AddressTranslationOffset (Bytes 30-37) or (Bytes 32-39) */ + Resource->Type = ACPI_RESOURCE_TYPE_ADDRESS64; + return_ACPI_STATUS (AE_OK); +} - Buffer += 8; - ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.AddressTranslationOffset, - Buffer); - - /* Get AddressLength (Bytes 38-45) or (Bytes 40-47) */ - - Buffer += 8; - ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.AddressLength, Buffer); - OutputStruct->Data.Address64.ResourceSource.Index = 0x00; - OutputStruct->Data.Address64.ResourceSource.StringLength = 0; - OutputStruct->Data.Address64.ResourceSource.StringPtr = NULL; - - if (ResourceType == ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE) - { - /* Get TypeSpecificAttribute (Bytes 48-55) */ - - Buffer += 8; - ACPI_MOVE_64_TO_64 ( - &OutputStruct->Data.Address64.TypeSpecificAttributes, - Buffer); - } - else - { - OutputStruct->Data.Address64.TypeSpecificAttributes = 0; - - /* Resource Source Index (if present) */ - - Buffer += 8; +/******************************************************************************* + * + * FUNCTION: AcpiRsSetAddress64 + * + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. + * + ******************************************************************************/ - /* - * This will leave us pointing to the Resource Source Index - * If it is present, then save it off and calculate the - * pointer to where the null terminated string goes: - * Each Interrupt takes 32-bits + the 5 bytes of the - * stream that are default. - * - * Note: Some resource descriptors will have an additional null, so - * we add 1 to the length. - */ - if (*BytesConsumed > (46 + 1)) - { - /* Dereference the Index */ +ACPI_STATUS +AcpiRsSetAddress64 ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml) +{ + ACPI_SIZE DescriptorLength; - Temp8 = *Buffer; - OutputStruct->Data.Address64.ResourceSource.Index = - (UINT32) Temp8; - /* Point to the String */ + ACPI_FUNCTION_TRACE ("RsSetAddress64"); - Buffer += 1; - /* Point the String pointer to the end of this structure */ - - OutputStruct->Data.Address64.ResourceSource.StringPtr = - (char *)((UINT8 *)OutputStruct + StructSize); - - TempPtr = (UINT8 *) - OutputStruct->Data.Address64.ResourceSource.StringPtr; - - /* Copy the string into the buffer */ + /* Set the Resource Type, General Flags, and Type-Specific Flags */ - Index = 0; - while (0x00 != *Buffer) - { - *TempPtr = *Buffer; - - TempPtr += 1; - Buffer += 1; - Index += 1; - } + AcpiRsSetAddressCommon (Aml, Resource); - /* - * Add the terminating null - */ - *TempPtr = 0x00; - OutputStruct->Data.Address64.ResourceSource.StringLength = - Index + 1; + /* + * Set the following contiguous fields in the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length + */ + AcpiRsMoveData (&Aml->Address64.Granularity, + &Resource->Data.Address64.Granularity, 5, ACPI_MOVE_TYPE_64_TO_64); - /* - * In order for the StructSize to fall on a 32-bit boundary, - * calculate the length of the string and expand the - * StructSize to the next 32-bit boundary. - */ - Temp8 = (UINT8) (Index + 1); - StructSize += ACPI_ROUND_UP_TO_32BITS (Temp8); - } - } + /* Resource Source Index and Resource Source are optional */ - /* Set the Length parameter */ - - OutputStruct->Length = (UINT32) StructSize; + DescriptorLength = AcpiRsSetResourceSource (Aml, + sizeof (AML_RESOURCE_ADDRESS64), + &Resource->Data.Address64.ResourceSource); - /* Return the final size of the structure */ + /* Complete the AML descriptor header */ - *StructureSize = StructSize; + AcpiRsSetResourceHeader (ACPI_RESOURCE_NAME_ADDRESS64, DescriptorLength, Aml); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsAddress64Stream + * FUNCTION: AcpiRsGetExtAddress64 * - * PARAMETERS: LinkedList - Pointer to the resource linked list - * OutputBuffer - Pointer to the user's return buffer - * BytesConsumed - Pointer to where the number of bytes - * used in the OutputBuffer is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * AmlResourceLength - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ ACPI_STATUS -AcpiRsAddress64Stream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed) +AcpiRsGetExtAddress64 ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource) { - UINT8 *Buffer; - UINT16 *LengthField; - UINT8 Temp8; - char *TempPointer; - - ACPI_FUNCTION_TRACE ("RsAddress64Stream"); + ACPI_FUNCTION_TRACE ("RsGetExtAddress64"); - Buffer = *OutputBuffer; - - /* The descriptor field is static */ - - *Buffer = 0x8A; - Buffer += 1; - - /* Set a pointer to the Length field - to be filled in later */ - - LengthField = ACPI_CAST_PTR (UINT16, Buffer); - Buffer += 2; + /* Get the Resource Type, general flags, and type-specific flags */ - /* Set the Resource Type (Memory, Io, BusNumber) */ - - Temp8 = (UINT8) (LinkedList->Data.Address64.ResourceType & 0x03); - - *Buffer = Temp8; - Buffer += 1; - - /* Set the general flags */ - - Temp8 = (UINT8) (LinkedList->Data.Address64.ProducerConsumer & 0x01); - Temp8 |= (LinkedList->Data.Address64.Decode & 0x01) << 1; - Temp8 |= (LinkedList->Data.Address64.MinAddressFixed & 0x01) << 2; - Temp8 |= (LinkedList->Data.Address64.MaxAddressFixed & 0x01) << 3; + if (!AcpiRsGetAddressCommon (Resource, Aml)) + { + return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); + } - *Buffer = Temp8; - Buffer += 1; - - /* Set the type specific flags */ - - Temp8 = 0; - - if (ACPI_MEMORY_RANGE == LinkedList->Data.Address64.ResourceType) + /* + * Get and validate the Revision ID + * Note: Only one revision ID is currently supported + */ + Resource->Data.ExtAddress64.RevisionID = Aml->ExtAddress64.RevisionID; + if (Aml->ExtAddress64.RevisionID != AML_RESOURCE_EXTENDED_ADDRESS_REVISION) { - Temp8 = (UINT8) - (LinkedList->Data.Address64.Attribute.Memory.ReadWriteAttribute & - 0x01); - - Temp8 |= - (LinkedList->Data.Address64.Attribute.Memory.CacheAttribute & - 0x03) << 1; - } - else if (ACPI_IO_RANGE == LinkedList->Data.Address64.ResourceType) - { - Temp8 = (UINT8) - (LinkedList->Data.Address64.Attribute.Io.RangeAttribute & - 0x03); - Temp8 |= - (LinkedList->Data.Address64.Attribute.Io.RangeAttribute & - 0x03) << 4; + return_ACPI_STATUS (AE_SUPPORT); } - *Buffer = Temp8; - Buffer += 1; - - /* Set the address space granularity */ - - ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.Granularity); - Buffer += 8; - - /* Set the address range minimum */ - - ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.MinAddressRange); - Buffer += 8; - - /* Set the address range maximum */ - - ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.MaxAddressRange); - Buffer += 8; - - /* Set the address translation offset */ - - ACPI_MOVE_64_TO_64 (Buffer, - &LinkedList->Data.Address64.AddressTranslationOffset); - Buffer += 8; - - /* Set the address length */ - - ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.AddressLength); - Buffer += 8; - - /* Resource Source Index and Resource Source are optional */ + /* + * Get the following contiguous fields from the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length + * Type-Specific Attribute + */ + AcpiRsMoveData (&Resource->Data.ExtAddress64.Granularity, + &Aml->ExtAddress64.Granularity, 6, ACPI_MOVE_TYPE_64_TO_64); - if (0 != LinkedList->Data.Address64.ResourceSource.StringLength) - { - Temp8 = (UINT8) LinkedList->Data.Address64.ResourceSource.Index; - - *Buffer = Temp8; - Buffer += 1; - - TempPointer = (char *) Buffer; - - /* Copy the string */ - - ACPI_STRCPY (TempPointer, - LinkedList->Data.Address64.ResourceSource.StringPtr); + /* Complete the resource header */ - /* - * Buffer needs to be set to the length of the sting + one for the - * terminating null - */ - Buffer += (ACPI_SIZE)(ACPI_STRLEN ( - LinkedList->Data.Address64.ResourceSource.StringPtr) + 1); - } - - /* Return the number of bytes consumed in this operation */ - - *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer); - - /* - * Set the length field to the number of bytes consumed - * minus the header size (3 bytes) - */ - *LengthField = (UINT16) (*BytesConsumed - 3); + Resource->Type = ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64; + Resource->Length = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_EXTENDED_ADDRESS64); return_ACPI_STATUS (AE_OK); } + +/******************************************************************************* + * + * FUNCTION: AcpiRsSetExtAddress64 + * + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiRsSetExtAddress64 ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml) +{ + ACPI_FUNCTION_TRACE ("RsSetExtAddress64"); + + + /* Set the Resource Type, General Flags, and Type-Specific Flags */ + + AcpiRsSetAddressCommon (Aml, Resource); + + /* Only one Revision ID is currently supported */ + + Aml->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; + Aml->ExtAddress64.Reserved = 0; + + /* + * Set the following contiguous fields in the AML descriptor: + * Address Granularity + * Address Range Minimum + * Address Range Maximum + * Address Translation Offset + * Address Length + * Type-Specific Attribute + */ + AcpiRsMoveData (&Aml->ExtAddress64.Granularity, + &Resource->Data.Address64.Granularity, 6, ACPI_MOVE_TYPE_64_TO_64); + + /* Complete the AML descriptor header */ + + AcpiRsSetResourceHeader (ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64, + sizeof (AML_RESOURCE_EXTENDED_ADDRESS64), Aml); + return_ACPI_STATUS (AE_OK); +} +
--- a/usr/src/uts/i86pc/io/acpica/resources/rscalc.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/resources/rscalc.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rscalc - Calculate stream and list lengths - * $Revision: 57 $ + * $Revision: 1.64 $ * ******************************************************************************/ @@ -125,238 +125,286 @@ ACPI_MODULE_NAME ("rscalc") +/* Local prototypes */ + +static UINT8 +AcpiRsCountSetBits ( + UINT16 BitField); + +static ACPI_SIZE +AcpiRsStructOptionLength ( + ACPI_RESOURCE_SOURCE *ResourceSource); + +static UINT32 +AcpiRsStreamOptionLength ( + UINT32 ResourceLength, + UINT32 MinimumTotalLength); + + /******************************************************************************* * - * FUNCTION: AcpiRsGetByteStreamLength + * FUNCTION: AcpiRsCountSetBits + * + * PARAMETERS: BitField - Field in which to count bits + * + * RETURN: Number of bits set within the field + * + * DESCRIPTION: Count the number of bits set in a resource field. Used for + * (Short descriptor) interrupt and DMA lists. * - * PARAMETERS: LinkedList - Pointer to the resource linked list - * SizeNeeded - UINT32 pointer of the size buffer needed - * to properly return the parsed data + ******************************************************************************/ + +static UINT8 +AcpiRsCountSetBits ( + UINT16 BitField) +{ + UINT8 BitsSet; + + + ACPI_FUNCTION_ENTRY (); + + + for (BitsSet = 0; BitField; BitsSet++) + { + /* Zero the least significant bit that is set */ + + BitField &= (BitField - 1); + } + + return (BitsSet); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsStructOptionLength + * + * PARAMETERS: ResourceSource - Pointer to optional descriptor field * * RETURN: Status * - * DESCRIPTION: Takes the resource byte stream and parses it once, calculating - * the size buffer needed to hold the linked list that conveys - * the resource data. + * DESCRIPTION: Common code to handle optional ResourceSourceIndex and + * ResourceSource fields in some Large descriptors. Used during + * list-to-stream conversion + * + ******************************************************************************/ + +static ACPI_SIZE +AcpiRsStructOptionLength ( + ACPI_RESOURCE_SOURCE *ResourceSource) +{ + ACPI_FUNCTION_ENTRY (); + + + /* + * If the ResourceSource string is valid, return the size of the string + * (StringLength includes the NULL terminator) plus the size of the + * ResourceSourceIndex (1). + */ + if (ResourceSource->StringPtr) + { + return ((ACPI_SIZE) ResourceSource->StringLength + 1); + } + + return (0); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsStreamOptionLength + * + * PARAMETERS: ResourceLength - Length from the resource header + * MinimumTotalLength - Minimum length of this resource, before + * any optional fields. Includes header size + * + * RETURN: Length of optional string (0 if no string present) + * + * DESCRIPTION: Common code to handle optional ResourceSourceIndex and + * ResourceSource fields in some Large descriptors. Used during + * stream-to-list conversion + * + ******************************************************************************/ + +static UINT32 +AcpiRsStreamOptionLength ( + UINT32 ResourceLength, + UINT32 MinimumAmlResourceLength) +{ + UINT32 StringLength = 0; + + + ACPI_FUNCTION_ENTRY (); + + + /* + * The ResourceSourceIndex and ResourceSource are optional elements of some + * Large-type resource descriptors. + */ + + /* + * If the length of the actual resource descriptor is greater than the ACPI + * spec-defined minimum length, it means that a ResourceSourceIndex exists + * and is followed by a (required) null terminated string. The string length + * (including the null terminator) is the resource length minus the minimum + * length, minus one byte for the ResourceSourceIndex itself. + */ + if (ResourceLength > MinimumAmlResourceLength) + { + /* Compute the length of the optional string */ + + StringLength = ResourceLength - MinimumAmlResourceLength - 1; + } + + /* Round up length to 32 bits for internal structure alignment */ + + return (ACPI_ROUND_UP_TO_32BITS (StringLength)); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsGetAmlLength + * + * PARAMETERS: Resource - Pointer to the resource linked list + * SizeNeeded - Where the required size is returned + * + * RETURN: Status + * + * DESCRIPTION: Takes a linked list of internal resource descriptors and + * calculates the size buffer needed to hold the corresponding + * external resource byte stream. * ******************************************************************************/ ACPI_STATUS -AcpiRsGetByteStreamLength ( - ACPI_RESOURCE *LinkedList, +AcpiRsGetAmlLength ( + ACPI_RESOURCE *Resource, ACPI_SIZE *SizeNeeded) { - ACPI_SIZE ByteStreamSizeNeeded = 0; + ACPI_SIZE AmlSizeNeeded = 0; ACPI_SIZE SegmentSize; - BOOLEAN Done = FALSE; - ACPI_FUNCTION_TRACE ("RsGetByteStreamLength"); + ACPI_FUNCTION_TRACE ("RsGetAmlLength"); - while (!Done) - { - /* Init the variable that will hold the size to add to the total. */ + /* Traverse entire list of internal resource descriptors */ - SegmentSize = 0; + while (Resource) + { + /* Validate the descriptor type */ - switch (LinkedList->Id) + if (Resource->Type > ACPI_RESOURCE_TYPE_MAX) { - case ACPI_RSTYPE_IRQ: - /* - * IRQ Resource - * For an IRQ Resource, Byte 3, although optional, will always be - * created - it holds IRQ information. - */ - SegmentSize = 4; - break; + return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); + } + + /* Get the base size of the (external stream) resource descriptor */ + + SegmentSize = AcpiGbl_AmlResourceSizes [Resource->Type]; - case ACPI_RSTYPE_DMA: - /* - * DMA Resource - * For this resource the size is static - */ - SegmentSize = 3; - break; - - case ACPI_RSTYPE_START_DPF: + /* + * Augment the base size for descriptors with optional and/or + * variable-length fields + */ + switch (Resource->Type) + { + case ACPI_RESOURCE_TYPE_VENDOR: /* - * Start Dependent Functions Resource - * For a StartDependentFunctions Resource, Byte 1, although - * optional, will always be created. - */ - SegmentSize = 2; - break; - - case ACPI_RSTYPE_END_DPF: - /* - * End Dependent Functions Resource - * For this resource the size is static - */ - SegmentSize = 1; - break; - - case ACPI_RSTYPE_IO: - /* - * IO Port Resource - * For this resource the size is static - */ - SegmentSize = 8; - break; - - case ACPI_RSTYPE_FIXED_IO: - /* - * Fixed IO Port Resource - * For this resource the size is static - */ - SegmentSize = 4; - break; - - case ACPI_RSTYPE_VENDOR: - /* - * Vendor Defined Resource + * Vendor Defined Resource: * For a Vendor Specific resource, if the Length is between 1 and 7 * it will be created as a Small Resource data type, otherwise it * is a Large Resource data type. */ - if (LinkedList->Data.VendorSpecific.Length > 7) + if (Resource->Data.Vendor.ByteLength > 7) { - SegmentSize = 3; - } - else - { - SegmentSize = 1; - } - SegmentSize += LinkedList->Data.VendorSpecific.Length; - break; + /* Base size of a Large resource descriptor */ - case ACPI_RSTYPE_END_TAG: - /* - * End Tag - * For this resource the size is static - */ - SegmentSize = 2; - Done = TRUE; - break; + SegmentSize = sizeof (AML_RESOURCE_LARGE_HEADER); + } - case ACPI_RSTYPE_MEM24: - /* - * 24-Bit Memory Resource - * For this resource the size is static - */ - SegmentSize = 12; + /* Add the size of the vendor-specific data */ + + SegmentSize += Resource->Data.Vendor.ByteLength; break; - case ACPI_RSTYPE_MEM32: - /* - * 32-Bit Memory Range Resource - * For this resource the size is static - */ - SegmentSize = 20; - break; - case ACPI_RSTYPE_FIXED_MEM32: + case ACPI_RESOURCE_TYPE_END_TAG: /* - * 32-Bit Fixed Memory Resource - * For this resource the size is static + * End Tag: + * We are done -- return the accumulated total size. */ - SegmentSize = 12; - break; + *SizeNeeded = AmlSizeNeeded + SegmentSize; + + /* Normal exit */ - case ACPI_RSTYPE_ADDRESS16: + return_ACPI_STATUS (AE_OK); + + + case ACPI_RESOURCE_TYPE_ADDRESS16: /* - * 16-Bit Address Resource - * The base size of this byte stream is 16. If a Resource Source - * string is not NULL, add 1 for the Index + the length of the null - * terminated string Resource Source + 1 for the null. + * 16-Bit Address Resource: + * Add the size of the optional ResourceSource info */ - SegmentSize = 16; - - if (LinkedList->Data.Address16.ResourceSource.StringPtr) - { - SegmentSize += - LinkedList->Data.Address16.ResourceSource.StringLength; - SegmentSize++; - } + SegmentSize += AcpiRsStructOptionLength ( + &Resource->Data.Address16.ResourceSource); break; - case ACPI_RSTYPE_ADDRESS32: + + case ACPI_RESOURCE_TYPE_ADDRESS32: /* - * 32-Bit Address Resource - * The base size of this byte stream is 26. If a Resource - * Source string is not NULL, add 1 for the Index + the - * length of the null terminated string Resource Source + - * 1 for the null. + * 32-Bit Address Resource: + * Add the size of the optional ResourceSource info */ - SegmentSize = 26; + SegmentSize += AcpiRsStructOptionLength ( + &Resource->Data.Address32.ResourceSource); + break; + - if (LinkedList->Data.Address32.ResourceSource.StringPtr) - { - SegmentSize += - LinkedList->Data.Address32.ResourceSource.StringLength; - SegmentSize++; - } + case ACPI_RESOURCE_TYPE_ADDRESS64: + /* + * 64-Bit Address Resource: + * Add the size of the optional ResourceSource info + */ + SegmentSize += AcpiRsStructOptionLength ( + &Resource->Data.Address64.ResourceSource); break; - case ACPI_RSTYPE_ADDRESS64: + + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: /* - * 64-Bit Address Resource - * The base size of this byte stream is 46. If a ResourceSource - * string is not NULL, add 1 for the Index + the length of the null - * terminated string Resource Source + 1 for the null. + * Extended IRQ Resource: + * Add the size of each additional optional interrupt beyond the + * required 1 (4 bytes for each UINT32 interrupt number) */ - SegmentSize = 46; + SegmentSize += (((ACPI_SIZE) + Resource->Data.ExtendedIrq.InterruptCount - 1) * 4); - if (LinkedList->Data.Address64.ResourceSource.StringPtr) - { - SegmentSize += - LinkedList->Data.Address64.ResourceSource.StringLength; - SegmentSize++; - } + /* Add the size of the optional ResourceSource info */ + + SegmentSize += AcpiRsStructOptionLength ( + &Resource->Data.ExtendedIrq.ResourceSource); break; - case ACPI_RSTYPE_EXT_IRQ: - /* - * Extended IRQ Resource - * The base size of this byte stream is 9. This is for an Interrupt - * table length of 1. For each additional interrupt, add 4. - * If a Resource Source string is not NULL, add 1 for the - * Index + the length of the null terminated string - * Resource Source + 1 for the null. - */ - SegmentSize = 9 + (((ACPI_SIZE) - LinkedList->Data.ExtendedIrq.NumberOfInterrupts - 1) * 4); - - if (LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr) - { - SegmentSize += - LinkedList->Data.ExtendedIrq.ResourceSource.StringLength; - SegmentSize++; - } - break; default: - - /* If we get here, everything is out of sync, exit with error */ - - return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); - - } /* switch (LinkedList->Id) */ + break; + } /* Update the total */ - ByteStreamSizeNeeded += SegmentSize; + AmlSizeNeeded += SegmentSize; /* Point to the next object */ - LinkedList = ACPI_PTR_ADD (ACPI_RESOURCE, - LinkedList, LinkedList->Length); + Resource = ACPI_PTR_ADD (ACPI_RESOURCE, + Resource, Resource->Length); } - /* This is the data the caller needs */ + /* Did not find an END_TAG descriptor */ - *SizeNeeded = ByteStreamSizeNeeded; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); } @@ -364,438 +412,197 @@ * * FUNCTION: AcpiRsGetListLength * - * PARAMETERS: ByteStreamBuffer - Pointer to the resource byte stream - * ByteStreamBufferLength - Size of ByteStreamBuffer - * SizeNeeded - UINT32 pointer of the size buffer - * needed to properly return the - * parsed data + * PARAMETERS: AmlBuffer - Pointer to the resource byte stream + * AmlBufferLength - Size of AmlBuffer + * SizeNeeded - Where the size needed is returned * * RETURN: Status * - * DESCRIPTION: Takes the resource byte stream and parses it once, calculating - * the size buffer needed to hold the linked list that conveys - * the resource data. + * DESCRIPTION: Takes an external resource byte stream and calculates the size + * buffer needed to hold the corresponding internal resource + * descriptor linked list. * ******************************************************************************/ ACPI_STATUS AcpiRsGetListLength ( - UINT8 *ByteStreamBuffer, - UINT32 ByteStreamBufferLength, + UINT8 *AmlBuffer, + UINT32 AmlBufferLength, ACPI_SIZE *SizeNeeded) { + UINT8 *Buffer; + ACPI_RESOURCE_INFO *ResourceInfo; UINT32 BufferSize = 0; UINT32 BytesParsed = 0; - UINT8 NumberOfInterrupts = 0; - UINT8 NumberOfChannels = 0; UINT8 ResourceType; - UINT32 StructureSize; - UINT32 BytesConsumed; - UINT8 *Buffer; - UINT8 Temp8; UINT16 Temp16; - UINT8 Index; - UINT8 AdditionalBytes; + UINT16 ResourceLength; + UINT16 HeaderLength; + UINT32 ExtraStructBytes; ACPI_FUNCTION_TRACE ("RsGetListLength"); - while (BytesParsed < ByteStreamBufferLength) + while (BytesParsed < AmlBufferLength) { - /* The next byte in the stream is the resource type */ - - ResourceType = AcpiRsGetResourceType (*ByteStreamBuffer); - - switch (ResourceType) - { - case ACPI_RDESC_TYPE_MEMORY_24: - /* - * 24-Bit Memory Resource - */ - BytesConsumed = 12; - - StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24); - break; - - - case ACPI_RDESC_TYPE_LARGE_VENDOR: - /* - * Vendor Defined Resource - */ - Buffer = ByteStreamBuffer; - ++Buffer; - - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - BytesConsumed = Temp16 + 3; - - /* Ensure a 32-bit boundary for the structure */ - - Temp16 = (UINT16) ACPI_ROUND_UP_TO_32BITS (Temp16); - - StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR) + - (Temp16 * sizeof (UINT8)); - break; - - - case ACPI_RDESC_TYPE_MEMORY_32: - /* - * 32-Bit Memory Range Resource - */ - BytesConsumed = 20; - - StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32); - break; - - - case ACPI_RDESC_TYPE_FIXED_MEMORY_32: - /* - * 32-Bit Fixed Memory Resource - */ - BytesConsumed = 12; - - StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32); - break; - - - case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE: - /* - * 64-Bit Address Resource - */ - Buffer = ByteStreamBuffer; - - ++Buffer; - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - - BytesConsumed = Temp16 + 3; - StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64); - break; - - - case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE: - /* - * 64-Bit Address Resource - */ - Buffer = ByteStreamBuffer; - - ++Buffer; - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - - BytesConsumed = Temp16 + 3; + /* The next byte in the stream is the resource descriptor type */ - /* - * Resource Source Index and Resource Source are optional elements. - * Check the length of the Bytestream. If it is greater than 43, - * that means that an Index exists and is followed by a null - * terminated string. Therefore, set the temp variable to the - * length minus the minimum byte stream length plus the byte for - * the Index to determine the size of the NULL terminated string. - */ - if (43 < Temp16) - { - Temp8 = (UINT8) (Temp16 - 44); - } - else - { - Temp8 = 0; - } - - /* Ensure a 64-bit boundary for the structure */ - - Temp8 = (UINT8) ACPI_ROUND_UP_TO_64BITS (Temp8); - - StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64) + - (Temp8 * sizeof (UINT8)); - break; - - - case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE: - /* - * 32-Bit Address Resource - */ - Buffer = ByteStreamBuffer; - - ++Buffer; - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - - BytesConsumed = Temp16 + 3; - - /* - * Resource Source Index and Resource Source are optional elements. - * Check the length of the Bytestream. If it is greater than 23, - * that means that an Index exists and is followed by a null - * terminated string. Therefore, set the temp variable to the - * length minus the minimum byte stream length plus the byte for - * the Index to determine the size of the NULL terminated string. - */ - if (23 < Temp16) - { - Temp8 = (UINT8) (Temp16 - 24); - } - else - { - Temp8 = 0; - } - - /* Ensure a 32-bit boundary for the structure */ - - Temp8 = (UINT8) ACPI_ROUND_UP_TO_32BITS (Temp8); - - StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32) + - (Temp8 * sizeof (UINT8)); - break; - - - case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE: - /* - * 16-Bit Address Resource - */ - Buffer = ByteStreamBuffer; - - ++Buffer; - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - - BytesConsumed = Temp16 + 3; - - /* - * Resource Source Index and Resource Source are optional elements. - * Check the length of the Bytestream. If it is greater than 13, - * that means that an Index exists and is followed by a null - * terminated string. Therefore, set the temp variable to the - * length minus the minimum byte stream length plus the byte for - * the Index to determine the size of the NULL terminated string. - */ - if (13 < Temp16) - { - Temp8 = (UINT8) (Temp16 - 14); - } - else - { - Temp8 = 0; - } - - /* Ensure a 32-bit boundary for the structure */ - - Temp8 = (UINT8) ACPI_ROUND_UP_TO_32BITS (Temp8); - - StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS16) + - (Temp8 * sizeof (UINT8)); - break; - - - case ACPI_RDESC_TYPE_EXTENDED_XRUPT: - /* - * Extended IRQ - */ - Buffer = ByteStreamBuffer; - - ++Buffer; - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); + ResourceType = AcpiRsGetResourceType (*AmlBuffer); - BytesConsumed = Temp16 + 3; - - /* - * Point past the length field and the Interrupt vector flags to - * save off the Interrupt table length to the Temp8 variable. - */ - Buffer += 3; - Temp8 = *Buffer; - - /* - * To compensate for multiple interrupt numbers, add 4 bytes for - * each additional interrupts greater than 1 - */ - AdditionalBytes = (UINT8) ((Temp8 - 1) * 4); - - /* - * Resource Source Index and Resource Source are optional elements. - * Check the length of the Bytestream. If it is greater than 9, - * that means that an Index exists and is followed by a null - * terminated string. Therefore, set the temp variable to the - * length minus the minimum byte stream length plus the byte for - * the Index to determine the size of the NULL terminated string. - */ - if (9 + AdditionalBytes < Temp16) - { - Temp8 = (UINT8) (Temp16 - (9 + AdditionalBytes)); - } - else - { - Temp8 = 0; - } - - /* Ensure a 32-bit boundary for the structure */ - - Temp8 = (UINT8) ACPI_ROUND_UP_TO_32BITS (Temp8); - - StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_EXT_IRQ) + - (AdditionalBytes * sizeof (UINT8)) + - (Temp8 * sizeof (UINT8)); - break; - - - case ACPI_RDESC_TYPE_IRQ_FORMAT: - /* - * IRQ Resource. - * Determine if it there are two or three trailing bytes - */ - Buffer = ByteStreamBuffer; - Temp8 = *Buffer; - - if(Temp8 & 0x01) - { - BytesConsumed = 4; - } - else - { - BytesConsumed = 3; - } - - /* Point past the descriptor */ - - ++Buffer; - - /* Look at the number of bits set */ - - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - - for (Index = 0; Index < 16; Index++) - { - if (Temp16 & 0x1) - { - ++NumberOfInterrupts; - } - - Temp16 >>= 1; - } - - StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IO) + - (NumberOfInterrupts * sizeof (UINT32)); - break; - - - case ACPI_RDESC_TYPE_DMA_FORMAT: - /* - * DMA Resource - */ - Buffer = ByteStreamBuffer; - BytesConsumed = 3; - - /* Point past the descriptor */ - - ++Buffer; - - /* Look at the number of bits set */ - - Temp8 = *Buffer; + /* Get the base stream size and structure sizes for the descriptor */ - for(Index = 0; Index < 8; Index++) - { - if(Temp8 & 0x1) - { - ++NumberOfChannels; - } - - Temp8 >>= 1; - } - - StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_DMA) + - (NumberOfChannels * sizeof (UINT32)); - break; - - - case ACPI_RDESC_TYPE_START_DEPENDENT: - /* - * Start Dependent Functions Resource - * Determine if it there are two or three trailing bytes - */ - Buffer = ByteStreamBuffer; - Temp8 = *Buffer; - - if(Temp8 & 0x01) - { - BytesConsumed = 2; - } - else - { - BytesConsumed = 1; - } - - StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_START_DPF); - break; - - - case ACPI_RDESC_TYPE_END_DEPENDENT: - /* - * End Dependent Functions Resource - */ - BytesConsumed = 1; - StructureSize = ACPI_RESOURCE_LENGTH; - break; - - - case ACPI_RDESC_TYPE_IO_PORT: - /* - * IO Port Resource - */ - BytesConsumed = 8; - StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IO); - break; - - - case ACPI_RDESC_TYPE_FIXED_IO_PORT: - /* - * Fixed IO Port Resource - */ - BytesConsumed = 4; - StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO); - break; - - - case ACPI_RDESC_TYPE_SMALL_VENDOR: - /* - * Vendor Specific Resource - */ - Buffer = ByteStreamBuffer; - - Temp8 = *Buffer; - Temp8 = (UINT8) (Temp8 & 0x7); - BytesConsumed = Temp8 + 1; - - /* Ensure a 32-bit boundary for the structure */ - - Temp8 = (UINT8) ACPI_ROUND_UP_TO_32BITS (Temp8); - StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR) + - (Temp8 * sizeof (UINT8)); - break; - - - case ACPI_RDESC_TYPE_END_TAG: - /* - * End Tag - */ - BytesConsumed = 2; - StructureSize = ACPI_RESOURCE_LENGTH; - ByteStreamBufferLength = BytesParsed; - break; - - - default: - /* - * If we get here, everything is out of sync, - * exit with an error - */ + ResourceInfo = AcpiRsGetResourceInfo (ResourceType); + if (!ResourceInfo) + { return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); } - /* Update the return value and counter */ + /* Get the Length field from the input resource descriptor */ + + ResourceLength = AcpiRsGetResourceLength ( + ACPI_CAST_PTR (AML_RESOURCE, AmlBuffer)); + + /* Augment the size for descriptors with optional fields */ + + ExtraStructBytes = 0; + + if (!(ResourceType & ACPI_RESOURCE_NAME_LARGE)) + { + /* + * Small resource descriptors + */ + HeaderLength = sizeof (AML_RESOURCE_SMALL_HEADER); + Buffer = AmlBuffer + HeaderLength; + + switch (ResourceType) + { + case ACPI_RESOURCE_NAME_IRQ: + /* + * IRQ Resource: + * Get the number of bits set in the IRQ word + */ + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); + ExtraStructBytes = (AcpiRsCountSetBits (Temp16) * + sizeof (UINT32)); + break; + + + case ACPI_RESOURCE_NAME_DMA: + /* + * DMA Resource: + * Get the number of bits set in the DMA channels byte + */ + ACPI_MOVE_16_TO_16 (&Temp16, Buffer); + ExtraStructBytes = (AcpiRsCountSetBits (Temp16) * + sizeof (UINT32)); + break; + + + case ACPI_RESOURCE_NAME_VENDOR_SMALL: + /* + * Vendor Specific Resource: + * Ensure a 32-bit boundary for the structure + */ + ExtraStructBytes = ACPI_ROUND_UP_TO_32BITS (ResourceLength); + break; + + + case ACPI_RESOURCE_NAME_END_TAG: + /* + * End Tag: + * Terminate the loop now + */ + AmlBufferLength = BytesParsed; + break; + + + default: + break; + } + } + else + { + /* + * Large resource descriptors + */ + HeaderLength = sizeof (AML_RESOURCE_LARGE_HEADER); + Buffer = AmlBuffer + HeaderLength; - BufferSize += (UINT32) ACPI_ALIGN_RESOURCE_SIZE (StructureSize); - BytesParsed += BytesConsumed; + switch (ResourceType) + { + case ACPI_RESOURCE_NAME_VENDOR_LARGE: + /* + * Vendor Defined Resource: + * Add vendor data and ensure a 32-bit boundary for the structure + */ + ExtraStructBytes = ACPI_ROUND_UP_TO_32BITS (ResourceLength); + break; + + + case ACPI_RESOURCE_NAME_ADDRESS32: + case ACPI_RESOURCE_NAME_ADDRESS16: + /* + * 32-Bit or 16-bit Address Resource: + * Add the size of any optional data (ResourceSource) + */ + ExtraStructBytes = AcpiRsStreamOptionLength (ResourceLength, + ResourceInfo->MinimumAmlResourceLength); + break; + + + case ACPI_RESOURCE_NAME_EXTENDED_IRQ: + /* + * Extended IRQ: + * Point past the InterruptVectorFlags to get the + * InterruptTableLength. + */ + Buffer++; + + /* + * Add 4 bytes for each additional interrupt. Note: at least one + * interrupt is required and is included in the minimum + * descriptor size + */ + ExtraStructBytes = ((*Buffer - 1) * sizeof (UINT32)); - /* Set the byte stream to point to the next resource */ + /* Add the size of any optional data (ResourceSource) */ + + ExtraStructBytes += AcpiRsStreamOptionLength ( + ResourceLength - ExtraStructBytes, + ResourceInfo->MinimumAmlResourceLength); + break; + + + case ACPI_RESOURCE_NAME_ADDRESS64: + /* + * 64-Bit Address Resource: + * Add the size of any optional data (ResourceSource) + * Ensure a 64-bit boundary for the structure + */ + ExtraStructBytes = ACPI_ROUND_UP_TO_64BITS ( + AcpiRsStreamOptionLength (ResourceLength, + ResourceInfo->MinimumAmlResourceLength)); + break; - ByteStreamBuffer += BytesConsumed; + + default: + break; + } + } + + /* Update the required buffer size for the internal descriptor structs */ + + Temp16 = (UINT16) (ResourceInfo->MinimumInternalStructLength + ExtraStructBytes); + BufferSize += (UINT32) ACPI_ALIGN_RESOURCE_SIZE (Temp16); + + /* + * Update byte count and point to the next resource within the stream + * using the size of the header plus the length contained in the header + */ + Temp16 = (UINT16) (HeaderLength + ResourceLength); + BytesParsed += Temp16; + AmlBuffer += Temp16; } /* This is the data the caller needs */
--- a/usr/src/uts/i86pc/io/acpica/resources/rscreate.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/resources/rscreate.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rscreate - Create resource lists/tables - * $Revision: 70 $ + * $Revision: 1.71 $ * ******************************************************************************/ @@ -130,10 +130,10 @@ * * FUNCTION: AcpiRsCreateResourceList * - * PARAMETERS: ByteStreamBuffer - Pointer to the resource byte stream - * OutputBuffer - Pointer to the user's buffer + * PARAMETERS: AmlBuffer - Pointer to the resource byte stream + * OutputBuffer - Pointer to the user's buffer * - * RETURN: Status - AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status: AE_OK if okay, else a valid ACPI_STATUS code * If OutputBuffer is not large enough, OutputBufferLength * indicates how large OutputBuffer should be, else it * indicates how may UINT8 elements of OutputBuffer are valid. @@ -146,32 +146,32 @@ ACPI_STATUS AcpiRsCreateResourceList ( - ACPI_OPERAND_OBJECT *ByteStreamBuffer, + ACPI_OPERAND_OBJECT *AmlBuffer, ACPI_BUFFER *OutputBuffer) { ACPI_STATUS Status; - UINT8 *ByteStreamStart; + UINT8 *AmlStart; ACPI_SIZE ListSizeNeeded = 0; - UINT32 ByteStreamBufferLength; + UINT32 AmlBufferLength; ACPI_FUNCTION_TRACE ("RsCreateResourceList"); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteStreamBuffer = %p\n", - ByteStreamBuffer)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlBuffer = %p\n", + AmlBuffer)); /* Params already validated, so we don't re-validate here */ - ByteStreamBufferLength = ByteStreamBuffer->Buffer.Length; - ByteStreamStart = ByteStreamBuffer->Buffer.Pointer; + AmlBufferLength = AmlBuffer->Buffer.Length; + AmlStart = AmlBuffer->Buffer.Pointer; /* - * Pass the ByteStreamBuffer into a module that can calculate + * Pass the AmlBuffer into a module that can calculate * the buffer size needed for the linked list */ - Status = AcpiRsGetListLength (ByteStreamStart, ByteStreamBufferLength, + Status = AcpiRsGetListLength (AmlStart, AmlBufferLength, &ListSizeNeeded); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status=%X ListSizeNeeded=%X\n", @@ -191,7 +191,7 @@ /* Do the conversion */ - Status = AcpiRsByteStreamToList (ByteStreamStart, ByteStreamBufferLength, + Status = AcpiRsConvertAmlToResources (AmlStart, AmlBufferLength, OutputBuffer->Pointer); if (ACPI_FAILURE (Status)) { @@ -448,7 +448,7 @@ /******************************************************************************* * - * FUNCTION: AcpiRsCreateByteStream + * FUNCTION: AcpiRsCreateAmlResources * * PARAMETERS: LinkedListBuffer - Pointer to the resource linked list * OutputBuffer - Pointer to the user's buffer @@ -465,15 +465,15 @@ ******************************************************************************/ ACPI_STATUS -AcpiRsCreateByteStream ( +AcpiRsCreateAmlResources ( ACPI_RESOURCE *LinkedListBuffer, ACPI_BUFFER *OutputBuffer) { ACPI_STATUS Status; - ACPI_SIZE ByteStreamSizeNeeded = 0; + ACPI_SIZE AmlSizeNeeded = 0; - ACPI_FUNCTION_TRACE ("RsCreateByteStream"); + ACPI_FUNCTION_TRACE ("RsCreateAmlResources"); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "LinkedListBuffer = %p\n", @@ -485,11 +485,11 @@ * Pass the LinkedListBuffer into a module that calculates * the buffer size needed for the byte stream. */ - Status = AcpiRsGetByteStreamLength (LinkedListBuffer, - &ByteStreamSizeNeeded); + Status = AcpiRsGetAmlLength (LinkedListBuffer, + &AmlSizeNeeded); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteStreamSizeNeeded=%X, %s\n", - (UINT32) ByteStreamSizeNeeded, AcpiFormatException (Status))); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n", + (UINT32) AmlSizeNeeded, AcpiFormatException (Status))); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -497,7 +497,7 @@ /* Validate/Allocate/Clear caller buffer */ - Status = AcpiUtInitializeBuffer (OutputBuffer, ByteStreamSizeNeeded); + Status = AcpiUtInitializeBuffer (OutputBuffer, AmlSizeNeeded); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -505,7 +505,7 @@ /* Do the conversion */ - Status = AcpiRsListToByteStream (LinkedListBuffer, ByteStreamSizeNeeded, + Status = AcpiRsConvertResourcesToAml (LinkedListBuffer, AmlSizeNeeded, OutputBuffer->Pointer); if (ACPI_FAILURE (Status)) {
--- a/usr/src/uts/i86pc/io/acpica/resources/rsdump.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/resources/rsdump.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsdump - Functions to display the resource structures. - * $Revision: 45 $ + * $Revision: 1.53 $ * ******************************************************************************/ @@ -129,981 +129,341 @@ /* Local prototypes */ static void -AcpiRsDumpIrq ( - ACPI_RESOURCE_DATA *Data); +AcpiRsOutString ( + char *Title, + char *Value); static void -AcpiRsDumpAddress16 ( - ACPI_RESOURCE_DATA *Data); +AcpiRsOutInteger8 ( + char *Title, + UINT8 Value); static void -AcpiRsDumpAddress32 ( - ACPI_RESOURCE_DATA *Data); +AcpiRsOutInteger16 ( + char *Title, + UINT16 Value); static void -AcpiRsDumpAddress64 ( - ACPI_RESOURCE_DATA *Data); +AcpiRsOutInteger32 ( + char *Title, + UINT32 Value); static void -AcpiRsDumpDma ( - ACPI_RESOURCE_DATA *Data); - -static void -AcpiRsDumpIo ( - ACPI_RESOURCE_DATA *Data); +AcpiRsOutInteger64 ( + char *Title, + UINT64 Value); static void -AcpiRsDumpExtendedIrq ( - ACPI_RESOURCE_DATA *Data); +AcpiRsOutTitle ( + char *Title); static void -AcpiRsDumpFixedIo ( - ACPI_RESOURCE_DATA *Data); - -static void -AcpiRsDumpFixedMemory32 ( - ACPI_RESOURCE_DATA *Data); +AcpiRsDumpByteList ( + UINT32 Length, + UINT8 *Data); static void -AcpiRsDumpMemory24 ( - ACPI_RESOURCE_DATA *Data); +AcpiRsDumpDwordList ( + UINT32 Length, + UINT32 *Data); static void -AcpiRsDumpMemory32 ( - ACPI_RESOURCE_DATA *Data); +AcpiRsDumpShortByteList ( + UINT32 Length, + UINT32 *Data); static void -AcpiRsDumpStartDependFns ( - ACPI_RESOURCE_DATA *Data); +AcpiRsDumpResourceSource ( + ACPI_RESOURCE_SOURCE *ResourceSource); static void -AcpiRsDumpVendorSpecific ( - ACPI_RESOURCE_DATA *Data); +AcpiRsDumpAddressCommon ( + ACPI_RESOURCE_DATA *Resource); /******************************************************************************* * - * FUNCTION: AcpiRsDumpIrq - * - * PARAMETERS: Data - pointer to the resource structure to dump. - * - * RETURN: None - * - * DESCRIPTION: Prints out the various members of the Data structure type. + * FUNCTION: AcpiRsOut* * - ******************************************************************************/ - -static void -AcpiRsDumpIrq ( - ACPI_RESOURCE_DATA *Data) -{ - ACPI_RESOURCE_IRQ *IrqData = (ACPI_RESOURCE_IRQ *) Data; - UINT8 Index = 0; - - - ACPI_FUNCTION_ENTRY (); - - - AcpiOsPrintf ("IRQ Resource\n"); - - AcpiOsPrintf (" %s Triggered\n", - ACPI_LEVEL_SENSITIVE == IrqData->EdgeLevel ? "Level" : "Edge"); - - AcpiOsPrintf (" Active %s\n", - ACPI_ACTIVE_LOW == IrqData->ActiveHighLow ? "Low" : "High"); - - AcpiOsPrintf (" %s\n", - ACPI_SHARED == IrqData->SharedExclusive ? "Shared" : "Exclusive"); - - AcpiOsPrintf (" %X Interrupts ( ", IrqData->NumberOfInterrupts); - - for (Index = 0; Index < IrqData->NumberOfInterrupts; Index++) - { - AcpiOsPrintf ("%X ", IrqData->Interrupts[Index]); - } - - AcpiOsPrintf (")\n"); - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsDumpDma - * - * PARAMETERS: Data - pointer to the resource structure to dump. + * PARAMETERS: Title - Name of the resource field + * Value - Value of the resource field * * RETURN: None * - * DESCRIPTION: Prints out the various members of the Data structure type. - * - ******************************************************************************/ - -static void -AcpiRsDumpDma ( - ACPI_RESOURCE_DATA *Data) -{ - ACPI_RESOURCE_DMA *DmaData = (ACPI_RESOURCE_DMA *) Data; - UINT8 Index = 0; - - - ACPI_FUNCTION_ENTRY (); - - - AcpiOsPrintf ("DMA Resource\n"); - - switch (DmaData->Type) - { - case ACPI_COMPATIBILITY: - AcpiOsPrintf (" Compatibility mode\n"); - break; - - case ACPI_TYPE_A: - AcpiOsPrintf (" Type A\n"); - break; - - case ACPI_TYPE_B: - AcpiOsPrintf (" Type B\n"); - break; - - case ACPI_TYPE_F: - AcpiOsPrintf (" Type F\n"); - break; - - default: - AcpiOsPrintf (" Invalid DMA type\n"); - break; - } - - AcpiOsPrintf (" %sBus Master\n", - ACPI_BUS_MASTER == DmaData->BusMaster ? "" : "Not a "); - - - switch (DmaData->Transfer) - { - case ACPI_TRANSFER_8: - AcpiOsPrintf (" 8-bit only transfer\n"); - break; - - case ACPI_TRANSFER_8_16: - AcpiOsPrintf (" 8 and 16-bit transfer\n"); - break; - - case ACPI_TRANSFER_16: - AcpiOsPrintf (" 16 bit only transfer\n"); - break; - - default: - AcpiOsPrintf (" Invalid transfer preference\n"); - break; - } - - AcpiOsPrintf (" Number of Channels: %X ( ", - DmaData->NumberOfChannels); - - for (Index = 0; Index < DmaData->NumberOfChannels; Index++) - { - AcpiOsPrintf ("%X ", DmaData->Channels[Index]); - } - - AcpiOsPrintf (")\n"); - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsDumpStartDependFns - * - * PARAMETERS: Data - pointer to the resource structure to dump. - * - * RETURN: None - * - * DESCRIPTION: Prints out the various members of the Data structure type. + * DESCRIPTION: Miscellaneous helper functions to consistently format the + * output of the resource dump routines * ******************************************************************************/ static void -AcpiRsDumpStartDependFns ( - ACPI_RESOURCE_DATA *Data) +AcpiRsOutString ( + char *Title, + char *Value) { - ACPI_RESOURCE_START_DPF *SdfData = (ACPI_RESOURCE_START_DPF *) Data; - - - ACPI_FUNCTION_ENTRY (); - - - AcpiOsPrintf ("Start Dependent Functions Resource\n"); - - switch (SdfData->CompatibilityPriority) - { - case ACPI_GOOD_CONFIGURATION: - AcpiOsPrintf (" Good configuration\n"); - break; - - case ACPI_ACCEPTABLE_CONFIGURATION: - AcpiOsPrintf (" Acceptable configuration\n"); - break; - - case ACPI_SUB_OPTIMAL_CONFIGURATION: - AcpiOsPrintf (" Sub-optimal configuration\n"); - break; - - default: - AcpiOsPrintf (" Invalid compatibility priority\n"); - break; - } - - switch(SdfData->PerformanceRobustness) - { - case ACPI_GOOD_CONFIGURATION: - AcpiOsPrintf (" Good configuration\n"); - break; - - case ACPI_ACCEPTABLE_CONFIGURATION: - AcpiOsPrintf (" Acceptable configuration\n"); - break; - - case ACPI_SUB_OPTIMAL_CONFIGURATION: - AcpiOsPrintf (" Sub-optimal configuration\n"); - break; - - default: - AcpiOsPrintf (" Invalid performance robustness preference\n"); - break; - } - - return; + AcpiOsPrintf ("%27s : %s\n", Title, Value); } - -/******************************************************************************* - * - * FUNCTION: AcpiRsDumpIo - * - * PARAMETERS: Data - pointer to the resource structure to dump. - * - * RETURN: None - * - * DESCRIPTION: Prints out the various members of the Data structure type. - * - ******************************************************************************/ - static void -AcpiRsDumpIo ( - ACPI_RESOURCE_DATA *Data) +AcpiRsOutInteger8 ( + char *Title, + UINT8 Value) { - ACPI_RESOURCE_IO *IoData = (ACPI_RESOURCE_IO *) Data; - - - ACPI_FUNCTION_ENTRY (); - - - AcpiOsPrintf ("Io Resource\n"); - - AcpiOsPrintf (" %d bit decode\n", - ACPI_DECODE_16 == IoData->IoDecode ? 16 : 10); - - AcpiOsPrintf (" Range minimum base: %08X\n", IoData->MinBaseAddress); - - AcpiOsPrintf (" Range maximum base: %08X\n", IoData->MaxBaseAddress); - - AcpiOsPrintf (" Alignment: %08X\n", IoData->Alignment); - - AcpiOsPrintf (" Range Length: %08X\n", IoData->RangeLength); - - return; + AcpiOsPrintf ("%27s : %2.2X\n", Title, Value); } - -/******************************************************************************* - * - * FUNCTION: AcpiRsDumpFixedIo - * - * PARAMETERS: Data - pointer to the resource structure to dump. - * - * RETURN: None - * - * DESCRIPTION: Prints out the various members of the Data structure type. - * - ******************************************************************************/ - -static void -AcpiRsDumpFixedIo ( - ACPI_RESOURCE_DATA *Data) -{ - ACPI_RESOURCE_FIXED_IO *FixedIoData = (ACPI_RESOURCE_FIXED_IO *) Data; - - - ACPI_FUNCTION_ENTRY (); - - - AcpiOsPrintf ("Fixed Io Resource\n"); - AcpiOsPrintf (" Range base address: %08X", FixedIoData->BaseAddress); - - AcpiOsPrintf (" Range length: %08X", FixedIoData->RangeLength); - - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsDumpVendorSpecific - * - * PARAMETERS: Data - pointer to the resource structure to dump. - * - * RETURN: None - * - * DESCRIPTION: Prints out the various members of the Data structure type. - * - ******************************************************************************/ - static void -AcpiRsDumpVendorSpecific ( - ACPI_RESOURCE_DATA *Data) +AcpiRsOutInteger16 ( + char *Title, + UINT16 Value) { - ACPI_RESOURCE_VENDOR *VendorData = (ACPI_RESOURCE_VENDOR *) Data; - UINT16 Index = 0; - - - ACPI_FUNCTION_ENTRY (); - - - AcpiOsPrintf ("Vendor Specific Resource\n"); - - AcpiOsPrintf (" Length: %08X\n", VendorData->Length); - - for (Index = 0; Index < VendorData->Length; Index++) - { - AcpiOsPrintf (" Byte %X: %08X\n", - Index, VendorData->Reserved[Index]); - } - - return; + AcpiOsPrintf ("%27s : %4.4X\n", Title, Value); } - -/******************************************************************************* - * - * FUNCTION: AcpiRsDumpMemory24 - * - * PARAMETERS: Data - pointer to the resource structure to dump. - * - * RETURN: None - * - * DESCRIPTION: Prints out the various members of the Data structure type. - * - ******************************************************************************/ - static void -AcpiRsDumpMemory24 ( - ACPI_RESOURCE_DATA *Data) +AcpiRsOutInteger32 ( + char *Title, + UINT32 Value) { - ACPI_RESOURCE_MEM24 *Memory24Data = (ACPI_RESOURCE_MEM24 *) Data; - - - ACPI_FUNCTION_ENTRY (); - - - AcpiOsPrintf ("24-Bit Memory Range Resource\n"); - - AcpiOsPrintf (" Read%s\n", - ACPI_READ_WRITE_MEMORY == - Memory24Data->ReadWriteAttribute ? - "/Write" : " only"); - - AcpiOsPrintf (" Range minimum base: %08X\n", - Memory24Data->MinBaseAddress); - - AcpiOsPrintf (" Range maximum base: %08X\n", - Memory24Data->MaxBaseAddress); - - AcpiOsPrintf (" Alignment: %08X\n", Memory24Data->Alignment); - - AcpiOsPrintf (" Range length: %08X\n", Memory24Data->RangeLength); - - return; + AcpiOsPrintf ("%27s : %8.8X\n", Title, Value); } - -/******************************************************************************* - * - * FUNCTION: AcpiRsDumpMemory32 - * - * PARAMETERS: Data - pointer to the resource structure to dump. - * - * RETURN: None - * - * DESCRIPTION: Prints out the various members of the Data structure type. - * - ******************************************************************************/ +static void +AcpiRsOutInteger64 ( + char *Title, + UINT64 Value) +{ + AcpiOsPrintf ("%27s : %8.8X%8.8X\n", Title, + ACPI_FORMAT_UINT64 (Value)); +} static void -AcpiRsDumpMemory32 ( - ACPI_RESOURCE_DATA *Data) +AcpiRsOutTitle ( + char *Title) { - ACPI_RESOURCE_MEM32 *Memory32Data = (ACPI_RESOURCE_MEM32 *) Data; - - - ACPI_FUNCTION_ENTRY (); - - - AcpiOsPrintf ("32-Bit Memory Range Resource\n"); - - AcpiOsPrintf (" Read%s\n", - ACPI_READ_WRITE_MEMORY == - Memory32Data->ReadWriteAttribute ? - "/Write" : " only"); - - AcpiOsPrintf (" Range minimum base: %08X\n", - Memory32Data->MinBaseAddress); - - AcpiOsPrintf (" Range maximum base: %08X\n", - Memory32Data->MaxBaseAddress); - - AcpiOsPrintf (" Alignment: %08X\n", Memory32Data->Alignment); - - AcpiOsPrintf (" Range length: %08X\n", Memory32Data->RangeLength); - - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsDumpFixedMemory32 - * - * PARAMETERS: Data - pointer to the resource structure to dump. - * - * RETURN: - * - * DESCRIPTION: Prints out the various members of the Data structure type. - * - ******************************************************************************/ - -static void -AcpiRsDumpFixedMemory32 ( - ACPI_RESOURCE_DATA *Data) -{ - ACPI_RESOURCE_FIXED_MEM32 *FixedMemory32Data = - (ACPI_RESOURCE_FIXED_MEM32 *) Data; - - - ACPI_FUNCTION_ENTRY (); - - - AcpiOsPrintf ("32-Bit Fixed Location Memory Range Resource\n"); - - AcpiOsPrintf (" Read%s\n", - ACPI_READ_WRITE_MEMORY == - FixedMemory32Data->ReadWriteAttribute ? "/Write" : " Only"); - - AcpiOsPrintf (" Range base address: %08X\n", - FixedMemory32Data->RangeBaseAddress); - - AcpiOsPrintf (" Range length: %08X\n", - FixedMemory32Data->RangeLength); - - return; + AcpiOsPrintf ("%27s : ", Title); } /******************************************************************************* * - * FUNCTION: AcpiRsDumpAddress16 + * FUNCTION: AcpiRsDump*List * - * PARAMETERS: Data - pointer to the resource structure to dump. + * PARAMETERS: Length - Number of elements in the list + * Data - Start of the list * * RETURN: None * - * DESCRIPTION: Prints out the various members of the Data structure type. + * DESCRIPTION: Miscellaneous functions to dump lists of raw data * ******************************************************************************/ static void -AcpiRsDumpAddress16 ( - ACPI_RESOURCE_DATA *Data) +AcpiRsDumpByteList ( + UINT32 Length, + UINT8 *Data) { - ACPI_RESOURCE_ADDRESS16 *Address16Data = (ACPI_RESOURCE_ADDRESS16 *) Data; + UINT32 i; + + + for (i = 0; i < Length; i++) + { + AcpiOsPrintf ("%25s%2.2X : %2.2X\n", + "Byte", i, Data[i]); + } +} + +static void +AcpiRsDumpDwordList ( + UINT32 Length, + UINT32 *Data) +{ + UINT32 i; + for (i = 0; i < Length; i++) + { + AcpiOsPrintf ("%25s%2.2X : %8.8X\n", + "Dword", i, Data[i]); + } +} + +static void +AcpiRsDumpShortByteList ( + UINT32 Length, + UINT32 *Data) +{ + UINT32 i; + + + for (i = 0; i < Length; i++) + { + AcpiOsPrintf ("%X ", Data[i]); + } + AcpiOsPrintf ("\n"); +} + +static void +AcpiRsDumpMemoryAttribute ( + UINT32 ReadWriteAttribute) +{ + + AcpiRsOutString ("Read/Write Attribute", + ACPI_READ_WRITE_MEMORY == ReadWriteAttribute ? + "Read/Write" : "Read-Only"); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpResourceSource + * + * PARAMETERS: ResourceSource - Pointer to a Resource Source struct + * + * RETURN: None + * + * DESCRIPTION: Common routine for dumping the optional ResourceSource and the + * corresponding ResourceSourceIndex. + * + ******************************************************************************/ + +static void +AcpiRsDumpResourceSource ( + ACPI_RESOURCE_SOURCE *ResourceSource) +{ ACPI_FUNCTION_ENTRY (); - AcpiOsPrintf ("16-Bit Address Space Resource\n"); - AcpiOsPrintf (" Resource Type: "); - - switch (Address16Data->ResourceType) + if (ResourceSource->Index == 0xFF) { - case ACPI_MEMORY_RANGE: - - AcpiOsPrintf ("Memory Range\n"); - - switch (Address16Data->Attribute.Memory.CacheAttribute) - { - case ACPI_NON_CACHEABLE_MEMORY: - AcpiOsPrintf (" Type Specific: Noncacheable memory\n"); - break; - - case ACPI_CACHABLE_MEMORY: - AcpiOsPrintf (" Type Specific: Cacheable memory\n"); - break; - - case ACPI_WRITE_COMBINING_MEMORY: - AcpiOsPrintf (" Type Specific: Write-combining memory\n"); - break; - - case ACPI_PREFETCHABLE_MEMORY: - AcpiOsPrintf (" Type Specific: Prefetchable memory\n"); - break; - - default: - AcpiOsPrintf (" Type Specific: Invalid cache attribute\n"); - break; - } - - AcpiOsPrintf (" Type Specific: Read%s\n", - ACPI_READ_WRITE_MEMORY == - Address16Data->Attribute.Memory.ReadWriteAttribute ? - "/Write" : " Only"); - break; - - case ACPI_IO_RANGE: - - AcpiOsPrintf ("I/O Range\n"); - - switch (Address16Data->Attribute.Io.RangeAttribute) - { - case ACPI_NON_ISA_ONLY_RANGES: - AcpiOsPrintf (" Type Specific: Non-ISA Io Addresses\n"); - break; - - case ACPI_ISA_ONLY_RANGES: - AcpiOsPrintf (" Type Specific: ISA Io Addresses\n"); - break; - - case ACPI_ENTIRE_RANGE: - AcpiOsPrintf (" Type Specific: ISA and non-ISA Io Addresses\n"); - break; - - default: - AcpiOsPrintf (" Type Specific: Invalid range attribute\n"); - break; - } - - AcpiOsPrintf (" Type Specific: %s Translation\n", - ACPI_SPARSE_TRANSLATION == - Address16Data->Attribute.Io.TranslationAttribute ? - "Sparse" : "Dense"); - break; - - case ACPI_BUS_NUMBER_RANGE: - - AcpiOsPrintf ("Bus Number Range\n"); - break; - - default: - - AcpiOsPrintf ("0x%2.2X\n", Address16Data->ResourceType); - break; + return; } - AcpiOsPrintf (" Resource %s\n", - ACPI_CONSUMER == Address16Data->ProducerConsumer ? - "Consumer" : "Producer"); - - AcpiOsPrintf (" %s decode\n", - ACPI_SUB_DECODE == Address16Data->Decode ? - "Subtractive" : "Positive"); - - AcpiOsPrintf (" Min address is %s fixed\n", - ACPI_ADDRESS_FIXED == Address16Data->MinAddressFixed ? - "" : "not"); - - AcpiOsPrintf (" Max address is %s fixed\n", - ACPI_ADDRESS_FIXED == Address16Data->MaxAddressFixed ? - "" : "not"); - - AcpiOsPrintf (" Granularity: %08X\n", - Address16Data->Granularity); + AcpiRsOutInteger8 ("Resource Source Index", + (UINT8) ResourceSource->Index); - AcpiOsPrintf (" Address range min: %08X\n", - Address16Data->MinAddressRange); - - AcpiOsPrintf (" Address range max: %08X\n", - Address16Data->MaxAddressRange); - - AcpiOsPrintf (" Address translation offset: %08X\n", - Address16Data->AddressTranslationOffset); - - AcpiOsPrintf (" Address Length: %08X\n", - Address16Data->AddressLength); - - if (0xFF != Address16Data->ResourceSource.Index) - { - AcpiOsPrintf (" Resource Source Index: %X\n", - Address16Data->ResourceSource.Index); - - AcpiOsPrintf (" Resource Source: %s\n", - Address16Data->ResourceSource.StringPtr); - } - - return; + AcpiRsOutString ("Resource Source", + ResourceSource->StringPtr ? + ResourceSource->StringPtr : "[Not Specified]"); } /******************************************************************************* * - * FUNCTION: AcpiRsDumpAddress32 + * FUNCTION: AcpiRsDumpAddressCommon * - * PARAMETERS: Data - pointer to the resource structure to dump. + * PARAMETERS: Resource - Pointer to an internal resource descriptor * * RETURN: None * - * DESCRIPTION: Prints out the various members of the Data structure type. - * - ******************************************************************************/ - -static void -AcpiRsDumpAddress32 ( - ACPI_RESOURCE_DATA *Data) -{ - ACPI_RESOURCE_ADDRESS32 *Address32Data = (ACPI_RESOURCE_ADDRESS32 *) Data; - - - ACPI_FUNCTION_ENTRY (); - - - AcpiOsPrintf ("32-Bit Address Space Resource\n"); - - switch (Address32Data->ResourceType) - { - case ACPI_MEMORY_RANGE: - - AcpiOsPrintf (" Resource Type: Memory Range\n"); - - switch (Address32Data->Attribute.Memory.CacheAttribute) - { - case ACPI_NON_CACHEABLE_MEMORY: - AcpiOsPrintf (" Type Specific: Noncacheable memory\n"); - break; - - case ACPI_CACHABLE_MEMORY: - AcpiOsPrintf (" Type Specific: Cacheable memory\n"); - break; - - case ACPI_WRITE_COMBINING_MEMORY: - AcpiOsPrintf (" Type Specific: Write-combining memory\n"); - break; - - case ACPI_PREFETCHABLE_MEMORY: - AcpiOsPrintf (" Type Specific: Prefetchable memory\n"); - break; - - default: - AcpiOsPrintf (" Type Specific: Invalid cache attribute\n"); - break; - } - - AcpiOsPrintf (" Type Specific: Read%s\n", - ACPI_READ_WRITE_MEMORY == - Address32Data->Attribute.Memory.ReadWriteAttribute ? - "/Write" : " Only"); - break; - - case ACPI_IO_RANGE: - - AcpiOsPrintf (" Resource Type: Io Range\n"); - - switch (Address32Data->Attribute.Io.RangeAttribute) - { - case ACPI_NON_ISA_ONLY_RANGES: - AcpiOsPrintf (" Type Specific: Non-ISA Io Addresses\n"); - break; - - case ACPI_ISA_ONLY_RANGES: - AcpiOsPrintf (" Type Specific: ISA Io Addresses\n"); - break; - - case ACPI_ENTIRE_RANGE: - AcpiOsPrintf (" Type Specific: ISA and non-ISA Io Addresses\n"); - break; - - default: - AcpiOsPrintf (" Type Specific: Invalid Range attribute"); - break; - } - - AcpiOsPrintf (" Type Specific: %s Translation\n", - ACPI_SPARSE_TRANSLATION == - Address32Data->Attribute.Io.TranslationAttribute ? - "Sparse" : "Dense"); - break; - - case ACPI_BUS_NUMBER_RANGE: - - AcpiOsPrintf (" Resource Type: Bus Number Range\n"); - break; - - default: - - AcpiOsPrintf (" Resource Type: 0x%2.2X\n", - Address32Data->ResourceType); - break; - } - - AcpiOsPrintf (" Resource %s\n", - ACPI_CONSUMER == Address32Data->ProducerConsumer ? - "Consumer" : "Producer"); - - AcpiOsPrintf (" %s decode\n", - ACPI_SUB_DECODE == Address32Data->Decode ? - "Subtractive" : "Positive"); - - AcpiOsPrintf (" Min address is %s fixed\n", - ACPI_ADDRESS_FIXED == Address32Data->MinAddressFixed ? - "" : "not "); - - AcpiOsPrintf (" Max address is %s fixed\n", - ACPI_ADDRESS_FIXED == Address32Data->MaxAddressFixed ? - "" : "not "); - - AcpiOsPrintf (" Granularity: %08X\n", - Address32Data->Granularity); - - AcpiOsPrintf (" Address range min: %08X\n", - Address32Data->MinAddressRange); - - AcpiOsPrintf (" Address range max: %08X\n", - Address32Data->MaxAddressRange); - - AcpiOsPrintf (" Address translation offset: %08X\n", - Address32Data->AddressTranslationOffset); - - AcpiOsPrintf (" Address Length: %08X\n", - Address32Data->AddressLength); - - if(0xFF != Address32Data->ResourceSource.Index) - { - AcpiOsPrintf (" Resource Source Index: %X\n", - Address32Data->ResourceSource.Index); - - AcpiOsPrintf (" Resource Source: %s\n", - Address32Data->ResourceSource.StringPtr); - } - - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiRsDumpAddress64 - * - * PARAMETERS: Data - pointer to the resource structure to dump. - * - * RETURN: None - * - * DESCRIPTION: Prints out the various members of the Data structure type. + * DESCRIPTION: Dump the fields that are common to all Address resource + * descriptors * ******************************************************************************/ static void -AcpiRsDumpAddress64 ( - ACPI_RESOURCE_DATA *Data) +AcpiRsDumpAddressCommon ( + ACPI_RESOURCE_DATA *Resource) { - ACPI_RESOURCE_ADDRESS64 *Address64Data = (ACPI_RESOURCE_ADDRESS64 *) Data; - - ACPI_FUNCTION_ENTRY (); - AcpiOsPrintf ("64-Bit Address Space Resource\n"); + /* Decode the type-specific flags */ - switch (Address64Data->ResourceType) + switch (Resource->Address.ResourceType) { case ACPI_MEMORY_RANGE: - AcpiOsPrintf (" Resource Type: Memory Range\n"); + AcpiRsOutString ("Resource Type", "Memory Range"); - switch (Address64Data->Attribute.Memory.CacheAttribute) + AcpiRsOutTitle ("Type-Specific Flags"); + + switch (Resource->Address.Attribute.Memory.CacheAttribute) { case ACPI_NON_CACHEABLE_MEMORY: - AcpiOsPrintf (" Type Specific: Noncacheable memory\n"); + AcpiOsPrintf ("Noncacheable memory\n"); break; case ACPI_CACHABLE_MEMORY: - AcpiOsPrintf (" Type Specific: Cacheable memory\n"); + AcpiOsPrintf ("Cacheable memory\n"); break; case ACPI_WRITE_COMBINING_MEMORY: - AcpiOsPrintf (" Type Specific: Write-combining memory\n"); + AcpiOsPrintf ("Write-combining memory\n"); break; case ACPI_PREFETCHABLE_MEMORY: - AcpiOsPrintf (" Type Specific: Prefetchable memory\n"); + AcpiOsPrintf ("Prefetchable memory\n"); break; default: - AcpiOsPrintf (" Type Specific: Invalid cache attribute\n"); + AcpiOsPrintf ("Invalid cache attribute\n"); break; } - AcpiOsPrintf (" Type Specific: Read%s\n", - ACPI_READ_WRITE_MEMORY == - Address64Data->Attribute.Memory.ReadWriteAttribute ? - "/Write" : " Only"); + AcpiRsDumpMemoryAttribute ( + Resource->Address.Attribute.Memory.ReadWriteAttribute); break; case ACPI_IO_RANGE: - AcpiOsPrintf (" Resource Type: Io Range\n"); + AcpiRsOutString ("Resource Type", "I/O Range"); - switch (Address64Data->Attribute.Io.RangeAttribute) + AcpiRsOutTitle ("Type-Specific Flags"); + + switch (Resource->Address.Attribute.Io.RangeAttribute) { case ACPI_NON_ISA_ONLY_RANGES: - AcpiOsPrintf (" Type Specific: Non-ISA Io Addresses\n"); + AcpiOsPrintf ("Non-ISA I/O Addresses\n"); break; case ACPI_ISA_ONLY_RANGES: - AcpiOsPrintf (" Type Specific: ISA Io Addresses\n"); + AcpiOsPrintf ("ISA I/O Addresses\n"); break; case ACPI_ENTIRE_RANGE: - AcpiOsPrintf (" Type Specific: ISA and non-ISA Io Addresses\n"); + AcpiOsPrintf ("ISA and non-ISA I/O Addresses\n"); break; default: - AcpiOsPrintf (" Type Specific: Invalid Range attribute"); + AcpiOsPrintf ("Invalid range attribute\n"); break; } - AcpiOsPrintf (" Type Specific: %s Translation\n", + AcpiRsOutString ("Translation Attribute", ACPI_SPARSE_TRANSLATION == - Address64Data->Attribute.Io.TranslationAttribute ? - "Sparse" : "Dense"); + Resource->Address.Attribute.Io.TranslationAttribute ? + "Sparse Translation" : "Dense Translation"); break; case ACPI_BUS_NUMBER_RANGE: - AcpiOsPrintf (" Resource Type: Bus Number Range\n"); + AcpiRsOutString ("Resource Type", "Bus Number Range"); break; default: - AcpiOsPrintf (" Resource Type: 0x%2.2X\n", - Address64Data->ResourceType); + AcpiRsOutInteger8 ("Resource Type", + (UINT8) Resource->Address.ResourceType); break; } - AcpiOsPrintf (" Resource %s\n", - ACPI_CONSUMER == Address64Data->ProducerConsumer ? + /* Decode the general flags */ + + AcpiRsOutString ("Resource", + ACPI_CONSUMER == Resource->Address.ProducerConsumer ? "Consumer" : "Producer"); - AcpiOsPrintf (" %s decode\n", - ACPI_SUB_DECODE == Address64Data->Decode ? + AcpiRsOutString ("Decode", + ACPI_SUB_DECODE == Resource->Address.Decode ? "Subtractive" : "Positive"); - AcpiOsPrintf (" Min address is %s fixed\n", - ACPI_ADDRESS_FIXED == Address64Data->MinAddressFixed ? - "" : "not "); - - AcpiOsPrintf (" Max address is %s fixed\n", - ACPI_ADDRESS_FIXED == Address64Data->MaxAddressFixed ? - "" : "not "); - - AcpiOsPrintf (" Granularity: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (Address64Data->Granularity)); - - AcpiOsPrintf (" Address range min: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (Address64Data->MinAddressRange)); - - AcpiOsPrintf (" Address range max: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (Address64Data->MaxAddressRange)); - - AcpiOsPrintf (" Address translation offset: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (Address64Data->AddressTranslationOffset)); - - AcpiOsPrintf (" Address Length: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (Address64Data->AddressLength)); - - AcpiOsPrintf (" Type Specific Attributes: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (Address64Data->TypeSpecificAttributes)); - - if (0xFF != Address64Data->ResourceSource.Index) - { - AcpiOsPrintf (" Resource Source Index: %X\n", - Address64Data->ResourceSource.Index); - - AcpiOsPrintf (" Resource Source: %s\n", - Address64Data->ResourceSource.StringPtr); - } - - return; -} - + AcpiRsOutString ("Min Address", + ACPI_ADDRESS_FIXED == Resource->Address.MinAddressFixed ? + "Fixed" : "Not Fixed"); -/******************************************************************************* - * - * FUNCTION: AcpiRsDumpExtendedIrq - * - * PARAMETERS: Data - pointer to the resource structure to dump. - * - * RETURN: None - * - * DESCRIPTION: Prints out the various members of the Data structure type. - * - ******************************************************************************/ - -static void -AcpiRsDumpExtendedIrq ( - ACPI_RESOURCE_DATA *Data) -{ - ACPI_RESOURCE_EXT_IRQ *ExtIrqData = (ACPI_RESOURCE_EXT_IRQ *) Data; - UINT8 Index = 0; - - - ACPI_FUNCTION_ENTRY (); - - - AcpiOsPrintf ("Extended IRQ Resource\n"); - - AcpiOsPrintf (" Resource %s\n", - ACPI_CONSUMER == ExtIrqData->ProducerConsumer ? - "Consumer" : "Producer"); - - AcpiOsPrintf (" %s\n", - ACPI_LEVEL_SENSITIVE == ExtIrqData->EdgeLevel ? - "Level" : "Edge"); - - AcpiOsPrintf (" Active %s\n", - ACPI_ACTIVE_LOW == ExtIrqData->ActiveHighLow ? - "low" : "high"); - - AcpiOsPrintf (" %s\n", - ACPI_SHARED == ExtIrqData->SharedExclusive ? - "Shared" : "Exclusive"); - - AcpiOsPrintf (" Interrupts : %X ( ", ExtIrqData->NumberOfInterrupts); - - for (Index = 0; Index < ExtIrqData->NumberOfInterrupts; Index++) - { - AcpiOsPrintf ("%X ", ExtIrqData->Interrupts[Index]); - } - - AcpiOsPrintf (")\n"); - - if(0xFF != ExtIrqData->ResourceSource.Index) - { - AcpiOsPrintf (" Resource Source Index: %X", - ExtIrqData->ResourceSource.Index); - - AcpiOsPrintf (" Resource Source: %s", - ExtIrqData->ResourceSource.StringPtr); - } - - return; + AcpiRsOutString ("Max Address", + ACPI_ADDRESS_FIXED == Resource->Address.MaxAddressFixed ? + "Fixed" : "Not Fixed"); } @@ -1111,7 +471,7 @@ * * FUNCTION: AcpiRsDumpResourceList * - * PARAMETERS: Resource - pointer to the resource structure to dump. + * PARAMETERS: ResourceList - Pointer to a resource descriptor list * * RETURN: None * @@ -1121,108 +481,747 @@ void AcpiRsDumpResourceList ( - ACPI_RESOURCE *Resource) + ACPI_RESOURCE *ResourceList) { - UINT8 Count = 0; - BOOLEAN Done = FALSE; + UINT32 Count = 0; ACPI_FUNCTION_ENTRY (); - if (AcpiDbgLevel & ACPI_LV_RESOURCES && _COMPONENT & AcpiDbgLayer) + if (!(AcpiDbgLevel & ACPI_LV_RESOURCES) || !( _COMPONENT & AcpiDbgLayer)) { - while (!Done) - { - AcpiOsPrintf ("Resource structure %X.\n", Count++); + return; + } + + /* Dump all resource descriptors in the list */ + + while (ResourceList) + { + AcpiOsPrintf ("\n[%02X] ", Count); + + /* Validate Type before dispatch */ - switch (Resource->Id) - { - case ACPI_RSTYPE_IRQ: - AcpiRsDumpIrq (&Resource->Data); - break; + if (ResourceList->Type > ACPI_RESOURCE_TYPE_MAX) + { + AcpiOsPrintf ( + "Invalid descriptor type (%X) in resource list\n", + ResourceList->Type); + return; + } + + /* Dump the resource descriptor */ + + AcpiGbl_DumpResourceDispatch[ResourceList->Type] (&ResourceList->Data); + + /* Exit on end tag */ - case ACPI_RSTYPE_DMA: - AcpiRsDumpDma (&Resource->Data); - break; + if (ResourceList->Type == ACPI_RESOURCE_TYPE_END_TAG) + { + return; + } + + /* Get the next resource structure */ + + ResourceList = ACPI_PTR_ADD (ACPI_RESOURCE, ResourceList, + ResourceList->Length); + Count++; + } +} + - case ACPI_RSTYPE_START_DPF: - AcpiRsDumpStartDependFns (&Resource->Data); - break; +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpIrq + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump the field names and values of the resource descriptor + * + ******************************************************************************/ - case ACPI_RSTYPE_END_DPF: - AcpiOsPrintf ("EndDependentFunctions Resource\n"); - /* AcpiRsDumpEndDependentFunctions (Resource->Data);*/ - break; +void +AcpiRsDumpIrq ( + ACPI_RESOURCE_DATA *Resource) +{ + ACPI_FUNCTION_ENTRY (); + + + AcpiOsPrintf ("IRQ Resource\n"); + + AcpiRsOutString ("Triggering", + ACPI_LEVEL_SENSITIVE == Resource->Irq.Triggering ? "Level" : "Edge"); + + AcpiRsOutString ("Active", + ACPI_ACTIVE_LOW == Resource->Irq.Polarity ? "Low" : "High"); - case ACPI_RSTYPE_IO: - AcpiRsDumpIo (&Resource->Data); - break; + AcpiRsOutString ("Sharing", + ACPI_SHARED == Resource->Irq.Sharable ? "Shared" : "Exclusive"); + + AcpiRsOutInteger8 ("Interrupt Count", + (UINT8) Resource->Irq.InterruptCount); + + AcpiRsOutTitle ("Interrupt List"); + AcpiRsDumpShortByteList (Resource->Irq.InterruptCount, + Resource->Irq.Interrupts); +} + - case ACPI_RSTYPE_FIXED_IO: - AcpiRsDumpFixedIo (&Resource->Data); - break; +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpDma + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump the field names and values of the resource descriptor + * + ******************************************************************************/ - case ACPI_RSTYPE_VENDOR: - AcpiRsDumpVendorSpecific (&Resource->Data); - break; +void +AcpiRsDumpDma ( + ACPI_RESOURCE_DATA *Resource) +{ + ACPI_FUNCTION_ENTRY (); - case ACPI_RSTYPE_END_TAG: - /*RsDumpEndTag (Resource->Data);*/ - AcpiOsPrintf ("EndTag Resource\n"); - Done = TRUE; - break; + + AcpiOsPrintf ("DMA Resource\n"); + + AcpiRsOutTitle ("DMA Type"); + switch (Resource->Dma.Type) + { + case ACPI_COMPATIBILITY: + AcpiOsPrintf ("Compatibility mode\n"); + break; + + case ACPI_TYPE_A: + AcpiOsPrintf ("Type A\n"); + break; + + case ACPI_TYPE_B: + AcpiOsPrintf ("Type B\n"); + break; + + case ACPI_TYPE_F: + AcpiOsPrintf ("Type F\n"); + break; - case ACPI_RSTYPE_MEM24: - AcpiRsDumpMemory24 (&Resource->Data); - break; + default: + AcpiOsPrintf ("**** Invalid DMA type\n"); + break; + } + + AcpiRsOutString ("Bus Master", + ACPI_BUS_MASTER == Resource->Dma.BusMaster ? "Yes" : "No"); - case ACPI_RSTYPE_MEM32: - AcpiRsDumpMemory32 (&Resource->Data); - break; + AcpiRsOutTitle ("Transfer Type"); + switch (Resource->Dma.Transfer) + { + case ACPI_TRANSFER_8: + AcpiOsPrintf ("8-bit transfers only\n"); + break; - case ACPI_RSTYPE_FIXED_MEM32: - AcpiRsDumpFixedMemory32 (&Resource->Data); - break; + case ACPI_TRANSFER_8_16: + AcpiOsPrintf ("8-bit and 16-bit transfers\n"); + break; + + case ACPI_TRANSFER_16: + AcpiOsPrintf ("16-bit transfers only\n"); + break; - case ACPI_RSTYPE_ADDRESS16: - AcpiRsDumpAddress16 (&Resource->Data); - break; + default: + AcpiOsPrintf ("**** Invalid transfer preference\n"); + break; + } + + AcpiRsOutInteger8 ("DMA Channel Count", + (UINT8) Resource->Dma.ChannelCount); + + AcpiRsOutTitle ("Channel List"); + AcpiRsDumpShortByteList (Resource->Dma.ChannelCount, + Resource->Dma.Channels); +} - case ACPI_RSTYPE_ADDRESS32: - AcpiRsDumpAddress32 (&Resource->Data); - break; - case ACPI_RSTYPE_ADDRESS64: - AcpiRsDumpAddress64 (&Resource->Data); - break; +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpStartDpf + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump the field names and values of the resource descriptor + * + ******************************************************************************/ - case ACPI_RSTYPE_EXT_IRQ: - AcpiRsDumpExtendedIrq (&Resource->Data); - break; +void +AcpiRsDumpStartDpf ( + ACPI_RESOURCE_DATA *Resource) +{ + ACPI_FUNCTION_ENTRY (); + + + AcpiOsPrintf ("Start Dependent Functions Resource\n"); - default: - AcpiOsPrintf ("Invalid resource type\n"); - break; + AcpiRsOutTitle ("Compatibility Priority"); + switch (Resource->StartDpf.CompatibilityPriority) + { + case ACPI_GOOD_CONFIGURATION: + AcpiOsPrintf ("Good configuration\n"); + break; - } + case ACPI_ACCEPTABLE_CONFIGURATION: + AcpiOsPrintf ("Acceptable configuration\n"); + break; - Resource = ACPI_PTR_ADD (ACPI_RESOURCE, Resource, Resource->Length); - } + case ACPI_SUB_OPTIMAL_CONFIGURATION: + AcpiOsPrintf ("Sub-optimal configuration\n"); + break; + + default: + AcpiOsPrintf ("**** Invalid compatibility priority\n"); + break; } - return; + AcpiRsOutTitle ("Performance/Robustness"); + switch (Resource->StartDpf.PerformanceRobustness) + { + case ACPI_GOOD_CONFIGURATION: + AcpiOsPrintf ("Good configuration\n"); + break; + + case ACPI_ACCEPTABLE_CONFIGURATION: + AcpiOsPrintf ("Acceptable configuration\n"); + break; + + case ACPI_SUB_OPTIMAL_CONFIGURATION: + AcpiOsPrintf ("Sub-optimal configuration\n"); + break; + + default: + AcpiOsPrintf ("**** Invalid performance robustness preference\n"); + break; + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpIo + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump the field names and values of the resource descriptor + * + ******************************************************************************/ + +void +AcpiRsDumpIo ( + ACPI_RESOURCE_DATA *Resource) +{ + ACPI_FUNCTION_ENTRY (); + + + AcpiOsPrintf ("I/O Resource\n"); + + AcpiRsOutString ("Decode", + ACPI_DECODE_16 == Resource->Io.IoDecode ? "16-bit" : "10-bit"); + + AcpiRsOutInteger32 ("Address Minimum", + Resource->Io.Minimum); + + AcpiRsOutInteger32 ("Address Maximum", + Resource->Io.Maximum); + + AcpiRsOutInteger32 ("Alignment", + Resource->Io.Alignment); + + AcpiRsOutInteger32 ("Address Length", + Resource->Io.AddressLength); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpFixedIo + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump the field names and values of the resource descriptor + * + ******************************************************************************/ + +void +AcpiRsDumpFixedIo ( + ACPI_RESOURCE_DATA *Resource) +{ + ACPI_FUNCTION_ENTRY (); + + + AcpiOsPrintf ("Fixed I/O Resource\n"); + + AcpiRsOutInteger32 ("Address", + Resource->FixedIo.Address); + + AcpiRsOutInteger32 ("Address Length", + Resource->FixedIo.AddressLength); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpVendor + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump the field names and values of the resource descriptor + * + ******************************************************************************/ + +void +AcpiRsDumpVendor ( + ACPI_RESOURCE_DATA *Resource) +{ + ACPI_FUNCTION_ENTRY (); + + + AcpiOsPrintf ("Vendor Specific Resource\n"); + + AcpiRsOutInteger16 ("Length", + (UINT16) Resource->Vendor.ByteLength); + + AcpiRsDumpByteList (Resource->Vendor.ByteLength, + Resource->Vendor.ByteData); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpMemory24 + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump the field names and values of the resource descriptor + * + ******************************************************************************/ + +void +AcpiRsDumpMemory24 ( + ACPI_RESOURCE_DATA *Resource) +{ + ACPI_FUNCTION_ENTRY (); + + + AcpiOsPrintf ("24-Bit Memory Range Resource\n"); + + AcpiRsDumpMemoryAttribute ( + Resource->Memory24.ReadWriteAttribute); + + AcpiRsOutInteger16 ("Address Minimum", + (UINT16) Resource->Memory24.Minimum); + + AcpiRsOutInteger16 ("Address Maximum", + (UINT16) Resource->Memory24.Maximum); + + AcpiRsOutInteger16 ("Alignment", + (UINT16) Resource->Memory24.Alignment); + + AcpiRsOutInteger16 ("Address Length", + (UINT16) Resource->Memory24.AddressLength); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpMemory32 + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump the field names and values of the resource descriptor + * + ******************************************************************************/ + +void +AcpiRsDumpMemory32 ( + ACPI_RESOURCE_DATA *Resource) +{ + ACPI_FUNCTION_ENTRY (); + + + AcpiOsPrintf ("32-Bit Memory Range Resource\n"); + + AcpiRsDumpMemoryAttribute ( + Resource->Memory32.ReadWriteAttribute); + + AcpiRsOutInteger32 ("Address Minimum", + Resource->Memory32.Minimum); + + AcpiRsOutInteger32 ("Address Maximum", + Resource->Memory32.Maximum); + + AcpiRsOutInteger32 ("Alignment", + Resource->Memory32.Alignment); + + AcpiRsOutInteger32 ("Address Length", + Resource->Memory32.AddressLength); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpFixedMemory32 + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: + * + * DESCRIPTION: Dump the field names and values of the resource descriptor + * + ******************************************************************************/ + +void +AcpiRsDumpFixedMemory32 ( + ACPI_RESOURCE_DATA *Resource) +{ + ACPI_FUNCTION_ENTRY (); + + + AcpiOsPrintf ("32-Bit Fixed Location Memory Range Resource\n"); + + AcpiRsDumpMemoryAttribute ( + Resource->FixedMemory32.ReadWriteAttribute); + + AcpiRsOutInteger32 ("Address", + Resource->FixedMemory32.Address); + + AcpiRsOutInteger32 ("Address Length", + Resource->FixedMemory32.AddressLength); } + +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpAddress16 + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump the field names and values of the resource descriptor + * + ******************************************************************************/ + +void +AcpiRsDumpAddress16 ( + ACPI_RESOURCE_DATA *Resource) +{ + ACPI_FUNCTION_ENTRY (); + + + AcpiOsPrintf ("16-Bit WORD Address Space Resource\n"); + + AcpiRsDumpAddressCommon (Resource); + + AcpiRsOutInteger16 ("Granularity", + (UINT16) Resource->Address16.Granularity); + + AcpiRsOutInteger16 ("Address Minimum", + (UINT16) Resource->Address16.Minimum); + + AcpiRsOutInteger16 ("Address Maximum", + (UINT16) Resource->Address16.Maximum); + + AcpiRsOutInteger16 ("Translation Offset", + (UINT16) Resource->Address16.TranslationOffset); + + AcpiRsOutInteger16 ("Address Length", + (UINT16) Resource->Address16.AddressLength); + + AcpiRsDumpResourceSource (&Resource->Address16.ResourceSource); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpAddress32 + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump the field names and values of the resource descriptor + * + ******************************************************************************/ + +void +AcpiRsDumpAddress32 ( + ACPI_RESOURCE_DATA *Resource) +{ + ACPI_FUNCTION_ENTRY (); + + + AcpiOsPrintf ("32-Bit DWORD Address Space Resource\n"); + + AcpiRsDumpAddressCommon (Resource); + + AcpiRsOutInteger32 ("Granularity", + Resource->Address32.Granularity); + + AcpiRsOutInteger32 ("Address Minimum", + Resource->Address32.Minimum); + + AcpiRsOutInteger32 ("Address Maximum", + Resource->Address32.Maximum); + + AcpiRsOutInteger32 ("Translation Offset", + Resource->Address32.TranslationOffset); + + AcpiRsOutInteger32 ("Address Length", + Resource->Address32.AddressLength); + + AcpiRsDumpResourceSource (&Resource->Address32.ResourceSource); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpAddress64 + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump the field names and values of the resource descriptor + * + ******************************************************************************/ + +void +AcpiRsDumpAddress64 ( + ACPI_RESOURCE_DATA *Resource) +{ + ACPI_FUNCTION_ENTRY (); + + + AcpiOsPrintf ("64-Bit QWORD Address Space Resource\n"); + + AcpiRsDumpAddressCommon (Resource); + + AcpiRsOutInteger64 ("Granularity", + Resource->Address64.Granularity); + + AcpiRsOutInteger64 ("Address Minimum", + Resource->Address64.Minimum); + + AcpiRsOutInteger64 ("Address Maximum", + Resource->Address64.Maximum); + + AcpiRsOutInteger64 ("Translation Offset", + Resource->Address64.TranslationOffset); + + AcpiRsOutInteger64 ("Address Length", + Resource->Address64.AddressLength); + + AcpiRsDumpResourceSource (&Resource->Address64.ResourceSource); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpExtAddress64 + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump the field names and values of the resource descriptor + * + ******************************************************************************/ + +void +AcpiRsDumpExtAddress64 ( + ACPI_RESOURCE_DATA *Resource) +{ + ACPI_FUNCTION_ENTRY (); + + + AcpiOsPrintf ("64-Bit Extended Address Space Resource\n"); + + AcpiRsDumpAddressCommon (Resource); + + AcpiRsOutInteger64 ("Granularity", + Resource->ExtAddress64.Granularity); + + AcpiRsOutInteger64 ("Address Minimum", + Resource->ExtAddress64.Minimum); + + AcpiRsOutInteger64 ("Address Maximum", + Resource->ExtAddress64.Maximum); + + AcpiRsOutInteger64 ("Translation Offset", + Resource->ExtAddress64.TranslationOffset); + + AcpiRsOutInteger64 ("Address Length", + Resource->ExtAddress64.AddressLength); + + AcpiRsOutInteger64 ("Type-Specific Attribute", + Resource->ExtAddress64.TypeSpecificAttributes); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpExtIrq + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump the field names and values of the resource descriptor + * + ******************************************************************************/ + +void +AcpiRsDumpExtIrq ( + ACPI_RESOURCE_DATA *Resource) +{ + ACPI_FUNCTION_ENTRY (); + + + AcpiOsPrintf ("Extended IRQ Resource\n"); + + AcpiRsOutString ("Resource", + ACPI_CONSUMER == Resource->ExtendedIrq.ProducerConsumer ? + "Consumer" : "Producer"); + + AcpiRsOutString ("Triggering", + ACPI_LEVEL_SENSITIVE == Resource->ExtendedIrq.Triggering ? + "Level" : "Edge"); + + AcpiRsOutString ("Active", + ACPI_ACTIVE_LOW == Resource->ExtendedIrq.Polarity ? + "Low" : "High"); + + AcpiRsOutString ("Sharing", + ACPI_SHARED == Resource->ExtendedIrq.Sharable ? + "Shared" : "Exclusive"); + + AcpiRsDumpResourceSource (&Resource->ExtendedIrq.ResourceSource); + + AcpiRsOutInteger8 ("Interrupts", + (UINT8) Resource->ExtendedIrq.InterruptCount); + + AcpiRsDumpDwordList (Resource->ExtendedIrq.InterruptCount, + Resource->ExtendedIrq.Interrupts); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpGenericReg + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Dump the field names and values of the resource descriptor + * + ******************************************************************************/ + +void +AcpiRsDumpGenericReg ( + ACPI_RESOURCE_DATA *Resource) +{ + ACPI_FUNCTION_ENTRY (); + + + AcpiOsPrintf ("Generic Register Resource\n"); + + AcpiRsOutInteger8 ("Space ID", + (UINT8) Resource->GenericReg.SpaceId); + + AcpiRsOutInteger8 ("Bit Width", + (UINT8) Resource->GenericReg.BitWidth); + + AcpiRsOutInteger8 ("Bit Offset", + (UINT8) Resource->GenericReg.BitOffset); + + AcpiRsOutInteger8 ("Access Size", + (UINT8) Resource->GenericReg.AccessSize); + + AcpiRsOutInteger64 ("Address", + Resource->GenericReg.Address); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpEndDpf + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Print type, no data. + * + ******************************************************************************/ + +void +AcpiRsDumpEndDpf ( + ACPI_RESOURCE_DATA *Resource) +{ + ACPI_FUNCTION_ENTRY (); + + + AcpiOsPrintf ("EndDependentFunctions Resource\n"); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpEndTag + * + * PARAMETERS: Resource - Pointer to an internal resource descriptor + * + * RETURN: None + * + * DESCRIPTION: Print type, no data. + * + ******************************************************************************/ + +void +AcpiRsDumpEndTag ( + ACPI_RESOURCE_DATA *Resource) +{ + ACPI_FUNCTION_ENTRY (); + + + AcpiOsPrintf ("EndTag Resource\n"); +} + + /******************************************************************************* * * FUNCTION: AcpiRsDumpIrqList * - * PARAMETERS: RouteTable - pointer to the routing table to dump. + * PARAMETERS: RouteTable - Pointer to the routing table to dump. * * RETURN: None * - * DESCRIPTION: Dispatches the structures to the correct dump routine. + * DESCRIPTION: Print IRQ routing table * ******************************************************************************/ @@ -1232,40 +1231,36 @@ { UINT8 *Buffer = RouteTable; UINT8 Count = 0; - BOOLEAN Done = FALSE; ACPI_PCI_ROUTING_TABLE *PrtElement; ACPI_FUNCTION_ENTRY (); - if (AcpiDbgLevel & ACPI_LV_RESOURCES && _COMPONENT & AcpiDbgLayer) + if (!(AcpiDbgLevel & ACPI_LV_RESOURCES) || !( _COMPONENT & AcpiDbgLayer)) { - PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); - - while (!Done) - { - AcpiOsPrintf ("PCI IRQ Routing Table structure %X.\n", Count++); - - AcpiOsPrintf (" Address: %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (PrtElement->Address)); - - AcpiOsPrintf (" Pin: %X\n", PrtElement->Pin); - - AcpiOsPrintf (" Source: %s\n", PrtElement->Source); - - AcpiOsPrintf (" SourceIndex: %X\n", PrtElement->SourceIndex); - - Buffer += PrtElement->Length; - PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); - if (0 == PrtElement->Length) - { - Done = TRUE; - } - } + return; } - return; + PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); + + /* Dump all table elements, Exit on null length element */ + + while (PrtElement->Length) + { + AcpiOsPrintf ("\n[%02X] PCI IRQ Routing Table Package\n", Count); + + AcpiRsOutInteger64 ("Address", + PrtElement->Address); + + AcpiRsOutInteger32 ("Pin", PrtElement->Pin); + AcpiRsOutString ("Source", PrtElement->Source); + AcpiRsOutInteger32 ("Source Index", PrtElement->SourceIndex); + + Buffer += PrtElement->Length; + PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); + Count++; + } } #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/i86pc/io/acpica/resources/rsinfo.c Thu Nov 17 08:46:01 2005 -0800 @@ -0,0 +1,299 @@ +/******************************************************************************* + * + * Module Name: rsinfo - Dispatch and Info tables + * $Revision: 1.3 $ + * + ******************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __RSINFO_C__ + +#include "acpi.h" +#include "acresrc.h" + +#define _COMPONENT ACPI_RESOURCES + ACPI_MODULE_NAME ("rsinfo") + +/* + * Resource dispatch and information tables. Any new resource types (either + * Large or Small) must be reflected in each of these tables, so they are here + * in one place. + * + * The tables for Large descriptors are indexed by bits 6:0 of the AML + * descriptor type byte. The tables for Small descriptors are indexed by + * bits 6:3 of the descriptor byte. The tables for internal resource + * descriptors are indexed by the ACPI_RESOURCE_TYPE field. + */ + + +/* Dispatch table for resource-to-AML (Set Resource) conversion functions */ + +ACPI_SET_RESOURCE_HANDLER AcpiGbl_SetResourceDispatch [] = +{ + AcpiRsSetIrq, /* 0x00, ACPI_RESOURCE_TYPE_IRQ */ + AcpiRsSetDma, /* 0x01, ACPI_RESOURCE_TYPE_DMA */ + AcpiRsSetStartDpf, /* 0x02, ACPI_RESOURCE_TYPE_START_DEPENDENT */ + AcpiRsSetEndDpf, /* 0x03, ACPI_RESOURCE_TYPE_END_DEPENDENT */ + AcpiRsSetIo, /* 0x04, ACPI_RESOURCE_TYPE_IO */ + AcpiRsSetFixedIo, /* 0x05, ACPI_RESOURCE_TYPE_FIXED_IO */ + AcpiRsSetVendor, /* 0x06, ACPI_RESOURCE_TYPE_VENDOR */ + AcpiRsSetEndTag, /* 0x07, ACPI_RESOURCE_TYPE_END_TAG */ + AcpiRsSetMemory24, /* 0x08, ACPI_RESOURCE_TYPE_MEMORY24 */ + AcpiRsSetMemory32, /* 0x09, ACPI_RESOURCE_TYPE_MEMORY32 */ + AcpiRsSetFixedMemory32, /* 0x0A, ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ + AcpiRsSetAddress16, /* 0x0B, ACPI_RESOURCE_TYPE_ADDRESS16 */ + AcpiRsSetAddress32, /* 0x0C, ACPI_RESOURCE_TYPE_ADDRESS32 */ + AcpiRsSetAddress64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */ + AcpiRsSetExtAddress64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ + AcpiRsSetExtIrq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ + AcpiRsSetGenericReg /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ +}; + + +/* Dispatch tables for AML-to-resource (Get Resource) conversion functions */ + +ACPI_GET_RESOURCE_HANDLER AcpiGbl_SmGetResourceDispatch [] = +{ + NULL, /* 0x00, Reserved */ + NULL, /* 0x01, Reserved */ + NULL, /* 0x02, Reserved */ + NULL, /* 0x03, Reserved */ + AcpiRsGetIrq, /* 0x04, ACPI_RESOURCE_NAME_IRQ */ + AcpiRsGetDma, /* 0x05, ACPI_RESOURCE_NAME_DMA */ + AcpiRsGetStartDpf, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */ + AcpiRsGetEndDpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */ + AcpiRsGetIo, /* 0x08, ACPI_RESOURCE_NAME_IO */ + AcpiRsGetFixedIo, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */ + NULL, /* 0x0A, Reserved */ + NULL, /* 0x0B, Reserved */ + NULL, /* 0x0C, Reserved */ + NULL, /* 0x0D, Reserved */ + AcpiRsGetVendor, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */ + AcpiRsGetEndTag /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */ +}; + +ACPI_GET_RESOURCE_HANDLER AcpiGbl_LgGetResourceDispatch[] = +{ + NULL, /* 0x00, Reserved */ + AcpiRsGetMemory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */ + AcpiRsGetGenericReg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */ + NULL, /* 0x03, Reserved */ + AcpiRsGetVendor, /* 0x04, ACPI_RESOURCE_NAME_VENDOR_LARGE */ + AcpiRsGetMemory32, /* 0x05, ACPI_RESOURCE_NAME_MEMORY32 */ + AcpiRsGetFixedMemory32, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY32 */ + AcpiRsGetAddress32, /* 0x07, ACPI_RESOURCE_NAME_ADDRESS32 */ + AcpiRsGetAddress16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */ + AcpiRsGetExtIrq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */ + AcpiRsGetAddress64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */ + AcpiRsGetExtAddress64 /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ +}; + + +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) + +/* Dispatch table for resource dump functions */ + +ACPI_DUMP_RESOURCE_HANDLER AcpiGbl_DumpResourceDispatch [] = +{ + AcpiRsDumpIrq, /* ACPI_RESOURCE_TYPE_IRQ */ + AcpiRsDumpDma, /* ACPI_RESOURCE_TYPE_DMA */ + AcpiRsDumpStartDpf, /* ACPI_RESOURCE_TYPE_START_DEPENDENT */ + AcpiRsDumpEndDpf, /* ACPI_RESOURCE_TYPE_END_DEPENDENT */ + AcpiRsDumpIo, /* ACPI_RESOURCE_TYPE_IO */ + AcpiRsDumpFixedIo, /* ACPI_RESOURCE_TYPE_FIXED_IO */ + AcpiRsDumpVendor, /* ACPI_RESOURCE_TYPE_VENDOR */ + AcpiRsDumpEndTag, /* ACPI_RESOURCE_TYPE_END_TAG */ + AcpiRsDumpMemory24, /* ACPI_RESOURCE_TYPE_MEMORY24 */ + AcpiRsDumpMemory32, /* ACPI_RESOURCE_TYPE_MEMORY32 */ + AcpiRsDumpFixedMemory32, /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ + AcpiRsDumpAddress16, /* ACPI_RESOURCE_TYPE_ADDRESS16 */ + AcpiRsDumpAddress32, /* ACPI_RESOURCE_TYPE_ADDRESS32 */ + AcpiRsDumpAddress64, /* ACPI_RESOURCE_TYPE_ADDRESS64 */ + AcpiRsDumpExtAddress64, /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ + AcpiRsDumpExtIrq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ + AcpiRsDumpGenericReg /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ +}; +#endif + + +/* + * Base sizes for external AML resource descriptors, indexed by internal type. + * Includes size of the descriptor header (1 byte for small descriptors, + * 3 bytes for large descriptors) + */ +UINT8 AcpiGbl_AmlResourceSizes [] = +{ + sizeof (AML_RESOURCE_IRQ), /* ACPI_RESOURCE_TYPE_IRQ (optional Byte 3 always created) */ + sizeof (AML_RESOURCE_DMA), /* ACPI_RESOURCE_TYPE_DMA */ + sizeof (AML_RESOURCE_START_DEPENDENT), /* ACPI_RESOURCE_TYPE_START_DEPENDENT (optional Byte 1 always created) */ + sizeof (AML_RESOURCE_END_DEPENDENT), /* ACPI_RESOURCE_TYPE_END_DEPENDENT */ + sizeof (AML_RESOURCE_IO), /* ACPI_RESOURCE_TYPE_IO */ + sizeof (AML_RESOURCE_FIXED_IO), /* ACPI_RESOURCE_TYPE_FIXED_IO */ + sizeof (AML_RESOURCE_VENDOR_SMALL), /* ACPI_RESOURCE_TYPE_VENDOR */ + sizeof (AML_RESOURCE_END_TAG), /* ACPI_RESOURCE_TYPE_END_TAG */ + sizeof (AML_RESOURCE_MEMORY24), /* ACPI_RESOURCE_TYPE_MEMORY24 */ + sizeof (AML_RESOURCE_MEMORY32), /* ACPI_RESOURCE_TYPE_MEMORY32 */ + sizeof (AML_RESOURCE_FIXED_MEMORY32), /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ + sizeof (AML_RESOURCE_ADDRESS16), /* ACPI_RESOURCE_TYPE_ADDRESS16 */ + sizeof (AML_RESOURCE_ADDRESS32), /* ACPI_RESOURCE_TYPE_ADDRESS32 */ + sizeof (AML_RESOURCE_ADDRESS64), /* ACPI_RESOURCE_TYPE_ADDRESS64 */ + sizeof (AML_RESOURCE_EXTENDED_ADDRESS64),/*ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ + sizeof (AML_RESOURCE_EXTENDED_IRQ), /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ + sizeof (AML_RESOURCE_GENERIC_REGISTER) /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ +}; + + +/* Macros used in the tables below */ + +#define ACPI_RLARGE(r) sizeof (r) - sizeof (AML_RESOURCE_LARGE_HEADER) +#define ACPI_RSMALL(r) sizeof (r) - sizeof (AML_RESOURCE_SMALL_HEADER) + +/* + * Base sizes of resource descriptors, both the AML stream resource length + * (minus size of header and length fields),and the size of the internal + * struct representation. + */ +ACPI_RESOURCE_INFO AcpiGbl_SmResourceInfo [] = +{ + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {2, ACPI_RSMALL (AML_RESOURCE_IRQ), ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IRQ)}, + {0, ACPI_RSMALL (AML_RESOURCE_DMA), ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_DMA)}, + {2, ACPI_RSMALL (AML_RESOURCE_START_DEPENDENT), ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_START_DEPENDENT)}, + {0, ACPI_RSMALL (AML_RESOURCE_END_DEPENDENT), ACPI_RESOURCE_LENGTH}, + {0, ACPI_RSMALL (AML_RESOURCE_IO), ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IO)}, + {0, ACPI_RSMALL (AML_RESOURCE_FIXED_IO), ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO)}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {0, 0, 0}, + {1, ACPI_RSMALL (AML_RESOURCE_VENDOR_SMALL), ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR)}, + {0, ACPI_RSMALL (AML_RESOURCE_END_TAG), ACPI_RESOURCE_LENGTH} +}; + +ACPI_RESOURCE_INFO AcpiGbl_LgResourceInfo [] = +{ + {0, 0, 0}, + {0, ACPI_RLARGE (AML_RESOURCE_MEMORY24), ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEMORY24)}, + {0, ACPI_RLARGE (AML_RESOURCE_GENERIC_REGISTER), ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_GENERIC_REGISTER)}, + {0, 0, 0}, + {1, ACPI_RLARGE (AML_RESOURCE_VENDOR_LARGE), ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR)}, + {0, ACPI_RLARGE (AML_RESOURCE_MEMORY32), ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEMORY32)}, + {0, ACPI_RLARGE (AML_RESOURCE_FIXED_MEMORY32), ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEMORY32)}, + {1, ACPI_RLARGE (AML_RESOURCE_ADDRESS32), ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32)}, + {1, ACPI_RLARGE (AML_RESOURCE_ADDRESS16), ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS16)}, + {1, ACPI_RLARGE (AML_RESOURCE_EXTENDED_IRQ), ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_EXTENDED_IRQ)}, + {1, ACPI_RLARGE (AML_RESOURCE_ADDRESS64), ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64)}, + {0, ACPI_RLARGE (AML_RESOURCE_EXTENDED_ADDRESS64), ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_EXTENDED_ADDRESS64)} +}; +
--- a/usr/src/uts/i86pc/io/acpica/resources/rsio.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/resources/rsio.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsio - IO and DMA resource descriptors - * $Revision: 28 $ + * $Revision: 1.32 $ * ******************************************************************************/ @@ -125,467 +125,299 @@ /******************************************************************************* * - * FUNCTION: AcpiRsIoResource + * FUNCTION: AcpiRsGetIo * - * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream - * BytesConsumed - Pointer to where the number of bytes - * consumed the ByteStreamBuffer is - * returned - * OutputBuffer - Pointer to the return data buffer - * StructureSize - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * AmlResourceLength - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ ACPI_STATUS -AcpiRsIoResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize) +AcpiRsGetIo ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource) { - UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; - UINT16 Temp16 = 0; - UINT8 Temp8 = 0; - ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE ( - ACPI_RESOURCE_IO); - - - ACPI_FUNCTION_TRACE ("RsIoResource"); + ACPI_FUNCTION_TRACE ("RsGetIo"); - /* The number of bytes consumed are Constant */ - - *BytesConsumed = 8; - - OutputStruct->Id = ACPI_RSTYPE_IO; - - /* Check Decode */ - - Buffer += 1; - Temp8 = *Buffer; + /* Get the Decode flag */ - OutputStruct->Data.Io.IoDecode = Temp8 & 0x01; - - /* Check MinBase Address */ - - Buffer += 1; - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - - OutputStruct->Data.Io.MinBaseAddress = Temp16; - - /* Check MaxBase Address */ + Resource->Data.Io.IoDecode = Aml->Io.Information & 0x01; - Buffer += 2; - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - - OutputStruct->Data.Io.MaxBaseAddress = Temp16; - - /* Check Base alignment */ - - Buffer += 2; - Temp8 = *Buffer; - - OutputStruct->Data.Io.Alignment = Temp8; + /* + * Get the following contiguous fields from the AML descriptor: + * Minimum Base Address + * Maximum Base Address + * Address Alignment + * Length + */ + ACPI_MOVE_16_TO_32 (&Resource->Data.Io.Minimum, + &Aml->Io.Minimum); + ACPI_MOVE_16_TO_32 (&Resource->Data.Io.Maximum, + &Aml->Io.Maximum); + Resource->Data.Io.Alignment = Aml->Io.Alignment; + Resource->Data.Io.AddressLength = Aml->Io.AddressLength; - /* Check RangeLength */ - - Buffer += 1; - Temp8 = *Buffer; - - OutputStruct->Data.Io.RangeLength = Temp8; + /* Complete the resource header */ - /* Set the Length parameter */ - - OutputStruct->Length = (UINT32) StructSize; - - /* Return the final size of the structure */ - - *StructureSize = StructSize; + Resource->Type = ACPI_RESOURCE_TYPE_IO; + Resource->Length = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IO); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsFixedIoResource + * FUNCTION: AcpiRsSetIo * - * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream - * BytesConsumed - Pointer to where the number of bytes - * consumed the ByteStreamBuffer is - * returned - * OutputBuffer - Pointer to the return data buffer - * StructureSize - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ ACPI_STATUS -AcpiRsFixedIoResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize) +AcpiRsSetIo ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml) { - UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; - UINT16 Temp16 = 0; - UINT8 Temp8 = 0; - ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE ( - ACPI_RESOURCE_FIXED_IO); + ACPI_FUNCTION_TRACE ("RsSetIo"); - ACPI_FUNCTION_TRACE ("RsFixedIoResource"); + /* I/O Information Byte */ + + Aml->Io.Information = (UINT8) (Resource->Data.Io.IoDecode & 0x01); + + /* + * Set the following contiguous fields in the AML descriptor: + * Minimum Base Address + * Maximum Base Address + * Address Alignment + * Length + */ + ACPI_MOVE_32_TO_16 (&Aml->Io.Minimum, &Resource->Data.Io.Minimum); + ACPI_MOVE_32_TO_16 (&Aml->Io.Maximum, &Resource->Data.Io.Maximum); + Aml->Io.Alignment = (UINT8) Resource->Data.Io.Alignment; + Aml->Io.AddressLength = (UINT8) Resource->Data.Io.AddressLength; + + /* Complete the AML descriptor header */ + + AcpiRsSetResourceHeader (ACPI_RESOURCE_NAME_IO, sizeof (AML_RESOURCE_IO), Aml); + return_ACPI_STATUS (AE_OK); +} - /* The number of bytes consumed are Constant */ - - *BytesConsumed = 4; - - OutputStruct->Id = ACPI_RSTYPE_FIXED_IO; - - /* Check Range Base Address */ - - Buffer += 1; - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - - OutputStruct->Data.FixedIo.BaseAddress = Temp16; +/******************************************************************************* + * + * FUNCTION: AcpiRsGetFixedIo + * + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * AmlResourceLength - Length of the resource from the AML header + * Resource - Where the internal resource is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. + * + ******************************************************************************/ - /* Check RangeLength */ +ACPI_STATUS +AcpiRsGetFixedIo ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource) +{ + ACPI_FUNCTION_TRACE ("RsGetFixedIo"); - Buffer += 2; - Temp8 = *Buffer; - - OutputStruct->Data.FixedIo.RangeLength = Temp8; - /* Set the Length parameter */ - - OutputStruct->Length = (UINT32) StructSize; + /* + * Get the following contiguous fields from the AML descriptor: + * Base Address + * Length + */ + ACPI_MOVE_16_TO_32 (&Resource->Data.FixedIo.Address, + &Aml->FixedIo.Address); + Resource->Data.FixedIo.AddressLength = Aml->FixedIo.AddressLength; - /* Return the final size of the structure */ + /* Complete the resource header */ - *StructureSize = StructSize; + Resource->Type = ACPI_RESOURCE_TYPE_FIXED_IO; + Resource->Length = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsIoStream + * FUNCTION: AcpiRsSetFixedIo * - * PARAMETERS: LinkedList - Pointer to the resource linked list - * OutputBuffer - Pointer to the user's return buffer - * BytesConsumed - Pointer to where the number of bytes - * used in the OutputBuffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ ACPI_STATUS -AcpiRsIoStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed) +AcpiRsSetFixedIo ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml) { - UINT8 *Buffer = *OutputBuffer; - UINT16 Temp16 = 0; - UINT8 Temp8 = 0; - - - ACPI_FUNCTION_TRACE ("RsIoStream"); + ACPI_FUNCTION_TRACE ("RsSetFixedIo"); - /* The descriptor field is static */ - - *Buffer = 0x47; - Buffer += 1; - - /* Io Information Byte */ - - Temp8 = (UINT8) (LinkedList->Data.Io.IoDecode & 0x01); - - *Buffer = Temp8; - Buffer += 1; - - /* Set the Range minimum base address */ - - Temp16 = (UINT16) LinkedList->Data.Io.MinBaseAddress; - - ACPI_MOVE_16_TO_16 (Buffer, &Temp16); - Buffer += 2; - - /* Set the Range maximum base address */ - - Temp16 = (UINT16) LinkedList->Data.Io.MaxBaseAddress; - - ACPI_MOVE_16_TO_16 (Buffer, &Temp16); - Buffer += 2; - - /* Set the base alignment */ - - Temp8 = (UINT8) LinkedList->Data.Io.Alignment; - - *Buffer = Temp8; - Buffer += 1; - - /* Set the range length */ - - Temp8 = (UINT8) LinkedList->Data.Io.RangeLength; - - *Buffer = Temp8; - Buffer += 1; - - /* Return the number of bytes consumed in this operation */ - - *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer); - return_ACPI_STATUS (AE_OK); -} - + /* + * Set the following contiguous fields in the AML descriptor: + * Base Address + * Length + */ + ACPI_MOVE_32_TO_16 (&Aml->FixedIo.Address, + &Resource->Data.FixedIo.Address); + Aml->FixedIo.AddressLength = (UINT8) Resource->Data.FixedIo.AddressLength; -/******************************************************************************* - * - * FUNCTION: AcpiRsFixedIoStream - * - * PARAMETERS: LinkedList - Pointer to the resource linked list - * OutputBuffer - Pointer to the user's return buffer - * BytesConsumed - Pointer to where the number of bytes - * used in the OutputBuffer is returned - * - * RETURN: Status - * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRsFixedIoStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed) -{ - UINT8 *Buffer = *OutputBuffer; - UINT16 Temp16 = 0; - UINT8 Temp8 = 0; - + /* Complete the AML descriptor header */ - ACPI_FUNCTION_TRACE ("RsFixedIoStream"); - - - /* The descriptor field is static */ - - *Buffer = 0x4B; - - Buffer += 1; - - /* Set the Range base address */ - - Temp16 = (UINT16) LinkedList->Data.FixedIo.BaseAddress; - - ACPI_MOVE_16_TO_16 (Buffer, &Temp16); - Buffer += 2; - - /* Set the range length */ - - Temp8 = (UINT8) LinkedList->Data.FixedIo.RangeLength; - - *Buffer = Temp8; - Buffer += 1; - - /* Return the number of bytes consumed in this operation */ - - *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer); + AcpiRsSetResourceHeader (ACPI_RESOURCE_NAME_FIXED_IO, + sizeof (AML_RESOURCE_FIXED_IO), Aml); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsDmaResource + * FUNCTION: AcpiRsGetDma * - * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream - * BytesConsumed - Pointer to where the number of bytes - * consumed the ByteStreamBuffer is - * returned - * OutputBuffer - Pointer to the return data buffer - * StructureSize - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * AmlResourceLength - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ ACPI_STATUS -AcpiRsDmaResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize) +AcpiRsGetDma ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource) { - UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; - UINT8 Temp8 = 0; - UINT8 Index; - UINT8 i; - ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE ( - ACPI_RESOURCE_DMA); + UINT32 ChannelCount = 0; + UINT32 i; + UINT8 Temp8; - ACPI_FUNCTION_TRACE ("RsDmaResource"); - - - /* The number of bytes consumed are Constant */ + ACPI_FUNCTION_TRACE ("RsGetDma"); - *BytesConsumed = 3; - OutputStruct->Id = ACPI_RSTYPE_DMA; - - /* Point to the 8-bits of Byte 1 */ - - Buffer += 1; - Temp8 = *Buffer; /* Decode the DMA channel bits */ - for (i = 0, Index = 0; Index < 8; Index++) + for (i = 0; i < 8; i++) { - if ((Temp8 >> Index) & 0x01) + if ((Aml->Dma.DmaChannelMask >> i) & 0x01) { - OutputStruct->Data.Dma.Channels[i] = Index; - i++; + Resource->Data.Dma.Channels[ChannelCount] = i; + ChannelCount++; } } - /* Zero DMA channels is valid */ + Resource->Length = 0; + Resource->Data.Dma.ChannelCount = ChannelCount; - OutputStruct->Data.Dma.NumberOfChannels = i; - if (i > 0) + /* + * Calculate the structure size based upon the number of channels + * Note: Zero DMA channels is valid + */ + if (ChannelCount > 0) { - /* Calculate the structure size based upon the number of interrupts */ - - StructSize += ((ACPI_SIZE) i - 1) * 4; + Resource->Length = (UINT32) (ChannelCount - 1) * 4; } - /* Point to Byte 2 */ - - Buffer += 1; - Temp8 = *Buffer; + /* Get the flags: transfer preference, bus mastering, channel speed */ - /* Check for transfer preference (Bits[1:0]) */ + Temp8 = Aml->Dma.Flags; + Resource->Data.Dma.Transfer = Temp8 & 0x03; + Resource->Data.Dma.BusMaster = (Temp8 >> 2) & 0x01; + Resource->Data.Dma.Type = (Temp8 >> 5) & 0x03; - OutputStruct->Data.Dma.Transfer = Temp8 & 0x03; - - if (0x03 == OutputStruct->Data.Dma.Transfer) + if (Resource->Data.Dma.Transfer == 0x03) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid DMA.Transfer preference (3)\n")); return_ACPI_STATUS (AE_BAD_DATA); } - /* Get bus master preference (Bit[2]) */ - - OutputStruct->Data.Dma.BusMaster = (Temp8 >> 2) & 0x01; - - /* Get channel speed support (Bits[6:5]) */ - - OutputStruct->Data.Dma.Type = (Temp8 >> 5) & 0x03; + /* Complete the resource header */ - /* Set the Length parameter */ - - OutputStruct->Length = (UINT32) StructSize; - - /* Return the final size of the structure */ - - *StructureSize = StructSize; + Resource->Type = ACPI_RESOURCE_TYPE_DMA; + Resource->Length += ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_DMA); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsDmaStream + * FUNCTION: AcpiRsSetDma * - * PARAMETERS: LinkedList - Pointer to the resource linked list - * OutputBuffer - Pointer to the user's return buffer - * BytesConsumed - Pointer to where the number of bytes - * used in the OutputBuffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ ACPI_STATUS -AcpiRsDmaStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed) +AcpiRsSetDma ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml) { - UINT8 *Buffer = *OutputBuffer; - UINT16 Temp16 = 0; - UINT8 Temp8 = 0; - UINT8 Index; + UINT8 i; - ACPI_FUNCTION_TRACE ("RsDmaStream"); + ACPI_FUNCTION_TRACE ("RsSetDma"); - /* The descriptor field is static */ - - *Buffer = 0x2A; - Buffer += 1; - Temp8 = 0; + /* Convert channel list to 8-bit DMA channel bitmask */ - /* Loop through all of the Channels and set the mask bits */ - - for (Index = 0; - Index < LinkedList->Data.Dma.NumberOfChannels; - Index++) + Aml->Dma.DmaChannelMask = 0; + for (i = 0; i < Resource->Data.Dma.ChannelCount; i++) { - Temp16 = (UINT16) LinkedList->Data.Dma.Channels[Index]; - Temp8 |= 0x1 << Temp16; + Aml->Dma.DmaChannelMask |= (1 << Resource->Data.Dma.Channels[i]); } - *Buffer = Temp8; - Buffer += 1; - - /* Set the DMA Info */ + /* Set the DMA Flag bits */ - Temp8 = (UINT8) ((LinkedList->Data.Dma.Type & 0x03) << 5); - Temp8 |= ((LinkedList->Data.Dma.BusMaster & 0x01) << 2); - Temp8 |= (LinkedList->Data.Dma.Transfer & 0x03); + Aml->Dma.Flags = (UINT8) + (((Resource->Data.Dma.Type & 0x03) << 5) | + ((Resource->Data.Dma.BusMaster & 0x01) << 2) | + (Resource->Data.Dma.Transfer & 0x03)); - *Buffer = Temp8; - Buffer += 1; + /* Complete the AML descriptor header */ - /* Return the number of bytes consumed in this operation */ - - *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer); + AcpiRsSetResourceHeader (ACPI_RESOURCE_NAME_DMA, sizeof (AML_RESOURCE_DMA), Aml); return_ACPI_STATUS (AE_OK); }
--- a/usr/src/uts/i86pc/io/acpica/resources/rsirq.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/resources/rsirq.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsirq - IRQ resource descriptors - * $Revision: 42 $ + * $Revision: 1.47 $ * ******************************************************************************/ @@ -125,100 +125,77 @@ /******************************************************************************* * - * FUNCTION: AcpiRsIrqResource + * FUNCTION: AcpiRsGetIrq * - * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream - * BytesConsumed - Pointer to where the number of bytes - * consumed the ByteStreamBuffer is - * returned - * OutputBuffer - Pointer to the return data buffer - * StructureSize - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * AmlResourceLength - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ ACPI_STATUS -AcpiRsIrqResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize) +AcpiRsGetIrq ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource) { - UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT16 Temp16 = 0; - UINT8 Temp8 = 0; - UINT8 Index; - UINT8 i; - ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE ( - ACPI_RESOURCE_IRQ); - - - ACPI_FUNCTION_TRACE ("RsIrqResource"); + UINT32 InterruptCount = 0; + UINT32 i; + UINT32 ResourceLength; - /* - * The number of bytes consumed are contained in the descriptor - * (Bits:0-1) - */ - Temp8 = *Buffer; - *BytesConsumed = (Temp8 & 0x03) + 1; - OutputStruct->Id = ACPI_RSTYPE_IRQ; + ACPI_FUNCTION_TRACE ("RsGetIrq"); + - /* Point to the 16-bits of Bytes 1 and 2 */ + /* Get the IRQ mask (bytes 1:2) */ + + ACPI_MOVE_16_TO_16 (&Temp16, &Aml->Irq.IrqMask); - Buffer += 1; - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - - OutputStruct->Data.Irq.NumberOfInterrupts = 0; - - /* Decode the IRQ bits */ + /* Decode the IRQ bits (up to 16 possible) */ - for (i = 0, Index = 0; Index < 16; Index++) + for (i = 0; i < 16; i++) { - if ((Temp16 >> Index) & 0x01) + if ((Temp16 >> i) & 0x01) { - OutputStruct->Data.Irq.Interrupts[i] = Index; - i++; + Resource->Data.Irq.Interrupts[InterruptCount] = i; + InterruptCount++; } } /* Zero interrupts is valid */ - OutputStruct->Data.Irq.NumberOfInterrupts = i; - if (i > 0) + ResourceLength = 0; + Resource->Data.Irq.InterruptCount = InterruptCount; + if (InterruptCount > 0) { /* Calculate the structure size based upon the number of interrupts */ - StructSize += ((ACPI_SIZE) i - 1) * 4; + ResourceLength = (UINT32) (InterruptCount - 1) * 4; } - /* Point to Byte 3 if it is used */ + /* Get Flags (Byte 3) if it is used */ - if (4 == *BytesConsumed) + if (AmlResourceLength == 3) { - Buffer += 2; - Temp8 = *Buffer; - /* Check for HE, LL interrupts */ - switch (Temp8 & 0x09) + switch (Aml->Irq.Flags & 0x09) { case 0x01: /* HE */ - OutputStruct->Data.Irq.EdgeLevel = ACPI_EDGE_SENSITIVE; - OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_HIGH; + Resource->Data.Irq.Triggering = ACPI_EDGE_SENSITIVE; + Resource->Data.Irq.Polarity = ACPI_ACTIVE_HIGH; break; case 0x08: /* LL */ - OutputStruct->Data.Irq.EdgeLevel = ACPI_LEVEL_SENSITIVE; - OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_LOW; + Resource->Data.Irq.Triggering = ACPI_LEVEL_SENSITIVE; + Resource->Data.Irq.Polarity = ACPI_ACTIVE_LOW; break; default: @@ -229,192 +206,148 @@ */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid interrupt polarity/trigger in resource list, %X\n", - Temp8)); + Aml->Irq.Flags)); return_ACPI_STATUS (AE_BAD_DATA); } - /* Check for sharable */ + /* Get Sharing flag */ - OutputStruct->Data.Irq.SharedExclusive = (Temp8 >> 3) & 0x01; + Resource->Data.Irq.Sharable = (Aml->Irq.Flags >> 3) & 0x01; } else { /* - * Assume Edge Sensitive, Active High, Non-Sharable - * per ACPI Specification + * Default configuration: assume Edge Sensitive, Active High, + * Non-Sharable as per the ACPI Specification */ - OutputStruct->Data.Irq.EdgeLevel = ACPI_EDGE_SENSITIVE; - OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_HIGH; - OutputStruct->Data.Irq.SharedExclusive = ACPI_EXCLUSIVE; + Resource->Data.Irq.Triggering = ACPI_EDGE_SENSITIVE; + Resource->Data.Irq.Polarity = ACPI_ACTIVE_HIGH; + Resource->Data.Irq.Sharable = ACPI_EXCLUSIVE; } - /* Set the Length parameter */ - - OutputStruct->Length = (UINT32) StructSize; + /* Complete the resource header */ - /* Return the final size of the structure */ - - *StructureSize = StructSize; + Resource->Type = ACPI_RESOURCE_TYPE_IRQ; + Resource->Length = ResourceLength + ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IRQ); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsIrqStream + * FUNCTION: AcpiRsSetIrq * - * PARAMETERS: LinkedList - Pointer to the resource linked list - * OutputBuffer - Pointer to the user's return buffer - * BytesConsumed - Pointer to where the number of bytes - * used in the OutputBuffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ ACPI_STATUS -AcpiRsIrqStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed) +AcpiRsSetIrq ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml) { - UINT8 *Buffer = *OutputBuffer; - UINT16 Temp16 = 0; - UINT8 Temp8 = 0; - UINT8 Index; - BOOLEAN IRQInfoByteNeeded; + ACPI_SIZE DescriptorLength; + UINT16 IrqMask; + UINT8 i; + + + ACPI_FUNCTION_TRACE ("RsSetIrq"); - ACPI_FUNCTION_TRACE ("RsIrqStream"); + /* Convert interrupt list to 16-bit IRQ bitmask */ + IrqMask = 0; + for (i = 0; i < Resource->Data.Irq.InterruptCount; i++) + { + IrqMask |= (1 << Resource->Data.Irq.Interrupts[i]); + } + + /* Set the interrupt mask */ + + ACPI_MOVE_16_TO_16 (&Aml->Irq.IrqMask, &IrqMask); /* * The descriptor field is set based upon whether a third byte is * needed to contain the IRQ Information. */ - if (ACPI_EDGE_SENSITIVE == LinkedList->Data.Irq.EdgeLevel && - ACPI_ACTIVE_HIGH == LinkedList->Data.Irq.ActiveHighLow && - ACPI_EXCLUSIVE == LinkedList->Data.Irq.SharedExclusive) + if ((Resource->Data.Irq.Triggering == ACPI_EDGE_SENSITIVE) && + (Resource->Data.Irq.Polarity == ACPI_ACTIVE_HIGH) && + (Resource->Data.Irq.Sharable == ACPI_EXCLUSIVE)) { - *Buffer = 0x22; - IRQInfoByteNeeded = FALSE; + /* IrqNoFlags() descriptor can be used */ + + DescriptorLength = sizeof (AML_RESOURCE_IRQ_NOFLAGS); } else { - *Buffer = 0x23; - IRQInfoByteNeeded = TRUE; - } + /* Irq() descriptor must be used */ - Buffer += 1; - Temp16 = 0; + DescriptorLength = sizeof (AML_RESOURCE_IRQ); - /* Loop through all of the interrupts and set the mask bits */ + /* Set the IRQ Info byte */ - for(Index = 0; - Index < LinkedList->Data.Irq.NumberOfInterrupts; - Index++) - { - Temp8 = (UINT8) LinkedList->Data.Irq.Interrupts[Index]; - Temp16 |= 0x1 << Temp8; - } - - ACPI_MOVE_16_TO_16 (Buffer, &Temp16); - Buffer += 2; + Aml->Irq.Flags = (UINT8) + ((Resource->Data.Irq.Sharable & 0x01) << 4); - /* Set the IRQ Info byte if needed. */ - - if (IRQInfoByteNeeded) - { - Temp8 = 0; - Temp8 = (UINT8) ((LinkedList->Data.Irq.SharedExclusive & - 0x01) << 4); - - if (ACPI_LEVEL_SENSITIVE == LinkedList->Data.Irq.EdgeLevel && - ACPI_ACTIVE_LOW == LinkedList->Data.Irq.ActiveHighLow) + if (ACPI_LEVEL_SENSITIVE == Resource->Data.Irq.Triggering && + ACPI_ACTIVE_LOW == Resource->Data.Irq.Polarity) { - Temp8 |= 0x08; + Aml->Irq.Flags |= 0x08; } else { - Temp8 |= 0x01; + Aml->Irq.Flags |= 0x01; } - - *Buffer = Temp8; - Buffer += 1; } - /* Return the number of bytes consumed in this operation */ + /* Complete the AML descriptor header */ - *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer); + AcpiRsSetResourceHeader (ACPI_RESOURCE_NAME_IRQ, DescriptorLength, Aml); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsExtendedIrqResource + * FUNCTION: AcpiRsGetExtIrq * - * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream - * BytesConsumed - Pointer to where the number of bytes - * consumed the ByteStreamBuffer is - * returned - * OutputBuffer - Pointer to the return data buffer - * StructureSize - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * AmlResourceLength - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ ACPI_STATUS -AcpiRsExtendedIrqResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize) +AcpiRsGetExtIrq ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource) { - UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; - UINT16 Temp16 = 0; - UINT8 Temp8 = 0; - UINT8 *TempPtr; - UINT8 Index; - ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE ( - ACPI_RESOURCE_EXT_IRQ); - - - ACPI_FUNCTION_TRACE ("RsExtendedIrqResource"); + char *OutResourceString; + UINT8 Temp8; - /* Point past the Descriptor to get the number of bytes consumed */ + ACPI_FUNCTION_TRACE ("RsGetExtIrq"); - Buffer += 1; - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - /* Validate minimum descriptor length */ + /* Get the flag bits */ - if (Temp16 < 6) - { - return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); - } - - *BytesConsumed = Temp16 + 3; - OutputStruct->Id = ACPI_RSTYPE_EXT_IRQ; - - /* Point to the Byte3 */ - - Buffer += 2; - Temp8 = *Buffer; - - OutputStruct->Data.ExtendedIrq.ProducerConsumer = Temp8 & 0x01; + Temp8 = Aml->ExtendedIrq.Flags; + Resource->Data.ExtendedIrq.ProducerConsumer = Temp8 & 0x01; + Resource->Data.ExtendedIrq.Polarity = (Temp8 >> 2) & 0x01; + Resource->Data.ExtendedIrq.Sharable = (Temp8 >> 3) & 0x01; /* * Check for Interrupt Mode @@ -424,173 +357,81 @@ * * - Edge/Level are defined opposite in the table vs the headers */ - OutputStruct->Data.ExtendedIrq.EdgeLevel = + Resource->Data.ExtendedIrq.Triggering = (Temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE; - /* Check Interrupt Polarity */ - - OutputStruct->Data.ExtendedIrq.ActiveHighLow = (Temp8 >> 2) & 0x1; - - /* Check for sharable */ - - OutputStruct->Data.ExtendedIrq.SharedExclusive = (Temp8 >> 3) & 0x01; + /* Get the IRQ Table length (Byte4) */ - /* Point to Byte4 (IRQ Table length) */ - - Buffer += 1; - Temp8 = *Buffer; - - /* Must have at least one IRQ */ - + Temp8 = Aml->ExtendedIrq.TableLength; + Resource->Data.ExtendedIrq.InterruptCount = Temp8; if (Temp8 < 1) { + /* Must have at least one IRQ */ + return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); } - OutputStruct->Data.ExtendedIrq.NumberOfInterrupts = Temp8; - /* * Add any additional structure size to properly calculate * the next pointer at the end of this function */ - StructSize += (Temp8 - 1) * 4; - - /* Point to Byte5 (First IRQ Number) */ - - Buffer += 1; - - /* Cycle through every IRQ in the table */ - - for (Index = 0; Index < Temp8; Index++) - { - ACPI_MOVE_32_TO_32 ( - &OutputStruct->Data.ExtendedIrq.Interrupts[Index], Buffer); - - /* Point to the next IRQ */ - - Buffer += 4; - } + Resource->Length = (Temp8 - 1) * 4; + OutResourceString = ACPI_CAST_PTR (char, + (&Resource->Data.ExtendedIrq.Interrupts[0] + Temp8)); - /* - * This will leave us pointing to the Resource Source Index - * If it is present, then save it off and calculate the - * pointer to where the null terminated string goes: - * Each Interrupt takes 32-bits + the 5 bytes of the - * stream that are default. - * - * Note: Some resource descriptors will have an additional null, so - * we add 1 to the length. - */ - if (*BytesConsumed > - ((ACPI_SIZE) OutputStruct->Data.ExtendedIrq.NumberOfInterrupts * 4) + - (5 + 1)) - { - /* Dereference the Index */ + /* Get every IRQ in the table, each is 32 bits */ - Temp8 = *Buffer; - OutputStruct->Data.ExtendedIrq.ResourceSource.Index = (UINT32) Temp8; - - /* Point to the String */ - - Buffer += 1; - - /* Point the String pointer to the end of this structure. */ + AcpiRsMoveData (Resource->Data.ExtendedIrq.Interrupts, + Aml->ExtendedIrq.InterruptNumber, + (UINT16) Temp8, ACPI_MOVE_TYPE_32_TO_32); - OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr = - (char *)((char *) OutputStruct + StructSize); - - TempPtr = (UINT8 *) - OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr; - - /* Copy the string into the buffer */ - - Index = 0; - while (0x00 != *Buffer) - { - *TempPtr = *Buffer; - - TempPtr += 1; - Buffer += 1; - Index += 1; - } - - /* Add the terminating null */ - - *TempPtr = 0x00; - OutputStruct->Data.ExtendedIrq.ResourceSource.StringLength = Index + 1; + /* Get the optional ResourceSource (index and string) */ - /* - * In order for the StructSize to fall on a 32-bit boundary, - * calculate the length of the string and expand the - * StructSize to the next 32-bit boundary. - */ - Temp8 = (UINT8) (Index + 1); - StructSize += ACPI_ROUND_UP_TO_32BITS (Temp8); - } - else - { - OutputStruct->Data.ExtendedIrq.ResourceSource.Index = 0x00; - OutputStruct->Data.ExtendedIrq.ResourceSource.StringLength = 0; - OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr = NULL; - } + Resource->Length += + AcpiRsGetResourceSource (AmlResourceLength, + (ACPI_SIZE) Resource->Length + sizeof (AML_RESOURCE_EXTENDED_IRQ), + &Resource->Data.ExtendedIrq.ResourceSource, + Aml, OutResourceString); - /* Set the Length parameter */ - - OutputStruct->Length = (UINT32) StructSize; + /* Complete the resource header */ - /* Return the final size of the structure */ - - *StructureSize = StructSize; + Resource->Type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; + Resource->Length += ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_EXTENDED_IRQ); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsExtendedIrqStream + * FUNCTION: AcpiRsSetExtIrq * - * PARAMETERS: LinkedList - Pointer to the resource linked list - * OutputBuffer - Pointer to the user's return buffer - * BytesConsumed - Pointer to where the number of bytes - * used in the OutputBuffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ ACPI_STATUS -AcpiRsExtendedIrqStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed) +AcpiRsSetExtIrq ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml) { - UINT8 *Buffer = *OutputBuffer; - UINT16 *LengthField; - UINT8 Temp8 = 0; - UINT8 Index; - char *TempPointer = NULL; + ACPI_SIZE DescriptorLength; - ACPI_FUNCTION_TRACE ("RsExtendedIrqStream"); - - - /* The descriptor field is static */ + ACPI_FUNCTION_TRACE ("RsSetExtIrq"); - *Buffer = 0x89; - Buffer += 1; - - /* Set a pointer to the Length field - to be filled in later */ - - LengthField = ACPI_CAST_PTR (UINT16, Buffer); - Buffer += 2; /* Set the Interrupt vector flags */ - Temp8 = (UINT8)(LinkedList->Data.ExtendedIrq.ProducerConsumer & 0x01); - Temp8 |= ((LinkedList->Data.ExtendedIrq.SharedExclusive & 0x01) << 3); + Aml->ExtendedIrq.Flags = (UINT8) + ((Resource->Data.ExtendedIrq.ProducerConsumer & 0x01) | + ((Resource->Data.ExtendedIrq.Sharable & 0x01) << 3) | + ((Resource->Data.ExtendedIrq.Polarity & 0x1) << 2)); /* * Set the Interrupt Mode @@ -601,64 +442,35 @@ * * - Edge/Level are defined opposite in the table vs the headers */ - if (ACPI_EDGE_SENSITIVE == LinkedList->Data.ExtendedIrq.EdgeLevel) + if (Resource->Data.ExtendedIrq.Triggering == ACPI_EDGE_SENSITIVE) { - Temp8 |= 0x2; + Aml->ExtendedIrq.Flags |= 0x02; } - /* Set the Interrupt Polarity */ - - Temp8 |= ((LinkedList->Data.ExtendedIrq.ActiveHighLow & 0x1) << 2); - - *Buffer = Temp8; - Buffer += 1; - /* Set the Interrupt table length */ - Temp8 = (UINT8) LinkedList->Data.ExtendedIrq.NumberOfInterrupts; + Aml->ExtendedIrq.TableLength = (UINT8) + Resource->Data.ExtendedIrq.InterruptCount; - *Buffer = Temp8; - Buffer += 1; + DescriptorLength = (sizeof (AML_RESOURCE_EXTENDED_IRQ) - 4) + + ((ACPI_SIZE) Resource->Data.ExtendedIrq.InterruptCount * sizeof (UINT32)); - for (Index = 0; Index < LinkedList->Data.ExtendedIrq.NumberOfInterrupts; - Index++) - { - ACPI_MOVE_32_TO_32 (Buffer, - &LinkedList->Data.ExtendedIrq.Interrupts[Index]); - Buffer += 4; - } + /* Set each interrupt value */ + + AcpiRsMoveData (Aml->ExtendedIrq.InterruptNumber, + Resource->Data.ExtendedIrq.Interrupts, + (UINT16) Resource->Data.ExtendedIrq.InterruptCount, + ACPI_MOVE_TYPE_32_TO_32); /* Resource Source Index and Resource Source are optional */ - if (0 != LinkedList->Data.ExtendedIrq.ResourceSource.StringLength) - { - *Buffer = (UINT8) LinkedList->Data.ExtendedIrq.ResourceSource.Index; - Buffer += 1; - - TempPointer = (char *) Buffer; - - /* Copy the string */ - - ACPI_STRCPY (TempPointer, - LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr); + DescriptorLength = AcpiRsSetResourceSource (Aml, DescriptorLength, + &Resource->Data.ExtendedIrq.ResourceSource); - /* - * Buffer needs to be set to the length of the sting + one for the - * terminating null - */ - Buffer += (ACPI_SIZE) (ACPI_STRLEN ( - LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr) + 1); - } + /* Complete the AML descriptor header */ - /* Return the number of bytes consumed in this operation */ - - *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer); - - /* - * Set the length field to the number of bytes consumed - * minus the header size (3 bytes) - */ - *LengthField = (UINT16) (*BytesConsumed - 3); + AcpiRsSetResourceHeader (ACPI_RESOURCE_NAME_EXTENDED_IRQ, + DescriptorLength, Aml); return_ACPI_STATUS (AE_OK); }
--- a/usr/src/uts/i86pc/io/acpica/resources/rslist.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/resources/rslist.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rslist - Linked list utilities - * $Revision: 39 $ + * $Revision: 1.45 $ * ******************************************************************************/ @@ -123,62 +123,142 @@ ACPI_MODULE_NAME ("rslist") +/* Local prototypes */ + +static ACPI_GET_RESOURCE_HANDLER +AcpiRsGetResourceHandler ( + UINT8 ResourceType); + +static ACPI_STATUS +AcpiRsValidateResourceLength ( + AML_RESOURCE *Aml); + + /******************************************************************************* * - * FUNCTION: AcpiRsGetResourceType + * FUNCTION: AcpiRsValidateResourceLength + * + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * + * RETURN: Status - AE_OK if the resource length appears valid + * + * DESCRIPTION: Validate the ResourceLength. Fixed-length descriptors must + * have the exact length; variable-length descriptors must be + * at least as long as the minimum. Certain Small descriptors + * can vary in size by at most one byte. * - * PARAMETERS: ResourceStartByte - Byte 0 of a resource descriptor + ******************************************************************************/ + +static ACPI_STATUS +AcpiRsValidateResourceLength ( + AML_RESOURCE *Aml) +{ + ACPI_RESOURCE_INFO *ResourceInfo; + UINT16 MinimumAmlResourceLength; + UINT16 ResourceLength; + + + ACPI_FUNCTION_ENTRY (); + + + /* Get the size and type info about this resource descriptor */ + + ResourceInfo = AcpiRsGetResourceInfo (Aml->SmallHeader.DescriptorType); + if (!ResourceInfo) + { + return (AE_AML_INVALID_RESOURCE_TYPE); + } + + ResourceLength = AcpiRsGetResourceLength (Aml); + MinimumAmlResourceLength = ResourceInfo->MinimumAmlResourceLength; + + /* Validate based upon the type of resource, fixed length or variable */ + + if (ResourceInfo->LengthType == ACPI_FIXED_LENGTH) + { + /* Fixed length resource, length must match exactly */ + + if (ResourceLength != MinimumAmlResourceLength) + { + return (AE_AML_BAD_RESOURCE_LENGTH); + } + } + else if (ResourceInfo->LengthType == ACPI_VARIABLE_LENGTH) + { + /* Variable length resource, must be at least the minimum */ + + if (ResourceLength < MinimumAmlResourceLength) + { + return (AE_AML_BAD_RESOURCE_LENGTH); + } + } + else + { + /* Small variable length resource, allowed to be (Min) or (Min-1) */ + + if ((ResourceLength > MinimumAmlResourceLength) || + (ResourceLength < (MinimumAmlResourceLength - 1))) + { + return (AE_AML_BAD_RESOURCE_LENGTH); + } + } + + return (AE_OK); +} + + +/******************************************************************************* * - * RETURN: The Resource Type with no extraneous bits + * FUNCTION: AcpiRsGetResourceHandler + * + * PARAMETERS: ResourceType - Byte 0 of a resource descriptor + * + * RETURN: Pointer to the resource conversion handler * * DESCRIPTION: Extract the Resource Type/Name from the first byte of * a resource descriptor. * ******************************************************************************/ -UINT8 -AcpiRsGetResourceType ( - UINT8 ResourceStartByte) +static ACPI_GET_RESOURCE_HANDLER +AcpiRsGetResourceHandler ( + UINT8 ResourceType) { - ACPI_FUNCTION_ENTRY (); /* Determine if this is a small or large resource */ - switch (ResourceStartByte & ACPI_RDESC_TYPE_MASK) + if (ResourceType & ACPI_RESOURCE_NAME_LARGE) { - case ACPI_RDESC_TYPE_SMALL: + /* Large Resource Type -- bits 6:0 contain the name */ - /* Small Resource Type -- Only bits 6:3 are valid */ - - return ((UINT8) (ResourceStartByte & ACPI_RDESC_SMALL_MASK)); - - - case ACPI_RDESC_TYPE_LARGE: + if (ResourceType > ACPI_RESOURCE_NAME_LARGE_MAX) + { + return (NULL); + } - /* Large Resource Type -- All bits are valid */ - - return (ResourceStartByte); - + return (AcpiGbl_LgGetResourceDispatch [ + (ResourceType & ACPI_RESOURCE_NAME_LARGE_MASK)]); + } + else + { + /* Small Resource Type -- bits 6:3 contain the name */ - default: - /* Invalid type */ - break; + return (AcpiGbl_SmGetResourceDispatch [ + ((ResourceType & ACPI_RESOURCE_NAME_SMALL_MASK) >> 3)]); } - - return (0xFF); } /******************************************************************************* * - * FUNCTION: AcpiRsByteStreamToList + * FUNCTION: AcpiRsConvertAmlToResources * - * PARAMETERS: ByteStreamBuffer - Pointer to the resource byte stream - * ByteStreamBufferLength - Length of ByteStreamBuffer - * OutputBuffer - Pointer to the buffer that will - * contain the output structures + * PARAMETERS: AmlBuffer - Pointer to the resource byte stream + * AmlBufferLength - Length of AmlBuffer + * OutputBuffer - Pointer to the buffer that will + * contain the output structures * * RETURN: Status * @@ -188,230 +268,105 @@ ******************************************************************************/ ACPI_STATUS -AcpiRsByteStreamToList ( - UINT8 *ByteStreamBuffer, - UINT32 ByteStreamBufferLength, +AcpiRsConvertAmlToResources ( + UINT8 *AmlBuffer, + UINT32 AmlBufferLength, UINT8 *OutputBuffer) { + UINT8 *Buffer = OutputBuffer; ACPI_STATUS Status; ACPI_SIZE BytesParsed = 0; - UINT8 ResourceType = 0; - ACPI_SIZE BytesConsumed = 0; - UINT8 *Buffer = OutputBuffer; - ACPI_SIZE StructureSize = 0; - BOOLEAN EndTagProcessed = FALSE; ACPI_RESOURCE *Resource; - - ACPI_FUNCTION_TRACE ("RsByteStreamToList"); - - - while (BytesParsed < ByteStreamBufferLength && - !EndTagProcessed) - { - /* The next byte in the stream is the resource type */ - - ResourceType = AcpiRsGetResourceType (*ByteStreamBuffer); - - switch (ResourceType) - { - case ACPI_RDESC_TYPE_MEMORY_24: - /* - * 24-Bit Memory Resource - */ - Status = AcpiRsMemory24Resource (ByteStreamBuffer, - &BytesConsumed, &Buffer, &StructureSize); - break; - - - case ACPI_RDESC_TYPE_LARGE_VENDOR: - /* - * Vendor Defined Resource - */ - Status = AcpiRsVendorResource (ByteStreamBuffer, - &BytesConsumed, &Buffer, &StructureSize); - break; + UINT16 ResourceLength; + UINT32 DescriptorLength; + ACPI_GET_RESOURCE_HANDLER Handler; - case ACPI_RDESC_TYPE_MEMORY_32: - /* - * 32-Bit Memory Range Resource - */ - Status = AcpiRsMemory32RangeResource (ByteStreamBuffer, - &BytesConsumed, &Buffer, &StructureSize); - break; - - - case ACPI_RDESC_TYPE_FIXED_MEMORY_32: - /* - * 32-Bit Fixed Memory Resource - */ - Status = AcpiRsFixedMemory32Resource (ByteStreamBuffer, - &BytesConsumed, &Buffer, &StructureSize); - break; - - - case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE: - case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE: - /* - * 64-Bit Address Resource - */ - Status = AcpiRsAddress64Resource (ByteStreamBuffer, - &BytesConsumed, &Buffer, &StructureSize); - break; - - - case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE: - /* - * 32-Bit Address Resource - */ - Status = AcpiRsAddress32Resource (ByteStreamBuffer, - &BytesConsumed, &Buffer, &StructureSize); - break; - - - case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE: - /* - * 16-Bit Address Resource - */ - Status = AcpiRsAddress16Resource (ByteStreamBuffer, - &BytesConsumed, &Buffer, &StructureSize); - break; + ACPI_FUNCTION_TRACE ("RsConvertAmlToResources"); - case ACPI_RDESC_TYPE_EXTENDED_XRUPT: - /* - * Extended IRQ - */ - Status = AcpiRsExtendedIrqResource (ByteStreamBuffer, - &BytesConsumed, &Buffer, &StructureSize); - break; - - - case ACPI_RDESC_TYPE_IRQ_FORMAT: - /* - * IRQ Resource - */ - Status = AcpiRsIrqResource (ByteStreamBuffer, - &BytesConsumed, &Buffer, &StructureSize); - break; - + /* Loop until end-of-buffer or an EndTag is found */ - case ACPI_RDESC_TYPE_DMA_FORMAT: - /* - * DMA Resource - */ - Status = AcpiRsDmaResource (ByteStreamBuffer, - &BytesConsumed, &Buffer, &StructureSize); - break; - - - case ACPI_RDESC_TYPE_START_DEPENDENT: - /* - * Start Dependent Functions Resource - */ - Status = AcpiRsStartDependFnsResource (ByteStreamBuffer, - &BytesConsumed, &Buffer, &StructureSize); - break; - - - case ACPI_RDESC_TYPE_END_DEPENDENT: - /* - * End Dependent Functions Resource - */ - Status = AcpiRsEndDependFnsResource (ByteStreamBuffer, - &BytesConsumed, &Buffer, &StructureSize); - break; + while (BytesParsed < AmlBufferLength) + { + /* Get the handler associated with this Descriptor Type */ - - case ACPI_RDESC_TYPE_IO_PORT: - /* - * IO Port Resource - */ - Status = AcpiRsIoResource (ByteStreamBuffer, - &BytesConsumed, &Buffer, &StructureSize); - break; - - - case ACPI_RDESC_TYPE_FIXED_IO_PORT: - /* - * Fixed IO Port Resource - */ - Status = AcpiRsFixedIoResource (ByteStreamBuffer, - &BytesConsumed, &Buffer, &StructureSize); - break; - + Handler = AcpiRsGetResourceHandler (*AmlBuffer); + if (!Handler) + { + /* No handler indicates invalid resource type */ - case ACPI_RDESC_TYPE_SMALL_VENDOR: - /* - * Vendor Specific Resource - */ - Status = AcpiRsVendorResource (ByteStreamBuffer, - &BytesConsumed, &Buffer, &StructureSize); - break; - - - case ACPI_RDESC_TYPE_END_TAG: - /* - * End Tag - */ - EndTagProcessed = TRUE; - Status = AcpiRsEndTagResource (ByteStreamBuffer, - &BytesConsumed, &Buffer, &StructureSize); - break; - - - default: - /* - * Invalid/Unknown resource type - */ - Status = AE_AML_INVALID_RESOURCE_TYPE; - break; + return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); } + ResourceLength = AcpiRsGetResourceLength ( + ACPI_CAST_PTR (AML_RESOURCE, AmlBuffer)); + + DescriptorLength = AcpiRsGetDescriptorLength ( + ACPI_CAST_PTR (AML_RESOURCE, AmlBuffer)); + + /* + * Perform limited validation of the resource length, based upon + * what we know about the resource type + */ + Status = AcpiRsValidateResourceLength ( + ACPI_CAST_PTR (AML_RESOURCE, AmlBuffer)); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - /* Update the return value and counter */ - - BytesParsed += BytesConsumed; + /* Convert a byte stream resource to local resource struct */ - /* Set the byte stream to point to the next resource */ + Status = Handler (ACPI_CAST_PTR (AML_RESOURCE, AmlBuffer), + ResourceLength, ACPI_CAST_PTR (ACPI_RESOURCE, Buffer)); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (( + "Could not convert AML resource (type %X) to resource, %s\n", + *AmlBuffer, AcpiFormatException (Status))); + return_ACPI_STATUS (Status); + } - ByteStreamBuffer += BytesConsumed; - - /* Set the Buffer to the next structure */ + /* Set the aligned length of the new resource descriptor */ Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer); Resource->Length = (UINT32) ACPI_ALIGN_RESOURCE_SIZE (Resource->Length); - Buffer += ACPI_ALIGN_RESOURCE_SIZE (StructureSize); + + /* Normal exit on completion of an EndTag resource descriptor */ + + if (AcpiRsGetResourceType (*AmlBuffer) == ACPI_RESOURCE_NAME_END_TAG) + { + return_ACPI_STATUS (AE_OK); + } + + /* Update counter and point to the next input resource */ + + BytesParsed += DescriptorLength; + AmlBuffer += DescriptorLength; + + /* Point to the next structure in the output buffer */ + + Buffer += Resource->Length; } - /* Check the reason for exiting the while loop */ + /* Completed buffer, but did not find an EndTag resource descriptor */ - if (!EndTagProcessed) - { - return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); - } - - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); } /******************************************************************************* * - * FUNCTION: AcpiRsListToByteStream + * FUNCTION: AcpiRsConvertResourcesToAml * - * PARAMETERS: LinkedList - Pointer to the resource linked list - * ByteSteamSizeNeeded - Calculated size of the byte stream - * needed from calling - * AcpiRsGetByteStreamLength() - * The size of the OutputBuffer is - * guaranteed to be >= - * ByteStreamSizeNeeded - * OutputBuffer - Pointer to the buffer that will - * contain the byte stream + * PARAMETERS: Resource - Pointer to the resource linked list + * AmlSizeNeeded - Calculated size of the byte stream + * needed from calling AcpiRsGetAmlLength() + * The size of the OutputBuffer is + * guaranteed to be >= AmlSizeNeeded + * OutputBuffer - Pointer to the buffer that will + * contain the byte stream * * RETURN: Status * @@ -421,168 +376,70 @@ ******************************************************************************/ ACPI_STATUS -AcpiRsListToByteStream ( - ACPI_RESOURCE *LinkedList, - ACPI_SIZE ByteStreamSizeNeeded, +AcpiRsConvertResourcesToAml ( + ACPI_RESOURCE *Resource, + ACPI_SIZE AmlSizeNeeded, UINT8 *OutputBuffer) { + UINT8 *AmlBuffer = OutputBuffer; ACPI_STATUS Status; - UINT8 *Buffer = OutputBuffer; - ACPI_SIZE BytesConsumed = 0; - BOOLEAN Done = FALSE; - ACPI_FUNCTION_TRACE ("RsListToByteStream"); + ACPI_FUNCTION_TRACE ("RsConvertResourcesToAml"); - while (!Done) - { - switch (LinkedList->Id) - { - case ACPI_RSTYPE_IRQ: - /* - * IRQ Resource - */ - Status = AcpiRsIrqStream (LinkedList, &Buffer, &BytesConsumed); - break; - - case ACPI_RSTYPE_DMA: - /* - * DMA Resource - */ - Status = AcpiRsDmaStream (LinkedList, &Buffer, &BytesConsumed); - break; - - case ACPI_RSTYPE_START_DPF: - /* - * Start Dependent Functions Resource - */ - Status = AcpiRsStartDependFnsStream (LinkedList, - &Buffer, &BytesConsumed); - break; - - case ACPI_RSTYPE_END_DPF: - /* - * End Dependent Functions Resource - */ - Status = AcpiRsEndDependFnsStream (LinkedList, - &Buffer, &BytesConsumed); - break; - - case ACPI_RSTYPE_IO: - /* - * IO Port Resource - */ - Status = AcpiRsIoStream (LinkedList, &Buffer, &BytesConsumed); - break; - - case ACPI_RSTYPE_FIXED_IO: - /* - * Fixed IO Port Resource - */ - Status = AcpiRsFixedIoStream (LinkedList, &Buffer, &BytesConsumed); - break; - - case ACPI_RSTYPE_VENDOR: - /* - * Vendor Defined Resource - */ - Status = AcpiRsVendorStream (LinkedList, &Buffer, &BytesConsumed); - break; - - case ACPI_RSTYPE_END_TAG: - /* - * End Tag - */ - Status = AcpiRsEndTagStream (LinkedList, &Buffer, &BytesConsumed); - - /* An End Tag indicates the end of the Resource Template */ + /* Convert each resource descriptor in the list */ - Done = TRUE; - break; - - case ACPI_RSTYPE_MEM24: - /* - * 24-Bit Memory Resource - */ - Status = AcpiRsMemory24Stream (LinkedList, &Buffer, &BytesConsumed); - break; - - case ACPI_RSTYPE_MEM32: - /* - * 32-Bit Memory Range Resource - */ - Status = AcpiRsMemory32RangeStream (LinkedList, &Buffer, - &BytesConsumed); - break; - - case ACPI_RSTYPE_FIXED_MEM32: - /* - * 32-Bit Fixed Memory Resource - */ - Status = AcpiRsFixedMemory32Stream (LinkedList, &Buffer, - &BytesConsumed); - break; + while (1) + { + /* Validate Resource Descriptor Type before dispatch */ - case ACPI_RSTYPE_ADDRESS16: - /* - * 16-Bit Address Descriptor Resource - */ - Status = AcpiRsAddress16Stream (LinkedList, &Buffer, - &BytesConsumed); - break; - - case ACPI_RSTYPE_ADDRESS32: - /* - * 32-Bit Address Descriptor Resource - */ - Status = AcpiRsAddress32Stream (LinkedList, &Buffer, - &BytesConsumed); - break; - - case ACPI_RSTYPE_ADDRESS64: - /* - * 64-Bit Address Descriptor Resource - */ - Status = AcpiRsAddress64Stream (LinkedList, &Buffer, - &BytesConsumed); - break; - - case ACPI_RSTYPE_EXT_IRQ: - /* - * Extended IRQ Resource - */ - Status = AcpiRsExtendedIrqStream (LinkedList, &Buffer, - &BytesConsumed); - break; - - default: - /* - * If we get here, everything is out of sync, - * so exit with an error - */ + if (Resource->Type > ACPI_RESOURCE_TYPE_MAX) + { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid descriptor type (%X) in resource list\n", - LinkedList->Id)); - Status = AE_BAD_DATA; - break; + Resource->Type)); + return_ACPI_STATUS (AE_BAD_DATA); } + /* Perform the conversion per resource type */ + + Status = AcpiGbl_SetResourceDispatch[Resource->Type] (Resource, + ACPI_CAST_PTR (AML_RESOURCE, AmlBuffer)); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (("Could not convert resource (type %X) to AML, %s\n", + Resource->Type, AcpiFormatException (Status))); + return_ACPI_STATUS (Status); + } + + /* Perform final sanity check on the new AML resource descriptor */ + + Status = AcpiRsValidateResourceLength ( + ACPI_CAST_PTR (AML_RESOURCE, AmlBuffer)); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - /* Set the Buffer to point to the open byte */ + /* Check for end-of-list, normal exit */ - Buffer += BytesConsumed; + if (Resource->Type == ACPI_RESOURCE_TYPE_END_TAG) + { + /* An End Tag indicates the end of the input Resource Template */ - /* Point to the next object */ + return_ACPI_STATUS (AE_OK); + } - LinkedList = ACPI_PTR_ADD (ACPI_RESOURCE, - LinkedList, LinkedList->Length); + /* Extract the total length of the new descriptor */ + /* Set the AmlBuffer to point to the next (output) resource descriptor */ + + AmlBuffer += AcpiRsGetDescriptorLength ( + ACPI_CAST_PTR (AML_RESOURCE, AmlBuffer)); + + /* Point to the next input resource descriptor */ + + Resource = ACPI_PTR_ADD (ACPI_RESOURCE, Resource, Resource->Length); } - - return_ACPI_STATUS (AE_OK); }
--- a/usr/src/uts/i86pc/io/acpica/resources/rsmemory.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/resources/rsmemory.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsmem24 - Memory resource descriptors - * $Revision: 28 $ + * $Revision: 1.31 $ * ******************************************************************************/ @@ -125,476 +125,279 @@ /******************************************************************************* * - * FUNCTION: AcpiRsMemory24Resource + * FUNCTION: AcpiRsGetMemory24 * - * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream - * BytesConsumed - Pointer to where the number of bytes - * consumed the ByteStreamBuffer is - * returned - * OutputBuffer - Pointer to the return data buffer - * StructureSize - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * AmlResourceLength - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ ACPI_STATUS -AcpiRsMemory24Resource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize) +AcpiRsGetMemory24 ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource) { - UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; - UINT16 Temp16 = 0; - UINT8 Temp8 = 0; - ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE ( - ACPI_RESOURCE_MEM24); - - - ACPI_FUNCTION_TRACE ("RsMemory24Resource"); + ACPI_FUNCTION_TRACE ("RsGetMemory24"); - /* Point past the Descriptor to get the number of bytes consumed */ - - Buffer += 1; - - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - Buffer += 2; - *BytesConsumed = (ACPI_SIZE) Temp16 + 3; - OutputStruct->Id = ACPI_RSTYPE_MEM24; - - /* Check Byte 3 the Read/Write bit */ + /* Get the Read/Write bit */ - Temp8 = *Buffer; - Buffer += 1; - OutputStruct->Data.Memory24.ReadWriteAttribute = Temp8 & 0x01; - - /* Get MinBaseAddress (Bytes 4-5) */ - - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - Buffer += 2; - OutputStruct->Data.Memory24.MinBaseAddress = Temp16; - - /* Get MaxBaseAddress (Bytes 6-7) */ + Resource->Data.Memory24.ReadWriteAttribute = + (Aml->Memory24.Information & 0x01); - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - Buffer += 2; - OutputStruct->Data.Memory24.MaxBaseAddress = Temp16; - - /* Get Alignment (Bytes 8-9) */ - - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - Buffer += 2; - OutputStruct->Data.Memory24.Alignment = Temp16; + /* + * Get the following contiguous fields from the AML descriptor: + * Minimum Base Address + * Maximum Base Address + * Address Base Alignment + * Range Length + */ + AcpiRsMoveData (&Resource->Data.Memory24.Minimum, + &Aml->Memory24.Minimum, 4, ACPI_MOVE_TYPE_16_TO_32); - /* Get RangeLength (Bytes 10-11) */ - - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - OutputStruct->Data.Memory24.RangeLength = Temp16; + /* Complete the resource header */ - /* Set the Length parameter */ - - OutputStruct->Length = (UINT32) StructSize; - - /* Return the final size of the structure */ - - *StructureSize = StructSize; + Resource->Type = ACPI_RESOURCE_TYPE_MEMORY24; + Resource->Length = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEMORY24); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsMemory24Stream + * FUNCTION: AcpiRsSetMemory24 * - * PARAMETERS: LinkedList - Pointer to the resource linked list - * OutputBuffer - Pointer to the user's return buffer - * BytesConsumed - Pointer to where the number of bytes - * used in the OutputBuffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ ACPI_STATUS -AcpiRsMemory24Stream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed) +AcpiRsSetMemory24 ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml) { - UINT8 *Buffer = *OutputBuffer; - UINT16 Temp16 = 0; - UINT8 Temp8 = 0; - - - ACPI_FUNCTION_TRACE ("RsMemory24Stream"); + ACPI_FUNCTION_TRACE ("RsSetMemory24"); - /* The descriptor field is static */ - - *Buffer = 0x81; - Buffer += 1; - - /* The length field is static */ - - Temp16 = 0x09; - ACPI_MOVE_16_TO_16 (Buffer, &Temp16); - Buffer += 2; - /* Set the Information Byte */ - Temp8 = (UINT8) (LinkedList->Data.Memory24.ReadWriteAttribute & 0x01); - *Buffer = Temp8; - Buffer += 1; - - /* Set the Range minimum base address */ - - ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.MinBaseAddress); - Buffer += 2; - - /* Set the Range maximum base address */ - - ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.MaxBaseAddress); - Buffer += 2; + Aml->Memory24.Information = (UINT8) + (Resource->Data.Memory24.ReadWriteAttribute & 0x01); - /* Set the base alignment */ - - ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.Alignment); - Buffer += 2; - - /* Set the range length */ + /* + * Set the following contiguous fields in the AML descriptor: + * Minimum Base Address + * Maximum Base Address + * Address Base Alignment + * Range Length + */ + AcpiRsMoveData (&Aml->Memory24.Minimum, + &Resource->Data.Memory24.Minimum, 4, ACPI_MOVE_TYPE_32_TO_16); - ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.RangeLength); - Buffer += 2; + /* Complete the AML descriptor header */ - /* Return the number of bytes consumed in this operation */ - - *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer); + AcpiRsSetResourceHeader (ACPI_RESOURCE_NAME_MEMORY24, + sizeof (AML_RESOURCE_MEMORY24), Aml); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsMemory32RangeResource + * FUNCTION: AcpiRsGetMemory32 * - * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream - * BytesConsumed - Pointer to where the number of bytes - * consumed the ByteStreamBuffer is - * returned - * OutputBuffer - Pointer to the return data buffer - * StructureSize - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * AmlResourceLength - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ ACPI_STATUS -AcpiRsMemory32RangeResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize) +AcpiRsGetMemory32 ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource) { - UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; - UINT16 Temp16 = 0; - UINT8 Temp8 = 0; - ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE ( - ACPI_RESOURCE_MEM32); + ACPI_FUNCTION_TRACE ("RsGetMemory32"); - ACPI_FUNCTION_TRACE ("RsMemory32RangeResource"); - - - /* Point past the Descriptor to get the number of bytes consumed */ + /* Get the Read/Write bit */ - Buffer += 1; - - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - Buffer += 2; - *BytesConsumed = (ACPI_SIZE) Temp16 + 3; - - OutputStruct->Id = ACPI_RSTYPE_MEM32; + Resource->Data.Memory32.ReadWriteAttribute = + (Aml->Memory32.Information & 0x01); /* - * Point to the place in the output buffer where the data portion will - * begin. - * 1. Set the RESOURCE_DATA * Data to point to its own address, then - * 2. Set the pointer to the next address. - * - * NOTE: OutputStruct->Data is cast to UINT8, otherwise, this addition adds - * 4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(UINT8) + * Get the following contiguous fields from the AML descriptor: + * Minimum Base Address + * Maximum Base Address + * Address Base Alignment + * Range Length */ - - /* Check Byte 3 the Read/Write bit */ - - Temp8 = *Buffer; - Buffer += 1; - - OutputStruct->Data.Memory32.ReadWriteAttribute = Temp8 & 0x01; - - /* Get MinBaseAddress (Bytes 4-7) */ - - ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.MinBaseAddress, Buffer); - Buffer += 4; + AcpiRsMoveData (&Resource->Data.Memory32.Minimum, + &Aml->Memory32.Minimum, 4, ACPI_MOVE_TYPE_32_TO_32); - /* Get MaxBaseAddress (Bytes 8-11) */ - - ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.MaxBaseAddress, Buffer); - Buffer += 4; - - /* Get Alignment (Bytes 12-15) */ - - ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.Alignment, Buffer); - Buffer += 4; + /* Complete the resource header */ - /* Get RangeLength (Bytes 16-19) */ - - ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.RangeLength, Buffer); - - /* Set the Length parameter */ - - OutputStruct->Length = (UINT32) StructSize; - - /* Return the final size of the structure */ - - *StructureSize = StructSize; + Resource->Type = ACPI_RESOURCE_TYPE_MEMORY32; + Resource->Length = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEMORY32); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsFixedMemory32Resource + * FUNCTION: AcpiRsSetMemory32 * - * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream - * BytesConsumed - Pointer to where the number of bytes - * consumed the ByteStreamBuffer is - * returned - * OutputBuffer - Pointer to the return data buffer - * StructureSize - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ ACPI_STATUS -AcpiRsFixedMemory32Resource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize) +AcpiRsSetMemory32 ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml) { - UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; - UINT16 Temp16 = 0; - UINT8 Temp8 = 0; - ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE ( - ACPI_RESOURCE_FIXED_MEM32); - - - ACPI_FUNCTION_TRACE ("RsFixedMemory32Resource"); + ACPI_FUNCTION_TRACE ("RsSetMemory32"); - /* Point past the Descriptor to get the number of bytes consumed */ - - Buffer += 1; - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - - Buffer += 2; - *BytesConsumed = (ACPI_SIZE) Temp16 + 3; + /* Set the Information Byte */ - OutputStruct->Id = ACPI_RSTYPE_FIXED_MEM32; - - /* Check Byte 3 the Read/Write bit */ - - Temp8 = *Buffer; - Buffer += 1; - OutputStruct->Data.FixedMemory32.ReadWriteAttribute = Temp8 & 0x01; + Aml->Memory32.Information = (UINT8) + (Resource->Data.Memory32.ReadWriteAttribute & 0x01); - /* Get RangeBaseAddress (Bytes 4-7) */ - - ACPI_MOVE_32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeBaseAddress, - Buffer); - Buffer += 4; - - /* Get RangeLength (Bytes 8-11) */ + /* + * Set the following contiguous fields in the AML descriptor: + * Minimum Base Address + * Maximum Base Address + * Address Base Alignment + * Range Length + */ + AcpiRsMoveData (&Aml->Memory32.Minimum, + &Resource->Data.Memory32.Minimum, 4, ACPI_MOVE_TYPE_32_TO_32); - ACPI_MOVE_32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeLength, Buffer); - - /* Set the Length parameter */ + /* Complete the AML descriptor header */ - OutputStruct->Length = (UINT32) StructSize; - - /* Return the final size of the structure */ - - *StructureSize = StructSize; + AcpiRsSetResourceHeader (ACPI_RESOURCE_NAME_MEMORY32, + sizeof (AML_RESOURCE_MEMORY32), Aml); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsMemory32RangeStream + * FUNCTION: AcpiRsGetFixedMemory32 * - * PARAMETERS: LinkedList - Pointer to the resource linked list - * OutputBuffer - Pointer to the user's return buffer - * BytesConsumed - Pointer to where the number of bytes - * used in the OutputBuffer is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * AmlResourceLength - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ ACPI_STATUS -AcpiRsMemory32RangeStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed) +AcpiRsGetFixedMemory32 ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource) { - UINT8 *Buffer = *OutputBuffer; - UINT16 Temp16 = 0; - UINT8 Temp8 = 0; - - - ACPI_FUNCTION_TRACE ("RsMemory32RangeStream"); + ACPI_FUNCTION_TRACE ("RsGetFixedMemory32"); - /* The descriptor field is static */ - - *Buffer = 0x85; - Buffer += 1; - - /* The length field is static */ - - Temp16 = 0x11; + /* Get the Read/Write bit */ - ACPI_MOVE_16_TO_16 (Buffer, &Temp16); - Buffer += 2; - - /* Set the Information Byte */ - - Temp8 = (UINT8) (LinkedList->Data.Memory32.ReadWriteAttribute & 0x01); - *Buffer = Temp8; - Buffer += 1; - - /* Set the Range minimum base address */ + Resource->Data.FixedMemory32.ReadWriteAttribute = + (Aml->FixedMemory32.Information & 0x01); - ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.MinBaseAddress); - Buffer += 4; - - /* Set the Range maximum base address */ - - ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.MaxBaseAddress); - Buffer += 4; - - /* Set the base alignment */ + /* + * Get the following contiguous fields from the AML descriptor: + * Base Address + * Range Length + */ + ACPI_MOVE_32_TO_32 (&Resource->Data.FixedMemory32.Address, + &Aml->FixedMemory32.Address); + ACPI_MOVE_32_TO_32 (&Resource->Data.FixedMemory32.AddressLength, + &Aml->FixedMemory32.AddressLength); - ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.Alignment); - Buffer += 4; - - /* Set the range length */ + /* Complete the resource header */ - ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.RangeLength); - Buffer += 4; - - /* Return the number of bytes consumed in this operation */ - - *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer); + Resource->Type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; + Resource->Length = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEMORY32); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsFixedMemory32Stream + * FUNCTION: AcpiRsSetFixedMemory32 * - * PARAMETERS: LinkedList - Pointer to the resource linked list - * OutputBuffer - Pointer to the user's return buffer - * BytesConsumed - Pointer to where the number of bytes - * used in the OutputBuffer is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ ACPI_STATUS -AcpiRsFixedMemory32Stream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed) +AcpiRsSetFixedMemory32 ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml) { - UINT8 *Buffer = *OutputBuffer; - UINT16 Temp16 = 0; - UINT8 Temp8 = 0; - - - ACPI_FUNCTION_TRACE ("RsFixedMemory32Stream"); + ACPI_FUNCTION_TRACE ("RsSetFixedMemory32"); - /* The descriptor field is static */ - - *Buffer = 0x86; - Buffer += 1; - - /* The length field is static */ - - Temp16 = 0x09; - - ACPI_MOVE_16_TO_16 (Buffer, &Temp16); - Buffer += 2; - /* Set the Information Byte */ - Temp8 = (UINT8) (LinkedList->Data.FixedMemory32.ReadWriteAttribute & 0x01); - *Buffer = Temp8; - Buffer += 1; - - /* Set the Range base address */ - - ACPI_MOVE_32_TO_32 (Buffer, - &LinkedList->Data.FixedMemory32.RangeBaseAddress); - Buffer += 4; + Aml->FixedMemory32.Information = (UINT8) + (Resource->Data.FixedMemory32.ReadWriteAttribute & 0x01); - /* Set the range length */ + /* + * Set the following contiguous fields in the AML descriptor: + * Base Address + * Range Length + */ + ACPI_MOVE_32_TO_32 (&Aml->FixedMemory32.Address, + &Resource->Data.FixedMemory32.Address); + ACPI_MOVE_32_TO_32 (&Aml->FixedMemory32.AddressLength, + &Resource->Data.FixedMemory32.AddressLength); - ACPI_MOVE_32_TO_32 (Buffer, - &LinkedList->Data.FixedMemory32.RangeLength); - Buffer += 4; + /* Complete the AML descriptor header */ - /* Return the number of bytes consumed in this operation */ - - *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer); + AcpiRsSetResourceHeader (ACPI_RESOURCE_NAME_FIXED_MEMORY32, + sizeof (AML_RESOURCE_FIXED_MEMORY32), Aml); return_ACPI_STATUS (AE_OK); }
--- a/usr/src/uts/i86pc/io/acpica/resources/rsmisc.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/resources/rsmisc.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsmisc - Miscellaneous resource descriptors - * $Revision: 29 $ + * $Revision: 1.34 $ * ******************************************************************************/ @@ -125,531 +125,466 @@ /******************************************************************************* * - * FUNCTION: AcpiRsEndTagResource + * FUNCTION: AcpiRsGetGenericReg * - * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream - * BytesConsumed - Pointer to where the number of bytes - * consumed the ByteStreamBuffer is - * returned - * OutputBuffer - Pointer to the return data buffer - * StructureSize - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * AmlResourceLength - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ ACPI_STATUS -AcpiRsEndTagResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize) +AcpiRsGetGenericReg ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource) { - ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; - ACPI_SIZE StructSize = ACPI_RESOURCE_LENGTH; + ACPI_FUNCTION_TRACE ("RsGetGenericReg"); - ACPI_FUNCTION_TRACE ("RsEndTagResource"); + /* + * Get the following fields from the AML descriptor: + * Address Space ID + * Register Bit Width + * Register Bit Offset + * Access Size + * Register Address + */ + Resource->Data.GenericReg.SpaceId = Aml->GenericReg.AddressSpaceId; + Resource->Data.GenericReg.BitWidth = Aml->GenericReg.BitWidth; + Resource->Data.GenericReg.BitOffset = Aml->GenericReg.BitOffset; + Resource->Data.GenericReg.AccessSize = Aml->GenericReg.AccessSize; + ACPI_MOVE_64_TO_64 (&Resource->Data.GenericReg.Address, + &Aml->GenericReg.Address); + + /* Complete the resource header */ + + Resource->Type = ACPI_RESOURCE_TYPE_GENERIC_REGISTER; + Resource->Length = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_GENERIC_REGISTER); + return_ACPI_STATUS (AE_OK); +} - /* The number of bytes consumed is static */ - - *BytesConsumed = 2; +/******************************************************************************* + * + * FUNCTION: AcpiRsSetGenericReg + * + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. + * + ******************************************************************************/ - /* Fill out the structure */ - - OutputStruct->Id = ACPI_RSTYPE_END_TAG; +ACPI_STATUS +AcpiRsSetGenericReg ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml) +{ + ACPI_FUNCTION_TRACE ("RsSetGenericReg"); - /* Set the Length parameter */ - - OutputStruct->Length = 0; - /* Return the final size of the structure */ + /* + * Set the following fields in the AML descriptor: + * Address Space ID + * Register Bit Width + * Register Bit Offset + * Access Size + * Register Address + */ + Aml->GenericReg.AddressSpaceId = (UINT8) Resource->Data.GenericReg.SpaceId; + Aml->GenericReg.BitWidth = (UINT8) Resource->Data.GenericReg.BitWidth; + Aml->GenericReg.BitOffset = (UINT8) Resource->Data.GenericReg.BitOffset; + Aml->GenericReg.AccessSize = (UINT8) Resource->Data.GenericReg.AccessSize; + ACPI_MOVE_64_TO_64 (&Aml->GenericReg.Address, + &Resource->Data.GenericReg.Address); - *StructureSize = StructSize; + /* Complete the AML descriptor header */ + + AcpiRsSetResourceHeader (ACPI_RESOURCE_NAME_GENERIC_REGISTER, + sizeof (AML_RESOURCE_GENERIC_REGISTER), Aml); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsEndTagStream + * FUNCTION: AcpiRsGetVendor * - * PARAMETERS: LinkedList - Pointer to the resource linked list - * OutputBuffer - Pointer to the user's return buffer - * BytesConsumed - Pointer to where the number of bytes - * used in the OutputBuffer is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * AmlResourceLength - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ ACPI_STATUS -AcpiRsEndTagStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed) +AcpiRsGetVendor ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource) { - UINT8 *Buffer = *OutputBuffer; - UINT8 Temp8 = 0; + UINT8 *AmlByteData; - ACPI_FUNCTION_TRACE ("RsEndTagStream"); + ACPI_FUNCTION_TRACE ("RsGetVendor"); - /* The descriptor field is static */ + /* Determine if this is a large or small vendor specific item */ + + if (Aml->LargeHeader.DescriptorType & ACPI_RESOURCE_NAME_LARGE) + { + /* Large item, Point to the first vendor byte */ - *Buffer = 0x79; - Buffer += 1; + AmlByteData = ((UINT8 *) Aml) + sizeof (AML_RESOURCE_LARGE_HEADER); + } + else + { + /* Small item, Point to the first vendor byte */ + + AmlByteData = ((UINT8 *) Aml) + sizeof (AML_RESOURCE_SMALL_HEADER); + } + + /* Copy the vendor-specific bytes */ + + ACPI_MEMCPY (Resource->Data.Vendor.ByteData, + AmlByteData, AmlResourceLength); + Resource->Data.Vendor.ByteLength = AmlResourceLength; /* - * Set the Checksum - zero means that the resource data is treated as if - * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8) + * In order for the StructSize to fall on a 32-bit boundary, + * calculate the length of the vendor string and expand the + * StructSize to the next 32-bit boundary. */ - Temp8 = 0; - - *Buffer = Temp8; - Buffer += 1; - - /* Return the number of bytes consumed in this operation */ - - *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer); + Resource->Type = ACPI_RESOURCE_TYPE_VENDOR; + Resource->Length = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR) + + ACPI_ROUND_UP_TO_32BITS (AmlResourceLength); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsVendorResource + * FUNCTION: AcpiRsSetVendor * - * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream - * BytesConsumed - Pointer to where the number of bytes - * consumed the ByteStreamBuffer is - * returned - * OutputBuffer - Pointer to the return data buffer - * StructureSize - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ ACPI_STATUS -AcpiRsVendorResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize) +AcpiRsSetVendor ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml) { - UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; - UINT16 Temp16 = 0; - UINT8 Temp8 = 0; - UINT8 Index; - ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE ( - ACPI_RESOURCE_VENDOR); + UINT32 ResourceLength; + UINT8 *Source; + UINT8 *Destination; - ACPI_FUNCTION_TRACE ("RsVendorResource"); + ACPI_FUNCTION_TRACE ("RsSetVendor"); - /* Dereference the Descriptor to find if this is a large or small item. */ - - Temp8 = *Buffer; + ResourceLength = Resource->Data.Vendor.ByteLength; + Source = ACPI_CAST_PTR (UINT8, Resource->Data.Vendor.ByteData); - if (Temp8 & 0x80) - { - /* Large Item, point to the length field */ - - Buffer += 1; + /* Length determines if this is a large or small resource */ - /* Dereference */ - - ACPI_MOVE_16_TO_16 (&Temp16, Buffer); - - /* Calculate bytes consumed */ + if (ResourceLength > 7) + { + /* Large item, get pointer to the data part of the descriptor */ - *BytesConsumed = (ACPI_SIZE) Temp16 + 3; + Destination = ((UINT8 *) Aml) + sizeof (AML_RESOURCE_LARGE_HEADER); - /* Point to the first vendor byte */ + /* Complete the AML descriptor header */ - Buffer += 2; + AcpiRsSetResourceHeader (ACPI_RESOURCE_NAME_VENDOR_LARGE, + (UINT32) (ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER)), Aml); } else { - /* Small Item, dereference the size */ + /* Small item, get pointer to the data part of the descriptor */ - Temp16 = (UINT8)(*Buffer & 0x07); - - /* Calculate bytes consumed */ + Destination = ((UINT8 *) Aml) + sizeof (AML_RESOURCE_SMALL_HEADER); - *BytesConsumed = (ACPI_SIZE) Temp16 + 1; + /* Complete the AML descriptor header */ - /* Point to the first vendor byte */ - - Buffer += 1; + AcpiRsSetResourceHeader (ACPI_RESOURCE_NAME_VENDOR_SMALL, + (UINT32) (ResourceLength + sizeof (AML_RESOURCE_SMALL_HEADER)), Aml); } - OutputStruct->Id = ACPI_RSTYPE_VENDOR; - OutputStruct->Data.VendorSpecific.Length = Temp16; - - for (Index = 0; Index < Temp16; Index++) - { - OutputStruct->Data.VendorSpecific.Reserved[Index] = *Buffer; - Buffer += 1; - } + /* Copy the vendor-specific bytes */ - /* - * In order for the StructSize to fall on a 32-bit boundary, - * calculate the length of the vendor string and expand the - * StructSize to the next 32-bit boundary. - */ - StructSize += ACPI_ROUND_UP_TO_32BITS (Temp16); - - /* Set the Length parameter */ - - OutputStruct->Length = (UINT32) StructSize; - - /* Return the final size of the structure */ - - *StructureSize = StructSize; + ACPI_MEMCPY (Destination, Source, ResourceLength); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsVendorStream + * FUNCTION: AcpiRsGetStartDpf * - * PARAMETERS: LinkedList - Pointer to the resource linked list - * OutputBuffer - Pointer to the user's return buffer - * BytesConsumed - Pointer to where the number of bytes - * used in the OutputBuffer is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * AmlResourceLength - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ ACPI_STATUS -AcpiRsVendorStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed) +AcpiRsGetStartDpf ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource) { - UINT8 *Buffer = *OutputBuffer; - UINT16 Temp16 = 0; - UINT8 Temp8 = 0; - UINT8 Index; - - - ACPI_FUNCTION_TRACE ("RsVendorStream"); - - - /* Dereference the length to find if this is a large or small item. */ - - if(LinkedList->Data.VendorSpecific.Length > 7) - { - /* Large Item, Set the descriptor field and length bytes */ - - *Buffer = 0x84; - Buffer += 1; - - Temp16 = (UINT16) LinkedList->Data.VendorSpecific.Length; - - ACPI_MOVE_16_TO_16 (Buffer, &Temp16); - Buffer += 2; - } - else - { - /* Small Item, Set the descriptor field */ - - Temp8 = 0x70; - Temp8 |= (UINT8) LinkedList->Data.VendorSpecific.Length; - - *Buffer = Temp8; - Buffer += 1; - } - - /* Loop through all of the Vendor Specific fields */ - - for (Index = 0; Index < LinkedList->Data.VendorSpecific.Length; Index++) - { - Temp8 = LinkedList->Data.VendorSpecific.Reserved[Index]; - - *Buffer = Temp8; - Buffer += 1; - } - - /* Return the number of bytes consumed in this operation */ - - *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer); - return_ACPI_STATUS (AE_OK); -} + ACPI_FUNCTION_TRACE ("RsGetStartDpf"); -/******************************************************************************* - * - * FUNCTION: AcpiRsStartDependFnsResource - * - * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream - * BytesConsumed - Pointer to where the number of bytes - * consumed the ByteStreamBuffer is - * returned - * OutputBuffer - Pointer to the return data buffer - * StructureSize - Pointer to where the number of bytes - * in the return data struct is returned - * - * RETURN: Status - * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. - * - ******************************************************************************/ + /* Get the flags byte if present */ -ACPI_STATUS -AcpiRsStartDependFnsResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize) -{ - UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; - UINT8 Temp8 = 0; - ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE ( - ACPI_RESOURCE_START_DPF); - - - ACPI_FUNCTION_TRACE ("RsStartDependFnsResource"); - - - /* The number of bytes consumed are found in the descriptor (Bits:0-1) */ + if (AmlResourceLength == 1) + { + /* Get the Compatibility priority */ - Temp8 = *Buffer; - - *BytesConsumed = (Temp8 & 0x01) + 1; - - OutputStruct->Id = ACPI_RSTYPE_START_DPF; - - /* Point to Byte 1 if it is used */ + Resource->Data.StartDpf.CompatibilityPriority = + (Aml->StartDpf.Flags & 0x03); - if (2 == *BytesConsumed) - { - Buffer += 1; - Temp8 = *Buffer; - - /* Check Compatibility priority */ - - OutputStruct->Data.StartDpf.CompatibilityPriority = Temp8 & 0x03; - - if (3 == OutputStruct->Data.StartDpf.CompatibilityPriority) + if (Resource->Data.StartDpf.CompatibilityPriority >= 3) { return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); } - /* Check Performance/Robustness preference */ + /* Get the Performance/Robustness preference */ - OutputStruct->Data.StartDpf.PerformanceRobustness = (Temp8 >> 2) & 0x03; + Resource->Data.StartDpf.PerformanceRobustness = + ((Aml->StartDpf.Flags >> 2) & 0x03); - if (3 == OutputStruct->Data.StartDpf.PerformanceRobustness) + if (Resource->Data.StartDpf.PerformanceRobustness >= 3) { return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); } } else { - OutputStruct->Data.StartDpf.CompatibilityPriority = + /* StartDependentNoPri(), no flags byte, set defaults */ + + Resource->Data.StartDpf.CompatibilityPriority = ACPI_ACCEPTABLE_CONFIGURATION; - OutputStruct->Data.StartDpf.PerformanceRobustness = + Resource->Data.StartDpf.PerformanceRobustness = ACPI_ACCEPTABLE_CONFIGURATION; } - /* Set the Length parameter */ - - OutputStruct->Length = (UINT32) StructSize; + /* Complete the resource header */ - /* Return the final size of the structure */ - - *StructureSize = StructSize; + Resource->Type = ACPI_RESOURCE_TYPE_START_DEPENDENT; + Resource->Length = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_START_DEPENDENT); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsEndDependFnsResource + * FUNCTION: AcpiRsSetStartDpf * - * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream - * BytesConsumed - Pointer to where the number of bytes - * consumed the ByteStreamBuffer is - * returned - * OutputBuffer - Pointer to the return data buffer - * StructureSize - Pointer to where the number of bytes - * in the return data struct is returned + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned * * RETURN: Status * - * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. * ******************************************************************************/ ACPI_STATUS -AcpiRsEndDependFnsResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize) +AcpiRsSetStartDpf ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml) { - ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; - ACPI_SIZE StructSize = ACPI_RESOURCE_LENGTH; - - - ACPI_FUNCTION_TRACE ("RsEndDependFnsResource"); + ACPI_FUNCTION_TRACE ("RsSetStartDpf"); - /* The number of bytes consumed is static */ - - *BytesConsumed = 1; - - /* Fill out the structure */ - - OutputStruct->Id = ACPI_RSTYPE_END_DPF; + /* + * The descriptor type field is set based upon whether a byte is needed + * to contain Priority data. + */ + if (ACPI_ACCEPTABLE_CONFIGURATION == + Resource->Data.StartDpf.CompatibilityPriority && + ACPI_ACCEPTABLE_CONFIGURATION == + Resource->Data.StartDpf.PerformanceRobustness) + { + AcpiRsSetResourceHeader (ACPI_RESOURCE_NAME_START_DEPENDENT, + sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO), Aml); + } + else + { + AcpiRsSetResourceHeader (ACPI_RESOURCE_NAME_START_DEPENDENT, + sizeof (AML_RESOURCE_START_DEPENDENT), Aml); - /* Set the Length parameter */ - - OutputStruct->Length = (UINT32) StructSize; + /* Set the Flags byte */ - /* Return the final size of the structure */ - - *StructureSize = StructSize; + Aml->StartDpf.Flags = (UINT8) + (((Resource->Data.StartDpf.PerformanceRobustness & 0x03) << 2) | + (Resource->Data.StartDpf.CompatibilityPriority & 0x03)); + } return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsStartDependFnsStream + * FUNCTION: AcpiRsGetEndDpf * - * PARAMETERS: LinkedList - Pointer to the resource linked list - * OutputBuffer - Pointer to the user's return buffer - * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes of the - * OutputBuffer used + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * AmlResourceLength - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ ACPI_STATUS -AcpiRsStartDependFnsStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed) +AcpiRsGetEndDpf ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource) { - UINT8 *Buffer = *OutputBuffer; - UINT8 Temp8 = 0; + ACPI_FUNCTION_TRACE ("RsGetEndDpf"); - ACPI_FUNCTION_TRACE ("RsStartDependFnsStream"); + /* Complete the resource header */ + + Resource->Type = ACPI_RESOURCE_TYPE_END_DEPENDENT; + Resource->Length = (UINT32) ACPI_RESOURCE_LENGTH; + return_ACPI_STATUS (AE_OK); +} - /* - * The descriptor field is set based upon whether a byte is needed - * to contain Priority data. - */ - if (ACPI_ACCEPTABLE_CONFIGURATION == - LinkedList->Data.StartDpf.CompatibilityPriority && - ACPI_ACCEPTABLE_CONFIGURATION == - LinkedList->Data.StartDpf.PerformanceRobustness) - { - *Buffer = 0x30; - } - else - { - *Buffer = 0x31; - Buffer += 1; +/******************************************************************************* + * + * FUNCTION: AcpiRsSetEndDpf + * + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. + * + ******************************************************************************/ - /* Set the Priority Byte Definition */ +ACPI_STATUS +AcpiRsSetEndDpf ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml) +{ + ACPI_FUNCTION_TRACE ("RsSetEndDpf"); - Temp8 = 0; - Temp8 = (UINT8) ((LinkedList->Data.StartDpf.PerformanceRobustness & - 0x03) << 2); - Temp8 |= (LinkedList->Data.StartDpf.CompatibilityPriority & - 0x03); - *Buffer = Temp8; - } + + /* Complete the AML descriptor header */ - Buffer += 1; - - /* Return the number of bytes consumed in this operation */ - - *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer); + AcpiRsSetResourceHeader (ACPI_RESOURCE_NAME_END_DEPENDENT, + sizeof (AML_RESOURCE_END_DEPENDENT), Aml); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiRsEndDependFnsStream + * FUNCTION: AcpiRsGetEndTag * - * PARAMETERS: LinkedList - Pointer to the resource linked list - * OutputBuffer - Pointer to the user's return buffer - * BytesConsumed - Pointer to where the number of bytes - * used in the OutputBuffer is returned + * PARAMETERS: Aml - Pointer to the AML resource descriptor + * AmlResourceLength - Length of the resource from the AML header + * Resource - Where the internal resource is returned * * RETURN: Status * - * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding + * internal resource descriptor, simplifying bitflags and handling + * alignment and endian issues if necessary. * ******************************************************************************/ ACPI_STATUS -AcpiRsEndDependFnsStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed) +AcpiRsGetEndTag ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource) { - UINT8 *Buffer = *OutputBuffer; + ACPI_FUNCTION_TRACE ("RsGetEndTag"); - ACPI_FUNCTION_TRACE ("RsEndDependFnsStream"); - - - /* The descriptor field is static */ + /* Complete the resource header */ - *Buffer = 0x38; - Buffer += 1; - - /* Return the number of bytes consumed in this operation */ - - *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer); + Resource->Type = ACPI_RESOURCE_TYPE_END_TAG; + Resource->Length = ACPI_RESOURCE_LENGTH; return_ACPI_STATUS (AE_OK); } + +/******************************************************************************* + * + * FUNCTION: AcpiRsSetEndTag + * + * PARAMETERS: Resource - Pointer to the resource descriptor + * Aml - Where the AML descriptor is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert an internal resource descriptor to the corresponding + * external AML resource descriptor. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiRsSetEndTag ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml) +{ + ACPI_FUNCTION_TRACE ("RsSetEndTag"); + + + /* + * Set the Checksum - zero means that the resource data is treated as if + * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8) + */ + Aml->EndTag.Checksum = 0; + + /* Complete the AML descriptor header */ + + AcpiRsSetResourceHeader (ACPI_RESOURCE_NAME_END_TAG, + sizeof (AML_RESOURCE_END_TAG), Aml); + return_ACPI_STATUS (AE_OK); +} + +
--- a/usr/src/uts/i86pc/io/acpica/resources/rsutils.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/resources/rsutils.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsutils - Utilities for the resource manager - * $Revision: 45 $ + * $Revision: 1.48 $ * ******************************************************************************/ @@ -128,6 +128,494 @@ /******************************************************************************* * + * FUNCTION: AcpiRsMoveData + * + * PARAMETERS: Destination - Pointer to the destination descriptor + * Source - Pointer to the source descriptor + * ItemCount - How many items to move + * MoveType - Byte width + * + * RETURN: None + * + * DESCRIPTION: Move multiple data items from one descriptor to another. Handles + * alignment issues and endian issues if necessary, as configured + * via the ACPI_MOVE_* macros. (This is why a memcpy is not used) + * + ******************************************************************************/ + +void +AcpiRsMoveData ( + void *Destination, + void *Source, + UINT16 ItemCount, + UINT8 MoveType) +{ + ACPI_NATIVE_UINT i; + + + /* One move per item */ + + for (i = 0; i < ItemCount; i++) + { + switch (MoveType) + { + case ACPI_MOVE_TYPE_16_TO_32: + ACPI_MOVE_16_TO_32 (&((UINT32 *) Destination)[i], + &((UINT16 *) Source)[i]); + break; + + case ACPI_MOVE_TYPE_32_TO_16: + ACPI_MOVE_32_TO_16 (&((UINT16 *) Destination)[i], + &((UINT32 *) Source)[i]); + break; + + case ACPI_MOVE_TYPE_32_TO_32: + ACPI_MOVE_32_TO_32 (&((UINT32 *) Destination)[i], + &((UINT32 *) Source)[i]); + break; + + case ACPI_MOVE_TYPE_64_TO_64: + ACPI_MOVE_64_TO_64 (&((UINT64 *) Destination)[i], + &((UINT64 *) Source)[i]); + break; + + default: + return; + } + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsGetResourceInfo + * + * PARAMETERS: ResourceType - Byte 0 of a resource descriptor + * + * RETURN: Pointer to the resource conversion handler + * + * DESCRIPTION: Extract the Resource Type/Name from the first byte of + * a resource descriptor. + * + ******************************************************************************/ + +ACPI_RESOURCE_INFO * +AcpiRsGetResourceInfo ( + UINT8 ResourceType) +{ + ACPI_RESOURCE_INFO *SizeInfo; + + + ACPI_FUNCTION_ENTRY (); + + + /* Determine if this is a small or large resource */ + + if (ResourceType & ACPI_RESOURCE_NAME_LARGE) + { + /* Large Resource Type -- bits 6:0 contain the name */ + + if (ResourceType > ACPI_RESOURCE_NAME_LARGE_MAX) + { + return (NULL); + } + + SizeInfo = &AcpiGbl_LgResourceInfo [ + (ResourceType & ACPI_RESOURCE_NAME_LARGE_MASK)]; + } + else + { + /* Small Resource Type -- bits 6:3 contain the name */ + + SizeInfo = &AcpiGbl_SmResourceInfo [ + ((ResourceType & ACPI_RESOURCE_NAME_SMALL_MASK) >> 3)]; + } + + /* Zero entry indicates an invalid resource type */ + + if (!SizeInfo->MinimumInternalStructLength) + { + return (NULL); + } + + return (SizeInfo); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsGetResourceLength + * + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor + * + * RETURN: Byte Length + * + * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By + * definition, this does not include the size of the descriptor + * header or the length field itself. + * + ******************************************************************************/ + +UINT16 +AcpiRsGetResourceLength ( + AML_RESOURCE *Aml) +{ + UINT16 ResourceLength; + + + ACPI_FUNCTION_ENTRY (); + + + /* Determine if this is a small or large resource */ + + if (Aml->LargeHeader.DescriptorType & ACPI_RESOURCE_NAME_LARGE) + { + /* Large Resource type -- bytes 1-2 contain the 16-bit length */ + + ACPI_MOVE_16_TO_16 (&ResourceLength, &Aml->LargeHeader.ResourceLength); + + } + else + { + /* Small Resource type -- bits 2:0 of byte 0 contain the length */ + + ResourceLength = (UINT16) (Aml->SmallHeader.DescriptorType & + ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); + } + + return (ResourceLength); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsGetDescriptorLength + * + * PARAMETERS: Aml - Pointer to the raw AML resource descriptor + * + * RETURN: Byte length + * + * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the + * length of the descriptor header and the length field itself. + * Used to walk descriptor lists. + * + ******************************************************************************/ + +UINT32 +AcpiRsGetDescriptorLength ( + AML_RESOURCE *Aml) +{ + UINT32 DescriptorLength; + + + ACPI_FUNCTION_ENTRY (); + + + /* Determine if this is a small or large resource */ + + if (Aml->LargeHeader.DescriptorType & ACPI_RESOURCE_NAME_LARGE) + { + /* Large Resource type -- bytes 1-2 contain the 16-bit length */ + + ACPI_MOVE_16_TO_32 (&DescriptorLength, &Aml->LargeHeader.ResourceLength); + DescriptorLength += sizeof (AML_RESOURCE_LARGE_HEADER); + + } + else + { + /* Small Resource type -- bits 2:0 of byte 0 contain the length */ + + DescriptorLength = (UINT32) (Aml->SmallHeader.DescriptorType & + ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK); + DescriptorLength += sizeof (AML_RESOURCE_SMALL_HEADER); + } + + return (DescriptorLength); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsSetResourceHeader + * + * PARAMETERS: DescriptorType - Byte to be inserted as the type + * TotalLength - Length of the AML descriptor, including + * the header and length fields. + * Aml - Pointer to the raw AML descriptor + * + * RETURN: None + * + * DESCRIPTION: Set the DescriptorType and ResourceLength fields of an AML + * resource descriptor, both Large and Small descriptors are + * supported automatically + * + ******************************************************************************/ + +void +AcpiRsSetResourceHeader ( + UINT8 DescriptorType, + ACPI_SIZE TotalLength, + AML_RESOURCE *Aml) +{ + UINT16 ResourceLength; + + + ACPI_FUNCTION_ENTRY (); + + + /* Set the descriptor type */ + + Aml->SmallHeader.DescriptorType = DescriptorType; + + /* Determine if this is a small or large resource */ + + if (Aml->SmallHeader.DescriptorType & ACPI_RESOURCE_NAME_LARGE) + { + /* Large Resource type -- bytes 1-2 contain the 16-bit length */ + + ResourceLength = (UINT16) (TotalLength - sizeof (AML_RESOURCE_LARGE_HEADER)); + + /* Insert length into the Large descriptor length field */ + + ACPI_MOVE_16_TO_16 (&Aml->LargeHeader.ResourceLength, &ResourceLength); + } + else + { + /* Small Resource type -- bits 2:0 of byte 0 contain the length */ + + ResourceLength = (UINT16) (TotalLength - sizeof (AML_RESOURCE_SMALL_HEADER)); + + /* Insert length into the descriptor type byte */ + + Aml->SmallHeader.DescriptorType |= (UINT8) ResourceLength; + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsGetResourceType + * + * PARAMETERS: ResourceType - Byte 0 of a resource descriptor + * + * RETURN: The Resource Type with no extraneous bits (except the + * Large/Small descriptor bit -- this is left alone) + * + * DESCRIPTION: Extract the Resource Type/Name from the first byte of + * a resource descriptor. + * + ******************************************************************************/ + +UINT8 +AcpiRsGetResourceType ( + UINT8 ResourceType) +{ + ACPI_FUNCTION_ENTRY (); + + + /* Determine if this is a small or large resource */ + + if (ResourceType & ACPI_RESOURCE_NAME_LARGE) + { + /* Large Resource Type -- bits 6:0 contain the name */ + + return (ResourceType); + } + else + { + /* Small Resource Type -- bits 6:3 contain the name */ + + return ((UINT8) (ResourceType & ACPI_RESOURCE_NAME_SMALL_MASK)); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsStrcpy + * + * PARAMETERS: Destination - Pointer to the destination string + * Source - Pointer to the source string + * + * RETURN: String length, including NULL terminator + * + * DESCRIPTION: Local string copy that returns the string length, saving a + * strcpy followed by a strlen. + * + ******************************************************************************/ + +static UINT16 +AcpiRsStrcpy ( + char *Destination, + char *Source) +{ + UINT16 i; + + + ACPI_FUNCTION_ENTRY (); + + + for (i = 0; Source[i]; i++) + { + Destination[i] = Source[i]; + } + + Destination[i] = 0; + + /* Return string length including the NULL terminator */ + + return ((UINT16) (i + 1)); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsGetResourceSource + * + * PARAMETERS: ResourceLength - Length field of the descriptor + * MinimumLength - Minimum length of the descriptor (minus + * any optional fields) + * ResourceSource - Where the ResourceSource is returned + * Aml - Pointer to the raw AML descriptor + * StringPtr - (optional) where to store the actual + * ResourceSource string + * + * RETURN: Length of the string plus NULL terminator, rounded up to 32 bit + * + * DESCRIPTION: Copy the optional ResourceSource data from a raw AML descriptor + * to an internal resource descriptor + * + ******************************************************************************/ + +UINT16 +AcpiRsGetResourceSource ( + UINT16 ResourceLength, + ACPI_SIZE MinimumLength, + ACPI_RESOURCE_SOURCE *ResourceSource, + AML_RESOURCE *Aml, + char *StringPtr) +{ + ACPI_SIZE TotalLength; + UINT8 *AmlResourceSource; + + + ACPI_FUNCTION_ENTRY (); + + + TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER); + AmlResourceSource = ((UINT8 *) Aml) + MinimumLength; + + /* + * ResourceSource is present if the length of the descriptor is longer than + * the minimum length. + * + * Note: Some resource descriptors will have an additional null, so + * we add 1 to the minimum length. + */ + if (TotalLength > (MinimumLength + 1)) + { + /* Get the ResourceSourceIndex */ + + ResourceSource->Index = AmlResourceSource[0]; + + ResourceSource->StringPtr = StringPtr; + if (!StringPtr) + { + /* + * String destination pointer is not specified; Set the String + * pointer to the end of the current ResourceSource structure. + */ + ResourceSource->StringPtr = (char *) + ((UINT8 *) ResourceSource) + sizeof (ACPI_RESOURCE_SOURCE); + } + + /* Copy the ResourceSource string to the destination */ + + ResourceSource->StringLength = AcpiRsStrcpy (ResourceSource->StringPtr, + (char *) &AmlResourceSource[1]); + + /* + * In order for the StructSize to fall on a 32-bit boundary, + * calculate the length of the string and expand the + * StructSize to the next 32-bit boundary. + */ + return ((UINT16) ACPI_ROUND_UP_TO_32BITS (ResourceSource->StringLength)); + } + else + { + /* ResourceSource is not present */ + + ResourceSource->Index = 0; + ResourceSource->StringLength = 0; + ResourceSource->StringPtr = NULL; + return (0); + } +} + +/******************************************************************************* + * + * FUNCTION: AcpiRsSetResourceSource + * + * PARAMETERS: Aml - Pointer to the raw AML descriptor + * MinimumLength - Minimum length of the descriptor (minus + * any optional fields) + * ResourceSource - Internal ResourceSource + + * + * RETURN: Total length of the AML descriptor + * + * DESCRIPTION: Convert an optoinal ResourceSource from internal format to a + * raw AML resource descriptor + * + ******************************************************************************/ + +ACPI_SIZE +AcpiRsSetResourceSource ( + AML_RESOURCE *Aml, + ACPI_SIZE MinimumLength, + ACPI_RESOURCE_SOURCE *ResourceSource) +{ + UINT8 *AmlResourceSource; + ACPI_SIZE DescriptorLength; + + + ACPI_FUNCTION_ENTRY (); + + + DescriptorLength = MinimumLength; + + /* Non-zero string length indicates presence of a ResourceSource */ + + if (ResourceSource->StringLength) + { + /* Point to the end of the AML descriptor */ + + AmlResourceSource = ((UINT8 *) Aml) + MinimumLength; + + /* Copy the ResourceSourceIndex */ + + AmlResourceSource[0] = (UINT8) ResourceSource->Index; + + /* Copy the ResourceSource string */ + + ACPI_STRCPY ((char *) &AmlResourceSource[1], + ResourceSource->StringPtr); + + /* + * Add the length of the string (+ 1 for null terminator) to the + * final descriptor length + */ + DescriptorLength += ((ACPI_SIZE) ResourceSource->StringLength + 1); + } + + /* Return the new total length of the AML descriptor */ + + return (DescriptorLength); +} + + +/******************************************************************************* + * * FUNCTION: AcpiRsGetPrtMethodData * * PARAMETERS: Handle - a handle to the containing object @@ -386,7 +874,7 @@ * Convert the linked list into a byte stream */ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiRsCreateByteStream (InBuffer->Pointer, &Buffer); + Status = AcpiRsCreateAmlResources (InBuffer->Pointer, &Buffer); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status);
--- a/usr/src/uts/i86pc/io/acpica/resources/rsxface.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/resources/rsxface.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsxface - Public interfaces to the resource manager - * $Revision: 33 $ + * $Revision: 1.36 $ * ******************************************************************************/ @@ -134,9 +134,9 @@ ACPI_COPY_FIELD(Out, In, MaxAddressFixed); \ ACPI_COPY_FIELD(Out, In, Attribute); \ ACPI_COPY_FIELD(Out, In, Granularity); \ - ACPI_COPY_FIELD(Out, In, MinAddressRange); \ - ACPI_COPY_FIELD(Out, In, MaxAddressRange); \ - ACPI_COPY_FIELD(Out, In, AddressTranslationOffset); \ + ACPI_COPY_FIELD(Out, In, Minimum); \ + ACPI_COPY_FIELD(Out, In, Maximum); \ + ACPI_COPY_FIELD(Out, In, TranslationOffset); \ ACPI_COPY_FIELD(Out, In, AddressLength); \ ACPI_COPY_FIELD(Out, In, ResourceSource); @@ -329,10 +329,10 @@ ACPI_STATUS AcpiWalkResources ( - ACPI_HANDLE DeviceHandle, - char *Path, - ACPI_WALK_RESOURCE_CALLBACK UserFunction, - void *Context) + ACPI_HANDLE DeviceHandle, + char *Path, + ACPI_WALK_RESOURCE_CALLBACK UserFunction, + void *Context) { ACPI_STATUS Status; ACPI_BUFFER Buffer = {ACPI_ALLOCATE_BUFFER, NULL}; @@ -366,7 +366,7 @@ for (;;) { - if (!Resource || Resource->Id == ACPI_RSTYPE_END_TAG) + if (!Resource || Resource->Type == ACPI_RESOURCE_TYPE_END_TAG) { break; } @@ -464,8 +464,8 @@ * * FUNCTION: AcpiResourceToAddress64 * - * PARAMETERS: resource - Pointer to a resource - * out - Pointer to the users's return + * PARAMETERS: Resource - Pointer to a resource + * Out - Pointer to the users's return * buffer (a struct * acpi_resource_address64) * @@ -487,29 +487,27 @@ ACPI_RESOURCE_ADDRESS32 *Address32; - switch (Resource->Id) { - case ACPI_RSTYPE_ADDRESS16: + switch (Resource->Type) + { + case ACPI_RESOURCE_TYPE_ADDRESS16: Address16 = (ACPI_RESOURCE_ADDRESS16 *) &Resource->Data; ACPI_COPY_ADDRESS (Out, Address16); break; - - case ACPI_RSTYPE_ADDRESS32: + case ACPI_RESOURCE_TYPE_ADDRESS32: Address32 = (ACPI_RESOURCE_ADDRESS32 *) &Resource->Data; ACPI_COPY_ADDRESS (Out, Address32); break; - - case ACPI_RSTYPE_ADDRESS64: + case ACPI_RESOURCE_TYPE_ADDRESS64: /* Simple copy for 64 bit source */ ACPI_MEMCPY (Out, &Resource->Data, sizeof (ACPI_RESOURCE_ADDRESS64)); break; - default: return (AE_BAD_PARAMETER); }
--- a/usr/src/uts/i86pc/io/acpica/tables/tbconvrt.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/tables/tbconvrt.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbconvrt - ACPI Table conversion utilities - * $Revision: 64 $ + * $Revision: 1.64 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/tables/tbget.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/tables/tbget.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbget - ACPI Table get* routines - * $Revision: 94 $ + * $Revision: 1.94 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/tables/tbgetall.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/tables/tbgetall.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbgetall - Get all required ACPI tables - * $Revision: 13 $ + * $Revision: 1.13 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/tables/tbinstal.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/tables/tbinstal.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbinstal - ACPI table installation and removal - * $Revision: 79 $ + * $Revision: 1.80 $ * *****************************************************************************/ @@ -203,9 +203,7 @@ * * RETURN: Status * - * DESCRIPTION: Load and validate all tables other than the RSDT. The RSDT must - * already be loaded and validated. - * Install the table into the global data structs. + * DESCRIPTION: Install the table into the global data structures. * ******************************************************************************/ @@ -215,6 +213,7 @@ { ACPI_STATUS Status; + ACPI_FUNCTION_TRACE ("TbInstallTable"); @@ -223,23 +222,35 @@ Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES); if (ACPI_FAILURE (Status)) { - ACPI_REPORT_ERROR (("Could not acquire table mutex for [%4.4s], %s\n", - TableInfo->Pointer->Signature, AcpiFormatException (Status))); + ACPI_REPORT_ERROR (("Could not acquire table mutex, %s\n", + AcpiFormatException (Status))); return_ACPI_STATUS (Status); } + /* + * Ignore a table that is already installed. For example, some BIOS + * ASL code will repeatedly attempt to load the same SSDT. + */ + Status = AcpiTbIsTableInstalled (TableInfo); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } + /* Install the table into the global data structure */ Status = AcpiTbInitTableDescriptor (TableInfo->Type, TableInfo); if (ACPI_FAILURE (Status)) { - ACPI_REPORT_ERROR (("Could not install ACPI table [%4.4s], %s\n", + ACPI_REPORT_ERROR (("Could not install table [%4.4s], %s\n", TableInfo->Pointer->Signature, AcpiFormatException (Status))); } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n", AcpiGbl_TableData[TableInfo->Type].Name, TableInfo->Pointer)); + +UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_ACPI_STATUS (Status); }
--- a/usr/src/uts/i86pc/io/acpica/tables/tbrsdt.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/tables/tbrsdt.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbrsdt - ACPI RSDT table utilities - * $Revision: 19 $ + * $Revision: 1.20 $ * *****************************************************************************/ @@ -360,7 +360,7 @@ } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "RSDP located at %p, points to RSDT physical=%8.8X%8.8X \n", + "RSDP located at %p, points to RSDT physical=%8.8X%8.8X\n", AcpiGbl_RSDP, ACPI_FORMAT_UINT64 (Address.Pointer.Value)));
--- a/usr/src/uts/i86pc/io/acpica/tables/tbutils.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/tables/tbutils.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbutils - Table manipulation utilities - * $Revision: 65 $ + * $Revision: 1.70 $ * *****************************************************************************/ @@ -135,6 +135,77 @@ /******************************************************************************* * + * FUNCTION: AcpiTbIsTableInstalled + * + * PARAMETERS: NewTableDesc - Descriptor for new table being installed + * + * RETURN: Status - AE_ALREADY_EXISTS if the table is already installed + * + * DESCRIPTION: Determine if an ACPI table is already installed + * + * MUTEX: Table data structures should be locked + * + ******************************************************************************/ + +ACPI_STATUS +AcpiTbIsTableInstalled ( + ACPI_TABLE_DESC *NewTableDesc) +{ + ACPI_TABLE_DESC *TableDesc; + + + ACPI_FUNCTION_TRACE ("TbIsTableInstalled"); + + + /* Get the list descriptor and first table descriptor */ + + TableDesc = AcpiGbl_TableLists[NewTableDesc->Type].Next; + + /* Examine all installed tables of this type */ + + while (TableDesc) + { + /* + * If the table lengths match, perform a full bytewise compare. This + * means that we will allow tables with duplicate OemTableId(s), as + * long as the tables are different in some way. + * + * Checking if the table has been loaded into the namespace means that + * we don't check for duplicate tables during the initial installation + * of tables within the RSDT/XSDT. + */ + if ((TableDesc->LoadedIntoNamespace) && + (TableDesc->Pointer->Length == NewTableDesc->Pointer->Length) && + (!ACPI_MEMCMP ( + (const char *) TableDesc->Pointer, + (const char *) NewTableDesc->Pointer, + (ACPI_SIZE) NewTableDesc->Pointer->Length))) + { + /* Match: this table is already installed */ + + ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, + "Table [%4.4s] already installed: Rev %X OemTableId [%8.8s]\n", + NewTableDesc->Pointer->Signature, + NewTableDesc->Pointer->Revision, + NewTableDesc->Pointer->OemTableId)); + + NewTableDesc->OwnerId = TableDesc->OwnerId; + NewTableDesc->InstalledDesc = TableDesc; + + return_ACPI_STATUS (AE_ALREADY_EXISTS); + } + + /* Get next table on the list */ + + TableDesc = TableDesc->Next; + } + + return_ACPI_STATUS (AE_OK); +} + + +/******************************************************************************* + * * FUNCTION: AcpiTbValidateTableHeader * * PARAMETERS: TableHeader - Logical pointer to the table @@ -234,7 +305,7 @@ /* Compute the checksum on the table */ - Checksum = AcpiTbChecksum (TableHeader, TableHeader->Length); + Checksum = AcpiTbGenerateChecksum (TableHeader, TableHeader->Length); /* Return the appropriate exception */ @@ -253,7 +324,7 @@ /******************************************************************************* * - * FUNCTION: AcpiTbChecksum + * FUNCTION: AcpiTbGenerateChecksum * * PARAMETERS: Buffer - Buffer to checksum * Length - Size of the buffer @@ -265,7 +336,7 @@ ******************************************************************************/ UINT8 -AcpiTbChecksum ( +AcpiTbGenerateChecksum ( void *Buffer, UINT32 Length) {
--- a/usr/src/uts/i86pc/io/acpica/tables/tbxface.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/tables/tbxface.c Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ * * Module Name: tbxface - Public interfaces to the ACPI subsystem * ACPI table oriented interfaces - * $Revision: 68 $ + * $Revision: 1.70 $ * *****************************************************************************/ @@ -261,11 +261,26 @@ return_ACPI_STATUS (Status); } + /* Check signature for a valid table type */ + + Status = AcpiTbRecognizeTable (&TableInfo, ACPI_TABLE_ALL); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* Install the new table into the local data structures */ Status = AcpiTbInstallTable (&TableInfo); if (ACPI_FAILURE (Status)) { + if (Status == AE_ALREADY_EXISTS) + { + /* Table already exists, no error */ + + Status = AE_OK; + } + /* Free table allocated by AcpiTbGetTableBody */ AcpiTbDeleteSingleTable (&TableInfo); @@ -345,6 +360,7 @@ * simply a position within the hierarchy */ AcpiNsDeleteNamespaceByOwner (TableDesc->OwnerId); + AcpiUtReleaseOwnerId (&TableDesc->OwnerId); TableDesc = TableDesc->Next; }
--- a/usr/src/uts/i86pc/io/acpica/tables/tbxfroot.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/tables/tbxfroot.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbxfroot - Find the root ACPI table (RSDT) - * $Revision: 89 $ + * $Revision: 1.91 $ * *****************************************************************************/ @@ -167,7 +167,7 @@ /* Check the standard checksum */ - if (AcpiTbChecksum (Rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) + if (AcpiTbGenerateChecksum (Rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { return (AE_BAD_CHECKSUM); } @@ -175,7 +175,7 @@ /* Check extended checksum if table version >= 2 */ if ((Rsdp->Revision >= 2) && - (AcpiTbChecksum (Rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) + (AcpiTbGenerateChecksum (Rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) { return (AE_BAD_CHECKSUM); } @@ -364,7 +364,7 @@ AcpiTbGetRsdtAddress (&Address); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "RSDP located at %p, RSDT physical=%8.8X%8.8X \n", + "RSDP located at %p, RSDT physical=%8.8X%8.8X\n", AcpiGbl_RSDP, ACPI_FORMAT_UINT64 (Address.Pointer.Value)));
--- a/usr/src/uts/i86pc/io/acpica/utilities/utalloc.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/utilities/utalloc.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utalloc - local memory allocation routines - * $Revision: 146 $ + * $Revision: 1.148 $ * *****************************************************************************/ @@ -148,7 +148,7 @@ AcpiUtCreateList ( char *ListName, UINT16 ObjectSize, - ACPI_HANDLE *ReturnCache); + ACPI_MEMORY_LIST **ReturnCache); #endif @@ -415,7 +415,7 @@ if (!Size) { _ACPI_REPORT_ERROR (Module, Line, Component, - ("UtAllocate: Attempt to allocate zero bytes\n")); + ("UtAllocate: Attempt to allocate zero bytes, allocating 1 byte\n")); Size = 1; } @@ -467,8 +467,8 @@ if (!Size) { _ACPI_REPORT_ERROR (Module, Line, Component, - ("UtCallocate: Attempt to allocate zero bytes\n")); - return_PTR (NULL); + ("UtCallocate: Attempt to allocate zero bytes, allocating 1 byte\n")); + Size = 1; } Allocation = AcpiOsAllocate (Size); @@ -518,7 +518,7 @@ AcpiUtCreateList ( char *ListName, UINT16 ObjectSize, - ACPI_HANDLE *ReturnCache) + ACPI_MEMORY_LIST **ReturnCache) { ACPI_MEMORY_LIST *Cache;
--- a/usr/src/uts/i86pc/io/acpica/utilities/utcache.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/utilities/utcache.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utcache - local cache allocation routines - * $Revision: 2 $ + * $Revision: 1.2 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/utilities/utclib.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/utilities/utclib.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: cmclib - Local implementation of C library functions - * $Revision: 58 $ + * $Revision: 1.58 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/utilities/utcopy.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/utilities/utcopy.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utcopy - Internal to external object translation utilities - * $Revision: 121 $ + * $Revision: 1.122 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/utilities/utdebug.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/utilities/utdebug.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utdebug - Debug print routines - * $Revision: 118 $ + * $Revision: 1.126 $ * *****************************************************************************/ @@ -128,6 +128,12 @@ static char *AcpiGbl_FnEntryStr = "----Entry"; static char *AcpiGbl_FnExitStr = "----Exit-"; +/* Local prototypes */ + +static const char * +AcpiUtTrimFunctionName ( + const char *FunctionName); + /******************************************************************************* * @@ -145,7 +151,7 @@ AcpiUtInitStackPtrTrace ( void) { - UINT32 CurrentSp; + UINT32 CurrentSp; AcpiGbl_EntryStackPointer = ACPI_PTR_DIFF (&CurrentSp, NULL); @@ -168,7 +174,7 @@ AcpiUtTrackStackPtr ( void) { - ACPI_SIZE CurrentSp; + ACPI_SIZE CurrentSp; CurrentSp = ACPI_PTR_DIFF (&CurrentSp, NULL); @@ -187,6 +193,45 @@ /******************************************************************************* * + * FUNCTION: AcpiUtTrimFunctionName + * + * PARAMETERS: FunctionName - Ascii string containing a procedure name + * + * RETURN: Updated pointer to the function name + * + * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. + * This allows compiler macros such as __FUNCTION__ to be used + * with no change to the debug output. + * + ******************************************************************************/ + +static const char * +AcpiUtTrimFunctionName ( + const char *FunctionName) +{ + + /* All Function names are longer than 4 chars, check is safe */ + + if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_MIXED) + { + /* This is the case where the original source has not been modified */ + + return (FunctionName + 4); + } + + if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_LOWER) + { + /* This is the case where the source has been 'linuxized' */ + + return (FunctionName + 5); + } + + return (FunctionName); +} + + +/******************************************************************************* + * * FUNCTION: AcpiUtDebugPrint * * PARAMETERS: RequestedDebugLevel - Requested debug print level @@ -208,7 +253,7 @@ AcpiUtDebugPrint ( UINT32 RequestedDebugLevel, UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId, char *Format, @@ -256,7 +301,7 @@ } AcpiOsPrintf ("[%02ld] %-22.22s: ", - AcpiGbl_NestingLevel, FunctionName); + AcpiGbl_NestingLevel, AcpiUtTrimFunctionName (FunctionName)); va_start (args, Format); AcpiOsVprintf (Format, args); @@ -286,7 +331,7 @@ AcpiUtDebugPrintRaw ( UINT32 RequestedDebugLevel, UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId, char *Format, @@ -325,7 +370,7 @@ void AcpiUtTrace ( UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId) { @@ -333,7 +378,7 @@ AcpiGbl_NestingLevel++; AcpiUtTrackStackPtr (); - AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, + AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, "%s\n", AcpiGbl_FnEntryStr); } @@ -359,7 +404,7 @@ void AcpiUtTracePtr ( UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId, void *Pointer) @@ -393,7 +438,7 @@ void AcpiUtTraceStr ( UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId, char *String) @@ -428,7 +473,7 @@ void AcpiUtTraceU32 ( UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId, UINT32 Integer) @@ -462,7 +507,7 @@ void AcpiUtExit ( UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId) { @@ -495,7 +540,7 @@ void AcpiUtStatusExit ( UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId, ACPI_STATUS Status) @@ -540,7 +585,7 @@ void AcpiUtValueExit ( UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId, ACPI_INTEGER Value) @@ -575,7 +620,7 @@ void AcpiUtPtrExit ( UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId, UINT8 *Ptr) @@ -689,8 +734,8 @@ } /* - * Print the ASCII equivalent characters - * But watch out for the bad unprintable ones... + * Print the ASCII equivalent characters but watch out for the bad + * unprintable ones (printable chars are 0x20 through 0x7E) */ AcpiOsPrintf (" "); for (j = 0; j < 16; j++) @@ -702,9 +747,7 @@ } BufChar = Buffer[i + j]; - if ((BufChar > 0x1F && BufChar < 0x2E) || - (BufChar > 0x2F && BufChar < 0x61) || - (BufChar > 0x60 && BufChar < 0x7F)) + if (ACPI_IS_PRINT (BufChar)) { AcpiOsPrintf ("%c", BufChar); }
--- a/usr/src/uts/i86pc/io/acpica/utilities/utdelete.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/utilities/utdelete.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utdelete - object deletion and reference count utilities - * $Revision: 107 $ + * $Revision: 1.107 $ * ******************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/utilities/uteval.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/utilities/uteval.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: uteval - Object evaluation - * $Revision: 59 $ + * $Revision: 1.59 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/utilities/utglobal.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/utilities/utglobal.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utglobal - Global variables for the ACPI subsystem - * $Revision: 213 $ + * $Revision: 1.214 $ * *****************************************************************************/ @@ -907,6 +907,9 @@ AcpiGbl_PsFindCount = 0; AcpiGbl_AcpiHardwarePresent = TRUE; AcpiGbl_OwnerIdMask = 0; + AcpiGbl_TraceMethodName = 0; + AcpiGbl_TraceDbgLevel = 0; + AcpiGbl_TraceDbgLayer = 0; AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT;
--- a/usr/src/uts/i86pc/io/acpica/utilities/utinit.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/utilities/utinit.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utinit - Common ACPI subsystem initialization - * $Revision: 123 $ + * $Revision: 1.123 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/utilities/utmath.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/utilities/utmath.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utmath - Integer math support routines - * $Revision: 16 $ + * $Revision: 1.17 $ * ******************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/utilities/utmisc.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/utilities/utmisc.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utmisc - common utility procedures - * $Revision: 116 $ + * $Revision: 1.124 $ * ******************************************************************************/ @@ -131,7 +131,11 @@ * * PARAMETERS: OwnerId - Where the new owner ID is returned * - * DESCRIPTION: Allocate a table or method owner id + * RETURN: Status + * + * DESCRIPTION: Allocate a table or method owner ID. The owner ID is used to + * track objects created by the table or method, to be deleted + * when the method exits or the table is unloaded. * ******************************************************************************/ @@ -141,11 +145,21 @@ { ACPI_NATIVE_UINT i; ACPI_STATUS Status; - - + + ACPI_FUNCTION_TRACE ("UtAllocateOwnerId"); - - + + + /* Guard against multiple allocations of ID to the same location */ + + if (*OwnerId) + { + ACPI_REPORT_ERROR (("Owner ID [%2.2X] already exists\n", *OwnerId)); + return_ACPI_STATUS (AE_ALREADY_EXISTS); + } + + /* Mutex for the global ID mask */ + Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES); if (ACPI_FAILURE (Status)) { @@ -154,28 +168,33 @@ /* Find a free owner ID */ - for (i = 0; i < 32; i++) + for (i = 0; i < 32; i++) { if (!(AcpiGbl_OwnerIdMask & (1 << i))) { + ACPI_DEBUG_PRINT ((ACPI_DB_VALUES, + "Current OwnerId mask: %8.8X New ID: %2.2X\n", + AcpiGbl_OwnerIdMask, (unsigned int) (i + 1))); + AcpiGbl_OwnerIdMask |= (1 << i); - *OwnerId = (ACPI_OWNER_ID) i; - goto exit; + *OwnerId = (ACPI_OWNER_ID) (i + 1); + goto Exit; } } - /* + /* * If we are here, all OwnerIds have been allocated. This probably should * not happen since the IDs are reused after deallocation. The IDs are * allocated upon table load (one per table) and method execution, and * they are released when a table is unloaded or a method completes * execution. */ + *OwnerId = 0; Status = AE_OWNER_ID_LIMIT; ACPI_REPORT_ERROR (( "Could not allocate new OwnerId (32 max), AE_OWNER_ID_LIMIT\n")); -exit: +Exit: (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES); return_ACPI_STATUS (Status); } @@ -185,43 +204,60 @@ * * FUNCTION: AcpiUtReleaseOwnerId * - * PARAMETERS: OwnerId - A previously allocated owner ID + * PARAMETERS: OwnerIdPtr - Pointer to a previously allocated OwnerID * - * DESCRIPTION: Release a table or method owner id + * RETURN: None. No error is returned because we are either exiting a + * control method or unloading a table. Either way, we would + * ignore any error anyway. + * + * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 32 * ******************************************************************************/ -ACPI_STATUS +void AcpiUtReleaseOwnerId ( - ACPI_OWNER_ID OwnerId) + ACPI_OWNER_ID *OwnerIdPtr) { + ACPI_OWNER_ID OwnerId = *OwnerIdPtr; ACPI_STATUS Status; - ACPI_FUNCTION_TRACE ("UtReleaseOwnerId"); + ACPI_FUNCTION_TRACE_U32 ("UtReleaseOwnerId", OwnerId); + + + /* Always clear the input OwnerId (zero is an invalid ID) */ + + *OwnerIdPtr = 0; + /* Zero is not a valid OwnerID */ + + if ((OwnerId == 0) || (OwnerId > 32)) + { + ACPI_REPORT_ERROR (("Invalid OwnerId: %2.2X\n", OwnerId)); + return_VOID; + } + + /* Mutex for the global ID mask */ Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + return_VOID; } - /* Free the owner ID */ + /* Normalize the ID to zero */ + + OwnerId--; + + /* Free the owner ID only if it is valid */ if (AcpiGbl_OwnerIdMask & (1 << OwnerId)) { AcpiGbl_OwnerIdMask ^= (1 << OwnerId); } - else - { - /* This OwnerId has not been allocated */ - - Status = AE_NOT_EXIST; - } (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES); - return_ACPI_STATUS (Status); + return_VOID; } @@ -231,7 +267,7 @@ * * PARAMETERS: SrcString - The source string to convert * - * RETURN: Converted SrcString (same as input pointer) + * RETURN: None * * DESCRIPTION: Convert string to uppercase * @@ -239,7 +275,7 @@ * ******************************************************************************/ -char * +void AcpiUtStrupr ( char *SrcString) { @@ -251,7 +287,7 @@ if (!SrcString) { - return (NULL); + return; } /* Walk entire string, uppercasing the letters */ @@ -261,7 +297,7 @@ *String = (char) ACPI_TOUPPER (*String); } - return (SrcString); + return; } @@ -974,7 +1010,7 @@ while (Buffer < EndBuffer) { BufferByte = *Buffer; - if (BufferByte & ACPI_RDESC_TYPE_MASK) + if (BufferByte & ACPI_RESOURCE_NAME_LARGE) { /* Large Descriptor - Length is next 2 bytes */ @@ -984,7 +1020,7 @@ { /* Small Descriptor. End Tag will be found here */ - if ((BufferByte & ACPI_RDESC_SMALL_MASK) == ACPI_RDESC_TYPE_END_TAG) + if ((BufferByte & ACPI_RESOURCE_NAME_SMALL_MASK) == ACPI_RESOURCE_NAME_END_TAG) { /* Found the end tag descriptor, all done. */
--- a/usr/src/uts/i86pc/io/acpica/utilities/utmutex.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/utilities/utmutex.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utmutex - local mutex support - * $Revision: 2 $ + * $Revision: 1.3 $ * ******************************************************************************/ @@ -326,7 +326,7 @@ */ for (i = MutexId; i < MAX_MUTEX; i++) { - if (AcpiGbl_MutexInfo[i].OwnerId == ThisThreadId) + if (AcpiGbl_MutexInfo[i].ThreadId == ThisThreadId) { if (i == MutexId) { @@ -432,7 +432,7 @@ */ for (i = MutexId; i < MAX_MUTEX; i++) { - if (AcpiGbl_MutexInfo[i].OwnerId == ThisThreadId) + if (AcpiGbl_MutexInfo[i].ThreadId == ThisThreadId) { if (i == MutexId) {
--- a/usr/src/uts/i86pc/io/acpica/utilities/utobject.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/utilities/utobject.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utobject - ACPI object create/delete/size/cache routines - * $Revision: 97 $ + * $Revision: 1.97 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/acpica/utilities/utstate.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/utilities/utstate.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utstate - state object support procedures - * $Revision: 1 $ + * $Revision: 1.2 $ * ******************************************************************************/ @@ -455,5 +455,3 @@ } - -
--- a/usr/src/uts/i86pc/io/acpica/utilities/utxface.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/acpica/utilities/utxface.c Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utxface - External interfaces for "global" ACPI functions - * $Revision: 112 $ + * $Revision: 1.112 $ * *****************************************************************************/
--- a/usr/src/uts/i86pc/io/psm/psm_common.c Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/i86pc/io/psm/psm_common.c Thu Nov 17 08:46:01 2005 -0800 @@ -102,11 +102,6 @@ static ACPI_HANDLE acpi_sbobj = NULL; static kmutex_t acpi_irq_cache_mutex; -#define D2A_INITLEN 20 -static int d2a_len = 0; -static int d2a_valid = 0; -static d2a *d2a_table; - /* * irq_cache_table is a list that serves a two-key cache. It is used * as a pci busid/devid/ipin <-> irq cache and also as a acpi @@ -476,7 +471,7 @@ ACPI_RESOURCE *resp; ACPI_RESOURCE *srsp; ACPI_HANDLE lnkobj; - int status; + int srs_len, status; ASSERT(acpipsmlnkp != NULL); @@ -498,20 +493,21 @@ * Find an IRQ resource descriptor to use as template */ srsp = NULL; - for (resp = rsb.Pointer; resp->Length != 0; + for (resp = rsb.Pointer; resp->Type != ACPI_RESOURCE_TYPE_END_TAG; resp = ACPI_NEXT_RESOURCE(resp)) { - if ((resp->Id == ACPI_RSTYPE_IRQ) || - (resp->Id == ACPI_RSTYPE_EXT_IRQ)) { + if ((resp->Type == ACPI_RESOURCE_TYPE_IRQ) || + (resp->Type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ)) { + ACPI_RESOURCE *endtag; /* - * Mild trickery here; allocate two - * resource structures, and set the Length - * field of the second one to 0 to terminate - * the list. Copy the possible resource into - * the first one as a template. + * Allocate enough room for this resource entry + * and one end tag following it */ - srsp = kmem_zalloc(2 * sizeof (*srsp), KM_SLEEP); - srsp[1].Length = 0; - *srsp = *resp; + srs_len = resp->Length + sizeof (*endtag); + srsp = kmem_zalloc(srs_len, KM_SLEEP); + bcopy(resp, srsp, resp->Length); + endtag = ACPI_NEXT_RESOURCE(srsp); + endtag->Type = ACPI_RESOURCE_TYPE_END_TAG; + endtag->Length = 0; break; /* drop out of the loop */ } } @@ -528,21 +524,21 @@ * The Interrupts[] array is always at least one entry * long; see the definition of ACPI_RESOURCE. */ - switch (srsp->Id) { - case ACPI_RSTYPE_IRQ: - srsp->Data.Irq.NumberOfInterrupts = 1; + switch (srsp->Type) { + case ACPI_RESOURCE_TYPE_IRQ: + srsp->Data.Irq.InterruptCount = 1; srsp->Data.Irq.Interrupts[0] = irq; break; - case ACPI_RSTYPE_EXT_IRQ: - srsp->Data.ExtendedIrq.NumberOfInterrupts = 1; + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: + srsp->Data.ExtendedIrq.InterruptCount = 1; srsp->Data.ExtendedIrq.Interrupts[0] = irq; break; } rsb.Pointer = srsp; - rsb.Length = 2 * sizeof (*srsp); + rsb.Length = srs_len; status = AcpiSetCurrentResources(lnkobj, &rsb); - kmem_free(srsp, 2 * sizeof (*srsp)); + kmem_free(srsp, srs_len); if (status != AE_OK) { cmn_err(CE_WARN, "!psm: set_irq: _SRS failed"); return (ACPI_PSM_FAILURE); @@ -630,8 +626,9 @@ } irq = -1; - for (rp = rb.Pointer; rp->Length != 0; rp = ACPI_NEXT_RESOURCE(rp)) { - if (rp->Id == ACPI_RSTYPE_IRQ) { + for (rp = rb.Pointer; rp->Type != ACPI_RESOURCE_TYPE_END_TAG; + rp = ACPI_NEXT_RESOURCE(rp)) { + if (rp->Type == ACPI_RESOURCE_TYPE_IRQ) { if (irq > 0) { PSM_VERBOSE_IRQ((CE_WARN, "!psm: multiple IRQ" " from _CRS ")); @@ -639,7 +636,7 @@ break; } - if (rp->Data.Irq.NumberOfInterrupts != 1) { + if (rp->Data.Irq.InterruptCount != 1) { PSM_VERBOSE_IRQ((CE_WARN, "!psm: <>1 interrupt" " from _CRS ")); status = ACPI_PSM_FAILURE; @@ -647,12 +644,12 @@ } intr_flagp->intr_el = psm_acpi_edgelevel( - rp->Data.Irq.EdgeLevel); + rp->Data.Irq.Triggering); intr_flagp->intr_po = psm_acpi_po( - rp->Data.Irq.ActiveHighLow); + rp->Data.Irq.Polarity); irq = rp->Data.Irq.Interrupts[0]; status = ACPI_PSM_SUCCESS; - } else if (rp->Id == ACPI_RSTYPE_EXT_IRQ) { + } else if (rp->Type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) { if (irq > 0) { PSM_VERBOSE_IRQ((CE_WARN, "!psm: multiple IRQ" " from _CRS ")); @@ -660,7 +657,7 @@ break; } - if (rp->Data.ExtendedIrq.NumberOfInterrupts != 1) { + if (rp->Data.ExtendedIrq.InterruptCount != 1) { PSM_VERBOSE_IRQ((CE_WARN, "!psm: <>1 interrupt" " from _CRS ")); status = ACPI_PSM_FAILURE; @@ -668,9 +665,9 @@ } intr_flagp->intr_el = psm_acpi_edgelevel( - rp->Data.ExtendedIrq.EdgeLevel); + rp->Data.ExtendedIrq.Triggering); intr_flagp->intr_po = psm_acpi_po( - rp->Data.ExtendedIrq.ActiveHighLow); + rp->Data.ExtendedIrq.Polarity); irq = rp->Data.ExtendedIrq.Interrupts[0]; status = ACPI_PSM_SUCCESS; } @@ -795,20 +792,20 @@ * Scan the resources looking for an interrupt resource */ *irqlistp = 0; - for (resp = rsb.Pointer; resp->Length != 0; + for (resp = rsb.Pointer; resp->Type != ACPI_RESOURCE_TYPE_END_TAG; resp = ACPI_NEXT_RESOURCE(resp)) { - switch (resp->Id) { - case ACPI_RSTYPE_IRQ: - irqlist_len = resp->Data.Irq.NumberOfInterrupts; + switch (resp->Type) { + case ACPI_RESOURCE_TYPE_IRQ: + irqlist_len = resp->Data.Irq.InterruptCount; tmplist = resp->Data.Irq.Interrupts; - el = resp->Data.Irq.EdgeLevel; - po = resp->Data.Irq.ActiveHighLow; + el = resp->Data.Irq.Triggering; + po = resp->Data.Irq.Polarity; break; - case ACPI_RSTYPE_EXT_IRQ: - irqlist_len = resp->Data.ExtendedIrq.NumberOfInterrupts; + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: + irqlist_len = resp->Data.ExtendedIrq.InterruptCount; tmplist = resp->Data.ExtendedIrq.Interrupts; - el = resp->Data.ExtendedIrq.EdgeLevel; - po = resp->Data.ExtendedIrq.ActiveHighLow; + el = resp->Data.ExtendedIrq.Triggering; + po = resp->Data.ExtendedIrq.Polarity; break; default: continue;
--- a/usr/src/uts/intel/sys/acpi/acconfig.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acconfig.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acconfig.h - Global configuration constants - * $Revision: 189 $ + * $Revision: 1.193 $ * *****************************************************************************/ @@ -135,9 +135,9 @@ * */ -/* Version string */ +/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20050708 +#define ACPI_CA_VERSION 0x20050930 /* * OS name, used for the _OS object. The _OS object is essentially obsolete,
--- a/usr/src/uts/intel/sys/acpi/acdebug.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acdebug.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acdebug.h - ACPI/AML debugger - * $Revision: 80 $ + * $Revision: 1.80 $ * *****************************************************************************/
--- a/usr/src/uts/intel/sys/acpi/acdisasm.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acdisasm.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acdisasm.h - AML disassembler - * $Revision: 21 $ + * $Revision: 1.23 $ * *****************************************************************************/ @@ -333,61 +333,61 @@ */ void AcpiDmWordDescriptor ( - ASL_WORD_ADDRESS_DESC *Resource, + AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmDwordDescriptor ( - ASL_DWORD_ADDRESS_DESC *Resource, + AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmExtendedDescriptor ( - ASL_EXTENDED_ADDRESS_DESC *Resource, + AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmQwordDescriptor ( - ASL_QWORD_ADDRESS_DESC *Resource, + AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmMemory24Descriptor ( - ASL_MEMORY_24_DESC *Resource, + AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmMemory32Descriptor ( - ASL_MEMORY_32_DESC *Resource, + AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void -AcpiDmFixedMem32Descriptor ( - ASL_FIXED_MEMORY_32_DESC *Resource, +AcpiDmFixedMemory32Descriptor ( + AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmGenericRegisterDescriptor ( - ASL_GENERAL_REGISTER_DESC *Resource, + AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmInterruptDescriptor ( - ASL_EXTENDED_XRUPT_DESC *Resource, + AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmVendorLargeDescriptor ( - ASL_LARGE_VENDOR_DESC *Resource, + AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); @@ -397,43 +397,43 @@ */ void AcpiDmIrqDescriptor ( - ASL_IRQ_FORMAT_DESC *Resource, + AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmDmaDescriptor ( - ASL_DMA_FORMAT_DESC *Resource, + AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmIoDescriptor ( - ASL_IO_PORT_DESC *Resource, + AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmFixedIoDescriptor ( - ASL_FIXED_IO_PORT_DESC *Resource, + AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmStartDependentDescriptor ( - ASL_START_DEPENDENT_DESC *Resource, + AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmEndDependentDescriptor ( - ASL_START_DEPENDENT_DESC *Resource, + AML_RESOURCE *Resource, UINT32 Length, UINT32 Level); void AcpiDmVendorSmallDescriptor ( - ASL_SMALL_VENDOR_DESC *Resource, + AML_RESOURCE *Resource, UINT32 Length, UINT32 Level);
--- a/usr/src/uts/intel/sys/acpi/acdispat.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acdispat.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acdispat.h - dispatcher (parser to interpreter interface) - * $Revision: 65 $ + * $Revision: 1.67 $ * *****************************************************************************/ @@ -309,7 +309,7 @@ */ ACPI_STATUS AcpiDsParseMethod ( - ACPI_HANDLE ObjHandle); + ACPI_NAMESPACE_NODE *Node); ACPI_STATUS AcpiDsCallControlMethod ( @@ -322,7 +322,7 @@ ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT *ReturnDesc); -ACPI_STATUS +void AcpiDsTerminateControlMethod ( ACPI_WALK_STATE *WalkState); @@ -464,7 +464,7 @@ UINT8 *AmlStart, UINT32 AmlLength, ACPI_PARAMETER_INFO *Info, - UINT32 PassNumber); + UINT8 PassNumber); ACPI_STATUS AcpiDsObjStackPopAndDelete (
--- a/usr/src/uts/intel/sys/acpi/acevents.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acevents.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acevents.h - Event subcomponent prototypes and defines - * $Revision: 103 $ + * $Revision: 1.103 $ * *****************************************************************************/
--- a/usr/src/uts/intel/sys/acpi/acexcep.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acexcep.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acexcep.h - Exception codes returned by the ACPI subsystem - * $Revision: 75 $ + * $Revision: 1.75 $ * *****************************************************************************/
--- a/usr/src/uts/intel/sys/acpi/acglobal.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acglobal.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acglobal.h - Declarations for global variables - * $Revision: 167 $ + * $Revision: 1.168 $ * *****************************************************************************/ @@ -155,6 +155,14 @@ extern UINT32 AcpiGbl_NestingLevel; +/* Support for dynamic control method tracing mechanism */ + +ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLevel; +ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLayer; +ACPI_EXTERN ACPI_NAME AcpiGbl_TraceMethodName; +ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLevel; +ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLayer; +ACPI_EXTERN UINT32 AcpiGbl_TraceFlags; /***************************************************************************** *
--- a/usr/src/uts/intel/sys/acpi/achware.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/achware.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: achware.h -- hardware specific interfaces - * $Revision: 78 $ + * $Revision: 1.79 $ * *****************************************************************************/
--- a/usr/src/uts/intel/sys/acpi/acinterp.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acinterp.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acinterp.h - Interpreter subcomponent prototypes and defines - * $Revision: 162 $ + * $Revision: 1.162 $ * *****************************************************************************/
--- a/usr/src/uts/intel/sys/acpi/aclocal.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/aclocal.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: aclocal.h - Internal data types used across the ACPI subsystem - * $Revision: 211 $ + * $Revision: 1.215 $ * *****************************************************************************/ @@ -946,45 +946,53 @@ /* ResourceType values */ -#define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0 -#define ACPI_RESOURCE_TYPE_IO_RANGE 1 -#define ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE 2 +#define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0 +#define ACPI_ADDRESS_TYPE_IO_RANGE 1 +#define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2 /* Resource descriptor types and masks */ -#define ACPI_RDESC_TYPE_LARGE 0x80 -#define ACPI_RDESC_TYPE_SMALL 0x00 +#define ACPI_RESOURCE_NAME_LARGE 0x80 +#define ACPI_RESOURCE_NAME_SMALL 0x00 -#define ACPI_RDESC_TYPE_MASK 0x80 -#define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */ +#define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */ +#define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */ +#define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */ /* - * Small resource descriptor types - * Note: The 3 length bits (2:0) must be zero + * Small resource descriptor "names" as defined by the ACPI specification. + * Note: Bits 2:0 are used for the descriptor length */ -#define ACPI_RDESC_TYPE_IRQ_FORMAT 0x20 -#define ACPI_RDESC_TYPE_DMA_FORMAT 0x28 -#define ACPI_RDESC_TYPE_START_DEPENDENT 0x30 -#define ACPI_RDESC_TYPE_END_DEPENDENT 0x38 -#define ACPI_RDESC_TYPE_IO_PORT 0x40 -#define ACPI_RDESC_TYPE_FIXED_IO_PORT 0x48 -#define ACPI_RDESC_TYPE_SMALL_VENDOR 0x70 -#define ACPI_RDESC_TYPE_END_TAG 0x78 +#define ACPI_RESOURCE_NAME_IRQ 0x20 +#define ACPI_RESOURCE_NAME_DMA 0x28 +#define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30 +#define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38 +#define ACPI_RESOURCE_NAME_IO 0x40 +#define ACPI_RESOURCE_NAME_FIXED_IO 0x48 +#define ACPI_RESOURCE_NAME_RESERVED_S1 0x50 +#define ACPI_RESOURCE_NAME_RESERVED_S2 0x58 +#define ACPI_RESOURCE_NAME_RESERVED_S3 0x60 +#define ACPI_RESOURCE_NAME_RESERVED_S4 0x68 +#define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70 +#define ACPI_RESOURCE_NAME_END_TAG 0x78 /* - * Large resource descriptor types + * Large resource descriptor "names" as defined by the ACPI specification. + * Note: includes the Large Descriptor bit in bit[7] */ -#define ACPI_RDESC_TYPE_MEMORY_24 0x81 -#define ACPI_RDESC_TYPE_GENERAL_REGISTER 0x82 -#define ACPI_RDESC_TYPE_LARGE_VENDOR 0x84 -#define ACPI_RDESC_TYPE_MEMORY_32 0x85 -#define ACPI_RDESC_TYPE_FIXED_MEMORY_32 0x86 -#define ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE 0x87 -#define ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE 0x88 -#define ACPI_RDESC_TYPE_EXTENDED_XRUPT 0x89 -#define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A -#define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE 0x8B +#define ACPI_RESOURCE_NAME_MEMORY24 0x81 +#define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82 +#define ACPI_RESOURCE_NAME_RESERVED_L1 0x83 +#define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84 +#define ACPI_RESOURCE_NAME_MEMORY32 0x85 +#define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86 +#define ACPI_RESOURCE_NAME_ADDRESS32 0x87 +#define ACPI_RESOURCE_NAME_ADDRESS16 0x88 +#define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89 +#define ACPI_RESOURCE_NAME_ADDRESS64 0x8A +#define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B +#define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B /***************************************************************************** @@ -993,7 +1001,7 @@ * ****************************************************************************/ -#define ACPI_ASCII_ZERO 0x30 +#define ACPI_ASCII_ZERO 0x30 /*****************************************************************************
--- a/usr/src/uts/intel/sys/acpi/acmacros.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acmacros.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acmacros.h - C macros for the entire subsystem. - * $Revision: 160 $ + * $Revision: 1.163 $ * *****************************************************************************/ @@ -569,7 +569,7 @@ /* * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, * define it now. This is the case where there the compiler does not support - * a __FUNCTION__ macro or equivalent. We save the function name on the + * a __FUNCTION__ macro or equivalent. We save the function name on the * local stack. */ #ifndef ACPI_GET_FUNCTION_NAME @@ -578,8 +578,10 @@ * The Name parameter should be the procedure name as a quoted string. * This is declared as a local string ("MyFunctionName") so that it can * be also used by the function exit macros below. + * Note: (const char) is used to be compatible with the debug interfaces + * and macros such as __FUNCTION__. */ -#define ACPI_FUNCTION_NAME(Name) char *_AcpiFunctionName = Name; +#define ACPI_FUNCTION_NAME(Name) const char *_AcpiFunctionName = Name; #else /* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ @@ -604,6 +606,9 @@ * bad form, but having a separate exit macro is very ugly and difficult to maintain. * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros * so that "_AcpiFunctionName" is defined. + * + * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining + * about these constructs. */ #ifdef ACPI_USE_DO_WHILE_0 #define ACPI_DO_WHILE0(a) do a while(0) @@ -611,10 +616,56 @@ #define ACPI_DO_WHILE0(a) a #endif -#define return_VOID ACPI_DO_WHILE0 ({AcpiUtExit(ACPI_DEBUG_PARAMETERS);return;}) -#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({AcpiUtStatusExit(ACPI_DEBUG_PARAMETERS,(s));return((s));}) -#define return_VALUE(s) ACPI_DO_WHILE0 ({AcpiUtValueExit(ACPI_DEBUG_PARAMETERS,(ACPI_INTEGER)(s));return((s));}) -#define return_PTR(s) ACPI_DO_WHILE0 ({AcpiUtPtrExit(ACPI_DEBUG_PARAMETERS,(UINT8 *)(s));return((s));}) +#define return_VOID ACPI_DO_WHILE0 ({ \ + AcpiUtExit (ACPI_DEBUG_PARAMETERS); \ + return;}) +/* + * There are two versions of most of the return macros. The default version is + * safer, since it avoids side-effects by guaranteeing that the argument will + * not be evaluated twice. + * + * A less-safe version of the macros is provided for optional use if the + * compiler uses excessive CPU stack (for example, this may happen in the + * debug case if code optimzation is disabled.) + */ +#ifndef ACPI_SIMPLE_RETURN_MACROS + +#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ + register ACPI_STATUS _s = (s); \ + AcpiUtStatusExit (ACPI_DEBUG_PARAMETERS, _s); \ + return (_s); }) +#define return_PTR(s) ACPI_DO_WHILE0 ({ \ + register void *_s = (void *) (s); \ + AcpiUtPtrExit (ACPI_DEBUG_PARAMETERS, (UINT8 *) _s); \ + return (_s); }) +#define return_VALUE(s) ACPI_DO_WHILE0 ({ \ + register ACPI_INTEGER _s = (s); \ + AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, _s); \ + return (_s); }) +#define return_UINT8(s) ACPI_DO_WHILE0 ({ \ + register UINT8 _s = (UINT8) (s); \ + AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, _s); \ + return (_s); }) +#define return_UINT32(s) ACPI_DO_WHILE0 ({ \ + register UINT32 _s = (UINT32) (s); \ + AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, _s); \ + return (_s); }) +#else /* Use original less-safe macros */ + +#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ + AcpiUtStatusExit (ACPI_DEBUG_PARAMETERS, (s)); \ + return((s)); }) +#define return_PTR(s) ACPI_DO_WHILE0 ({ \ + AcpiUtPtrExit (ACPI_DEBUG_PARAMETERS, (UINT8 *) (s)); \ + return((s)); }) +#define return_VALUE(s) ACPI_DO_WHILE0 ({ \ + AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (ACPI_INTEGER) (s)); \ + return((s)); }) +#define return_UINT8(s) return_VALUE(s) +#define return_UINT32(s) return_VALUE(s) + +#endif /* ACPI_SIMPLE_RETURN_MACROS */ + /* Conditional execution */ @@ -696,6 +747,8 @@ #define return_VOID return #define return_ACPI_STATUS(s) return(s) #define return_VALUE(s) return(s) +#define return_UINT8(s) return(s) +#define return_UINT32(s) return(s) #define return_PTR(s) return(s) #endif
--- a/usr/src/uts/intel/sys/acpi/acnames.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acnames.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acnames.h - Global names and strings - * $Revision: 1 $ + * $Revision: 1.5 $ * *****************************************************************************/ @@ -144,14 +144,15 @@ /* Definitions of the predefined namespace names */ -#define ACPI_UNKNOWN_NAME (UINT32) 0x3F3F3F3F /* Unknown name is "????" */ -#define ACPI_ROOT_NAME (UINT32) 0x5F5F5F5C /* Root name is "\___" */ -#define ACPI_SYS_BUS_NAME (UINT32) 0x5F53425F /* Sys bus name is "_SB_" */ +#define ACPI_UNKNOWN_NAME (UINT32) 0x3F3F3F3F /* Unknown name is "????" */ +#define ACPI_ROOT_NAME (UINT32) 0x5F5F5F5C /* Root name is "\___" */ + +#define ACPI_PREFIX_MIXED (UINT32) 0x69706341 /* "Acpi" */ +#define ACPI_PREFIX_LOWER (UINT32) 0x69706361 /* "acpi" */ #define ACPI_NS_ROOT_PATH "\\" #define ACPI_NS_SYSTEM_BUS "_SB_" - #endif /* __ACNAMES_H__ */
--- a/usr/src/uts/intel/sys/acpi/acnamesp.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acnamesp.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acnamesp.h - Namespace subcomponent prototypes and defines - * $Revision: 141 $ + * $Revision: 1.142 $ * *****************************************************************************/ @@ -197,7 +197,7 @@ ACPI_STATUS AcpiNsOneCompleteParse ( - UINT32 PassNumber, + UINT8 PassNumber, ACPI_TABLE_DESC *TableDesc);
--- a/usr/src/uts/intel/sys/acpi/acobject.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acobject.h Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only) - * $Revision: 130 $ + * $Revision: 1.130 $ * *****************************************************************************/
--- a/usr/src/uts/intel/sys/acpi/acopcode.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acopcode.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acopcode.h - AML opcode information for the AML parser and interpreter - * $Revision: 3 $ + * $Revision: 1.3 $ * *****************************************************************************/
--- a/usr/src/uts/intel/sys/acpi/acoutput.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acoutput.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acoutput.h -- debug output - * $Revision: 97 $ + * $Revision: 1.97 $ * *****************************************************************************/
--- a/usr/src/uts/intel/sys/acpi/acparser.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acparser.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: acparser.h - AML Parser subcomponent prototypes and defines - * $Revision: 76 $ + * $Revision: 1.77 $ * *****************************************************************************/ @@ -150,12 +150,7 @@ * psxface - Parser external interfaces */ ACPI_STATUS -AcpiPsxLoadTable ( - UINT8 *PcodeAddr, - UINT32 PcodeLength); - -ACPI_STATUS -AcpiPsxExecute ( +AcpiPsExecuteMethod ( ACPI_PARAMETER_INFO *Info);
--- a/usr/src/uts/intel/sys/acpi/acpi.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acpi.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acpi.h - Master include file, Publics and external data. - * $Revision: 59 $ + * $Revision: 1.59 $ * *****************************************************************************/
--- a/usr/src/uts/intel/sys/acpi/acpixf.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acpixf.h Thu Nov 17 08:46:01 2005 -0800 @@ -274,6 +274,13 @@ ACPI_OBJECT_HANDLER Handler, void **Data); +ACPI_STATUS +AcpiDebugTrace ( + char *Name, + UINT32 DebugLevel, + UINT32 DebugLayer, + UINT32 Flags); + /* * Object manipulation and enumeration
--- a/usr/src/uts/intel/sys/acpi/acresrc.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acresrc.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acresrc.h - Resource Manager function prototypes - * $Revision: 42 $ + * $Revision: 1.48 $ * *****************************************************************************/ @@ -118,6 +118,55 @@ #ifndef __ACRESRC_H__ #define __ACRESRC_H__ +/* Need the AML resource descriptor structs */ + +#include "amlresrc.h" + + +/* + * Resource dispatch and info tables + */ +typedef struct acpi_resource_info +{ + UINT8 LengthType; + UINT8 MinimumAmlResourceLength; + UINT8 MinimumInternalStructLength; + +} ACPI_RESOURCE_INFO; + +/* Types for LengthType above */ + +#define ACPI_FIXED_LENGTH 0 +#define ACPI_VARIABLE_LENGTH 1 +#define ACPI_SMALL_VARIABLE_LENGTH 2 + +/* Handlers */ + +typedef ACPI_STATUS (*ACPI_SET_RESOURCE_HANDLER) ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml); + +typedef ACPI_STATUS (*ACPI_GET_RESOURCE_HANDLER) ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource); + +typedef void (*ACPI_DUMP_RESOURCE_HANDLER) ( + ACPI_RESOURCE_DATA *Data); + +/* Tables indexed by internal resource type */ + +extern UINT8 AcpiGbl_AmlResourceSizes[]; +extern ACPI_SET_RESOURCE_HANDLER AcpiGbl_SetResourceDispatch[]; +extern ACPI_DUMP_RESOURCE_HANDLER AcpiGbl_DumpResourceDispatch[]; + +/* Tables indexed by raw AML resource descriptor type */ + +extern ACPI_RESOURCE_INFO AcpiGbl_SmResourceInfo[]; +extern ACPI_RESOURCE_INFO AcpiGbl_LgResourceInfo[]; +extern ACPI_GET_RESOURCE_HANDLER AcpiGbl_SmGetResourceDispatch[]; +extern ACPI_GET_RESOURCE_HANDLER AcpiGbl_LgGetResourceDispatch[]; + /* * Function prototypes called from Acpi* APIs @@ -127,7 +176,6 @@ ACPI_HANDLE Handle, ACPI_BUFFER *RetBuffer); - ACPI_STATUS AcpiRsGetCrsMethodData ( ACPI_HANDLE Handle, @@ -151,11 +199,11 @@ ACPI_STATUS AcpiRsCreateResourceList ( - ACPI_OPERAND_OBJECT *ByteStreamBuffer, + ACPI_OPERAND_OBJECT *AmlBuffer, ACPI_BUFFER *OutputBuffer); ACPI_STATUS -AcpiRsCreateByteStream ( +AcpiRsCreateAmlResources ( ACPI_RESOURCE *LinkedListBuffer, ACPI_BUFFER *OutputBuffer); @@ -181,19 +229,13 @@ * rscalc */ ACPI_STATUS -AcpiRsGetByteStreamStart ( - UINT8 *ByteStreamBuffer, - UINT8 **ByteStreamStart, - UINT32 *Size); - -ACPI_STATUS AcpiRsGetListLength ( - UINT8 *ByteStreamBuffer, - UINT32 ByteStreamBufferLength, + UINT8 *AmlBuffer, + UINT32 AmlBufferLength, ACPI_SIZE *SizeNeeded); ACPI_STATUS -AcpiRsGetByteStreamLength ( +AcpiRsGetAmlLength ( ACPI_RESOURCE *LinkedListBuffer, ACPI_SIZE *SizeNeeded); @@ -203,214 +245,351 @@ ACPI_SIZE *BufferSizeNeeded); ACPI_STATUS -AcpiRsByteStreamToList ( - UINT8 *ByteStreamBuffer, - UINT32 ByteStreamBufferLength, - UINT8 *OutputBuffer); - -ACPI_STATUS -AcpiRsListToByteStream ( - ACPI_RESOURCE *LinkedList, - ACPI_SIZE ByteStreamSizeNeeded, +AcpiRsConvertAmlToResources ( + UINT8 *AmlBuffer, + UINT32 AmlBufferLength, UINT8 *OutputBuffer); ACPI_STATUS -AcpiRsIoResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize); +AcpiRsConvertResourcesToAml ( + ACPI_RESOURCE *Resource, + ACPI_SIZE AmlSizeNeeded, + UINT8 *OutputBuffer); + + +/* + * rsio + */ +ACPI_STATUS +AcpiRsGetIo ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource); ACPI_STATUS -AcpiRsFixedIoResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize); +AcpiRsSetIo ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml); ACPI_STATUS -AcpiRsIoStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed); +AcpiRsGetFixedIo ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource); ACPI_STATUS -AcpiRsFixedIoStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed); +AcpiRsSetFixedIo ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml); ACPI_STATUS -AcpiRsIrqResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize); +AcpiRsGetDma ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource); ACPI_STATUS -AcpiRsIrqStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed); +AcpiRsSetDma ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml); + + +/* + * rsirq + */ +ACPI_STATUS +AcpiRsGetIrq ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource); ACPI_STATUS -AcpiRsDmaResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize); +AcpiRsSetIrq ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml); + +ACPI_STATUS +AcpiRsGetExtIrq ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource); ACPI_STATUS -AcpiRsDmaStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed); +AcpiRsSetExtIrq ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml); + +/* + * rsaddr + */ ACPI_STATUS -AcpiRsAddress16Resource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize); +AcpiRsGetAddress16 ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource); ACPI_STATUS -AcpiRsAddress16Stream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed); +AcpiRsSetAddress16 ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml); ACPI_STATUS -AcpiRsAddress32Resource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize); +AcpiRsGetAddress32 ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource); + +ACPI_STATUS +AcpiRsSetAddress32 ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml); ACPI_STATUS -AcpiRsAddress32Stream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed); +AcpiRsGetAddress64 ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource); ACPI_STATUS -AcpiRsAddress64Resource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize); +AcpiRsSetAddress64 ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml); ACPI_STATUS -AcpiRsAddress64Stream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed); +AcpiRsGetExtAddress64 ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource); ACPI_STATUS -AcpiRsStartDependFnsResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize); +AcpiRsSetExtAddress64 ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml); + + +/* + * rsmemory + */ +ACPI_STATUS +AcpiRsGetMemory24 ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource); ACPI_STATUS -AcpiRsEndDependFnsResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize); +AcpiRsSetMemory24 ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml); ACPI_STATUS -AcpiRsStartDependFnsStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed); +AcpiRsGetMemory32 ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource); + +ACPI_STATUS +AcpiRsSetMemory32 ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml); ACPI_STATUS -AcpiRsEndDependFnsStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed); +AcpiRsGetFixedMemory32 ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource); ACPI_STATUS -AcpiRsMemory24Resource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize); +AcpiRsSetFixedMemory32 ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml); + + +/* + * rsmisc + */ +ACPI_STATUS +AcpiRsGetGenericReg ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource); ACPI_STATUS -AcpiRsMemory24Stream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed); +AcpiRsSetGenericReg ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml); ACPI_STATUS -AcpiRsMemory32RangeResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize); +AcpiRsGetVendor ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource); ACPI_STATUS -AcpiRsFixedMemory32Resource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize); +AcpiRsSetVendor ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml); + +ACPI_STATUS +AcpiRsGetStartDpf ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource); + +ACPI_STATUS +AcpiRsSetStartDpf ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml); ACPI_STATUS -AcpiRsMemory32RangeStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed); +AcpiRsGetEndDpf ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource); ACPI_STATUS -AcpiRsFixedMemory32Stream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed); +AcpiRsSetEndDpf ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml); ACPI_STATUS -AcpiRsExtendedIrqResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize); +AcpiRsGetEndTag ( + AML_RESOURCE *Aml, + UINT16 AmlResourceLength, + ACPI_RESOURCE *Resource); ACPI_STATUS -AcpiRsExtendedIrqStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed); +AcpiRsSetEndTag ( + ACPI_RESOURCE *Resource, + AML_RESOURCE *Aml); -ACPI_STATUS -AcpiRsEndTagResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize); +/* + * rsutils + */ +void +AcpiRsMoveData ( + void *Destination, + void *Source, + UINT16 ItemCount, + UINT8 MoveType); + +/* Types used in MoveType above */ -ACPI_STATUS -AcpiRsEndTagStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed); +#define ACPI_MOVE_TYPE_16_TO_32 0 +#define ACPI_MOVE_TYPE_32_TO_16 1 +#define ACPI_MOVE_TYPE_32_TO_32 2 +#define ACPI_MOVE_TYPE_64_TO_64 3 + -ACPI_STATUS -AcpiRsVendorResource ( - UINT8 *ByteStreamBuffer, - ACPI_SIZE *BytesConsumed, - UINT8 **OutputBuffer, - ACPI_SIZE *StructureSize); +UINT16 +AcpiRsGetResourceSource ( + UINT16 ResourceLength, + ACPI_SIZE MinimumLength, + ACPI_RESOURCE_SOURCE *ResourceSource, + AML_RESOURCE *Aml, + char *StringPtr); -ACPI_STATUS -AcpiRsVendorStream ( - ACPI_RESOURCE *LinkedList, - UINT8 **OutputBuffer, - ACPI_SIZE *BytesConsumed); +ACPI_SIZE +AcpiRsSetResourceSource ( + AML_RESOURCE *Aml, + ACPI_SIZE MinimumLength, + ACPI_RESOURCE_SOURCE *ResourceSource); UINT8 AcpiRsGetResourceType ( UINT8 ResourceStartByte); +UINT32 +AcpiRsGetDescriptorLength ( + AML_RESOURCE *Aml); + +UINT16 +AcpiRsGetResourceLength ( + AML_RESOURCE *Aml); + +void +AcpiRsSetResourceHeader ( + UINT8 DescriptorType, + ACPI_SIZE TotalLength, + AML_RESOURCE *Aml); + +ACPI_RESOURCE_INFO * +AcpiRsGetResourceInfo ( + UINT8 ResourceType); + + +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) +/* + * rsdump + */ +void +AcpiRsDumpIrq ( + ACPI_RESOURCE_DATA *Resource); + +void +AcpiRsDumpAddress16 ( + ACPI_RESOURCE_DATA *Resource); + +void +AcpiRsDumpAddress32 ( + ACPI_RESOURCE_DATA *Resource); + +void +AcpiRsDumpAddress64 ( + ACPI_RESOURCE_DATA *Resource); + +void +AcpiRsDumpExtAddress64 ( + ACPI_RESOURCE_DATA *Resource); + +void +AcpiRsDumpDma ( + ACPI_RESOURCE_DATA *Resource); + +void +AcpiRsDumpIo ( + ACPI_RESOURCE_DATA *Resource); + +void +AcpiRsDumpExtIrq ( + ACPI_RESOURCE_DATA *Resource); + +void +AcpiRsDumpFixedIo ( + ACPI_RESOURCE_DATA *Resource); + +void +AcpiRsDumpFixedMemory32 ( + ACPI_RESOURCE_DATA *Resource); + +void +AcpiRsDumpMemory24 ( + ACPI_RESOURCE_DATA *Resource); + +void +AcpiRsDumpMemory32 ( + ACPI_RESOURCE_DATA *Resource); + +void +AcpiRsDumpStartDpf ( + ACPI_RESOURCE_DATA *Resource); + +void +AcpiRsDumpVendor ( + ACPI_RESOURCE_DATA *Resource); + +void +AcpiRsDumpGenericReg ( + ACPI_RESOURCE_DATA *Resource); + +void +AcpiRsDumpEndDpf ( + ACPI_RESOURCE_DATA *Resource); + +void +AcpiRsDumpEndTag ( + ACPI_RESOURCE_DATA *Resource); + +#endif + #endif /* __ACRESRC_H__ */
--- a/usr/src/uts/intel/sys/acpi/acstruct.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acstruct.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acstruct.h - Internal structs - * $Revision: 35 $ + * $Revision: 1.37 $ * *****************************************************************************/ @@ -229,6 +229,7 @@ typedef struct acpi_walk_info { UINT32 DebugLevel; + UINT32 Count; ACPI_OWNER_ID OwnerId; UINT8 DisplayType; @@ -288,8 +289,10 @@ typedef struct acpi_parameter_info { ACPI_NAMESPACE_NODE *Node; + ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT **Parameters; ACPI_OPERAND_OBJECT *ReturnObject; + UINT8 PassNumber; UINT8 ParameterType; UINT8 ReturnObjectType;
--- a/usr/src/uts/intel/sys/acpi/actables.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/actables.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actables.h - ACPI table management - * $Revision: 51 $ + * $Revision: 1.53 $ * *****************************************************************************/ @@ -251,11 +251,15 @@ * tbutils - common table utilities */ ACPI_STATUS +AcpiTbIsTableInstalled ( + ACPI_TABLE_DESC *NewTableDesc); + +ACPI_STATUS AcpiTbVerifyTableChecksum ( ACPI_TABLE_HEADER *TableHeader); UINT8 -AcpiTbChecksum ( +AcpiTbGenerateChecksum ( void *Buffer, UINT32 Length);
--- a/usr/src/uts/intel/sys/acpi/actbl.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/actbl.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actbl.h - Table data structures defined in ACPI specification - * $Revision: 72 $ + * $Revision: 1.72 $ * *****************************************************************************/
--- a/usr/src/uts/intel/sys/acpi/actbl1.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/actbl1.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actbl1.h - ACPI 1.0 tables - * $Revision: 32 $ + * $Revision: 1.32 $ * *****************************************************************************/
--- a/usr/src/uts/intel/sys/acpi/actbl2.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/actbl2.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actbl2.h - ACPI Specification Revision 2.0 Tables - * $Revision: 44 $ + * $Revision: 1.45 $ * *****************************************************************************/ @@ -174,7 +174,7 @@ UINT32 GlobalLock; /* Global Lock used to synchronize access to shared hardware resources */ /* Flags (32 bits) */ - + UINT8_BIT S4Bios_f : 1; /* 00: S4BIOS support is present */ UINT8_BIT : 7; /* 01-07: Reserved, must be zero */ UINT8 Reserved1[3]; /* 08-31: Reserved, must be zero */
--- a/usr/src/uts/intel/sys/acpi/actypes.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/actypes.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actypes.h - Common data types for the entire ACPI subsystem - * $Revision: 282 $ + * $Revision: 1.286 $ * *****************************************************************************/ @@ -1151,57 +1151,61 @@ */ typedef struct acpi_resource_irq { - UINT32 EdgeLevel; - UINT32 ActiveHighLow; - UINT32 SharedExclusive; - UINT32 NumberOfInterrupts; + UINT32 Triggering; + UINT32 Polarity; + UINT32 Sharable; + UINT32 InterruptCount; UINT32 Interrupts[1]; } ACPI_RESOURCE_IRQ; + typedef struct ACPI_RESOURCE_DMA { UINT32 Type; UINT32 BusMaster; UINT32 Transfer; - UINT32 NumberOfChannels; + UINT32 ChannelCount; UINT32 Channels[1]; } ACPI_RESOURCE_DMA; -typedef struct acpi_resource_start_dpf + +typedef struct acpi_resource_start_dependent { UINT32 CompatibilityPriority; UINT32 PerformanceRobustness; -} ACPI_RESOURCE_START_DPF; +} ACPI_RESOURCE_START_DEPENDENT; + /* * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not * needed because it has no fields */ + typedef struct acpi_resource_io { UINT32 IoDecode; - UINT32 MinBaseAddress; - UINT32 MaxBaseAddress; + UINT32 Minimum; + UINT32 Maximum; UINT32 Alignment; - UINT32 RangeLength; + UINT32 AddressLength; } ACPI_RESOURCE_IO; typedef struct acpi_resource_fixed_io { - UINT32 BaseAddress; - UINT32 RangeLength; + UINT32 Address; + UINT32 AddressLength; } ACPI_RESOURCE_FIXED_IO; typedef struct acpi_resource_vendor { - UINT32 Length; - UINT8 Reserved[1]; + UINT32 ByteLength; + UINT8 ByteData[1]; } ACPI_RESOURCE_VENDOR; @@ -1211,33 +1215,33 @@ } ACPI_RESOURCE_END_TAG; -typedef struct acpi_resource_mem24 +typedef struct acpi_resource_memory24 { UINT32 ReadWriteAttribute; - UINT32 MinBaseAddress; - UINT32 MaxBaseAddress; + UINT32 Minimum; + UINT32 Maximum; UINT32 Alignment; - UINT32 RangeLength; + UINT32 AddressLength; -} ACPI_RESOURCE_MEM24; +} ACPI_RESOURCE_MEMORY24; -typedef struct acpi_resource_mem32 +typedef struct acpi_resource_memory32 { UINT32 ReadWriteAttribute; - UINT32 MinBaseAddress; - UINT32 MaxBaseAddress; + UINT32 Minimum; + UINT32 Maximum; UINT32 Alignment; - UINT32 RangeLength; + UINT32 AddressLength; -} ACPI_RESOURCE_MEM32; +} ACPI_RESOURCE_MEMORY32; -typedef struct acpi_resource_fixed_mem32 +typedef struct acpi_resource_fixed_memory32 { UINT32 ReadWriteAttribute; - UINT32 RangeBaseAddress; - UINT32 RangeLength; + UINT32 Address; + UINT32 AddressLength; -} ACPI_RESOURCE_FIXED_MEM32; +} ACPI_RESOURCE_FIXED_MEMORY32; typedef struct acpi_memory_attribute { @@ -1276,18 +1280,29 @@ } ACPI_RESOURCE_SOURCE; +/* Fields common to all address descriptors, 16/32/64 bit */ + +#define ACPI_RESOURCE_ADDRESS_COMMON \ + UINT32 ResourceType; \ + UINT32 ProducerConsumer; \ + UINT32 Decode; \ + UINT32 MinAddressFixed; \ + UINT32 MaxAddressFixed; \ + ACPI_RESOURCE_ATTRIBUTE Attribute; + +typedef struct acpi_resource_address +{ + ACPI_RESOURCE_ADDRESS_COMMON + +} ACPI_RESOURCE_ADDRESS; + typedef struct acpi_resource_address16 { - UINT32 ResourceType; - UINT32 ProducerConsumer; - UINT32 Decode; - UINT32 MinAddressFixed; - UINT32 MaxAddressFixed; - ACPI_RESOURCE_ATTRIBUTE Attribute; + ACPI_RESOURCE_ADDRESS_COMMON UINT32 Granularity; - UINT32 MinAddressRange; - UINT32 MaxAddressRange; - UINT32 AddressTranslationOffset; + UINT32 Minimum; + UINT32 Maximum; + UINT32 TranslationOffset; UINT32 AddressLength; ACPI_RESOURCE_SOURCE ResourceSource; @@ -1295,16 +1310,11 @@ typedef struct acpi_resource_address32 { - UINT32 ResourceType; - UINT32 ProducerConsumer; - UINT32 Decode; - UINT32 MinAddressFixed; - UINT32 MaxAddressFixed; - ACPI_RESOURCE_ATTRIBUTE Attribute; + ACPI_RESOURCE_ADDRESS_COMMON UINT32 Granularity; - UINT32 MinAddressRange; - UINT32 MaxAddressRange; - UINT32 AddressTranslationOffset; + UINT32 Minimum; + UINT32 Maximum; + UINT32 TranslationOffset; UINT32 AddressLength; ACPI_RESOURCE_SOURCE ResourceSource; @@ -1312,86 +1322,113 @@ typedef struct acpi_resource_address64 { - UINT32 ResourceType; - UINT32 ProducerConsumer; - UINT32 Decode; - UINT32 MinAddressFixed; - UINT32 MaxAddressFixed; - ACPI_RESOURCE_ATTRIBUTE Attribute; + ACPI_RESOURCE_ADDRESS_COMMON UINT64 Granularity; - UINT64 MinAddressRange; - UINT64 MaxAddressRange; - UINT64 AddressTranslationOffset; + UINT64 Minimum; + UINT64 Maximum; + UINT64 TranslationOffset; UINT64 AddressLength; - UINT64 TypeSpecificAttributes; ACPI_RESOURCE_SOURCE ResourceSource; } ACPI_RESOURCE_ADDRESS64; -typedef struct acpi_resource_ext_irq +typedef struct acpi_resource_extended_address64 +{ + ACPI_RESOURCE_ADDRESS_COMMON + UINT64 Granularity; + UINT64 Minimum; + UINT64 Maximum; + UINT64 TranslationOffset; + UINT64 AddressLength; + UINT64 TypeSpecificAttributes; + UINT8 RevisionID; + +} ACPI_RESOURCE_EXTENDED_ADDRESS64; + +typedef struct acpi_resource_extended_irq { UINT32 ProducerConsumer; - UINT32 EdgeLevel; - UINT32 ActiveHighLow; - UINT32 SharedExclusive; - UINT32 NumberOfInterrupts; + UINT32 Triggering; + UINT32 Polarity; + UINT32 Sharable; + UINT32 InterruptCount; ACPI_RESOURCE_SOURCE ResourceSource; UINT32 Interrupts[1]; -} ACPI_RESOURCE_EXT_IRQ; +} ACPI_RESOURCE_EXTENDED_IRQ; + +typedef struct acpi_resource_generic_register +{ + UINT32 SpaceId; + UINT32 BitWidth; + UINT32 BitOffset; + UINT32 AccessSize; + UINT64 Address; + +} ACPI_RESOURCE_GENERIC_REGISTER; /* ACPI_RESOURCE_TYPEs */ -#define ACPI_RSTYPE_IRQ 0 -#define ACPI_RSTYPE_DMA 1 -#define ACPI_RSTYPE_START_DPF 2 -#define ACPI_RSTYPE_END_DPF 3 -#define ACPI_RSTYPE_IO 4 -#define ACPI_RSTYPE_FIXED_IO 5 -#define ACPI_RSTYPE_VENDOR 6 -#define ACPI_RSTYPE_END_TAG 7 -#define ACPI_RSTYPE_MEM24 8 -#define ACPI_RSTYPE_MEM32 9 -#define ACPI_RSTYPE_FIXED_MEM32 10 -#define ACPI_RSTYPE_ADDRESS16 11 -#define ACPI_RSTYPE_ADDRESS32 12 -#define ACPI_RSTYPE_ADDRESS64 13 -#define ACPI_RSTYPE_EXT_IRQ 14 +#define ACPI_RESOURCE_TYPE_IRQ 0 +#define ACPI_RESOURCE_TYPE_DMA 1 +#define ACPI_RESOURCE_TYPE_START_DEPENDENT 2 +#define ACPI_RESOURCE_TYPE_END_DEPENDENT 3 +#define ACPI_RESOURCE_TYPE_IO 4 +#define ACPI_RESOURCE_TYPE_FIXED_IO 5 +#define ACPI_RESOURCE_TYPE_VENDOR 6 +#define ACPI_RESOURCE_TYPE_END_TAG 7 +#define ACPI_RESOURCE_TYPE_MEMORY24 8 +#define ACPI_RESOURCE_TYPE_MEMORY32 9 +#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10 +#define ACPI_RESOURCE_TYPE_ADDRESS16 11 +#define ACPI_RESOURCE_TYPE_ADDRESS32 12 +#define ACPI_RESOURCE_TYPE_ADDRESS64 13 +#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */ +#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15 +#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16 +#define ACPI_RESOURCE_TYPE_MAX 16 -typedef UINT32 ACPI_RESOURCE_TYPE; typedef union acpi_resource_data { - ACPI_RESOURCE_IRQ Irq; - ACPI_RESOURCE_DMA Dma; - ACPI_RESOURCE_START_DPF StartDpf; - ACPI_RESOURCE_IO Io; - ACPI_RESOURCE_FIXED_IO FixedIo; - ACPI_RESOURCE_VENDOR VendorSpecific; - ACPI_RESOURCE_END_TAG EndTag; - ACPI_RESOURCE_MEM24 Memory24; - ACPI_RESOURCE_MEM32 Memory32; - ACPI_RESOURCE_FIXED_MEM32 FixedMemory32; - ACPI_RESOURCE_ADDRESS16 Address16; - ACPI_RESOURCE_ADDRESS32 Address32; - ACPI_RESOURCE_ADDRESS64 Address64; - ACPI_RESOURCE_EXT_IRQ ExtendedIrq; + ACPI_RESOURCE_IRQ Irq; + ACPI_RESOURCE_DMA Dma; + ACPI_RESOURCE_START_DEPENDENT StartDpf; + ACPI_RESOURCE_IO Io; + ACPI_RESOURCE_FIXED_IO FixedIo; + ACPI_RESOURCE_VENDOR Vendor; + ACPI_RESOURCE_END_TAG EndTag; + ACPI_RESOURCE_MEMORY24 Memory24; + ACPI_RESOURCE_MEMORY32 Memory32; + ACPI_RESOURCE_FIXED_MEMORY32 FixedMemory32; + ACPI_RESOURCE_ADDRESS16 Address16; + ACPI_RESOURCE_ADDRESS32 Address32; + ACPI_RESOURCE_ADDRESS64 Address64; + ACPI_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64; + ACPI_RESOURCE_EXTENDED_IRQ ExtendedIrq; + ACPI_RESOURCE_GENERIC_REGISTER GenericReg; + + /* Common fields */ + + ACPI_RESOURCE_ADDRESS Address; /* Common 16/32/64 address fields */ } ACPI_RESOURCE_DATA; + typedef struct acpi_resource { - ACPI_RESOURCE_TYPE Id; + UINT32 Type; UINT32 Length; ACPI_RESOURCE_DATA Data; } ACPI_RESOURCE; + #define ACPI_RESOURCE_LENGTH 12 #define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ -#define ACPI_SIZEOF_RESOURCE(Type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (Type)) +#define ACPI_SIZEOF_RESOURCE(Type) (UINT32) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (Type)) #define ACPI_NEXT_RESOURCE(Res) (ACPI_RESOURCE *)((UINT8 *) Res + Res->Length)
--- a/usr/src/uts/intel/sys/acpi/acutils.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/acutils.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures - * $Revision: 177 $ + * $Revision: 1.181 $ * *****************************************************************************/ @@ -376,14 +376,14 @@ void AcpiUtTrace ( UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId); void AcpiUtTracePtr ( UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId, void *Pointer); @@ -391,7 +391,7 @@ void AcpiUtTraceU32 ( UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId, UINT32 Integer); @@ -399,7 +399,7 @@ void AcpiUtTraceStr ( UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId, char *String); @@ -407,14 +407,14 @@ void AcpiUtExit ( UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId); void AcpiUtStatusExit ( UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId, ACPI_STATUS Status); @@ -422,7 +422,7 @@ void AcpiUtValueExit ( UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId, ACPI_INTEGER Value); @@ -430,7 +430,7 @@ void AcpiUtPtrExit ( UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId, UINT8 *Ptr); @@ -464,7 +464,7 @@ AcpiUtDebugPrint ( UINT32 RequestedDebugLevel, UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId, char *Format, @@ -474,7 +474,7 @@ AcpiUtDebugPrintRaw ( UINT32 RequestedDebugLevel, UINT32 LineNumber, - char *FunctionName, + const char *FunctionName, char *ModuleName, UINT32 ComponentId, char *Format, @@ -670,9 +670,9 @@ AcpiUtAllocateOwnerId ( ACPI_OWNER_ID *OwnerId); -ACPI_STATUS +void AcpiUtReleaseOwnerId ( - ACPI_OWNER_ID OwnerId); + ACPI_OWNER_ID *OwnerId); ACPI_STATUS AcpiUtWalkPackageTree ( @@ -681,7 +681,7 @@ ACPI_PKG_CALLBACK WalkCallback, void *Context); -char * +void AcpiUtStrupr ( char *SrcString); @@ -755,7 +755,6 @@ ACPI_MUTEX_HANDLE MutexId); - /* * utalloc - memory allocation and object caching */
--- a/usr/src/uts/intel/sys/acpi/amlcode.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/amlcode.h Thu Nov 17 08:46:01 2005 -0800 @@ -3,7 +3,7 @@ * Name: amlcode.h - Definitions for AML, as included in "definition blocks" * Declarations and definitions contained herein are derived * directly from the ACPI specification. - * $Revision: 82 $ + * $Revision: 1.82 $ * *****************************************************************************/
--- a/usr/src/uts/intel/sys/acpi/amlresrc.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/amlresrc.h Thu Nov 17 08:46:01 2005 -0800 @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: amlresrc.h - AML resource descriptors - * $Revision: 29 $ + * $Revision: 1.32 $ * *****************************************************************************/ @@ -176,239 +176,254 @@ * Resource descriptors defined in the ACPI specification. * * Packing/alignment must be BYTE because these descriptors - * are used to overlay the AML byte stream. + * are used to overlay the raw AML byte stream. */ #pragma pack(1) -typedef struct asl_irq_format_desc +/* + * SMALL descriptors + */ +#define AML_RESOURCE_SMALL_HEADER_COMMON \ + UINT8 DescriptorType; + +typedef struct aml_resource_small_header { - UINT8 DescriptorType; + AML_RESOURCE_SMALL_HEADER_COMMON + +} AML_RESOURCE_SMALL_HEADER; + + +typedef struct aml_resource_irq +{ + AML_RESOURCE_SMALL_HEADER_COMMON UINT16 IrqMask; UINT8 Flags; -} ASL_IRQ_FORMAT_DESC; +} AML_RESOURCE_IRQ; -typedef struct asl_irq_noflags_desc +typedef struct aml_resource_irq_noflags { - UINT8 DescriptorType; + AML_RESOURCE_SMALL_HEADER_COMMON UINT16 IrqMask; -} ASL_IRQ_NOFLAGS_DESC; +} AML_RESOURCE_IRQ_NOFLAGS; -typedef struct asl_dma_format_desc +typedef struct aml_resource_dma { - UINT8 DescriptorType; + AML_RESOURCE_SMALL_HEADER_COMMON UINT8 DmaChannelMask; UINT8 Flags; -} ASL_DMA_FORMAT_DESC; +} AML_RESOURCE_DMA; -typedef struct asl_start_dependent_desc +typedef struct aml_resource_start_dependent { - UINT8 DescriptorType; + AML_RESOURCE_SMALL_HEADER_COMMON UINT8 Flags; -} ASL_START_DEPENDENT_DESC; +} AML_RESOURCE_START_DEPENDENT; -typedef struct asl_start_dependent_noprio_desc +typedef struct aml_resource_start_dependent_noprio { - UINT8 DescriptorType; + AML_RESOURCE_SMALL_HEADER_COMMON -} ASL_START_DEPENDENT_NOPRIO_DESC; +} AML_RESOURCE_START_DEPENDENT_NOPRIO; -typedef struct asl_end_dependent_desc +typedef struct aml_resource_end_dependent { - UINT8 DescriptorType; + AML_RESOURCE_SMALL_HEADER_COMMON -} ASL_END_DEPENDENT_DESC; +} AML_RESOURCE_END_DEPENDENT; -typedef struct asl_io_port_desc +typedef struct aml_resource_io { - UINT8 DescriptorType; + AML_RESOURCE_SMALL_HEADER_COMMON UINT8 Information; - UINT16 AddressMin; - UINT16 AddressMax; + UINT16 Minimum; + UINT16 Maximum; UINT8 Alignment; - UINT8 Length; + UINT8 AddressLength; -} ASL_IO_PORT_DESC; +} AML_RESOURCE_IO; -typedef struct asl_fixed_io_port_desc +typedef struct aml_resource_fixed_io { - UINT8 DescriptorType; - UINT16 BaseAddress; - UINT8 Length; + AML_RESOURCE_SMALL_HEADER_COMMON + UINT16 Address; + UINT8 AddressLength; -} ASL_FIXED_IO_PORT_DESC; +} AML_RESOURCE_FIXED_IO; -typedef struct asl_small_vendor_desc +typedef struct aml_resource_vendor_small { - UINT8 DescriptorType; - UINT8 VendorDefined[7]; + AML_RESOURCE_SMALL_HEADER_COMMON -} ASL_SMALL_VENDOR_DESC; +} AML_RESOURCE_VENDOR_SMALL; -typedef struct asl_end_tag_desc +typedef struct aml_resource_end_tag { - UINT8 DescriptorType; + AML_RESOURCE_SMALL_HEADER_COMMON UINT8 Checksum; -} ASL_END_TAG_DESC; +} AML_RESOURCE_END_TAG; + + +/* + * LARGE descriptors + */ +#define AML_RESOURCE_LARGE_HEADER_COMMON \ + UINT8 DescriptorType;\ + UINT16 ResourceLength; + +typedef struct aml_resource_large_header +{ + AML_RESOURCE_LARGE_HEADER_COMMON + +} AML_RESOURCE_LARGE_HEADER; -/* LARGE descriptors */ - -typedef struct asl_memory_24_desc +typedef struct aml_resource_memory24 { - UINT8 DescriptorType; - UINT16 Length; + AML_RESOURCE_LARGE_HEADER_COMMON UINT8 Information; - UINT16 AddressMin; - UINT16 AddressMax; + UINT16 Minimum; + UINT16 Maximum; UINT16 Alignment; - UINT16 RangeLength; + UINT16 AddressLength; -} ASL_MEMORY_24_DESC; +} AML_RESOURCE_MEMORY24; -typedef struct asl_large_vendor_desc +typedef struct aml_resource_vendor_large { - UINT8 DescriptorType; - UINT16 Length; - UINT8 VendorDefined[1]; + AML_RESOURCE_LARGE_HEADER_COMMON -} ASL_LARGE_VENDOR_DESC; +} AML_RESOURCE_VENDOR_LARGE; -typedef struct asl_memory_32_desc +typedef struct aml_resource_memory32 { - UINT8 DescriptorType; - UINT16 Length; + AML_RESOURCE_LARGE_HEADER_COMMON UINT8 Information; - UINT32 AddressMin; - UINT32 AddressMax; + UINT32 Minimum; + UINT32 Maximum; UINT32 Alignment; - UINT32 RangeLength; + UINT32 AddressLength; -} ASL_MEMORY_32_DESC; +} AML_RESOURCE_MEMORY32; -typedef struct asl_fixed_memory_32_desc +typedef struct aml_resource_fixed_memory32 { - UINT8 DescriptorType; - UINT16 Length; + AML_RESOURCE_LARGE_HEADER_COMMON UINT8 Information; - UINT32 BaseAddress; - UINT32 RangeLength; + UINT32 Address; + UINT32 AddressLength; -} ASL_FIXED_MEMORY_32_DESC; +} AML_RESOURCE_FIXED_MEMORY32; -typedef struct asl_extended_address_desc +#define AML_RESOURCE_ADDRESS_COMMON \ + UINT8 ResourceType; \ + UINT8 Flags; \ + UINT8 SpecificFlags; + + +typedef struct aml_resource_address { - UINT8 DescriptorType; - UINT16 Length; - UINT8 ResourceType; - UINT8 Flags; - UINT8 SpecificFlags; + AML_RESOURCE_LARGE_HEADER_COMMON + AML_RESOURCE_ADDRESS_COMMON + +} AML_RESOURCE_ADDRESS; + + +typedef struct aml_resource_extended_address64 +{ + AML_RESOURCE_LARGE_HEADER_COMMON + AML_RESOURCE_ADDRESS_COMMON UINT8 RevisionID; UINT8 Reserved; UINT64 Granularity; - UINT64 AddressMin; - UINT64 AddressMax; + UINT64 Minimum; + UINT64 Maximum; UINT64 TranslationOffset; UINT64 AddressLength; UINT64 TypeSpecificAttributes; - UINT8 OptionalFields[2]; /* Used for length calculation only */ -} ASL_EXTENDED_ADDRESS_DESC; +} AML_RESOURCE_EXTENDED_ADDRESS64; -#define ASL_EXTENDED_ADDRESS_DESC_REVISION 1 /* ACPI 3.0 */ +#define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */ -typedef struct asl_qword_address_desc +typedef struct aml_resource_address64 { - UINT8 DescriptorType; - UINT16 Length; - UINT8 ResourceType; - UINT8 Flags; - UINT8 SpecificFlags; + AML_RESOURCE_LARGE_HEADER_COMMON + AML_RESOURCE_ADDRESS_COMMON UINT64 Granularity; - UINT64 AddressMin; - UINT64 AddressMax; + UINT64 Minimum; + UINT64 Maximum; UINT64 TranslationOffset; UINT64 AddressLength; - UINT8 OptionalFields[2]; -} ASL_QWORD_ADDRESS_DESC; +} AML_RESOURCE_ADDRESS64; -typedef struct asl_dword_address_desc +typedef struct aml_resource_address32 { - UINT8 DescriptorType; - UINT16 Length; - UINT8 ResourceType; - UINT8 Flags; - UINT8 SpecificFlags; + AML_RESOURCE_LARGE_HEADER_COMMON + AML_RESOURCE_ADDRESS_COMMON UINT32 Granularity; - UINT32 AddressMin; - UINT32 AddressMax; + UINT32 Minimum; + UINT32 Maximum; UINT32 TranslationOffset; UINT32 AddressLength; - UINT8 OptionalFields[2]; -} ASL_DWORD_ADDRESS_DESC; +} AML_RESOURCE_ADDRESS32; -typedef struct asl_word_address_desc +typedef struct aml_resource_address16 { - UINT8 DescriptorType; - UINT16 Length; - UINT8 ResourceType; - UINT8 Flags; - UINT8 SpecificFlags; + AML_RESOURCE_LARGE_HEADER_COMMON + AML_RESOURCE_ADDRESS_COMMON UINT16 Granularity; - UINT16 AddressMin; - UINT16 AddressMax; + UINT16 Minimum; + UINT16 Maximum; UINT16 TranslationOffset; UINT16 AddressLength; - UINT8 OptionalFields[2]; -} ASL_WORD_ADDRESS_DESC; +} AML_RESOURCE_ADDRESS16; -typedef struct asl_extended_xrupt_desc +typedef struct aml_resource_extended_irq { - UINT8 DescriptorType; - UINT16 Length; + AML_RESOURCE_LARGE_HEADER_COMMON UINT8 Flags; UINT8 TableLength; UINT32 InterruptNumber[1]; /* ResSourceIndex, ResSource optional fields follow */ -} ASL_EXTENDED_XRUPT_DESC; +} AML_RESOURCE_EXTENDED_IRQ; -typedef struct asl_general_register_desc +typedef struct aml_resource_generic_register { - UINT8 DescriptorType; - UINT16 Length; + AML_RESOURCE_LARGE_HEADER_COMMON UINT8 AddressSpaceId; UINT8 BitWidth; UINT8 BitOffset; - UINT8 AccessSize; /* ACPI 3.0, was Reserved */ + UINT8 AccessSize; /* ACPI 3.0, was previously Reserved */ UINT64 Address; -} ASL_GENERAL_REGISTER_DESC; +} AML_RESOURCE_GENERIC_REGISTER; /* restore default alignment */ @@ -416,32 +431,45 @@ /* Union of all resource descriptors, so we can allocate the worst case */ -typedef union asl_resource_desc +typedef union aml_resource { - ASL_IRQ_FORMAT_DESC Irq; - ASL_DMA_FORMAT_DESC Dma; - ASL_START_DEPENDENT_DESC Std; - ASL_END_DEPENDENT_DESC End; - ASL_IO_PORT_DESC Iop; - ASL_FIXED_IO_PORT_DESC Fio; - ASL_SMALL_VENDOR_DESC Smv; - ASL_END_TAG_DESC Et; + /* Descriptor headers */ + + AML_RESOURCE_SMALL_HEADER SmallHeader; + AML_RESOURCE_LARGE_HEADER LargeHeader; + + /* Small resource descriptors */ + + AML_RESOURCE_IRQ Irq; + AML_RESOURCE_DMA Dma; + AML_RESOURCE_START_DEPENDENT StartDpf; + AML_RESOURCE_END_DEPENDENT EndDpf; + AML_RESOURCE_IO Io; + AML_RESOURCE_FIXED_IO FixedIo; + AML_RESOURCE_VENDOR_SMALL VendorSmall; + AML_RESOURCE_END_TAG EndTag; + + /* Large resource descriptors */ - ASL_MEMORY_24_DESC M24; - ASL_LARGE_VENDOR_DESC Lgv; - ASL_MEMORY_32_DESC M32; - ASL_FIXED_MEMORY_32_DESC F32; - ASL_QWORD_ADDRESS_DESC Qas; - ASL_DWORD_ADDRESS_DESC Das; - ASL_WORD_ADDRESS_DESC Was; - ASL_EXTENDED_ADDRESS_DESC Eas; - ASL_EXTENDED_XRUPT_DESC Exx; - ASL_GENERAL_REGISTER_DESC Grg; - UINT32 U32Item; - UINT16 U16Item; - UINT8 U8Item; + AML_RESOURCE_MEMORY24 Memory24; + AML_RESOURCE_GENERIC_REGISTER GenericReg; + AML_RESOURCE_VENDOR_LARGE VendorLarge; + AML_RESOURCE_MEMORY32 Memory32; + AML_RESOURCE_FIXED_MEMORY32 FixedMemory32; + AML_RESOURCE_ADDRESS16 Address16; + AML_RESOURCE_ADDRESS32 Address32; + AML_RESOURCE_ADDRESS64 Address64; + AML_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64; + AML_RESOURCE_EXTENDED_IRQ ExtendedIrq; -} ASL_RESOURCE_DESC; + /* Utility overlays */ + + AML_RESOURCE_ADDRESS Address; + UINT32 U32Item; + UINT16 U16Item; + UINT8 U8Item; + +} AML_RESOURCE; #endif
--- a/usr/src/uts/intel/sys/acpi/platform/acdos16.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/platform/acdos16.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acdos16.h - DOS specific defines, etc. - * $Revision: 12 $ + * $Revision: 1.12 $ * *****************************************************************************/
--- a/usr/src/uts/intel/sys/acpi/platform/acefi.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/platform/acefi.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acefi.h - OS specific defines, etc. - * $Revision: 16 $ + * $Revision: 1.16 $ * *****************************************************************************/
--- a/usr/src/uts/intel/sys/acpi/platform/acenv.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/platform/acenv.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acenv.h - Generation environment specific items - * $Revision: 116 $ + * $Revision: 1.118 $ * *****************************************************************************/ @@ -142,6 +142,7 @@ #define ACPI_APPLICATION #define ACPI_DEBUGGER #define ACPI_DISASSEMBLER +#define ACPI_MUTEX_DEBUG #endif #ifdef ACPI_ASL_COMPILER @@ -317,15 +318,15 @@ #define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (ACPI_SIZE)(n)) #define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (ACPI_SIZE)(n)) -#define ACPI_TOUPPER toupper -#define ACPI_TOLOWER tolower -#define ACPI_IS_XDIGIT isxdigit -#define ACPI_IS_DIGIT isdigit -#define ACPI_IS_SPACE isspace -#define ACPI_IS_UPPER isupper -#define ACPI_IS_PRINT isprint -#define ACPI_IS_ALPHA isalpha -#define ACPI_IS_ASCII isascii +#define ACPI_TOUPPER(i) toupper((int) (i)) +#define ACPI_TOLOWER(i) tolower((int) (i)) +#define ACPI_IS_XDIGIT(i) isxdigit((int) (i)) +#define ACPI_IS_DIGIT(i) isdigit((int) (i)) +#define ACPI_IS_SPACE(i) isspace((int) (i)) +#define ACPI_IS_UPPER(i) isupper((int) (i)) +#define ACPI_IS_PRINT(i) isprint((int) (i)) +#define ACPI_IS_ALPHA(i) isalpha((int) (i)) +#define ACPI_IS_ASCII(i) isascii((int) (i)) #else
--- a/usr/src/uts/intel/sys/acpi/platform/acfreebsd.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/platform/acfreebsd.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acfreebsd.h - OS specific defines, etc. - * $Revision: 19 $ + * $Revision: 1.19 $ * *****************************************************************************/
--- a/usr/src/uts/intel/sys/acpi/platform/acgcc.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/platform/acgcc.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acgcc.h - GCC specific defines, etc. - * $Revision: 29 $ + * $Revision: 1.29 $ * *****************************************************************************/
--- a/usr/src/uts/intel/sys/acpi/platform/acintel.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/platform/acintel.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acintel.h - VC specific defines, etc. - * $Revision: 13 $ + * $Revision: 1.14 $ * *****************************************************************************/ @@ -160,6 +160,9 @@ /* warn C4706: assignment within conditional expression */ #pragma warning(disable:4706) +/* warn C4214: bit field types other than int */ +#pragma warning(disable:4214) + /* This macro is used to tag functions as "printf-like" because * some compilers can catch printf format string problems. MSVC * doesn't, so this is proprocessed away.
--- a/usr/src/uts/intel/sys/acpi/platform/aclinux.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/platform/aclinux.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: aclinux.h - OS specific defines, etc. - * $Revision: 37 $ + * $Revision: 1.37 $ * *****************************************************************************/
--- a/usr/src/uts/intel/sys/acpi/platform/acmsvc.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/platform/acmsvc.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acmsvc.h - VC specific defines, etc. - * $Revision: 22 $ + * $Revision: 1.22 $ * *****************************************************************************/
--- a/usr/src/uts/intel/sys/acpi/platform/acnetbsd.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/platform/acnetbsd.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acnetbsd.h - OS specific defines, etc. - * $Revision: 7 $ + * $Revision: 1.7 $ * *****************************************************************************/
--- a/usr/src/uts/intel/sys/acpi/platform/acwin.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/platform/acwin.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acwin.h - OS specific defines, etc. - * $Revision: 21 $ + * $Revision: 1.22 $ * *****************************************************************************/ @@ -154,6 +154,9 @@ #define ACPI_FLUSH_CPU_CACHE() __asm {WBINVD} #endif +#ifdef _DEBUG +#define ACPI_SIMPLE_RETURN_MACROS +#endif /* * For Acpi applications, we don't want to try to access the global lock
--- a/usr/src/uts/intel/sys/acpi/platform/acwin64.h Thu Nov 17 06:07:22 2005 -0800 +++ b/usr/src/uts/intel/sys/acpi/platform/acwin64.h Thu Nov 17 08:46:01 2005 -0800 @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acwin.h - OS specific defines, etc. - * $Revision: 14 $ + * $Revision: 1.14 $ * *****************************************************************************/