| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /******************************************************************************* | 
 | 2 |  * | 
 | 3 |  * Module Name: rsmem24 - Memory 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("rsmemory") | 
| 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_memory24 | 
| 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_memory24[4] = { | 
 | 56 | 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY24, | 
 | 57 | 	 ACPI_RS_SIZE(struct acpi_resource_memory24), | 
 | 58 | 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory24)}, | 
| 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_MEMORY24, | 
 | 61 | 	 sizeof(struct aml_resource_memory24), | 
 | 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 | 	/* Read/Write bit */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 |  | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 66 | 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory24.write_protect), | 
 | 67 | 	 AML_OFFSET(memory24.flags), | 
 | 68 | 	 0}, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [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 | 	 * Minimum Base Address | 
 | 72 | 	 * Maximum Base Address | 
 | 73 | 	 * Address Base Alignment | 
 | 74 | 	 * Range Length | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | 	 */ | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 76 | 	{ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.memory24.minimum), | 
 | 77 | 	 AML_OFFSET(memory24.minimum), | 
 | 78 | 	 4} | 
 | 79 | }; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | /******************************************************************************* | 
 | 82 |  * | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 83 |  * acpi_rs_convert_memory32 | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 |  * | 
 | 85 |  ******************************************************************************/ | 
 | 86 |  | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 87 | struct acpi_rsconvert_info acpi_rs_convert_memory32[4] = { | 
 | 88 | 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY32, | 
 | 89 | 	 ACPI_RS_SIZE(struct acpi_resource_memory32), | 
 | 90 | 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory32)}, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 |  | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 92 | 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY32, | 
 | 93 | 	 sizeof(struct aml_resource_memory32), | 
 | 94 | 	 0}, | 
| Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 95 |  | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 96 | 	/* Read/Write bit */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 |  | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 98 | 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory32.write_protect), | 
 | 99 | 	 AML_OFFSET(memory32.flags), | 
 | 100 | 	 0}, | 
| Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 101 | 	/* | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 102 | 	 * These fields are contiguous in both the source and destination: | 
| Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 103 | 	 * Minimum Base Address | 
 | 104 | 	 * Maximum Base Address | 
 | 105 | 	 * Address Base Alignment | 
 | 106 | 	 * Range Length | 
 | 107 | 	 */ | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 108 | 	{ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.memory32.minimum), | 
 | 109 | 	 AML_OFFSET(memory32.minimum), | 
 | 110 | 	 4} | 
 | 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_fixed_memory32 | 
| 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_fixed_memory32[4] = { | 
 | 120 | 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_MEMORY32, | 
 | 121 | 	 ACPI_RS_SIZE(struct acpi_resource_fixed_memory32), | 
 | 122 | 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_fixed_memory32)}, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 |  | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 124 | 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_MEMORY32, | 
 | 125 | 	 sizeof(struct aml_resource_fixed_memory32), | 
 | 126 | 	 0}, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 |  | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 128 | 	/* Read/Write bit */ | 
| Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 129 |  | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 130 | 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.fixed_memory32.write_protect), | 
 | 131 | 	 AML_OFFSET(fixed_memory32.flags), | 
 | 132 | 	 0}, | 
| Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 133 | 	/* | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 134 | 	 * These fields are contiguous in both the source and destination: | 
| Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 135 | 	 * Base Address | 
 | 136 | 	 * Range Length | 
 | 137 | 	 */ | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 138 | 	{ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.fixed_memory32.address), | 
 | 139 | 	 AML_OFFSET(fixed_memory32.address), | 
 | 140 | 	 2} | 
 | 141 | }; | 
| Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 142 |  | 
 | 143 | /******************************************************************************* | 
 | 144 |  * | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 145 |  * acpi_rs_get_vendor_small | 
| Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 146 |  * | 
 | 147 |  ******************************************************************************/ | 
 | 148 |  | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 149 | struct acpi_rsconvert_info acpi_rs_get_vendor_small[3] = { | 
 | 150 | 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR, | 
 | 151 | 	 ACPI_RS_SIZE(struct acpi_resource_vendor), | 
 | 152 | 	 ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_small)}, | 
| Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 153 |  | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 154 | 	/* Length of the vendor data (byte count) */ | 
| Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 155 |  | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 156 | 	{ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), | 
 | 157 | 	 0, | 
 | 158 | 	 sizeof(u8)} | 
 | 159 | 	, | 
 | 160 |  | 
 | 161 | 	/* Vendor data */ | 
 | 162 |  | 
 | 163 | 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), | 
 | 164 | 	 sizeof(struct aml_resource_small_header), | 
 | 165 | 	 0} | 
 | 166 | }; | 
 | 167 |  | 
 | 168 | /******************************************************************************* | 
 | 169 |  * | 
 | 170 |  * acpi_rs_get_vendor_large | 
 | 171 |  * | 
 | 172 |  ******************************************************************************/ | 
 | 173 |  | 
 | 174 | struct acpi_rsconvert_info acpi_rs_get_vendor_large[3] = { | 
 | 175 | 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR, | 
 | 176 | 	 ACPI_RS_SIZE(struct acpi_resource_vendor), | 
 | 177 | 	 ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_large)}, | 
 | 178 |  | 
 | 179 | 	/* Length of the vendor data (byte count) */ | 
 | 180 |  | 
 | 181 | 	{ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), | 
 | 182 | 	 0, | 
 | 183 | 	 sizeof(u8)} | 
 | 184 | 	, | 
 | 185 |  | 
 | 186 | 	/* Vendor data */ | 
 | 187 |  | 
 | 188 | 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), | 
 | 189 | 	 sizeof(struct aml_resource_large_header), | 
 | 190 | 	 0} | 
 | 191 | }; | 
 | 192 |  | 
 | 193 | /******************************************************************************* | 
 | 194 |  * | 
 | 195 |  * acpi_rs_set_vendor | 
 | 196 |  * | 
 | 197 |  ******************************************************************************/ | 
 | 198 |  | 
 | 199 | struct acpi_rsconvert_info acpi_rs_set_vendor[7] = { | 
 | 200 | 	/* Default is a small vendor descriptor */ | 
 | 201 |  | 
 | 202 | 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_SMALL, | 
 | 203 | 	 sizeof(struct aml_resource_small_header), | 
 | 204 | 	 ACPI_RSC_TABLE_SIZE(acpi_rs_set_vendor)}, | 
 | 205 |  | 
 | 206 | 	/* Get the length and copy the data */ | 
 | 207 |  | 
 | 208 | 	{ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), | 
 | 209 | 	 0, | 
 | 210 | 	 0}, | 
 | 211 |  | 
 | 212 | 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), | 
 | 213 | 	 sizeof(struct aml_resource_small_header), | 
 | 214 | 	 0}, | 
| Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 215 |  | 
 | 216 | 	/* | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 217 | 	 * All done if the Vendor byte length is 7 or less, meaning that it will | 
 | 218 | 	 * fit within a small descriptor | 
| Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 219 | 	 */ | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 220 | 	{ACPI_RSC_EXIT_LE, 0, 0, 7}, | 
| Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 221 |  | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 222 | 	/* Must create a large vendor descriptor */ | 
| Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 223 |  | 
| Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 224 | 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_LARGE, | 
 | 225 | 	 sizeof(struct aml_resource_large_header), | 
 | 226 | 	 0}, | 
 | 227 |  | 
 | 228 | 	{ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), | 
 | 229 | 	 0, | 
 | 230 | 	 0}, | 
 | 231 |  | 
 | 232 | 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), | 
 | 233 | 	 sizeof(struct aml_resource_large_header), | 
 | 234 | 	 0} | 
 | 235 | }; |