diff options
| author | Len Brown <len.brown@intel.com> | 2005-12-06 16:27:40 -0500 |
|---|---|---|
| committer | Len Brown <len.brown@intel.com> | 2005-12-06 16:27:40 -0500 |
| commit | 9115a6c787596e687df03010d97fccc5e0762506 (patch) | |
| tree | da65904b8c0c0bc6c778b39bc25d06e07ca7c82c | |
| parent | 927fe18397b3b1194a5b26b1d388d97e391e5fd2 (diff) | |
| parent | e4f5c82a92c2a546a16af1614114eec19120e40a (diff) | |
Auto-update from upstream
| -rw-r--r-- | drivers/acpi/resources/rsinfo.c | 228 |
1 files changed, 228 insertions, 0 deletions
diff --git a/drivers/acpi/resources/rsinfo.c b/drivers/acpi/resources/rsinfo.c new file mode 100644 index 0000000000..49a5f81c72 --- /dev/null +++ b/drivers/acpi/resources/rsinfo.c | |||
| @@ -0,0 +1,228 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * | ||
| 3 | * Module Name: rsinfo - Dispatch and Info tables | ||
| 4 | * | ||
| 5 | ******************************************************************************/ | ||
| 6 | |||
| 7 | /* | ||
| 8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
| 9 | * All rights reserved. | ||
| 10 | * | ||
| 11 | * Redistribution and use in source and binary forms, with or without | ||
| 12 | * modification, are permitted provided that the following conditions | ||
| 13 | * are met: | ||
| 14 | * 1. Redistributions of source code must retain the above copyright | ||
| 15 | * notice, this list of conditions, and the following disclaimer, | ||
| 16 | * without modification. | ||
| 17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
| 18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
| 19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
| 20 | * including a substantially similar Disclaimer requirement for further | ||
| 21 | * binary redistribution. | ||
| 22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
| 23 | * of any contributors may be used to endorse or promote products derived | ||
| 24 | * from this software without specific prior written permission. | ||
| 25 | * | ||
| 26 | * Alternatively, this software may be distributed under the terms of the | ||
| 27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
| 28 | * Software Foundation. | ||
| 29 | * | ||
| 30 | * NO WARRANTY | ||
| 31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
| 34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
| 40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 41 | * POSSIBILITY OF SUCH DAMAGES. | ||
| 42 | */ | ||
| 43 | |||
| 44 | #include <acpi/acpi.h> | ||
| 45 | #include <acpi/acresrc.h> | ||
| 46 | |||
| 47 | #define _COMPONENT ACPI_RESOURCES | ||
| 48 | ACPI_MODULE_NAME("rsinfo") | ||
| 49 | |||
| 50 | /* | ||
| 51 | * Resource dispatch and information tables. Any new resource types (either | ||
| 52 | * Large or Small) must be reflected in each of these tables, so they are here | ||
| 53 | * in one place. | ||
| 54 | * | ||
| 55 | * The tables for Large descriptors are indexed by bits 6:0 of the AML | ||
| 56 | * descriptor type byte. The tables for Small descriptors are indexed by | ||
| 57 | * bits 6:3 of the descriptor byte. The tables for internal resource | ||
| 58 | * descriptors are indexed by the acpi_resource_type field. | ||
| 59 | */ | ||
| 60 | /* Dispatch table for resource-to-AML (Set Resource) conversion functions */ | ||
| 61 | ACPI_SET_RESOURCE_HANDLER acpi_gbl_set_resource_dispatch[] = { | ||
| 62 | acpi_rs_set_irq, /* 0x00, ACPI_RESOURCE_TYPE_IRQ */ | ||
| 63 | acpi_rs_set_dma, /* 0x01, ACPI_RESOURCE_TYPE_DMA */ | ||
| 64 | acpi_rs_set_start_dpf, /* 0x02, ACPI_RESOURCE_TYPE_START_DEPENDENT */ | ||
| 65 | acpi_rs_set_end_dpf, /* 0x03, ACPI_RESOURCE_TYPE_END_DEPENDENT */ | ||
| 66 | acpi_rs_set_io, /* 0x04, ACPI_RESOURCE_TYPE_IO */ | ||
| 67 | acpi_rs_set_fixed_io, /* 0x05, ACPI_RESOURCE_TYPE_FIXED_IO */ | ||
| 68 | acpi_rs_set_vendor, /* 0x06, ACPI_RESOURCE_TYPE_VENDOR */ | ||
| 69 | acpi_rs_set_end_tag, /* 0x07, ACPI_RESOURCE_TYPE_END_TAG */ | ||
| 70 | acpi_rs_set_memory24, /* 0x08, ACPI_RESOURCE_TYPE_MEMORY24 */ | ||
| 71 | acpi_rs_set_memory32, /* 0x09, ACPI_RESOURCE_TYPE_MEMORY32 */ | ||
| 72 | acpi_rs_set_fixed_memory32, /* 0x0A, ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ | ||
| 73 | acpi_rs_set_address16, /* 0x0B, ACPI_RESOURCE_TYPE_ADDRESS16 */ | ||
| 74 | acpi_rs_set_address32, /* 0x0C, ACPI_RESOURCE_TYPE_ADDRESS32 */ | ||
| 75 | acpi_rs_set_address64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */ | ||
| 76 | acpi_rs_set_ext_address64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ | ||
| 77 | acpi_rs_set_ext_irq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ | ||
| 78 | acpi_rs_set_generic_reg /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ | ||
| 79 | }; | ||
| 80 | |||
| 81 | /* Dispatch tables for AML-to-resource (Get Resource) conversion functions */ | ||
| 82 | |||
| 83 | ACPI_GET_RESOURCE_HANDLER acpi_gbl_sm_get_resource_dispatch[] = { | ||
| 84 | NULL, /* 0x00, Reserved */ | ||
| 85 | NULL, /* 0x01, Reserved */ | ||
| 86 | NULL, /* 0x02, Reserved */ | ||
| 87 | NULL, /* 0x03, Reserved */ | ||
| 88 | acpi_rs_get_irq, /* 0x04, ACPI_RESOURCE_NAME_IRQ */ | ||
| 89 | acpi_rs_get_dma, /* 0x05, ACPI_RESOURCE_NAME_DMA */ | ||
| 90 | acpi_rs_get_start_dpf, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */ | ||
| 91 | acpi_rs_get_end_dpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */ | ||
| 92 | acpi_rs_get_io, /* 0x08, ACPI_RESOURCE_NAME_IO */ | ||
| 93 | acpi_rs_get_fixed_io, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */ | ||
| 94 | NULL, /* 0x0A, Reserved */ | ||
| 95 | NULL, /* 0x0B, Reserved */ | ||
| 96 | NULL, /* 0x0C, Reserved */ | ||
| 97 | NULL, /* 0x0D, Reserved */ | ||
| 98 | acpi_rs_get_vendor, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */ | ||
| 99 | acpi_rs_get_end_tag /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */ | ||
| 100 | }; | ||
| 101 | |||
| 102 | ACPI_GET_RESOURCE_HANDLER acpi_gbl_lg_get_resource_dispatch[] = { | ||
| 103 | NULL, /* 0x00, Reserved */ | ||
| 104 | acpi_rs_get_memory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */ | ||
| 105 | acpi_rs_get_generic_reg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */ | ||
| 106 | NULL, /* 0x03, Reserved */ | ||
| 107 | acpi_rs_get_vendor, /* 0x04, ACPI_RESOURCE_NAME_VENDOR_LARGE */ | ||
| 108 | acpi_rs_get_memory32, /* 0x05, ACPI_RESOURCE_NAME_MEMORY32 */ | ||
| 109 | acpi_rs_get_fixed_memory32, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY32 */ | ||
| 110 | acpi_rs_get_address32, /* 0x07, ACPI_RESOURCE_NAME_ADDRESS32 */ | ||
| 111 | acpi_rs_get_address16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */ | ||
| 112 | acpi_rs_get_ext_irq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */ | ||
| 113 | acpi_rs_get_address64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */ | ||
| 114 | acpi_rs_get_ext_address64 /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ | ||
| 115 | }; | ||
| 116 | |||
| 117 | #ifdef ACPI_FUTURE_USAGE | ||
| 118 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
| 119 | |||
| 120 | /* Dispatch table for resource dump functions */ | ||
| 121 | |||
| 122 | ACPI_DUMP_RESOURCE_HANDLER acpi_gbl_dump_resource_dispatch[] = { | ||
| 123 | acpi_rs_dump_irq, /* ACPI_RESOURCE_TYPE_IRQ */ | ||
| 124 | acpi_rs_dump_dma, /* ACPI_RESOURCE_TYPE_DMA */ | ||
| 125 | acpi_rs_dump_start_dpf, /* ACPI_RESOURCE_TYPE_START_DEPENDENT */ | ||
| 126 | acpi_rs_dump_end_dpf, /* ACPI_RESOURCE_TYPE_END_DEPENDENT */ | ||
| 127 | acpi_rs_dump_io, /* ACPI_RESOURCE_TYPE_IO */ | ||
| 128 | acpi_rs_dump_fixed_io, /* ACPI_RESOURCE_TYPE_FIXED_IO */ | ||
| 129 | acpi_rs_dump_vendor, /* ACPI_RESOURCE_TYPE_VENDOR */ | ||
| 130 | acpi_rs_dump_end_tag, /* ACPI_RESOURCE_TYPE_END_TAG */ | ||
| 131 | acpi_rs_dump_memory24, /* ACPI_RESOURCE_TYPE_MEMORY24 */ | ||
| 132 | acpi_rs_dump_memory32, /* ACPI_RESOURCE_TYPE_MEMORY32 */ | ||
| 133 | acpi_rs_dump_fixed_memory32, /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ | ||
| 134 | acpi_rs_dump_address16, /* ACPI_RESOURCE_TYPE_ADDRESS16 */ | ||
| 135 | acpi_rs_dump_address32, /* ACPI_RESOURCE_TYPE_ADDRESS32 */ | ||
| 136 | acpi_rs_dump_address64, /* ACPI_RESOURCE_TYPE_ADDRESS64 */ | ||
| 137 | acpi_rs_dump_ext_address64, /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ | ||
| 138 | acpi_rs_dump_ext_irq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ | ||
| 139 | acpi_rs_dump_generic_reg /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ | ||
| 140 | }; | ||
| 141 | #endif | ||
| 142 | #endif /* ACPI_FUTURE_USAGE */ | ||
| 143 | |||
| 144 | /* | ||
| 145 | * Base sizes for external AML resource descriptors, indexed by internal type. | ||
| 146 | * Includes size of the descriptor header (1 byte for small descriptors, | ||
| 147 | * 3 bytes for large descriptors) | ||
| 148 | */ | ||
| 149 | u8 acpi_gbl_aml_resource_sizes[] = { | ||
| 150 | sizeof(struct aml_resource_irq), /* ACPI_RESOURCE_TYPE_IRQ (optional Byte 3 always created) */ | ||
| 151 | sizeof(struct aml_resource_dma), /* ACPI_RESOURCE_TYPE_DMA */ | ||
| 152 | sizeof(struct aml_resource_start_dependent), /* ACPI_RESOURCE_TYPE_START_DEPENDENT (optional Byte 1 always created) */ | ||
| 153 | sizeof(struct aml_resource_end_dependent), /* ACPI_RESOURCE_TYPE_END_DEPENDENT */ | ||
| 154 | sizeof(struct aml_resource_io), /* ACPI_RESOURCE_TYPE_IO */ | ||
| 155 | sizeof(struct aml_resource_fixed_io), /* ACPI_RESOURCE_TYPE_FIXED_IO */ | ||
| 156 | sizeof(struct aml_resource_vendor_small), /* ACPI_RESOURCE_TYPE_VENDOR */ | ||
| 157 | sizeof(struct aml_resource_end_tag), /* ACPI_RESOURCE_TYPE_END_TAG */ | ||
| 158 | sizeof(struct aml_resource_memory24), /* ACPI_RESOURCE_TYPE_MEMORY24 */ | ||
| 159 | sizeof(struct aml_resource_memory32), /* ACPI_RESOURCE_TYPE_MEMORY32 */ | ||
| 160 | sizeof(struct aml_resource_fixed_memory32), /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */ | ||
| 161 | sizeof(struct aml_resource_address16), /* ACPI_RESOURCE_TYPE_ADDRESS16 */ | ||
| 162 | sizeof(struct aml_resource_address32), /* ACPI_RESOURCE_TYPE_ADDRESS32 */ | ||
| 163 | sizeof(struct aml_resource_address64), /* ACPI_RESOURCE_TYPE_ADDRESS64 */ | ||
| 164 | sizeof(struct aml_resource_extended_address64), /*ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ | ||
| 165 | sizeof(struct aml_resource_extended_irq), /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ | ||
| 166 | sizeof(struct aml_resource_generic_register) /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ | ||
| 167 | }; | ||
| 168 | |||
| 169 | /* Macros used in the tables below */ | ||
| 170 | |||
| 171 | #define ACPI_RLARGE(r) sizeof (r) - sizeof (struct aml_resource_large_header) | ||
| 172 | #define ACPI_RSMALL(r) sizeof (r) - sizeof (struct aml_resource_small_header) | ||
| 173 | |||
| 174 | /* | ||
| 175 | * Base sizes of resource descriptors, both the AML stream resource length | ||
| 176 | * (minus size of header and length fields),and the size of the internal | ||
| 177 | * struct representation. | ||
| 178 | */ | ||
| 179 | struct acpi_resource_info acpi_gbl_sm_resource_info[] = { | ||
| 180 | {0, 0, 0}, | ||
| 181 | {0, 0, 0}, | ||
| 182 | {0, 0, 0}, | ||
| 183 | {0, 0, 0}, | ||
| 184 | {2, ACPI_RSMALL(struct aml_resource_irq), | ||
| 185 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq)}, | ||
| 186 | {0, ACPI_RSMALL(struct aml_resource_dma), | ||
| 187 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma)}, | ||
| 188 | {2, ACPI_RSMALL(struct aml_resource_start_dependent), | ||
| 189 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dependent)}, | ||
| 190 | {0, ACPI_RSMALL(struct aml_resource_end_dependent), | ||
| 191 | ACPI_RESOURCE_LENGTH}, | ||
| 192 | {0, ACPI_RSMALL(struct aml_resource_io), | ||
| 193 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_io)}, | ||
| 194 | {0, ACPI_RSMALL(struct aml_resource_fixed_io), | ||
| 195 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io)}, | ||
| 196 | {0, 0, 0}, | ||
| 197 | {0, 0, 0}, | ||
| 198 | {0, 0, 0}, | ||
| 199 | {0, 0, 0}, | ||
| 200 | {1, ACPI_RSMALL(struct aml_resource_vendor_small), | ||
| 201 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, | ||
| 202 | {0, ACPI_RSMALL(struct aml_resource_end_tag), ACPI_RESOURCE_LENGTH} | ||
| 203 | }; | ||
| 204 | |||
| 205 | struct acpi_resource_info acpi_gbl_lg_resource_info[] = { | ||
| 206 | {0, 0, 0}, | ||
| 207 | {0, ACPI_RLARGE(struct aml_resource_memory24), | ||
| 208 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory24)}, | ||
| 209 | {0, ACPI_RLARGE(struct aml_resource_generic_register), | ||
| 210 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_generic_registerister)}, | ||
| 211 | {0, 0, 0}, | ||
| 212 | {1, ACPI_RLARGE(struct aml_resource_vendor_large), | ||
| 213 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor)}, | ||
| 214 | {0, ACPI_RLARGE(struct aml_resource_memory32), | ||
| 215 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_memory32)}, | ||
| 216 | {0, ACPI_RLARGE(struct aml_resource_fixed_memory32), | ||
| 217 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_memory32)}, | ||
| 218 | {1, ACPI_RLARGE(struct aml_resource_address32), | ||
| 219 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32)}, | ||
| 220 | {1, ACPI_RLARGE(struct aml_resource_address16), | ||
| 221 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16)}, | ||
| 222 | {1, ACPI_RLARGE(struct aml_resource_extended_irq), | ||
| 223 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_irq)}, | ||
| 224 | {1, ACPI_RLARGE(struct aml_resource_address64), | ||
| 225 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64)}, | ||
| 226 | {0, ACPI_RLARGE(struct aml_resource_extended_address64), | ||
| 227 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_address64)} | ||
| 228 | }; | ||
