diff options
Diffstat (limited to 'sys/contrib/dev/acpica/rsdump.c')
-rw-r--r-- | sys/contrib/dev/acpica/rsdump.c | 102 |
1 files changed, 52 insertions, 50 deletions
diff --git a/sys/contrib/dev/acpica/rsdump.c b/sys/contrib/dev/acpica/rsdump.c index 8be18b5bbb9d..eec3df9b577d 100644 --- a/sys/contrib/dev/acpica/rsdump.c +++ b/sys/contrib/dev/acpica/rsdump.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsdump - Functions to display the resource structures. - * $Revision: 1.54 $ + * $Revision: 1.62 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. * All rights reserved. * * 2. License @@ -119,7 +119,6 @@ #include <contrib/dev/acpica/acpi.h> #include <contrib/dev/acpica/acresrc.h> -#include <contrib/dev/acpica/acdisasm.h> #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME ("rsdump") @@ -204,9 +203,9 @@ AcpiRsDumpDescriptor ( ACPI_RSDUMP_INFO AcpiRsDumpIrq[6] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIrq), "IRQ", NULL}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Triggering), "Triggering", AcpiGbl_HEDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Polarity), "Polarity", AcpiGbl_LLDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Sharable), "Sharing", AcpiGbl_SHRDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Triggering), "Triggering", AcpiGbl_HeDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Polarity), "Polarity", AcpiGbl_LlDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Sharable), "Sharing", AcpiGbl_ShrDecode}, {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (Irq.InterruptCount), "Interrupt Count", NULL}, {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Irq.Interrupts[0]), "Interrupt List", NULL} }; @@ -214,9 +213,9 @@ ACPI_RSDUMP_INFO AcpiRsDumpIrq[6] = ACPI_RSDUMP_INFO AcpiRsDumpDma[6] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpDma), "DMA", NULL}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Type), "Speed", AcpiGbl_TYPDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Dma.BusMaster), "Mastering", AcpiGbl_BMDecode}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Transfer), "Transfer Type", AcpiGbl_SIZDecode}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Type), "Speed", AcpiGbl_TypDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Dma.BusMaster), "Mastering", AcpiGbl_BmDecode}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Transfer), "Transfer Type", AcpiGbl_SizDecode}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Dma.ChannelCount), "Channel Count", NULL}, {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Dma.Channels[0]), "Channel List", NULL} }; @@ -265,7 +264,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpEndTag[1] = ACPI_RSDUMP_INFO AcpiRsDumpMemory24[6] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory24), "24-Bit Memory Range", NULL}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory24.WriteProtect), "Write Protect", AcpiGbl_RWDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory24.WriteProtect), "Write Protect", AcpiGbl_RwDecode}, {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Minimum), "Address Minimum", NULL}, {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Maximum), "Address Maximum", NULL}, {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Alignment), "Alignment", NULL}, @@ -275,7 +274,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpMemory24[6] = ACPI_RSDUMP_INFO AcpiRsDumpMemory32[6] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory32), "32-Bit Memory Range", NULL}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory32.WriteProtect), "Write Protect", AcpiGbl_RWDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory32.WriteProtect), "Write Protect", AcpiGbl_RwDecode}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Minimum), "Address Minimum", NULL}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Maximum), "Address Maximum", NULL}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Alignment), "Alignment", NULL}, @@ -285,7 +284,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpMemory32[6] = ACPI_RSDUMP_INFO AcpiRsDumpFixedMemory32[4] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedMemory32), "32-Bit Fixed Memory Range",NULL}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (FixedMemory32.WriteProtect), "Write Protect", AcpiGbl_RWDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (FixedMemory32.WriteProtect), "Write Protect", AcpiGbl_RwDecode}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (FixedMemory32.Address), "Address", NULL}, {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (FixedMemory32.AddressLength), "Address Length", NULL} }; @@ -342,9 +341,9 @@ ACPI_RSDUMP_INFO AcpiRsDumpExtIrq[8] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtIrq), "Extended IRQ", NULL}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.ProducerConsumer), "Type", AcpiGbl_ConsumeDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Triggering), "Triggering", AcpiGbl_HEDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Polarity), "Polarity", AcpiGbl_LLDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Sharable), "Sharing", AcpiGbl_SHRDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Triggering), "Triggering", AcpiGbl_HeDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Polarity), "Polarity", AcpiGbl_LlDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Sharable), "Sharing", AcpiGbl_ShrDecode}, {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (ExtendedIrq.ResourceSource), NULL, NULL}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (ExtendedIrq.InterruptCount), "Interrupt Count", NULL}, {ACPI_RSD_DWORDLIST,ACPI_RSD_OFFSET (ExtendedIrq.Interrupts[0]), "Interrupt List", NULL} @@ -368,26 +367,26 @@ static ACPI_RSDUMP_INFO AcpiRsDumpGeneralFlags[5] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpGeneralFlags), NULL, NULL}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.ProducerConsumer), "Consumer/Producer", AcpiGbl_ConsumeDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Decode), "Address Decode", AcpiGbl_DECDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Decode), "Address Decode", AcpiGbl_DecDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MinAddressFixed), "Min Relocatability", AcpiGbl_MinDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MaxAddressFixed), "Max Relocatability", AcpiGbl_MaxDecode} }; static ACPI_RSDUMP_INFO AcpiRsDumpMemoryFlags[5] = { - {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemoryFlags), "Resource Type", "Memory Range"}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.WriteProtect), "Write Protect", AcpiGbl_RWDecode}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Caching), "Caching", AcpiGbl_MEMDecode}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.RangeType), "Range Type", AcpiGbl_MTPDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Translation), "Translation", AcpiGbl_TTPDecode} + {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemoryFlags), "Resource Type", (void *) "Memory Range"}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.WriteProtect), "Write Protect", AcpiGbl_RwDecode}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Caching), "Caching", AcpiGbl_MemDecode}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.RangeType), "Range Type", AcpiGbl_MtpDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Translation), "Translation", AcpiGbl_TtpDecode} }; static ACPI_RSDUMP_INFO AcpiRsDumpIoFlags[4] = { - {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIoFlags), "Resource Type", "I/O Range"}, - {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.RangeType), "Range Type", AcpiGbl_RNGDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.Translation), "Translation", AcpiGbl_TTPDecode}, - {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.TranslationType), "Translation Type", AcpiGbl_TRSDecode} + {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIoFlags), "Resource Type", (void *) "I/O Range"}, + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.RangeType), "Range Type", AcpiGbl_RngDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.Translation), "Translation", AcpiGbl_TtpDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.TranslationType), "Translation Type", AcpiGbl_TrsDecode} }; @@ -421,8 +420,8 @@ AcpiRsDumpDescriptor ( void *Resource, ACPI_RSDUMP_INFO *Table) { - void *Target = NULL; - void *PreviousTarget; + UINT8 *Target = NULL; + UINT8 *PreviousTarget; char *Name; UINT8 Count; @@ -434,7 +433,7 @@ AcpiRsDumpDescriptor ( while (Count) { PreviousTarget = Target; - Target = ((UINT8 *) Resource) + Table->Offset; + Target = ACPI_ADD_PTR (UINT8, Resource, Table->Offset); Name = Table->Name; switch (Table->Opcode) @@ -452,41 +451,41 @@ AcpiRsDumpDescriptor ( /* Strings */ case ACPI_RSD_LITERAL: - AcpiRsOutString (Name, (char *) Table->Pointer); + AcpiRsOutString (Name, ACPI_CAST_PTR (char, Table->Pointer)); break; case ACPI_RSD_STRING: - AcpiRsOutString (Name, (char *) Target); + AcpiRsOutString (Name, ACPI_CAST_PTR (char, Target)); break; /* Data items, 8/16/32/64 bit */ case ACPI_RSD_UINT8: - AcpiRsOutInteger8 (Name, *(UINT8 *) Target); + AcpiRsOutInteger8 (Name, ACPI_GET8 (Target)); break; case ACPI_RSD_UINT16: - AcpiRsOutInteger16 (Name, *(UINT16 *) Target); + AcpiRsOutInteger16 (Name, ACPI_GET16 (Target)); break; case ACPI_RSD_UINT32: - AcpiRsOutInteger32 (Name, *(UINT32 *) Target); + AcpiRsOutInteger32 (Name, ACPI_GET32 (Target)); break; case ACPI_RSD_UINT64: - AcpiRsOutInteger64 (Name, *(UINT64 *) Target); + AcpiRsOutInteger64 (Name, ACPI_GET64 (Target)); break; /* Flags: 1-bit and 2-bit flags supported */ case ACPI_RSD_1BITFLAG: - AcpiRsOutString (Name, (char *) - ((const char **) Table->Pointer)[(*(UINT8 *) Target) & 0x01]); + AcpiRsOutString (Name, ACPI_CAST_PTR (char, + Table->Pointer [*Target & 0x01])); break; case ACPI_RSD_2BITFLAG: - AcpiRsOutString (Name, (char *) - ((const char **) Table->Pointer)[(*(UINT8 *) Target) & 0x03]); + AcpiRsOutString (Name, ACPI_CAST_PTR (char, + Table->Pointer [*Target & 0x03])); break; case ACPI_RSD_SHORTLIST: @@ -497,8 +496,7 @@ AcpiRsDumpDescriptor ( if (PreviousTarget) { AcpiRsOutTitle (Name); - AcpiRsDumpShortByteList (*((UINT8 *) PreviousTarget), - (UINT8 *) Target); + AcpiRsDumpShortByteList (*PreviousTarget, Target); } break; @@ -509,8 +507,7 @@ AcpiRsDumpDescriptor ( */ if (PreviousTarget) { - AcpiRsDumpByteList (*((UINT16 *) PreviousTarget), - (UINT8 *) Target); + AcpiRsDumpByteList (ACPI_GET16 (PreviousTarget), Target); } break; @@ -521,8 +518,8 @@ AcpiRsDumpDescriptor ( */ if (PreviousTarget) { - AcpiRsDumpDwordList (*((UINT8 *) PreviousTarget), - (UINT32 *) Target); + AcpiRsDumpDwordList (*PreviousTarget, + ACPI_CAST_PTR (UINT32, Target)); } break; @@ -530,14 +527,14 @@ AcpiRsDumpDescriptor ( /* * Common flags for all Address resources */ - AcpiRsDumpAddressCommon ((ACPI_RESOURCE_DATA *) Target); + AcpiRsDumpAddressCommon (ACPI_CAST_PTR (ACPI_RESOURCE_DATA, Target)); break; case ACPI_RSD_SOURCE: /* * Optional ResourceSource for Address resources */ - AcpiRsDumpResourceSource ((ACPI_RESOURCE_SOURCE *) Target); + AcpiRsDumpResourceSource (ACPI_CAST_PTR (ACPI_RESOURCE_SOURCE, Target)); break; default: @@ -691,7 +688,7 @@ AcpiRsDumpResourceList ( /* Point to the next resource structure */ - ResourceList = ACPI_PTR_ADD (ACPI_RESOURCE, ResourceList, + ResourceList = ACPI_ADD_PTR (ACPI_RESOURCE, ResourceList, ResourceList->Length); /* Exit when END_TAG descriptor is reached */ @@ -737,8 +734,8 @@ AcpiRsDumpIrqList ( AcpiOsPrintf ("\n[%02X] PCI IRQ Routing Table Package\n", Count); AcpiRsDumpDescriptor (PrtElement, AcpiRsDumpPrt); - PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, - ((UINT8 *) PrtElement) + PrtElement->Length); + PrtElement = ACPI_ADD_PTR (ACPI_PCI_ROUTING_TABLE, + PrtElement, PrtElement->Length); } } @@ -762,7 +759,12 @@ AcpiRsOutString ( char *Title, char *Value) { - AcpiOsPrintf ("%27s : %s\n", Title, Value); + AcpiOsPrintf ("%27s : %s", Title, Value); + if (!*Value) + { + AcpiOsPrintf ("[NULL NAMESTRING]"); + } + AcpiOsPrintf ("\n"); } static void |