1 /******************************************************************************* 2 * 3 * Module Name: rsmem24 - Memory resource descriptors 4 * 5 ******************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2013, 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 #define __RSMEMORY_C__ 45 46 #include "acpi.h" 47 #include "accommon.h" 48 #include "acresrc.h" 49 50 #define _COMPONENT ACPI_RESOURCES 51 ACPI_MODULE_NAME ("rsmemory") 52 53 54 /******************************************************************************* 55 * 56 * AcpiRsConvertMemory24 57 * 58 ******************************************************************************/ 59 60 ACPI_RSCONVERT_INFO AcpiRsConvertMemory24[4] = 61 { 62 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY24, 63 ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY24), 64 ACPI_RSC_TABLE_SIZE (AcpiRsConvertMemory24)}, 65 66 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY24, 67 sizeof (AML_RESOURCE_MEMORY24), 68 0}, 69 70 /* Read/Write bit */ 71 72 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Memory24.WriteProtect), 73 AML_OFFSET (Memory24.Flags), 74 0}, 75 /* 76 * These fields are contiguous in both the source and destination: 77 * Minimum Base Address 78 * Maximum Base Address 79 * Address Base Alignment 80 * Range Length 81 */ 82 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.Memory24.Minimum), 83 AML_OFFSET (Memory24.Minimum), 84 4} 85 }; 86 87 88 /******************************************************************************* 89 * 90 * AcpiRsConvertMemory32 91 * 92 ******************************************************************************/ 93 94 ACPI_RSCONVERT_INFO AcpiRsConvertMemory32[4] = 95 { 96 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY32, 97 ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY32), 98 ACPI_RSC_TABLE_SIZE (AcpiRsConvertMemory32)}, 99 100 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY32, 101 sizeof (AML_RESOURCE_MEMORY32), 102 0}, 103 104 /* Read/Write bit */ 105 106 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Memory32.WriteProtect), 107 AML_OFFSET (Memory32.Flags), 108 0}, 109 /* 110 * These fields are contiguous in both the source and destination: 111 * Minimum Base Address 112 * Maximum Base Address 113 * Address Base Alignment 114 * Range Length 115 */ 116 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.Memory32.Minimum), 117 AML_OFFSET (Memory32.Minimum), 118 4} 119 }; 120 121 122 /******************************************************************************* 123 * 124 * AcpiRsConvertFixedMemory32 125 * 126 ******************************************************************************/ 127 128 ACPI_RSCONVERT_INFO AcpiRsConvertFixedMemory32[4] = 129 { 130 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_MEMORY32, 131 ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_MEMORY32), 132 ACPI_RSC_TABLE_SIZE (AcpiRsConvertFixedMemory32)}, 133 134 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_MEMORY32, 135 sizeof (AML_RESOURCE_FIXED_MEMORY32), 136 0}, 137 138 /* Read/Write bit */ 139 140 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.FixedMemory32.WriteProtect), 141 AML_OFFSET (FixedMemory32.Flags), 142 0}, 143 /* 144 * These fields are contiguous in both the source and destination: 145 * Base Address 146 * Range Length 147 */ 148 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.FixedMemory32.Address), 149 AML_OFFSET (FixedMemory32.Address), 150 2} 151 }; 152 153 154 /******************************************************************************* 155 * 156 * AcpiRsGetVendorSmall 157 * 158 ******************************************************************************/ 159 160 ACPI_RSCONVERT_INFO AcpiRsGetVendorSmall[3] = 161 { 162 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR, 163 ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR), 164 ACPI_RSC_TABLE_SIZE (AcpiRsGetVendorSmall)}, 165 166 /* Length of the vendor data (byte count) */ 167 168 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET (Data.Vendor.ByteLength), 169 0, 170 sizeof (UINT8)}, 171 172 /* Vendor data */ 173 174 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Vendor.ByteData[0]), 175 sizeof (AML_RESOURCE_SMALL_HEADER), 176 0} 177 }; 178 179 180 /******************************************************************************* 181 * 182 * AcpiRsGetVendorLarge 183 * 184 ******************************************************************************/ 185 186 ACPI_RSCONVERT_INFO AcpiRsGetVendorLarge[3] = 187 { 188 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR, 189 ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR), 190 ACPI_RSC_TABLE_SIZE (AcpiRsGetVendorLarge)}, 191 192 /* Length of the vendor data (byte count) */ 193 194 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET (Data.Vendor.ByteLength), 195 0, 196 sizeof (UINT8)}, 197 198 /* Vendor data */ 199 200 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Vendor.ByteData[0]), 201 sizeof (AML_RESOURCE_LARGE_HEADER), 202 0} 203 }; 204 205 206 /******************************************************************************* 207 * 208 * AcpiRsSetVendor 209 * 210 ******************************************************************************/ 211 212 ACPI_RSCONVERT_INFO AcpiRsSetVendor[7] = 213 { 214 /* Default is a small vendor descriptor */ 215 216 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_SMALL, 217 sizeof (AML_RESOURCE_SMALL_HEADER), 218 ACPI_RSC_TABLE_SIZE (AcpiRsSetVendor)}, 219 220 /* Get the length and copy the data */ 221 222 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET (Data.Vendor.ByteLength), 223 0, 224 0}, 225 226 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Vendor.ByteData[0]), 227 sizeof (AML_RESOURCE_SMALL_HEADER), 228 0}, 229 230 /* 231 * All done if the Vendor byte length is 7 or less, meaning that it will 232 * fit within a small descriptor 233 */ 234 {ACPI_RSC_EXIT_LE, 0, 0, 7}, 235 236 /* Must create a large vendor descriptor */ 237 238 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_LARGE, 239 sizeof (AML_RESOURCE_LARGE_HEADER), 240 0}, 241 242 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET (Data.Vendor.ByteLength), 243 0, 244 0}, 245 246 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Vendor.ByteData[0]), 247 sizeof (AML_RESOURCE_LARGE_HEADER), 248 0} 249 };