Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * |
| 3 | * Module Name: rsio - IO and DMA resource descriptors |
| 4 | * |
| 5 | ******************************************************************************/ |
| 6 | |
| 7 | /* |
Bob Moore | 4a90c7e | 2006-01-13 16:22:00 -0500 | [diff] [blame] | 8 | * Copyright (C) 2000 - 2006, R. Byron Moore |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #include <acpi/acpi.h> |
| 45 | #include <acpi/acresrc.h> |
| 46 | |
| 47 | #define _COMPONENT ACPI_RESOURCES |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 48 | ACPI_MODULE_NAME("rsio") |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | |
| 50 | /******************************************************************************* |
| 51 | * |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 52 | * acpi_rs_convert_io |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | * |
| 54 | ******************************************************************************/ |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 55 | struct acpi_rsconvert_info acpi_rs_convert_io[5] = { |
| 56 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IO, |
| 57 | ACPI_RS_SIZE(struct acpi_resource_io), |
| 58 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_io)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 60 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IO, |
| 61 | sizeof(struct aml_resource_io), |
| 62 | 0}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 64 | /* Decode flag */ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 65 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 66 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.io.io_decode), |
| 67 | AML_OFFSET(io.flags), |
| 68 | 0}, |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 69 | /* |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 70 | * These fields are contiguous in both the source and destination: |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 71 | * Address Alignment |
| 72 | * Length |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 73 | * Minimum Base Address |
| 74 | * Maximum Base Address |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 75 | */ |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 76 | {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.io.alignment), |
| 77 | AML_OFFSET(io.alignment), |
| 78 | 2}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 80 | {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.io.minimum), |
| 81 | AML_OFFSET(io.minimum), |
| 82 | 2} |
| 83 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | /******************************************************************************* |
| 86 | * |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 87 | * acpi_rs_convert_fixed_io |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | * |
| 89 | ******************************************************************************/ |
| 90 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 91 | struct acpi_rsconvert_info acpi_rs_convert_fixed_io[4] = { |
| 92 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_IO, |
| 93 | ACPI_RS_SIZE(struct acpi_resource_fixed_io), |
| 94 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_fixed_io)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 96 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_IO, |
| 97 | sizeof(struct aml_resource_fixed_io), |
| 98 | 0}, |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 99 | /* |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 100 | * These fields are contiguous in both the source and destination: |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 101 | * Base Address |
| 102 | * Length |
| 103 | */ |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 104 | {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.fixed_io.address_length), |
| 105 | AML_OFFSET(fixed_io.address_length), |
| 106 | 1}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 108 | {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.fixed_io.address), |
| 109 | AML_OFFSET(fixed_io.address), |
| 110 | 1} |
| 111 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | /******************************************************************************* |
| 114 | * |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 115 | * acpi_rs_convert_generic_reg |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | * |
| 117 | ******************************************************************************/ |
| 118 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 119 | struct acpi_rsconvert_info acpi_rs_convert_generic_reg[4] = { |
| 120 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GENERIC_REGISTER, |
| 121 | ACPI_RS_SIZE(struct acpi_resource_generic_register), |
| 122 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_generic_reg)}, |
| 123 | |
| 124 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_GENERIC_REGISTER, |
| 125 | sizeof(struct aml_resource_generic_register), |
| 126 | 0}, |
| 127 | /* |
| 128 | * These fields are contiguous in both the source and destination: |
| 129 | * Address Space ID |
| 130 | * Register Bit Width |
| 131 | * Register Bit Offset |
| 132 | * Access Size |
| 133 | */ |
| 134 | {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.generic_reg.space_id), |
| 135 | AML_OFFSET(generic_reg.address_space_id), |
| 136 | 4}, |
| 137 | |
| 138 | /* Get the Register Address */ |
| 139 | |
| 140 | {ACPI_RSC_MOVE64, ACPI_RS_OFFSET(data.generic_reg.address), |
| 141 | AML_OFFSET(generic_reg.address), |
| 142 | 1} |
| 143 | }; |
| 144 | |
| 145 | /******************************************************************************* |
| 146 | * |
| 147 | * acpi_rs_convert_end_dpf |
| 148 | * |
| 149 | ******************************************************************************/ |
| 150 | |
| 151 | struct acpi_rsconvert_info acpi_rs_convert_end_dpf[2] = { |
| 152 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_DEPENDENT, |
| 153 | ACPI_RS_SIZE_MIN, |
| 154 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_end_dpf)}, |
| 155 | |
| 156 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_DEPENDENT, |
| 157 | sizeof(struct aml_resource_end_dependent), |
| 158 | 0} |
| 159 | }; |
| 160 | |
| 161 | /******************************************************************************* |
| 162 | * |
| 163 | * acpi_rs_convert_end_tag |
| 164 | * |
| 165 | ******************************************************************************/ |
| 166 | |
| 167 | struct acpi_rsconvert_info acpi_rs_convert_end_tag[2] = { |
| 168 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_TAG, |
| 169 | ACPI_RS_SIZE_MIN, |
| 170 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_end_tag)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 172 | /* |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 173 | * Note: The checksum field is set to zero, meaning that the resource |
| 174 | * data is treated as if the checksum operation succeeded. |
| 175 | * (ACPI Spec 1.0b Section 6.4.2.8) |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 176 | */ |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 177 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_TAG, |
| 178 | sizeof(struct aml_resource_end_tag), |
| 179 | 0} |
| 180 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | /******************************************************************************* |
| 183 | * |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 184 | * acpi_rs_get_start_dpf |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | * |
| 186 | ******************************************************************************/ |
| 187 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 188 | struct acpi_rsconvert_info acpi_rs_get_start_dpf[5] = { |
| 189 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_START_DEPENDENT, |
| 190 | ACPI_RS_SIZE(struct acpi_resource_start_dependent), |
| 191 | ACPI_RSC_TABLE_SIZE(acpi_rs_get_start_dpf)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 193 | /* Defaults for Compatibility and Performance priorities */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 195 | {ACPI_RSC_SET8, ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), |
| 196 | ACPI_ACCEPTABLE_CONFIGURATION, |
| 197 | 2}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 198 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 199 | /* All done if there is no flag byte present in the descriptor */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 200 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 201 | {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 1}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 203 | /* Flag byte is present, get the flags */ |
| 204 | |
| 205 | {ACPI_RSC_2BITFLAG, |
| 206 | ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), |
| 207 | AML_OFFSET(start_dpf.flags), |
| 208 | 0}, |
| 209 | |
| 210 | {ACPI_RSC_2BITFLAG, |
| 211 | ACPI_RS_OFFSET(data.start_dpf.performance_robustness), |
| 212 | AML_OFFSET(start_dpf.flags), |
| 213 | 2} |
| 214 | }; |
| 215 | |
| 216 | /******************************************************************************* |
| 217 | * |
| 218 | * acpi_rs_set_start_dpf |
| 219 | * |
| 220 | ******************************************************************************/ |
| 221 | |
| 222 | struct acpi_rsconvert_info acpi_rs_set_start_dpf[6] = { |
| 223 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_START_DEPENDENT, |
| 224 | sizeof(struct aml_resource_start_dependent), |
| 225 | ACPI_RSC_TABLE_SIZE(acpi_rs_set_start_dpf)}, |
| 226 | |
| 227 | /* Set the default flag values */ |
| 228 | |
| 229 | {ACPI_RSC_2BITFLAG, |
| 230 | ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), |
| 231 | AML_OFFSET(start_dpf.flags), |
| 232 | 0}, |
| 233 | |
| 234 | {ACPI_RSC_2BITFLAG, |
| 235 | ACPI_RS_OFFSET(data.start_dpf.performance_robustness), |
| 236 | AML_OFFSET(start_dpf.flags), |
| 237 | 2}, |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 238 | /* |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 239 | * All done if flags byte is necessary -- if either priority value |
| 240 | * is not ACPI_ACCEPTABLE_CONFIGURATION |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 241 | */ |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 242 | {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, |
| 243 | ACPI_RS_OFFSET(data.start_dpf.compatibility_priority), |
| 244 | ACPI_ACCEPTABLE_CONFIGURATION}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 246 | {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, |
| 247 | ACPI_RS_OFFSET(data.start_dpf.performance_robustness), |
| 248 | ACPI_ACCEPTABLE_CONFIGURATION}, |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 249 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 250 | /* Flag byte is not necessary */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 252 | {ACPI_RSC_LENGTH, 0, 0, |
| 253 | sizeof(struct aml_resource_start_dependent_noprio)} |
| 254 | }; |