1 /******************************************************************************* 2 * 3 * Module Name: rsinfo - Dispatch and Info tables 4 * 5 ******************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2021, 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 MERCHANTABILITY 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, UART, and CSI2 */ 141 142 ACPI_RSCONVERT_INFO *AcpiGbl_ConvertResourceSerialBusDispatch[] = 143 { 144 NULL, 145 AcpiRsConvertI2cSerialBus, 146 AcpiRsConvertSpiSerialBus, 147 AcpiRsConvertUartSerialBus, 148 AcpiRsConvertCsi2SerialBus 149 }; 150 151 152 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUGGER) 153 154 /* Dispatch table for resource dump functions */ 155 156 ACPI_RSDUMP_INFO *AcpiGbl_DumpResourceDispatch[] = 157 { 158 AcpiRsDumpIrq, /* ACPI_RESOURCE_TYPE_IRQ */ 159 AcpiRsDumpDma, /* ACPI_RESOURCE_TYPE_DMA */ 160 AcpiRsDumpStartDpf, /* ACPI_RESOURCE_TYPE_START_DEPENDENT */ 161 AcpiRsDumpEndDpf, /* ACPI_RESOURCE_TYPE_END_DEPENDENT */ 162 AcpiRsDumpIo, /* ACPI_RESOURCE_TYPE_IO */ 163 AcpiRsDumpFixedIo, /* ACPI_RESOURCE_TYPE_FIXED_IO */ 164 AcpiRsDumpVendor, /* ACPI_RESOURCE_TYPE_VENDOR */ 165 AcpiRsDumpEndTag, /* ACPI_RESOURCE_TYPE_END_TAG */ 166 AcpiRsDumpMemory24, /* ACPI_RESOURCE_TYPE_MEMORY24 */ 167 AcpiRsDumpMemory32, /* ACPI_RESOURCE_TYPE_MEMORY32 */ 168 AcpiRsDumpFixedMemory32, /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ 169 AcpiRsDumpAddress16, /* ACPI_RESOURCE_TYPE_ADDRESS16 */ 170 AcpiRsDumpAddress32, /* ACPI_RESOURCE_TYPE_ADDRESS32 */ 171 AcpiRsDumpAddress64, /* ACPI_RESOURCE_TYPE_ADDRESS64 */ 172 AcpiRsDumpExtAddress64, /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ 173 AcpiRsDumpExtIrq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ 174 AcpiRsDumpGenericReg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ 175 AcpiRsDumpGpio, /* ACPI_RESOURCE_TYPE_GPIO */ 176 AcpiRsDumpFixedDma, /* ACPI_RESOURCE_TYPE_FIXED_DMA */ 177 NULL, /* ACPI_RESOURCE_TYPE_SERIAL_BUS */ 178 AcpiRsDumpPinFunction, /* ACPI_RESOURCE_TYPE_PIN_FUNCTION */ 179 AcpiRsDumpPinConfig, /* ACPI_RESOURCE_TYPE_PIN_CONFIG */ 180 AcpiRsDumpPinGroup, /* ACPI_RESOURCE_TYPE_PIN_GROUP */ 181 AcpiRsDumpPinGroupFunction, /* ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION */ 182 AcpiRsDumpPinGroupConfig, /* ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG */ 183 }; 184 185 ACPI_RSDUMP_INFO *AcpiGbl_DumpSerialBusDispatch[] = 186 { 187 NULL, 188 AcpiRsDumpI2cSerialBus, /* AML_RESOURCE_I2C_BUS_TYPE */ 189 AcpiRsDumpSpiSerialBus, /* AML_RESOURCE_SPI_BUS_TYPE */ 190 AcpiRsDumpUartSerialBus, /* AML_RESOURCE_UART_BUS_TYPE */ 191 AcpiRsDumpCsi2SerialBus, /* AML_RESOURCE_CSI2_BUS_TYPE */ 192 }; 193 #endif 194 195 196 /* 197 * Base sizes for external AML resource descriptors, indexed by internal type. 198 * Includes size of the descriptor header (1 byte for small descriptors, 199 * 3 bytes for large descriptors) 200 */ 201 const UINT8 AcpiGbl_AmlResourceSizes[] = 202 { 203 sizeof (AML_RESOURCE_IRQ), /* ACPI_RESOURCE_TYPE_IRQ (optional Byte 3 always created) */ 204 sizeof (AML_RESOURCE_DMA), /* ACPI_RESOURCE_TYPE_DMA */ 205 sizeof (AML_RESOURCE_START_DEPENDENT), /* ACPI_RESOURCE_TYPE_START_DEPENDENT (optional Byte 1 always created) */ 206 sizeof (AML_RESOURCE_END_DEPENDENT), /* ACPI_RESOURCE_TYPE_END_DEPENDENT */ 207 sizeof (AML_RESOURCE_IO), /* ACPI_RESOURCE_TYPE_IO */ 208 sizeof (AML_RESOURCE_FIXED_IO), /* ACPI_RESOURCE_TYPE_FIXED_IO */ 209 sizeof (AML_RESOURCE_VENDOR_SMALL), /* ACPI_RESOURCE_TYPE_VENDOR */ 210 sizeof (AML_RESOURCE_END_TAG), /* ACPI_RESOURCE_TYPE_END_TAG */ 211 sizeof (AML_RESOURCE_MEMORY24), /* ACPI_RESOURCE_TYPE_MEMORY24 */ 212 sizeof (AML_RESOURCE_MEMORY32), /* ACPI_RESOURCE_TYPE_MEMORY32 */ 213 sizeof (AML_RESOURCE_FIXED_MEMORY32), /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ 214 sizeof (AML_RESOURCE_ADDRESS16), /* ACPI_RESOURCE_TYPE_ADDRESS16 */ 215 sizeof (AML_RESOURCE_ADDRESS32), /* ACPI_RESOURCE_TYPE_ADDRESS32 */ 216 sizeof (AML_RESOURCE_ADDRESS64), /* ACPI_RESOURCE_TYPE_ADDRESS64 */ 217 sizeof (AML_RESOURCE_EXTENDED_ADDRESS64),/*ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ 218 sizeof (AML_RESOURCE_EXTENDED_IRQ), /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ 219 sizeof (AML_RESOURCE_GENERIC_REGISTER), /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ 220 sizeof (AML_RESOURCE_GPIO), /* ACPI_RESOURCE_TYPE_GPIO */ 221 sizeof (AML_RESOURCE_FIXED_DMA), /* ACPI_RESOURCE_TYPE_FIXED_DMA */ 222 sizeof (AML_RESOURCE_COMMON_SERIALBUS), /* ACPI_RESOURCE_TYPE_SERIAL_BUS */ 223 sizeof (AML_RESOURCE_PIN_FUNCTION), /* ACPI_RESOURCE_TYPE_PIN_FUNCTION */ 224 sizeof (AML_RESOURCE_PIN_CONFIG), /* ACPI_RESOURCE_TYPE_PIN_CONFIG */ 225 sizeof (AML_RESOURCE_PIN_GROUP), /* ACPI_RESOURCE_TYPE_PIN_GROUP */ 226 sizeof (AML_RESOURCE_PIN_GROUP_FUNCTION), /* ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION */ 227 sizeof (AML_RESOURCE_PIN_GROUP_CONFIG), /* ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG */ 228 }; 229 230 231 const UINT8 AcpiGbl_ResourceStructSizes[] = 232 { 233 /* Small descriptors */ 234 235 0, 236 0, 237 0, 238 0, 239 ACPI_RS_SIZE (ACPI_RESOURCE_IRQ), 240 ACPI_RS_SIZE (ACPI_RESOURCE_DMA), 241 ACPI_RS_SIZE (ACPI_RESOURCE_START_DEPENDENT), 242 ACPI_RS_SIZE_MIN, 243 ACPI_RS_SIZE (ACPI_RESOURCE_IO), 244 ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_IO), 245 ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_DMA), 246 0, 247 0, 248 0, 249 ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR), 250 ACPI_RS_SIZE_MIN, 251 252 /* Large descriptors */ 253 254 0, 255 ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY24), 256 ACPI_RS_SIZE (ACPI_RESOURCE_GENERIC_REGISTER), 257 0, 258 ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR), 259 ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY32), 260 ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_MEMORY32), 261 ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS32), 262 ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS16), 263 ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_IRQ), 264 ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS64), 265 ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_ADDRESS64), 266 ACPI_RS_SIZE (ACPI_RESOURCE_GPIO), 267 ACPI_RS_SIZE (ACPI_RESOURCE_PIN_FUNCTION), 268 ACPI_RS_SIZE (ACPI_RESOURCE_COMMON_SERIALBUS), 269 ACPI_RS_SIZE (ACPI_RESOURCE_PIN_CONFIG), 270 ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP), 271 ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP_FUNCTION), 272 ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP_CONFIG), 273 }; 274 275 const UINT8 AcpiGbl_AmlResourceSerialBusSizes[] = 276 { 277 0, 278 sizeof (AML_RESOURCE_I2C_SERIALBUS), 279 sizeof (AML_RESOURCE_SPI_SERIALBUS), 280 sizeof (AML_RESOURCE_UART_SERIALBUS), 281 sizeof (AML_RESOURCE_CSI2_SERIALBUS), 282 }; 283 284 const UINT8 AcpiGbl_ResourceStructSerialBusSizes[] = 285 { 286 0, 287 ACPI_RS_SIZE (ACPI_RESOURCE_I2C_SERIALBUS), 288 ACPI_RS_SIZE (ACPI_RESOURCE_SPI_SERIALBUS), 289 ACPI_RS_SIZE (ACPI_RESOURCE_UART_SERIALBUS), 290 ACPI_RS_SIZE (ACPI_RESOURCE_CSI2_SERIALBUS), 291 }; 292