Merge tag 'trace-v5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
[linux/fpc-iii.git] / drivers / acpi / acpica / rsmemory.c
blob44fa16dde9bad9ef29d9a4020693efb0878dc30c
1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2 /*******************************************************************************
4 * Module Name: rsmem24 - Memory resource descriptors
6 ******************************************************************************/
8 #include <acpi/acpi.h>
9 #include "accommon.h"
10 #include "acresrc.h"
12 #define _COMPONENT ACPI_RESOURCES
13 ACPI_MODULE_NAME("rsmemory")
15 /*******************************************************************************
17 * acpi_rs_convert_memory24
19 ******************************************************************************/
20 struct acpi_rsconvert_info acpi_rs_convert_memory24[4] = {
21 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY24,
22 ACPI_RS_SIZE(struct acpi_resource_memory24),
23 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory24)},
25 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY24,
26 sizeof(struct aml_resource_memory24),
27 0},
29 /* Read/Write bit */
31 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory24.write_protect),
32 AML_OFFSET(memory24.flags),
33 0},
35 * These fields are contiguous in both the source and destination:
36 * Minimum Base Address
37 * Maximum Base Address
38 * Address Base Alignment
39 * Range Length
41 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.memory24.minimum),
42 AML_OFFSET(memory24.minimum),
46 /*******************************************************************************
48 * acpi_rs_convert_memory32
50 ******************************************************************************/
52 struct acpi_rsconvert_info acpi_rs_convert_memory32[4] = {
53 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY32,
54 ACPI_RS_SIZE(struct acpi_resource_memory32),
55 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory32)},
57 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY32,
58 sizeof(struct aml_resource_memory32),
59 0},
61 /* Read/Write bit */
63 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory32.write_protect),
64 AML_OFFSET(memory32.flags),
65 0},
67 * These fields are contiguous in both the source and destination:
68 * Minimum Base Address
69 * Maximum Base Address
70 * Address Base Alignment
71 * Range Length
73 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.memory32.minimum),
74 AML_OFFSET(memory32.minimum),
78 /*******************************************************************************
80 * acpi_rs_convert_fixed_memory32
82 ******************************************************************************/
84 struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[4] = {
85 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_MEMORY32,
86 ACPI_RS_SIZE(struct acpi_resource_fixed_memory32),
87 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_fixed_memory32)},
89 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_MEMORY32,
90 sizeof(struct aml_resource_fixed_memory32),
91 0},
93 /* Read/Write bit */
95 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.fixed_memory32.write_protect),
96 AML_OFFSET(fixed_memory32.flags),
97 0},
99 * These fields are contiguous in both the source and destination:
100 * Base Address
101 * Range Length
103 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.fixed_memory32.address),
104 AML_OFFSET(fixed_memory32.address),
108 /*******************************************************************************
110 * acpi_rs_get_vendor_small
112 ******************************************************************************/
114 struct acpi_rsconvert_info acpi_rs_get_vendor_small[3] = {
115 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR,
116 ACPI_RS_SIZE(struct acpi_resource_vendor),
117 ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_small)},
119 /* Length of the vendor data (byte count) */
121 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
123 sizeof(u8)},
125 /* Vendor data */
127 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
128 sizeof(struct aml_resource_small_header),
132 /*******************************************************************************
134 * acpi_rs_get_vendor_large
136 ******************************************************************************/
138 struct acpi_rsconvert_info acpi_rs_get_vendor_large[3] = {
139 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR,
140 ACPI_RS_SIZE(struct acpi_resource_vendor),
141 ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_large)},
143 /* Length of the vendor data (byte count) */
145 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
147 sizeof(u8)},
149 /* Vendor data */
151 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
152 sizeof(struct aml_resource_large_header),
156 /*******************************************************************************
158 * acpi_rs_set_vendor
160 ******************************************************************************/
162 struct acpi_rsconvert_info acpi_rs_set_vendor[7] = {
163 /* Default is a small vendor descriptor */
165 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_SMALL,
166 sizeof(struct aml_resource_small_header),
167 ACPI_RSC_TABLE_SIZE(acpi_rs_set_vendor)},
169 /* Get the length and copy the data */
171 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
175 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
176 sizeof(struct aml_resource_small_header),
180 * All done if the Vendor byte length is 7 or less, meaning that it will
181 * fit within a small descriptor
183 {ACPI_RSC_EXIT_LE, 0, 0, 7},
185 /* Must create a large vendor descriptor */
187 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_LARGE,
188 sizeof(struct aml_resource_large_header),
191 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
195 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
196 sizeof(struct aml_resource_large_header),