1 /******************************************************************************* 2 * 3 * Module Name: rsinfo - Dispatch and Info tables 4 * 5 ******************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2019, Intel Corp. 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions, and the following disclaimer, 16 * without modification. 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18 * substantially similar to the "NO WARRANTY" disclaimer below 19 * ("Disclaimer") and any redistribution must be conditioned upon 20 * including a substantially similar Disclaimer requirement for further 21 * binary redistribution. 22 * 3. Neither the names of the above-listed copyright holders nor the names 23 * of any contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * Alternatively, this software may be distributed under the terms of the 27 * GNU General Public License ("GPL") version 2 as published by the Free 28 * Software Foundation. 29 * 30 * NO WARRANTY 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 * POSSIBILITY OF SUCH DAMAGES. 42 */ 43 44 #include "acpi.h" 45 #include "accommon.h" 46 #include "acresrc.h" 47 48 #define _COMPONENT ACPI_RESOURCES 49 ACPI_MODULE_NAME ("rsinfo") 50 51 /* 52 * Resource dispatch and information tables. Any new resource types (either 53 * Large or Small) must be reflected in each of these tables, so they are here 54 * in one place. 55 * 56 * The tables for Large descriptors are indexed by bits 6:0 of the AML 57 * descriptor type byte. The tables for Small descriptors are indexed by 58 * bits 6:3 of the descriptor byte. The tables for internal resource 59 * descriptors are indexed by the ACPI_RESOURCE_TYPE field. 60 */ 61 62 63 /* Dispatch table for resource-to-AML (Set Resource) conversion functions */ 64 65 ACPI_RSCONVERT_INFO *AcpiGbl_SetResourceDispatch[] = 66 { 67 AcpiRsSetIrq, /* 0x00, ACPI_RESOURCE_TYPE_IRQ */ 68 AcpiRsConvertDma, /* 0x01, ACPI_RESOURCE_TYPE_DMA */ 69 AcpiRsSetStartDpf, /* 0x02, ACPI_RESOURCE_TYPE_START_DEPENDENT */ 70 AcpiRsConvertEndDpf, /* 0x03, ACPI_RESOURCE_TYPE_END_DEPENDENT */ 71 AcpiRsConvertIo, /* 0x04, ACPI_RESOURCE_TYPE_IO */ 72 AcpiRsConvertFixedIo, /* 0x05, ACPI_RESOURCE_TYPE_FIXED_IO */ 73 AcpiRsSetVendor, /* 0x06, ACPI_RESOURCE_TYPE_VENDOR */ 74 AcpiRsConvertEndTag, /* 0x07, ACPI_RESOURCE_TYPE_END_TAG */ 75 AcpiRsConvertMemory24, /* 0x08, ACPI_RESOURCE_TYPE_MEMORY24 */ 76 AcpiRsConvertMemory32, /* 0x09, ACPI_RESOURCE_TYPE_MEMORY32 */ 77 AcpiRsConvertFixedMemory32, /* 0x0A, ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ 78 AcpiRsConvertAddress16, /* 0x0B, ACPI_RESOURCE_TYPE_ADDRESS16 */ 79 AcpiRsConvertAddress32, /* 0x0C, ACPI_RESOURCE_TYPE_ADDRESS32 */ 80 AcpiRsConvertAddress64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */ 81 AcpiRsConvertExtAddress64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ 82 AcpiRsConvertExtIrq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ 83 AcpiRsConvertGenericReg, /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ 84 AcpiRsConvertGpio, /* 0x11, ACPI_RESOURCE_TYPE_GPIO */ 85 AcpiRsConvertFixedDma, /* 0x12, ACPI_RESOURCE_TYPE_FIXED_DMA */ 86 NULL, /* 0x13, ACPI_RESOURCE_TYPE_SERIAL_BUS - Use subtype table below */ 87 AcpiRsConvertPinFunction, /* 0x14, ACPI_RESOURCE_TYPE_PIN_FUNCTION */ 88 AcpiRsConvertPinConfig, /* 0x15, ACPI_RESOURCE_TYPE_PIN_CONFIG */ 89 AcpiRsConvertPinGroup, /* 0x16, ACPI_RESOURCE_TYPE_PIN_GROUP */ 90 AcpiRsConvertPinGroupFunction, /* 0x17, ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION */ 91 AcpiRsConvertPinGroupConfig, /* 0x18, ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG */ 92 }; 93 94 /* Dispatch tables for AML-to-resource (Get Resource) conversion functions */ 95 96 ACPI_RSCONVERT_INFO *AcpiGbl_GetResourceDispatch[] = 97 { 98 /* Small descriptors */ 99 100 NULL, /* 0x00, Reserved */ 101 NULL, /* 0x01, Reserved */ 102 NULL, /* 0x02, Reserved */ 103 NULL, /* 0x03, Reserved */ 104 AcpiRsGetIrq, /* 0x04, ACPI_RESOURCE_NAME_IRQ */ 105 AcpiRsConvertDma, /* 0x05, ACPI_RESOURCE_NAME_DMA */ 106 AcpiRsGetStartDpf, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */ 107 AcpiRsConvertEndDpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */ 108 AcpiRsConvertIo, /* 0x08, ACPI_RESOURCE_NAME_IO */ 109 AcpiRsConvertFixedIo, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */ 110 AcpiRsConvertFixedDma, /* 0x0A, ACPI_RESOURCE_NAME_FIXED_DMA */ 111 NULL, /* 0x0B, Reserved */ 112 NULL, /* 0x0C, Reserved */ 113 NULL, /* 0x0D, Reserved */ 114 AcpiRsGetVendorSmall, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */ 115 AcpiRsConvertEndTag, /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */ 116 117 /* Large descriptors */ 118 119 NULL, /* 0x00, Reserved */ 120 AcpiRsConvertMemory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */ 121 AcpiRsConvertGenericReg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */ 122 NULL, /* 0x03, Reserved */ 123 AcpiRsGetVendorLarge, /* 0x04, ACPI_RESOURCE_NAME_VENDOR_LARGE */ 124 AcpiRsConvertMemory32, /* 0x05, ACPI_RESOURCE_NAME_MEMORY32 */ 125 AcpiRsConvertFixedMemory32, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY32 */ 126 AcpiRsConvertAddress32, /* 0x07, ACPI_RESOURCE_NAME_ADDRESS32 */ 127 AcpiRsConvertAddress16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */ 128 AcpiRsConvertExtIrq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */ 129 AcpiRsConvertAddress64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */ 130 AcpiRsConvertExtAddress64, /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ 131 AcpiRsConvertGpio, /* 0x0C, ACPI_RESOURCE_NAME_GPIO */ 132 AcpiRsConvertPinFunction, /* 0x0D, ACPI_RESOURCE_NAME_PIN_FUNCTION */ 133 NULL, /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS - Use subtype table below */ 134 AcpiRsConvertPinConfig, /* 0x0F, ACPI_RESOURCE_NAME_PIN_CONFIG */ 135 AcpiRsConvertPinGroup, /* 0x10, ACPI_RESOURCE_NAME_PIN_GROUP */ 136 AcpiRsConvertPinGroupFunction, /* 0x11, ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION */ 137 AcpiRsConvertPinGroupConfig, /* 0x12, ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG */ 138 }; 139 140 /* Subtype table for SerialBus -- I2C, SPI, and UART */ 141 142 ACPI_RSCONVERT_INFO *AcpiGbl_ConvertResourceSerialBusDispatch[] = 143 { 144 NULL, 145 AcpiRsConvertI2cSerialBus, 146 AcpiRsConvertSpiSerialBus, 147 AcpiRsConvertUartSerialBus, 148 }; 149 150 151 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUGGER) 152 153 /* Dispatch table for resource dump functions */ 154 155 ACPI_RSDUMP_INFO *AcpiGbl_DumpResourceDispatch[] = 156 { 157 AcpiRsDumpIrq, /* ACPI_RESOURCE_TYPE_IRQ */ 158 AcpiRsDumpDma, /* ACPI_RESOURCE_TYPE_DMA */ 159 AcpiRsDumpStartDpf, /* ACPI_RESOURCE_TYPE_START_DEPENDENT */ 160 AcpiRsDumpEndDpf, /* ACPI_RESOURCE_TYPE_END_DEPENDENT */ 161 AcpiRsDumpIo, /* ACPI_RESOURCE_TYPE_IO */ 162 AcpiRsDumpFixedIo, /* ACPI_RESOURCE_TYPE_FIXED_IO */ 163 AcpiRsDumpVendor, /* ACPI_RESOURCE_TYPE_VENDOR */ 164 AcpiRsDumpEndTag, /* ACPI_RESOURCE_TYPE_END_TAG */ 165 AcpiRsDumpMemory24, /* ACPI_RESOURCE_TYPE_MEMORY24 */ 166 AcpiRsDumpMemory32, /* ACPI_RESOURCE_TYPE_MEMORY32 */ 167 AcpiRsDumpFixedMemory32, /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ 168 AcpiRsDumpAddress16, /* ACPI_RESOURCE_TYPE_ADDRESS16 */ 169 AcpiRsDumpAddress32, /* ACPI_RESOURCE_TYPE_ADDRESS32 */ 170 AcpiRsDumpAddress64, /* ACPI_RESOURCE_TYPE_ADDRESS64 */ 171 AcpiRsDumpExtAddress64, /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ 172 AcpiRsDumpExtIrq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ 173 AcpiRsDumpGenericReg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ 174 AcpiRsDumpGpio, /* ACPI_RESOURCE_TYPE_GPIO */ 175 AcpiRsDumpFixedDma, /* ACPI_RESOURCE_TYPE_FIXED_DMA */ 176 NULL, /* ACPI_RESOURCE_TYPE_SERIAL_BUS */ 177 AcpiRsDumpPinFunction, /* ACPI_RESOURCE_TYPE_PIN_FUNCTION */ 178 AcpiRsDumpPinConfig, /* ACPI_RESOURCE_TYPE_PIN_CONFIG */ 179 AcpiRsDumpPinGroup, /* ACPI_RESOURCE_TYPE_PIN_GROUP */ 180 AcpiRsDumpPinGroupFunction, /* ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION */ 181 AcpiRsDumpPinGroupConfig, /* ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG */ 182 }; 183 184 ACPI_RSDUMP_INFO *AcpiGbl_DumpSerialBusDispatch[] = 185 { 186 NULL, 187 AcpiRsDumpI2cSerialBus, /* AML_RESOURCE_I2C_BUS_TYPE */ 188 AcpiRsDumpSpiSerialBus, /* AML_RESOURCE_SPI_BUS_TYPE */ 189 AcpiRsDumpUartSerialBus, /* AML_RESOURCE_UART_BUS_TYPE */ 190 }; 191 #endif 192 193 194 /* 195 * Base sizes for external AML resource descriptors, indexed by internal type. 196 * Includes size of the descriptor header (1 byte for small descriptors, 197 * 3 bytes for large descriptors) 198 */ 199 const UINT8 AcpiGbl_AmlResourceSizes[] = 200 { 201 sizeof (AML_RESOURCE_IRQ), /* ACPI_RESOURCE_TYPE_IRQ (optional Byte 3 always created) */ 202 sizeof (AML_RESOURCE_DMA), /* ACPI_RESOURCE_TYPE_DMA */ 203 sizeof (AML_RESOURCE_START_DEPENDENT), /* ACPI_RESOURCE_TYPE_START_DEPENDENT (optional Byte 1 always created) */ 204 sizeof (AML_RESOURCE_END_DEPENDENT), /* ACPI_RESOURCE_TYPE_END_DEPENDENT */ 205 sizeof (AML_RESOURCE_IO), /* ACPI_RESOURCE_TYPE_IO */ 206 sizeof (AML_RESOURCE_FIXED_IO), /* ACPI_RESOURCE_TYPE_FIXED_IO */ 207 sizeof (AML_RESOURCE_VENDOR_SMALL), /* ACPI_RESOURCE_TYPE_VENDOR */ 208 sizeof (AML_RESOURCE_END_TAG), /* ACPI_RESOURCE_TYPE_END_TAG */ 209 sizeof (AML_RESOURCE_MEMORY24), /* ACPI_RESOURCE_TYPE_MEMORY24 */ 210 sizeof (AML_RESOURCE_MEMORY32), /* ACPI_RESOURCE_TYPE_MEMORY32 */ 211 sizeof (AML_RESOURCE_FIXED_MEMORY32), /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ 212 sizeof (AML_RESOURCE_ADDRESS16), /* ACPI_RESOURCE_TYPE_ADDRESS16 */ 213 sizeof (AML_RESOURCE_ADDRESS32), /* ACPI_RESOURCE_TYPE_ADDRESS32 */ 214 sizeof (AML_RESOURCE_ADDRESS64), /* ACPI_RESOURCE_TYPE_ADDRESS64 */ 215 sizeof (AML_RESOURCE_EXTENDED_ADDRESS64),/*ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ 216 sizeof (AML_RESOURCE_EXTENDED_IRQ), /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ 217 sizeof (AML_RESOURCE_GENERIC_REGISTER), /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ 218 sizeof (AML_RESOURCE_GPIO), /* ACPI_RESOURCE_TYPE_GPIO */ 219 sizeof (AML_RESOURCE_FIXED_DMA), /* ACPI_RESOURCE_TYPE_FIXED_DMA */ 220 sizeof (AML_RESOURCE_COMMON_SERIALBUS), /* ACPI_RESOURCE_TYPE_SERIAL_BUS */ 221 sizeof (AML_RESOURCE_PIN_FUNCTION), /* ACPI_RESOURCE_TYPE_PIN_FUNCTION */ 222 sizeof (AML_RESOURCE_PIN_CONFIG), /* ACPI_RESOURCE_TYPE_PIN_CONFIG */ 223 sizeof (AML_RESOURCE_PIN_GROUP), /* ACPI_RESOURCE_TYPE_PIN_GROUP */ 224 sizeof (AML_RESOURCE_PIN_GROUP_FUNCTION), /* ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION */ 225 sizeof (AML_RESOURCE_PIN_GROUP_CONFIG), /* ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG */ 226 }; 227 228 229 const UINT8 AcpiGbl_ResourceStructSizes[] = 230 { 231 /* Small descriptors */ 232 233 0, 234 0, 235 0, 236 0, 237 ACPI_RS_SIZE (ACPI_RESOURCE_IRQ), 238 ACPI_RS_SIZE (ACPI_RESOURCE_DMA), 239 ACPI_RS_SIZE (ACPI_RESOURCE_START_DEPENDENT), 240 ACPI_RS_SIZE_MIN, 241 ACPI_RS_SIZE (ACPI_RESOURCE_IO), 242 ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_IO), 243 ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_DMA), 244 0, 245 0, 246 0, 247 ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR), 248 ACPI_RS_SIZE_MIN, 249 250 /* Large descriptors */ 251 252 0, 253 ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY24), 254 ACPI_RS_SIZE (ACPI_RESOURCE_GENERIC_REGISTER), 255 0, 256 ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR), 257 ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY32), 258 ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_MEMORY32), 259 ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS32), 260 ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS16), 261 ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_IRQ), 262 ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS64), 263 ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_ADDRESS64), 264 ACPI_RS_SIZE (ACPI_RESOURCE_GPIO), 265 ACPI_RS_SIZE (ACPI_RESOURCE_PIN_FUNCTION), 266 ACPI_RS_SIZE (ACPI_RESOURCE_COMMON_SERIALBUS), 267 ACPI_RS_SIZE (ACPI_RESOURCE_PIN_CONFIG), 268 ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP), 269 ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP_FUNCTION), 270 ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP_CONFIG), 271 }; 272 273 const UINT8 AcpiGbl_AmlResourceSerialBusSizes[] = 274 { 275 0, 276 sizeof (AML_RESOURCE_I2C_SERIALBUS), 277 sizeof (AML_RESOURCE_SPI_SERIALBUS), 278 sizeof (AML_RESOURCE_UART_SERIALBUS), 279 }; 280 281 const UINT8 AcpiGbl_ResourceStructSerialBusSizes[] = 282 { 283 0, 284 ACPI_RS_SIZE (ACPI_RESOURCE_I2C_SERIALBUS), 285 ACPI_RS_SIZE (ACPI_RESOURCE_SPI_SERIALBUS), 286 ACPI_RS_SIZE (ACPI_RESOURCE_UART_SERIALBUS), 287 }; 288