Commit e0fe0a8d4ed5474261d0ee1452f5d9ae77236958
Committed by
Len Brown
1 parent
2da120b684
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
ACPI 5.0: Support for all new resource descriptors
FixedDMA, GPIO descriptors, SerialBus descriptors Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Showing 16 changed files with 1776 additions and 119 deletions Side-by-side Diff
- drivers/acpi/acpica/Makefile
- drivers/acpi/acpica/aclocal.h
- drivers/acpi/acpica/acresrc.h
- drivers/acpi/acpica/acutils.h
- drivers/acpi/acpica/amlresrc.h
- drivers/acpi/acpica/rscalc.c
- drivers/acpi/acpica/rscreate.c
- drivers/acpi/acpica/rsdump.c
- drivers/acpi/acpica/rsinfo.c
- drivers/acpi/acpica/rsirq.c
- drivers/acpi/acpica/rslist.c
- drivers/acpi/acpica/rsmisc.c
- drivers/acpi/acpica/rsserial.c
- drivers/acpi/acpica/rsutils.c
- drivers/acpi/acpica/utresrc.c
- include/acpi/acrestyp.h
drivers/acpi/acpica/Makefile
... | ... | @@ -36,7 +36,7 @@ |
36 | 36 | psopcode.o psscope.o psutils.o psxface.o |
37 | 37 | |
38 | 38 | acpi-y += rsaddr.o rscreate.o rsinfo.o rsio.o rslist.o rsmisc.o rsxface.o \ |
39 | - rscalc.o rsirq.o rsmemory.o rsutils.o | |
39 | + rscalc.o rsirq.o rsmemory.o rsutils.o rsserial.o | |
40 | 40 | |
41 | 41 | acpi-$(ACPI_FUTURE_USAGE) += rsdump.o |
42 | 42 |
drivers/acpi/acpica/aclocal.h
... | ... | @@ -955,7 +955,7 @@ |
955 | 955 | #define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38 |
956 | 956 | #define ACPI_RESOURCE_NAME_IO 0x40 |
957 | 957 | #define ACPI_RESOURCE_NAME_FIXED_IO 0x48 |
958 | -#define ACPI_RESOURCE_NAME_RESERVED_S1 0x50 | |
958 | +#define ACPI_RESOURCE_NAME_FIXED_DMA 0x50 | |
959 | 959 | #define ACPI_RESOURCE_NAME_RESERVED_S2 0x58 |
960 | 960 | #define ACPI_RESOURCE_NAME_RESERVED_S3 0x60 |
961 | 961 | #define ACPI_RESOURCE_NAME_RESERVED_S4 0x68 |
... | ... | @@ -977,7 +977,9 @@ |
977 | 977 | #define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89 |
978 | 978 | #define ACPI_RESOURCE_NAME_ADDRESS64 0x8A |
979 | 979 | #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B |
980 | -#define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B | |
980 | +#define ACPI_RESOURCE_NAME_GPIO 0x8C | |
981 | +#define ACPI_RESOURCE_NAME_SERIAL_BUS 0x8E | |
982 | +#define ACPI_RESOURCE_NAME_LARGE_MAX 0x8E | |
981 | 983 | |
982 | 984 | /***************************************************************************** |
983 | 985 | * |
drivers/acpi/acpica/acresrc.h
... | ... | @@ -73,28 +73,40 @@ |
73 | 73 | |
74 | 74 | /* Resource conversion opcodes */ |
75 | 75 | |
76 | -#define ACPI_RSC_INITGET 0 | |
77 | -#define ACPI_RSC_INITSET 1 | |
78 | -#define ACPI_RSC_FLAGINIT 2 | |
79 | -#define ACPI_RSC_1BITFLAG 3 | |
80 | -#define ACPI_RSC_2BITFLAG 4 | |
81 | -#define ACPI_RSC_COUNT 5 | |
82 | -#define ACPI_RSC_COUNT16 6 | |
83 | -#define ACPI_RSC_LENGTH 7 | |
84 | -#define ACPI_RSC_MOVE8 8 | |
85 | -#define ACPI_RSC_MOVE16 9 | |
86 | -#define ACPI_RSC_MOVE32 10 | |
87 | -#define ACPI_RSC_MOVE64 11 | |
88 | -#define ACPI_RSC_SET8 12 | |
89 | -#define ACPI_RSC_DATA8 13 | |
90 | -#define ACPI_RSC_ADDRESS 14 | |
91 | -#define ACPI_RSC_SOURCE 15 | |
92 | -#define ACPI_RSC_SOURCEX 16 | |
93 | -#define ACPI_RSC_BITMASK 17 | |
94 | -#define ACPI_RSC_BITMASK16 18 | |
95 | -#define ACPI_RSC_EXIT_NE 19 | |
96 | -#define ACPI_RSC_EXIT_LE 20 | |
97 | -#define ACPI_RSC_EXIT_EQ 21 | |
76 | +typedef enum { | |
77 | + ACPI_RSC_INITGET = 0, | |
78 | + ACPI_RSC_INITSET, | |
79 | + ACPI_RSC_FLAGINIT, | |
80 | + ACPI_RSC_1BITFLAG, | |
81 | + ACPI_RSC_2BITFLAG, | |
82 | + ACPI_RSC_3BITFLAG, | |
83 | + ACPI_RSC_ADDRESS, | |
84 | + ACPI_RSC_BITMASK, | |
85 | + ACPI_RSC_BITMASK16, | |
86 | + ACPI_RSC_COUNT, | |
87 | + ACPI_RSC_COUNT16, | |
88 | + ACPI_RSC_COUNT_GPIO_PIN, | |
89 | + ACPI_RSC_COUNT_GPIO_RES, | |
90 | + ACPI_RSC_COUNT_GPIO_VEN, | |
91 | + ACPI_RSC_COUNT_SERIAL_RES, | |
92 | + ACPI_RSC_COUNT_SERIAL_VEN, | |
93 | + ACPI_RSC_DATA8, | |
94 | + ACPI_RSC_EXIT_EQ, | |
95 | + ACPI_RSC_EXIT_LE, | |
96 | + ACPI_RSC_EXIT_NE, | |
97 | + ACPI_RSC_LENGTH, | |
98 | + ACPI_RSC_MOVE_GPIO_PIN, | |
99 | + ACPI_RSC_MOVE_GPIO_RES, | |
100 | + ACPI_RSC_MOVE_SERIAL_RES, | |
101 | + ACPI_RSC_MOVE_SERIAL_VEN, | |
102 | + ACPI_RSC_MOVE8, | |
103 | + ACPI_RSC_MOVE16, | |
104 | + ACPI_RSC_MOVE32, | |
105 | + ACPI_RSC_MOVE64, | |
106 | + ACPI_RSC_SET8, | |
107 | + ACPI_RSC_SOURCE, | |
108 | + ACPI_RSC_SOURCEX | |
109 | +} ACPI_RSCONVERT_OPCODES; | |
98 | 110 | |
99 | 111 | /* Resource Conversion sub-opcodes */ |
100 | 112 | |
... | ... | @@ -106,6 +118,9 @@ |
106 | 118 | #define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f) |
107 | 119 | #define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f) |
108 | 120 | |
121 | +/* | |
122 | + * Individual entry for the resource dump tables | |
123 | + */ | |
109 | 124 | typedef const struct acpi_rsdump_info { |
110 | 125 | u8 opcode; |
111 | 126 | u8 offset; |
... | ... | @@ -116,20 +131,25 @@ |
116 | 131 | |
117 | 132 | /* Values for the Opcode field above */ |
118 | 133 | |
119 | -#define ACPI_RSD_TITLE 0 | |
120 | -#define ACPI_RSD_LITERAL 1 | |
121 | -#define ACPI_RSD_STRING 2 | |
122 | -#define ACPI_RSD_UINT8 3 | |
123 | -#define ACPI_RSD_UINT16 4 | |
124 | -#define ACPI_RSD_UINT32 5 | |
125 | -#define ACPI_RSD_UINT64 6 | |
126 | -#define ACPI_RSD_1BITFLAG 7 | |
127 | -#define ACPI_RSD_2BITFLAG 8 | |
128 | -#define ACPI_RSD_SHORTLIST 9 | |
129 | -#define ACPI_RSD_LONGLIST 10 | |
130 | -#define ACPI_RSD_DWORDLIST 11 | |
131 | -#define ACPI_RSD_ADDRESS 12 | |
132 | -#define ACPI_RSD_SOURCE 13 | |
134 | +typedef enum { | |
135 | + ACPI_RSD_TITLE = 0, | |
136 | + ACPI_RSD_1BITFLAG, | |
137 | + ACPI_RSD_2BITFLAG, | |
138 | + ACPI_RSD_3BITFLAG, | |
139 | + ACPI_RSD_ADDRESS, | |
140 | + ACPI_RSD_DWORDLIST, | |
141 | + ACPI_RSD_LITERAL, | |
142 | + ACPI_RSD_LONGLIST, | |
143 | + ACPI_RSD_SHORTLIST, | |
144 | + ACPI_RSD_SHORTLISTX, | |
145 | + ACPI_RSD_SOURCE, | |
146 | + ACPI_RSD_STRING, | |
147 | + ACPI_RSD_UINT8, | |
148 | + ACPI_RSD_UINT16, | |
149 | + ACPI_RSD_UINT32, | |
150 | + ACPI_RSD_UINT64, | |
151 | + ACPI_RSD_WORDLIST | |
152 | +} ACPI_RSDUMP_OPCODES; | |
133 | 153 | |
134 | 154 | /* restore default alignment */ |
135 | 155 | |
136 | 156 | |
137 | 157 | |
... | ... | @@ -138,13 +158,18 @@ |
138 | 158 | /* Resource tables indexed by internal resource type */ |
139 | 159 | |
140 | 160 | extern const u8 acpi_gbl_aml_resource_sizes[]; |
161 | +extern const u8 acpi_gbl_aml_resource_serial_bus_sizes[]; | |
141 | 162 | extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[]; |
142 | 163 | |
143 | 164 | /* Resource tables indexed by raw AML resource descriptor type */ |
144 | 165 | |
145 | 166 | extern const u8 acpi_gbl_resource_struct_sizes[]; |
167 | +extern const u8 acpi_gbl_resource_struct_serial_bus_sizes[]; | |
146 | 168 | extern struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[]; |
147 | 169 | |
170 | +extern struct acpi_rsconvert_info | |
171 | + *acpi_gbl_convert_resource_serial_bus_dispatch[]; | |
172 | + | |
148 | 173 | struct acpi_vendor_walk_info { |
149 | 174 | struct acpi_vendor_uuid *uuid; |
150 | 175 | struct acpi_buffer *buffer; |
... | ... | @@ -293,6 +318,11 @@ |
293 | 318 | extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[]; |
294 | 319 | extern struct acpi_rsconvert_info acpi_rs_convert_address64[]; |
295 | 320 | extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[]; |
321 | +extern struct acpi_rsconvert_info acpi_rs_convert_gpio[]; | |
322 | +extern struct acpi_rsconvert_info acpi_rs_convert_fixed_dma[]; | |
323 | +extern struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[]; | |
324 | +extern struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[]; | |
325 | +extern struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[]; | |
296 | 326 | |
297 | 327 | /* These resources require separate get/set tables */ |
298 | 328 | |
... | ... | @@ -310,6 +340,7 @@ |
310 | 340 | * rsinfo |
311 | 341 | */ |
312 | 342 | extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[]; |
343 | +extern struct acpi_rsdump_info *acpi_gbl_dump_serial_bus_dispatch[]; | |
313 | 344 | |
314 | 345 | /* |
315 | 346 | * rsdump |
... | ... | @@ -331,6 +362,12 @@ |
331 | 362 | extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[]; |
332 | 363 | extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[]; |
333 | 364 | extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[]; |
365 | +extern struct acpi_rsdump_info acpi_rs_dump_gpio[]; | |
366 | +extern struct acpi_rsdump_info acpi_rs_dump_fixed_dma[]; | |
367 | +extern struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[]; | |
368 | +extern struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[]; | |
369 | +extern struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[]; | |
370 | +extern struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[]; | |
334 | 371 | #endif |
335 | 372 | |
336 | 373 | #endif /* __ACRESRC_H__ */ |
drivers/acpi/acpica/acutils.h
drivers/acpi/acpica/amlresrc.h
... | ... | @@ -58,29 +58,48 @@ |
58 | 58 | #define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT" |
59 | 59 | #define ACPI_RESTAG_BASEADDRESS "_BAS" |
60 | 60 | #define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */ |
61 | +#define ACPI_RESTAG_DEBOUNCETIME "_DBT" | |
61 | 62 | #define ACPI_RESTAG_DECODE "_DEC" |
63 | +#define ACPI_RESTAG_DEVICEPOLARITY "_DPL" | |
62 | 64 | #define ACPI_RESTAG_DMA "_DMA" |
63 | 65 | #define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ |
66 | +#define ACPI_RESTAG_DRIVESTRENGTH "_DRS" | |
67 | +#define ACPI_RESTAG_ENDIANNESS "_END" | |
68 | +#define ACPI_RESTAG_FLOWCONTROL "_FLC" | |
64 | 69 | #define ACPI_RESTAG_GRANULARITY "_GRA" |
65 | 70 | #define ACPI_RESTAG_INTERRUPT "_INT" |
66 | 71 | #define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ |
67 | 72 | #define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ |
68 | 73 | #define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ |
74 | +#define ACPI_RESTAG_IORESTRICTION "_IOR" | |
69 | 75 | #define ACPI_RESTAG_LENGTH "_LEN" |
76 | +#define ACPI_RESTAG_LINE "_LIN" | |
70 | 77 | #define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ |
71 | 78 | #define ACPI_RESTAG_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ |
72 | 79 | #define ACPI_RESTAG_MAXADDR "_MAX" |
73 | 80 | #define ACPI_RESTAG_MINADDR "_MIN" |
74 | 81 | #define ACPI_RESTAG_MAXTYPE "_MAF" |
75 | 82 | #define ACPI_RESTAG_MINTYPE "_MIF" |
83 | +#define ACPI_RESTAG_MODE "_MOD" | |
84 | +#define ACPI_RESTAG_PARITY "_PAR" | |
85 | +#define ACPI_RESTAG_PHASE "_PHA" | |
86 | +#define ACPI_RESTAG_PIN "_PIN" | |
87 | +#define ACPI_RESTAG_PINCONFIG "_PPI" | |
88 | +#define ACPI_RESTAG_POLARITY "_POL" | |
76 | 89 | #define ACPI_RESTAG_REGISTERBITOFFSET "_RBO" |
77 | 90 | #define ACPI_RESTAG_REGISTERBITWIDTH "_RBW" |
78 | 91 | #define ACPI_RESTAG_RANGETYPE "_RNG" |
79 | 92 | #define ACPI_RESTAG_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ |
93 | +#define ACPI_RESTAG_LENGTH_RX "_RXL" | |
94 | +#define ACPI_RESTAG_LENGTH_TX "_TXL" | |
95 | +#define ACPI_RESTAG_SLAVEMODE "_SLV" | |
96 | +#define ACPI_RESTAG_SPEED "_SPE" | |
97 | +#define ACPI_RESTAG_STOPBITS "_STB" | |
80 | 98 | #define ACPI_RESTAG_TRANSLATION "_TRA" |
81 | 99 | #define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ |
82 | 100 | #define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */ |
83 | 101 | #define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8_and16(1), 16(2) */ |
102 | +#define ACPI_RESTAG_VENDORDATA "_VEN" | |
84 | 103 | |
85 | 104 | /* Default sizes for "small" resource descriptors */ |
86 | 105 | |
... | ... | @@ -90,6 +109,7 @@ |
90 | 109 | #define ASL_RDESC_END_DEPEND_SIZE 0x00 |
91 | 110 | #define ASL_RDESC_IO_SIZE 0x07 |
92 | 111 | #define ASL_RDESC_FIXED_IO_SIZE 0x03 |
112 | +#define ASL_RDESC_FIXED_DMA_SIZE 0x05 | |
93 | 113 | #define ASL_RDESC_END_TAG_SIZE 0x01 |
94 | 114 | |
95 | 115 | struct asl_resource_node { |
... | ... | @@ -164,6 +184,12 @@ |
164 | 184 | AML_RESOURCE_SMALL_HEADER_COMMON u8 checksum; |
165 | 185 | }; |
166 | 186 | |
187 | +struct aml_resource_fixed_dma { | |
188 | + AML_RESOURCE_SMALL_HEADER_COMMON u16 request_lines; | |
189 | + u16 channels; | |
190 | + u8 width; | |
191 | +}; | |
192 | + | |
167 | 193 | /* |
168 | 194 | * LARGE descriptors |
169 | 195 | */ |
... | ... | @@ -263,6 +289,110 @@ |
263 | 289 | u64 address; |
264 | 290 | }; |
265 | 291 | |
292 | +/* Common descriptor for gpio_int and gpio_io (ACPI 5.0) */ | |
293 | + | |
294 | +struct aml_resource_gpio { | |
295 | + AML_RESOURCE_LARGE_HEADER_COMMON u8 revision_id; | |
296 | + u8 connection_type; | |
297 | + u16 flags; | |
298 | + u16 int_flags; | |
299 | + u8 pin_config; | |
300 | + u16 drive_strength; | |
301 | + u16 debounce_timeout; | |
302 | + u16 pin_table_offset; | |
303 | + u8 res_source_index; | |
304 | + u16 res_source_offset; | |
305 | + u16 vendor_offset; | |
306 | + u16 vendor_length; | |
307 | + /* | |
308 | + * Optional fields follow immediately: | |
309 | + * 1) PIN list (Words) | |
310 | + * 2) Resource Source String | |
311 | + * 3) Vendor Data bytes | |
312 | + */ | |
313 | +}; | |
314 | + | |
315 | +#define AML_RESOURCE_GPIO_REVISION 1 /* ACPI 5.0 */ | |
316 | + | |
317 | +/* Values for connection_type above */ | |
318 | + | |
319 | +#define AML_RESOURCE_GPIO_TYPE_INT 0 | |
320 | +#define AML_RESOURCE_GPIO_TYPE_IO 1 | |
321 | +#define AML_RESOURCE_MAX_GPIOTYPE 1 | |
322 | + | |
323 | +/* Common preamble for all serial descriptors (ACPI 5.0) */ | |
324 | + | |
325 | +#define AML_RESOURCE_SERIAL_COMMON \ | |
326 | + u8 revision_id; \ | |
327 | + u8 res_source_index; \ | |
328 | + u8 type; \ | |
329 | + u8 flags; \ | |
330 | + u16 type_specific_flags; \ | |
331 | + u8 type_revision_id; \ | |
332 | + u16 type_data_length; \ | |
333 | + | |
334 | +/* Values for the type field above */ | |
335 | + | |
336 | +#define AML_RESOURCE_I2C_SERIALBUSTYPE 1 | |
337 | +#define AML_RESOURCE_SPI_SERIALBUSTYPE 2 | |
338 | +#define AML_RESOURCE_UART_SERIALBUSTYPE 3 | |
339 | +#define AML_RESOURCE_MAX_SERIALBUSTYPE 3 | |
340 | +#define AML_RESOURCE_VENDOR_SERIALBUSTYPE 192 /* Vendor defined is 0xC0-0xFF (NOT SUPPORTED) */ | |
341 | + | |
342 | +struct aml_resource_common_serialbus { | |
343 | +AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_SERIAL_COMMON}; | |
344 | + | |
345 | +struct aml_resource_i2c_serialbus { | |
346 | + AML_RESOURCE_LARGE_HEADER_COMMON | |
347 | + AML_RESOURCE_SERIAL_COMMON u32 connection_speed; | |
348 | + u16 slave_address; | |
349 | + /* | |
350 | + * Optional fields follow immediately: | |
351 | + * 1) Vendor Data bytes | |
352 | + * 2) Resource Source String | |
353 | + */ | |
354 | +}; | |
355 | + | |
356 | +#define AML_RESOURCE_I2C_REVISION 1 /* ACPI 5.0 */ | |
357 | +#define AML_RESOURCE_I2C_TYPE_REVISION 1 /* ACPI 5.0 */ | |
358 | +#define AML_RESOURCE_I2C_MIN_DATA_LEN 6 | |
359 | + | |
360 | +struct aml_resource_spi_serialbus { | |
361 | + AML_RESOURCE_LARGE_HEADER_COMMON | |
362 | + AML_RESOURCE_SERIAL_COMMON u32 connection_speed; | |
363 | + u8 data_bit_length; | |
364 | + u8 clock_phase; | |
365 | + u8 clock_polarity; | |
366 | + u16 device_selection; | |
367 | + /* | |
368 | + * Optional fields follow immediately: | |
369 | + * 1) Vendor Data bytes | |
370 | + * 2) Resource Source String | |
371 | + */ | |
372 | +}; | |
373 | + | |
374 | +#define AML_RESOURCE_SPI_REVISION 1 /* ACPI 5.0 */ | |
375 | +#define AML_RESOURCE_SPI_TYPE_REVISION 1 /* ACPI 5.0 */ | |
376 | +#define AML_RESOURCE_SPI_MIN_DATA_LEN 9 | |
377 | + | |
378 | +struct aml_resource_uart_serialbus { | |
379 | + AML_RESOURCE_LARGE_HEADER_COMMON | |
380 | + AML_RESOURCE_SERIAL_COMMON u32 default_baud_rate; | |
381 | + u16 rx_fifo_size; | |
382 | + u16 tx_fifo_size; | |
383 | + u8 parity; | |
384 | + u8 lines_enabled; | |
385 | + /* | |
386 | + * Optional fields follow immediately: | |
387 | + * 1) Vendor Data bytes | |
388 | + * 2) Resource Source String | |
389 | + */ | |
390 | +}; | |
391 | + | |
392 | +#define AML_RESOURCE_UART_REVISION 1 /* ACPI 5.0 */ | |
393 | +#define AML_RESOURCE_UART_TYPE_REVISION 1 /* ACPI 5.0 */ | |
394 | +#define AML_RESOURCE_UART_MIN_DATA_LEN 10 | |
395 | + | |
266 | 396 | /* restore default alignment */ |
267 | 397 | |
268 | 398 | #pragma pack() |
... | ... | @@ -284,6 +414,7 @@ |
284 | 414 | struct aml_resource_end_dependent end_dpf; |
285 | 415 | struct aml_resource_io io; |
286 | 416 | struct aml_resource_fixed_io fixed_io; |
417 | + struct aml_resource_fixed_dma fixed_dma; | |
287 | 418 | struct aml_resource_vendor_small vendor_small; |
288 | 419 | struct aml_resource_end_tag end_tag; |
289 | 420 | |
... | ... | @@ -299,6 +430,11 @@ |
299 | 430 | struct aml_resource_address64 address64; |
300 | 431 | struct aml_resource_extended_address64 ext_address64; |
301 | 432 | struct aml_resource_extended_irq extended_irq; |
433 | + struct aml_resource_gpio gpio; | |
434 | + struct aml_resource_i2c_serialbus i2c_serial_bus; | |
435 | + struct aml_resource_spi_serialbus spi_serial_bus; | |
436 | + struct aml_resource_uart_serialbus uart_serial_bus; | |
437 | + struct aml_resource_common_serialbus common_serial_bus; | |
302 | 438 | |
303 | 439 | /* Utility overlays */ |
304 | 440 |
drivers/acpi/acpica/rscalc.c
... | ... | @@ -313,6 +313,38 @@ |
313 | 313 | resource_source)); |
314 | 314 | break; |
315 | 315 | |
316 | + case ACPI_RESOURCE_TYPE_GPIO: | |
317 | + | |
318 | + total_size = | |
319 | + (acpi_rs_length) (total_size + | |
320 | + (resource->data.gpio. | |
321 | + pin_table_length * 2) + | |
322 | + resource->data.gpio. | |
323 | + resource_source.string_length + | |
324 | + resource->data.gpio. | |
325 | + vendor_length); | |
326 | + | |
327 | + break; | |
328 | + | |
329 | + case ACPI_RESOURCE_TYPE_SERIAL_BUS: | |
330 | + | |
331 | + total_size = | |
332 | + acpi_gbl_aml_resource_serial_bus_sizes[resource-> | |
333 | + data. | |
334 | + common_serial_bus. | |
335 | + type]; | |
336 | + | |
337 | + total_size = (acpi_rs_length) (total_size + | |
338 | + resource->data. | |
339 | + i2c_serial_bus. | |
340 | + resource_source. | |
341 | + string_length + | |
342 | + resource->data. | |
343 | + i2c_serial_bus. | |
344 | + vendor_length); | |
345 | + | |
346 | + break; | |
347 | + | |
316 | 348 | default: |
317 | 349 | break; |
318 | 350 | } |
319 | 351 | |
... | ... | @@ -362,10 +394,11 @@ |
362 | 394 | u32 extra_struct_bytes; |
363 | 395 | u8 resource_index; |
364 | 396 | u8 minimum_aml_resource_length; |
397 | + union aml_resource *aml_resource; | |
365 | 398 | |
366 | 399 | ACPI_FUNCTION_TRACE(rs_get_list_length); |
367 | 400 | |
368 | - *size_needed = 0; | |
401 | + *size_needed = ACPI_RS_SIZE_MIN; /* Minimum size is one end_tag */ | |
369 | 402 | end_aml = aml_buffer + aml_buffer_length; |
370 | 403 | |
371 | 404 | /* Walk the list of AML resource descriptors */ |
372 | 405 | |
... | ... | @@ -376,9 +409,15 @@ |
376 | 409 | |
377 | 410 | status = acpi_ut_validate_resource(aml_buffer, &resource_index); |
378 | 411 | if (ACPI_FAILURE(status)) { |
412 | + /* | |
413 | + * Exit on failure. Cannot continue because the descriptor length | |
414 | + * may be bogus also. | |
415 | + */ | |
379 | 416 | return_ACPI_STATUS(status); |
380 | 417 | } |
381 | 418 | |
419 | + aml_resource = (void *)aml_buffer; | |
420 | + | |
382 | 421 | /* Get the resource length and base (minimum) AML size */ |
383 | 422 | |
384 | 423 | resource_length = acpi_ut_get_resource_length(aml_buffer); |
385 | 424 | |
... | ... | @@ -422,10 +461,8 @@ |
422 | 461 | |
423 | 462 | case ACPI_RESOURCE_NAME_END_TAG: |
424 | 463 | /* |
425 | - * End Tag: | |
426 | - * This is the normal exit, add size of end_tag | |
464 | + * End Tag: This is the normal exit | |
427 | 465 | */ |
428 | - *size_needed += ACPI_RS_SIZE_MIN; | |
429 | 466 | return_ACPI_STATUS(AE_OK); |
430 | 467 | |
431 | 468 | case ACPI_RESOURCE_NAME_ADDRESS32: |
... | ... | @@ -457,6 +494,33 @@ |
457 | 494 | minimum_aml_resource_length); |
458 | 495 | break; |
459 | 496 | |
497 | + case ACPI_RESOURCE_NAME_GPIO: | |
498 | + | |
499 | + /* Vendor data is optional */ | |
500 | + | |
501 | + if (aml_resource->gpio.vendor_length) { | |
502 | + extra_struct_bytes += | |
503 | + aml_resource->gpio.vendor_offset - | |
504 | + aml_resource->gpio.pin_table_offset + | |
505 | + aml_resource->gpio.vendor_length; | |
506 | + } else { | |
507 | + extra_struct_bytes += | |
508 | + aml_resource->large_header.resource_length + | |
509 | + sizeof(struct aml_resource_large_header) - | |
510 | + aml_resource->gpio.pin_table_offset; | |
511 | + } | |
512 | + break; | |
513 | + | |
514 | + case ACPI_RESOURCE_NAME_SERIAL_BUS: | |
515 | + | |
516 | + minimum_aml_resource_length = | |
517 | + acpi_gbl_resource_aml_serial_bus_sizes | |
518 | + [aml_resource->common_serial_bus.type]; | |
519 | + extra_struct_bytes += | |
520 | + aml_resource->common_serial_bus.resource_length - | |
521 | + minimum_aml_resource_length; | |
522 | + break; | |
523 | + | |
460 | 524 | default: |
461 | 525 | break; |
462 | 526 | } |
... | ... | @@ -467,9 +531,18 @@ |
467 | 531 | * Important: Round the size up for the appropriate alignment. This |
468 | 532 | * is a requirement on IA64. |
469 | 533 | */ |
470 | - buffer_size = acpi_gbl_resource_struct_sizes[resource_index] + | |
471 | - extra_struct_bytes; | |
472 | - buffer_size = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(buffer_size); | |
534 | + if (acpi_ut_get_resource_type(aml_buffer) == | |
535 | + ACPI_RESOURCE_NAME_SERIAL_BUS) { | |
536 | + buffer_size = | |
537 | + acpi_gbl_resource_struct_serial_bus_sizes | |
538 | + [aml_resource->common_serial_bus.type] + | |
539 | + extra_struct_bytes; | |
540 | + } else { | |
541 | + buffer_size = | |
542 | + acpi_gbl_resource_struct_sizes[resource_index] + | |
543 | + extra_struct_bytes; | |
544 | + } | |
545 | + buffer_size = (u32)ACPI_ROUND_UP_TO_NATIVE_WORD(buffer_size); | |
473 | 546 | |
474 | 547 | *size_needed += buffer_size; |
475 | 548 |
drivers/acpi/acpica/rscreate.c
... | ... | @@ -66,9 +66,10 @@ |
66 | 66 | * of device resources. |
67 | 67 | * |
68 | 68 | ******************************************************************************/ |
69 | + | |
69 | 70 | acpi_status |
70 | 71 | acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, |
71 | - struct acpi_buffer *output_buffer) | |
72 | + struct acpi_buffer * output_buffer) | |
72 | 73 | { |
73 | 74 | |
74 | 75 | acpi_status status; |
drivers/acpi/acpica/rsdump.c
... | ... | @@ -61,12 +61,14 @@ |
61 | 61 | |
62 | 62 | static void acpi_rs_out_title(char *title); |
63 | 63 | |
64 | -static void acpi_rs_dump_byte_list(u16 length, u8 * data); | |
64 | +static void acpi_rs_dump_byte_list(u16 length, u8 *data); | |
65 | 65 | |
66 | -static void acpi_rs_dump_dword_list(u8 length, u32 * data); | |
66 | +static void acpi_rs_dump_word_list(u16 length, u16 *data); | |
67 | 67 | |
68 | -static void acpi_rs_dump_short_byte_list(u8 length, u8 * data); | |
68 | +static void acpi_rs_dump_dword_list(u8 length, u32 *data); | |
69 | 69 | |
70 | +static void acpi_rs_dump_short_byte_list(u8 length, u8 *data); | |
71 | + | |
70 | 72 | static void |
71 | 73 | acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source); |
72 | 74 | |
... | ... | @@ -309,6 +311,125 @@ |
309 | 311 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(generic_reg.address), "Address", NULL} |
310 | 312 | }; |
311 | 313 | |
314 | +struct acpi_rsdump_info acpi_rs_dump_gpio[16] = { | |
315 | + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_gpio), "GPIO", NULL}, | |
316 | + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.revision_id), "RevisionId", NULL}, | |
317 | + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.connection_type), | |
318 | + "ConnectionType", acpi_gbl_ct_decode}, | |
319 | + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(gpio.producer_consumer), | |
320 | + "ProducerConsumer", acpi_gbl_consume_decode}, | |
321 | + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.pin_config), "PinConfig", | |
322 | + acpi_gbl_ppc_decode}, | |
323 | + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.sharable), "Sharable", | |
324 | + acpi_gbl_shr_decode}, | |
325 | + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.io_restriction), | |
326 | + "IoRestriction", acpi_gbl_ior_decode}, | |
327 | + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(gpio.triggering), "Triggering", | |
328 | + acpi_gbl_he_decode}, | |
329 | + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.polarity), "Polarity", | |
330 | + acpi_gbl_ll_decode}, | |
331 | + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.drive_strength), "DriveStrength", | |
332 | + NULL}, | |
333 | + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.debounce_timeout), | |
334 | + "DebounceTimeout", NULL}, | |
335 | + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(gpio.resource_source), | |
336 | + "ResourceSource", NULL}, | |
337 | + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.pin_table_length), | |
338 | + "PinTableLength", NULL}, | |
339 | + {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET(gpio.pin_table), "PinTable", NULL}, | |
340 | + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.vendor_length), "VendorLength", | |
341 | + NULL}, | |
342 | + {ACPI_RSD_SHORTLISTX, ACPI_RSD_OFFSET(gpio.vendor_data), "VendorData", | |
343 | + NULL}, | |
344 | +}; | |
345 | + | |
346 | +struct acpi_rsdump_info acpi_rs_dump_fixed_dma[4] = { | |
347 | + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_dma), | |
348 | + "FixedDma", NULL}, | |
349 | + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_dma.request_lines), | |
350 | + "RequestLines", NULL}, | |
351 | + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_dma.channels), "Channels", | |
352 | + NULL}, | |
353 | + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_dma.width), "TransferWidth", | |
354 | + acpi_gbl_dts_decode}, | |
355 | +}; | |
356 | + | |
357 | +#define ACPI_RS_DUMP_COMMON_SERIAL_BUS \ | |
358 | + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.revision_id), "RevisionId", NULL}, \ | |
359 | + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type), "Type", acpi_gbl_sbt_decode}, \ | |
360 | + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.producer_consumer), "ProducerConsumer", acpi_gbl_consume_decode}, \ | |
361 | + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.slave_mode), "SlaveMode", acpi_gbl_sm_decode}, \ | |
362 | + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type_revision_id), "TypeRevisionId", NULL}, \ | |
363 | + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.type_data_length), "TypeDataLength", NULL}, \ | |
364 | + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (common_serial_bus.resource_source), "ResourceSource", NULL}, \ | |
365 | + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.vendor_length), "VendorLength", NULL}, \ | |
366 | + {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (common_serial_bus.vendor_data), "VendorData", NULL}, | |
367 | + | |
368 | +struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[10] = { | |
369 | + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_common_serial_bus), | |
370 | + "Common Serial Bus", NULL}, | |
371 | + ACPI_RS_DUMP_COMMON_SERIAL_BUS | |
372 | +}; | |
373 | + | |
374 | +struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[13] = { | |
375 | + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_i2c_serial_bus), | |
376 | + "I2C Serial Bus", NULL}, | |
377 | + ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG, | |
378 | + ACPI_RSD_OFFSET(i2c_serial_bus. | |
379 | + access_mode), | |
380 | + "AccessMode", acpi_gbl_am_decode}, | |
381 | + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(i2c_serial_bus.connection_speed), | |
382 | + "ConnectionSpeed", NULL}, | |
383 | + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(i2c_serial_bus.slave_address), | |
384 | + "SlaveAddress", NULL}, | |
385 | +}; | |
386 | + | |
387 | +struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[17] = { | |
388 | + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_spi_serial_bus), | |
389 | + "Spi Serial Bus", NULL}, | |
390 | + ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG, | |
391 | + ACPI_RSD_OFFSET(spi_serial_bus. | |
392 | + wire_mode), "WireMode", | |
393 | + acpi_gbl_wm_decode}, | |
394 | + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(spi_serial_bus.device_polarity), | |
395 | + "DevicePolarity", acpi_gbl_dp_decode}, | |
396 | + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.data_bit_length), | |
397 | + "DataBitLength", NULL}, | |
398 | + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.clock_phase), | |
399 | + "ClockPhase", acpi_gbl_cph_decode}, | |
400 | + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.clock_polarity), | |
401 | + "ClockPolarity", acpi_gbl_cpo_decode}, | |
402 | + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(spi_serial_bus.device_selection), | |
403 | + "DeviceSelection", NULL}, | |
404 | + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(spi_serial_bus.connection_speed), | |
405 | + "ConnectionSpeed", NULL}, | |
406 | +}; | |
407 | + | |
408 | +struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[19] = { | |
409 | + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_uart_serial_bus), | |
410 | + "Uart Serial Bus", NULL}, | |
411 | + ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_2BITFLAG, | |
412 | + ACPI_RSD_OFFSET(uart_serial_bus. | |
413 | + flow_control), | |
414 | + "FlowControl", acpi_gbl_fc_decode}, | |
415 | + {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.stop_bits), | |
416 | + "StopBits", acpi_gbl_sb_decode}, | |
417 | + {ACPI_RSD_3BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.data_bits), | |
418 | + "DataBits", acpi_gbl_bpb_decode}, | |
419 | + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.endian), "Endian", | |
420 | + acpi_gbl_ed_decode}, | |
421 | + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(uart_serial_bus.parity), "Parity", | |
422 | + acpi_gbl_pt_decode}, | |
423 | + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(uart_serial_bus.lines_enabled), | |
424 | + "LinesEnabled", NULL}, | |
425 | + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(uart_serial_bus.rx_fifo_size), | |
426 | + "RxFifoSize", NULL}, | |
427 | + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(uart_serial_bus.tx_fifo_size), | |
428 | + "TxFifoSize", NULL}, | |
429 | + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(uart_serial_bus.default_baud_rate), | |
430 | + "ConnectionSpeed", NULL}, | |
431 | +}; | |
432 | + | |
312 | 433 | /* |
313 | 434 | * Tables used for common address descriptor flag fields |
314 | 435 | */ |
... | ... | @@ -413,7 +534,14 @@ |
413 | 534 | /* Data items, 8/16/32/64 bit */ |
414 | 535 | |
415 | 536 | case ACPI_RSD_UINT8: |
416 | - acpi_rs_out_integer8(name, ACPI_GET8(target)); | |
537 | + if (table->pointer) { | |
538 | + acpi_rs_out_string(name, ACPI_CAST_PTR(char, | |
539 | + table-> | |
540 | + pointer | |
541 | + [*target])); | |
542 | + } else { | |
543 | + acpi_rs_out_integer8(name, ACPI_GET8(target)); | |
544 | + } | |
417 | 545 | break; |
418 | 546 | |
419 | 547 | case ACPI_RSD_UINT16: |
... | ... | @@ -444,6 +572,13 @@ |
444 | 572 | 0x03])); |
445 | 573 | break; |
446 | 574 | |
575 | + case ACPI_RSD_3BITFLAG: | |
576 | + acpi_rs_out_string(name, ACPI_CAST_PTR(char, | |
577 | + table-> | |
578 | + pointer[*target & | |
579 | + 0x07])); | |
580 | + break; | |
581 | + | |
447 | 582 | case ACPI_RSD_SHORTLIST: |
448 | 583 | /* |
449 | 584 | * Short byte list (single line output) for DMA and IRQ resources |
... | ... | @@ -456,6 +591,20 @@ |
456 | 591 | } |
457 | 592 | break; |
458 | 593 | |
594 | + case ACPI_RSD_SHORTLISTX: | |
595 | + /* | |
596 | + * Short byte list (single line output) for GPIO vendor data | |
597 | + * Note: The list length is obtained from the previous table entry | |
598 | + */ | |
599 | + if (previous_target) { | |
600 | + acpi_rs_out_title(name); | |
601 | + acpi_rs_dump_short_byte_list(*previous_target, | |
602 | + * | |
603 | + (ACPI_CAST_INDIRECT_PTR | |
604 | + (u8, target))); | |
605 | + } | |
606 | + break; | |
607 | + | |
459 | 608 | case ACPI_RSD_LONGLIST: |
460 | 609 | /* |
461 | 610 | * Long byte list for Vendor resource data |
... | ... | @@ -480,6 +629,18 @@ |
480 | 629 | } |
481 | 630 | break; |
482 | 631 | |
632 | + case ACPI_RSD_WORDLIST: | |
633 | + /* | |
634 | + * Word list for GPIO Pin Table | |
635 | + * Note: The list length is obtained from the previous table entry | |
636 | + */ | |
637 | + if (previous_target) { | |
638 | + acpi_rs_dump_word_list(*previous_target, | |
639 | + *(ACPI_CAST_INDIRECT_PTR | |
640 | + (u16, target))); | |
641 | + } | |
642 | + break; | |
643 | + | |
483 | 644 | case ACPI_RSD_ADDRESS: |
484 | 645 | /* |
485 | 646 | * Common flags for all Address resources |
486 | 647 | |
... | ... | @@ -627,14 +788,20 @@ |
627 | 788 | |
628 | 789 | /* Dump the resource descriptor */ |
629 | 790 | |
630 | - acpi_rs_dump_descriptor(&resource_list->data, | |
631 | - acpi_gbl_dump_resource_dispatch[type]); | |
791 | + if (type == ACPI_RESOURCE_TYPE_SERIAL_BUS) { | |
792 | + acpi_rs_dump_descriptor(&resource_list->data, | |
793 | + acpi_gbl_dump_serial_bus_dispatch | |
794 | + [resource_list->data. | |
795 | + common_serial_bus.type]); | |
796 | + } else { | |
797 | + acpi_rs_dump_descriptor(&resource_list->data, | |
798 | + acpi_gbl_dump_resource_dispatch | |
799 | + [type]); | |
800 | + } | |
632 | 801 | |
633 | 802 | /* Point to the next resource structure */ |
634 | 803 | |
635 | - resource_list = | |
636 | - ACPI_ADD_PTR(struct acpi_resource, resource_list, | |
637 | - resource_list->length); | |
804 | + resource_list = ACPI_NEXT_RESOURCE(resource_list); | |
638 | 805 | |
639 | 806 | /* Exit when END_TAG descriptor is reached */ |
640 | 807 | |
... | ... | @@ -765,6 +932,15 @@ |
765 | 932 | |
766 | 933 | for (i = 0; i < length; i++) { |
767 | 934 | acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]); |
935 | + } | |
936 | +} | |
937 | + | |
938 | +static void acpi_rs_dump_word_list(u16 length, u16 *data) | |
939 | +{ | |
940 | + u16 i; | |
941 | + | |
942 | + for (i = 0; i < length; i++) { | |
943 | + acpi_os_printf("%25s%2.2X : %4.4X\n", "Word", i, data[i]); | |
768 | 944 | } |
769 | 945 | } |
770 | 946 |
drivers/acpi/acpica/rsinfo.c
... | ... | @@ -76,7 +76,10 @@ |
76 | 76 | acpi_rs_convert_address64, /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */ |
77 | 77 | acpi_rs_convert_ext_address64, /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ |
78 | 78 | acpi_rs_convert_ext_irq, /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ |
79 | - acpi_rs_convert_generic_reg /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ | |
79 | + acpi_rs_convert_generic_reg, /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ | |
80 | + acpi_rs_convert_gpio, /* 0x11, ACPI_RESOURCE_TYPE_GPIO */ | |
81 | + acpi_rs_convert_fixed_dma, /* 0x12, ACPI_RESOURCE_TYPE_FIXED_DMA */ | |
82 | + NULL, /* 0x13, ACPI_RESOURCE_TYPE_SERIAL_BUS - Use subtype table below */ | |
80 | 83 | }; |
81 | 84 | |
82 | 85 | /* Dispatch tables for AML-to-resource (Get Resource) conversion functions */ |
... | ... | @@ -94,7 +97,7 @@ |
94 | 97 | acpi_rs_convert_end_dpf, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */ |
95 | 98 | acpi_rs_convert_io, /* 0x08, ACPI_RESOURCE_NAME_IO */ |
96 | 99 | acpi_rs_convert_fixed_io, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */ |
97 | - NULL, /* 0x0A, Reserved */ | |
100 | + acpi_rs_convert_fixed_dma, /* 0x0A, ACPI_RESOURCE_NAME_FIXED_DMA */ | |
98 | 101 | NULL, /* 0x0B, Reserved */ |
99 | 102 | NULL, /* 0x0C, Reserved */ |
100 | 103 | NULL, /* 0x0D, Reserved */ |
101 | 104 | |
... | ... | @@ -114,9 +117,21 @@ |
114 | 117 | acpi_rs_convert_address16, /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */ |
115 | 118 | acpi_rs_convert_ext_irq, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */ |
116 | 119 | acpi_rs_convert_address64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */ |
117 | - acpi_rs_convert_ext_address64 /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ | |
120 | + acpi_rs_convert_ext_address64, /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ | |
121 | + acpi_rs_convert_gpio, /* 0x0C, ACPI_RESOURCE_NAME_GPIO */ | |
122 | + NULL, /* 0x0D, Reserved */ | |
123 | + NULL, /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS - Use subtype table below */ | |
118 | 124 | }; |
119 | 125 | |
126 | +/* Subtype table for serial_bus -- I2C, SPI, and UART */ | |
127 | + | |
128 | +struct acpi_rsconvert_info *acpi_gbl_convert_resource_serial_bus_dispatch[] = { | |
129 | + NULL, | |
130 | + acpi_rs_convert_i2c_serial_bus, | |
131 | + acpi_rs_convert_spi_serial_bus, | |
132 | + acpi_rs_convert_uart_serial_bus, | |
133 | +}; | |
134 | + | |
120 | 135 | #ifdef ACPI_FUTURE_USAGE |
121 | 136 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
122 | 137 | |
123 | 138 | |
... | ... | @@ -140,7 +155,17 @@ |
140 | 155 | acpi_rs_dump_ext_address64, /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ |
141 | 156 | acpi_rs_dump_ext_irq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ |
142 | 157 | acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ |
158 | + acpi_rs_dump_gpio, /* ACPI_RESOURCE_TYPE_GPIO */ | |
159 | + acpi_rs_dump_fixed_dma, /* ACPI_RESOURCE_TYPE_FIXED_DMA */ | |
160 | + NULL, /* ACPI_RESOURCE_TYPE_SERIAL_BUS */ | |
143 | 161 | }; |
162 | + | |
163 | +struct acpi_rsdump_info *acpi_gbl_dump_serial_bus_dispatch[] = { | |
164 | + NULL, | |
165 | + acpi_rs_dump_i2c_serial_bus, /* AML_RESOURCE_I2C_BUS_TYPE */ | |
166 | + acpi_rs_dump_spi_serial_bus, /* AML_RESOURCE_SPI_BUS_TYPE */ | |
167 | + acpi_rs_dump_uart_serial_bus, /* AML_RESOURCE_UART_BUS_TYPE */ | |
168 | +}; | |
144 | 169 | #endif |
145 | 170 | |
146 | 171 | #endif /* ACPI_FUTURE_USAGE */ |
... | ... | @@ -166,7 +191,10 @@ |
166 | 191 | sizeof(struct aml_resource_address64), /* ACPI_RESOURCE_TYPE_ADDRESS64 */ |
167 | 192 | sizeof(struct aml_resource_extended_address64), /*ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */ |
168 | 193 | sizeof(struct aml_resource_extended_irq), /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */ |
169 | - sizeof(struct aml_resource_generic_register) /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ | |
194 | + sizeof(struct aml_resource_generic_register), /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ | |
195 | + sizeof(struct aml_resource_gpio), /* ACPI_RESOURCE_TYPE_GPIO */ | |
196 | + sizeof(struct aml_resource_fixed_dma), /* ACPI_RESOURCE_TYPE_FIXED_DMA */ | |
197 | + sizeof(struct aml_resource_common_serialbus), /* ACPI_RESOURCE_TYPE_SERIAL_BUS */ | |
170 | 198 | }; |
171 | 199 | |
172 | 200 | const u8 acpi_gbl_resource_struct_sizes[] = { |
173 | 201 | |
... | ... | @@ -182,10 +210,10 @@ |
182 | 210 | ACPI_RS_SIZE_MIN, |
183 | 211 | ACPI_RS_SIZE(struct acpi_resource_io), |
184 | 212 | ACPI_RS_SIZE(struct acpi_resource_fixed_io), |
213 | + ACPI_RS_SIZE(struct acpi_resource_fixed_dma), | |
185 | 214 | 0, |
186 | 215 | 0, |
187 | 216 | 0, |
188 | - 0, | |
189 | 217 | ACPI_RS_SIZE(struct acpi_resource_vendor), |
190 | 218 | ACPI_RS_SIZE_MIN, |
191 | 219 | |
... | ... | @@ -202,6 +230,22 @@ |
202 | 230 | ACPI_RS_SIZE(struct acpi_resource_address16), |
203 | 231 | ACPI_RS_SIZE(struct acpi_resource_extended_irq), |
204 | 232 | ACPI_RS_SIZE(struct acpi_resource_address64), |
205 | - ACPI_RS_SIZE(struct acpi_resource_extended_address64) | |
233 | + ACPI_RS_SIZE(struct acpi_resource_extended_address64), | |
234 | + ACPI_RS_SIZE(struct acpi_resource_gpio), | |
235 | + ACPI_RS_SIZE(struct acpi_resource_common_serialbus) | |
236 | +}; | |
237 | + | |
238 | +const u8 acpi_gbl_aml_resource_serial_bus_sizes[] = { | |
239 | + 0, | |
240 | + sizeof(struct aml_resource_i2c_serialbus), | |
241 | + sizeof(struct aml_resource_spi_serialbus), | |
242 | + sizeof(struct aml_resource_uart_serialbus), | |
243 | +}; | |
244 | + | |
245 | +const u8 acpi_gbl_resource_struct_serial_bus_sizes[] = { | |
246 | + 0, | |
247 | + ACPI_RS_SIZE(struct acpi_resource_i2c_serialbus), | |
248 | + ACPI_RS_SIZE(struct acpi_resource_spi_serialbus), | |
249 | + ACPI_RS_SIZE(struct acpi_resource_uart_serialbus), | |
206 | 250 | }; |
drivers/acpi/acpica/rsirq.c
... | ... | @@ -264,4 +264,35 @@ |
264 | 264 | AML_OFFSET(dma.dma_channel_mask), |
265 | 265 | ACPI_RS_OFFSET(data.dma.channel_count)} |
266 | 266 | }; |
267 | + | |
268 | +/******************************************************************************* | |
269 | + * | |
270 | + * acpi_rs_convert_fixed_dma | |
271 | + * | |
272 | + ******************************************************************************/ | |
273 | + | |
274 | +struct acpi_rsconvert_info acpi_rs_convert_fixed_dma[4] = { | |
275 | + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_DMA, | |
276 | + ACPI_RS_SIZE(struct acpi_resource_fixed_dma), | |
277 | + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_fixed_dma)}, | |
278 | + | |
279 | + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_DMA, | |
280 | + sizeof(struct aml_resource_fixed_dma), | |
281 | + 0}, | |
282 | + | |
283 | + /* | |
284 | + * These fields are contiguous in both the source and destination: | |
285 | + * request_lines | |
286 | + * Channels | |
287 | + */ | |
288 | + | |
289 | + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.fixed_dma.request_lines), | |
290 | + AML_OFFSET(fixed_dma.request_lines), | |
291 | + 2}, | |
292 | + | |
293 | + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.fixed_dma.width), | |
294 | + AML_OFFSET(fixed_dma.width), | |
295 | + 1}, | |
296 | + | |
297 | +}; |
drivers/acpi/acpica/rslist.c
... | ... | @@ -70,6 +70,8 @@ |
70 | 70 | struct acpi_resource **resource_ptr = |
71 | 71 | ACPI_CAST_INDIRECT_PTR(struct acpi_resource, context); |
72 | 72 | struct acpi_resource *resource; |
73 | + union aml_resource *aml_resource; | |
74 | + struct acpi_rsconvert_info *conversion_table; | |
73 | 75 | acpi_status status; |
74 | 76 | |
75 | 77 | ACPI_FUNCTION_TRACE(rs_convert_aml_to_resources); |
76 | 78 | |
... | ... | @@ -84,14 +86,37 @@ |
84 | 86 | "Misaligned resource pointer %p", resource)); |
85 | 87 | } |
86 | 88 | |
89 | + /* Get the appropriate conversion info table */ | |
90 | + | |
91 | + aml_resource = ACPI_CAST_PTR(union aml_resource, aml); | |
92 | + if (acpi_ut_get_resource_type(aml) == ACPI_RESOURCE_NAME_SERIAL_BUS) { | |
93 | + if (aml_resource->common_serial_bus.type > | |
94 | + AML_RESOURCE_MAX_SERIALBUSTYPE) { | |
95 | + conversion_table = NULL; | |
96 | + } else { | |
97 | + /* This is an I2C, SPI, or UART serial_bus descriptor */ | |
98 | + | |
99 | + conversion_table = | |
100 | + acpi_gbl_convert_resource_serial_bus_dispatch | |
101 | + [aml_resource->common_serial_bus.type]; | |
102 | + } | |
103 | + } else { | |
104 | + conversion_table = | |
105 | + acpi_gbl_get_resource_dispatch[resource_index]; | |
106 | + } | |
107 | + | |
108 | + if (!conversion_table) { | |
109 | + ACPI_ERROR((AE_INFO, | |
110 | + "Invalid/unsupported resource descriptor: Type 0x%2.2X", | |
111 | + resource_index)); | |
112 | + return (AE_AML_INVALID_RESOURCE_TYPE); | |
113 | + } | |
114 | + | |
87 | 115 | /* Convert the AML byte stream resource to a local resource struct */ |
88 | 116 | |
89 | 117 | status = |
90 | - acpi_rs_convert_aml_to_resource(resource, | |
91 | - ACPI_CAST_PTR(union aml_resource, | |
92 | - aml), | |
93 | - acpi_gbl_get_resource_dispatch | |
94 | - [resource_index]); | |
118 | + acpi_rs_convert_aml_to_resource(resource, aml_resource, | |
119 | + conversion_table); | |
95 | 120 | if (ACPI_FAILURE(status)) { |
96 | 121 | ACPI_EXCEPTION((AE_INFO, status, |
97 | 122 | "Could not convert AML resource (Type 0x%X)", |
... | ... | @@ -106,7 +131,7 @@ |
106 | 131 | |
107 | 132 | /* Point to the next structure in the output buffer */ |
108 | 133 | |
109 | - *resource_ptr = ACPI_ADD_PTR(void, resource, resource->length); | |
134 | + *resource_ptr = ACPI_NEXT_RESOURCE(resource); | |
110 | 135 | return_ACPI_STATUS(AE_OK); |
111 | 136 | } |
112 | 137 | |
... | ... | @@ -135,6 +160,7 @@ |
135 | 160 | { |
136 | 161 | u8 *aml = output_buffer; |
137 | 162 | u8 *end_aml = output_buffer + aml_size_needed; |
163 | + struct acpi_rsconvert_info *conversion_table; | |
138 | 164 | acpi_status status; |
139 | 165 | |
140 | 166 | ACPI_FUNCTION_TRACE(rs_convert_resources_to_aml); |
... | ... | @@ -154,11 +180,34 @@ |
154 | 180 | |
155 | 181 | /* Perform the conversion */ |
156 | 182 | |
157 | - status = acpi_rs_convert_resource_to_aml(resource, ACPI_CAST_PTR(union | |
158 | - aml_resource, | |
159 | - aml), | |
160 | - acpi_gbl_set_resource_dispatch | |
161 | - [resource->type]); | |
183 | + if (resource->type == ACPI_RESOURCE_TYPE_SERIAL_BUS) { | |
184 | + if (resource->data.common_serial_bus.type > | |
185 | + AML_RESOURCE_MAX_SERIALBUSTYPE) { | |
186 | + conversion_table = NULL; | |
187 | + } else { | |
188 | + /* This is an I2C, SPI, or UART serial_bus descriptor */ | |
189 | + | |
190 | + conversion_table = | |
191 | + acpi_gbl_convert_resource_serial_bus_dispatch | |
192 | + [resource->data.common_serial_bus.type]; | |
193 | + } | |
194 | + } else { | |
195 | + conversion_table = | |
196 | + acpi_gbl_set_resource_dispatch[resource->type]; | |
197 | + } | |
198 | + | |
199 | + if (!conversion_table) { | |
200 | + ACPI_ERROR((AE_INFO, | |
201 | + "Invalid/unsupported resource descriptor: Type 0x%2.2X", | |
202 | + resource->type)); | |
203 | + return (AE_AML_INVALID_RESOURCE_TYPE); | |
204 | + } | |
205 | + | |
206 | + status = acpi_rs_convert_resource_to_aml(resource, | |
207 | + ACPI_CAST_PTR(union | |
208 | + aml_resource, | |
209 | + aml), | |
210 | + conversion_table); | |
162 | 211 | if (ACPI_FAILURE(status)) { |
163 | 212 | ACPI_EXCEPTION((AE_INFO, status, |
164 | 213 | "Could not convert resource (type 0x%X) to AML", |
... | ... | @@ -192,9 +241,7 @@ |
192 | 241 | |
193 | 242 | /* Point to the next input resource descriptor */ |
194 | 243 | |
195 | - resource = | |
196 | - ACPI_ADD_PTR(struct acpi_resource, resource, | |
197 | - resource->length); | |
244 | + resource = ACPI_NEXT_RESOURCE(resource); | |
198 | 245 | } |
199 | 246 | |
200 | 247 | /* Completed buffer, but did not find an end_tag resource descriptor */ |
drivers/acpi/acpica/rsmisc.c
... | ... | @@ -83,6 +83,10 @@ |
83 | 83 | |
84 | 84 | ACPI_FUNCTION_TRACE(rs_convert_aml_to_resource); |
85 | 85 | |
86 | + if (!info) { | |
87 | + return_ACPI_STATUS(AE_BAD_PARAMETER); | |
88 | + } | |
89 | + | |
86 | 90 | if (((acpi_size) resource) & 0x3) { |
87 | 91 | |
88 | 92 | /* Each internal resource struct is expected to be 32-bit aligned */ |
... | ... | @@ -101,7 +105,6 @@ |
101 | 105 | * table length (# of table entries) |
102 | 106 | */ |
103 | 107 | count = INIT_TABLE_LENGTH(info); |
104 | - | |
105 | 108 | while (count) { |
106 | 109 | /* |
107 | 110 | * Source is the external AML byte stream buffer, |
... | ... | @@ -145,6 +148,14 @@ |
145 | 148 | ((ACPI_GET8(source) >> info->value) & 0x03); |
146 | 149 | break; |
147 | 150 | |
151 | + case ACPI_RSC_3BITFLAG: | |
152 | + /* | |
153 | + * Mask and shift the flag bits | |
154 | + */ | |
155 | + ACPI_SET8(destination) = (u8) | |
156 | + ((ACPI_GET8(source) >> info->value) & 0x07); | |
157 | + break; | |
158 | + | |
148 | 159 | case ACPI_RSC_COUNT: |
149 | 160 | |
150 | 161 | item_count = ACPI_GET8(source); |
... | ... | @@ -163,6 +174,69 @@ |
163 | 174 | (info->value * (item_count - 1)); |
164 | 175 | break; |
165 | 176 | |
177 | + case ACPI_RSC_COUNT_GPIO_PIN: | |
178 | + | |
179 | + target = ACPI_ADD_PTR(void, aml, info->value); | |
180 | + item_count = ACPI_GET16(target) - ACPI_GET16(source); | |
181 | + | |
182 | + resource->length = resource->length + item_count; | |
183 | + item_count = item_count / 2; | |
184 | + ACPI_SET16(destination) = item_count; | |
185 | + break; | |
186 | + | |
187 | + case ACPI_RSC_COUNT_GPIO_VEN: | |
188 | + | |
189 | + item_count = ACPI_GET8(source); | |
190 | + ACPI_SET8(destination) = (u8)item_count; | |
191 | + | |
192 | + resource->length = resource->length + | |
193 | + (info->value * item_count); | |
194 | + break; | |
195 | + | |
196 | + case ACPI_RSC_COUNT_GPIO_RES: | |
197 | + | |
198 | + /* | |
199 | + * Vendor data is optional (length/offset may both be zero) | |
200 | + * Examine vendor data length field first | |
201 | + */ | |
202 | + target = ACPI_ADD_PTR(void, aml, (info->value + 2)); | |
203 | + if (ACPI_GET16(target)) { | |
204 | + | |
205 | + /* Use vendor offset to get resource source length */ | |
206 | + | |
207 | + target = ACPI_ADD_PTR(void, aml, info->value); | |
208 | + item_count = | |
209 | + ACPI_GET16(target) - ACPI_GET16(source); | |
210 | + } else { | |
211 | + /* No vendor data to worry about */ | |
212 | + | |
213 | + item_count = aml->large_header.resource_length + | |
214 | + sizeof(struct aml_resource_large_header) - | |
215 | + ACPI_GET16(source); | |
216 | + } | |
217 | + | |
218 | + resource->length = resource->length + item_count; | |
219 | + ACPI_SET16(destination) = item_count; | |
220 | + break; | |
221 | + | |
222 | + case ACPI_RSC_COUNT_SERIAL_VEN: | |
223 | + | |
224 | + item_count = ACPI_GET16(source) - info->value; | |
225 | + | |
226 | + resource->length = resource->length + item_count; | |
227 | + ACPI_SET16(destination) = item_count; | |
228 | + break; | |
229 | + | |
230 | + case ACPI_RSC_COUNT_SERIAL_RES: | |
231 | + | |
232 | + item_count = (aml_resource_length + | |
233 | + sizeof(struct aml_resource_large_header)) | |
234 | + - ACPI_GET16(source) - info->value; | |
235 | + | |
236 | + resource->length = resource->length + item_count; | |
237 | + ACPI_SET16(destination) = item_count; | |
238 | + break; | |
239 | + | |
166 | 240 | case ACPI_RSC_LENGTH: |
167 | 241 | |
168 | 242 | resource->length = resource->length + info->value; |
... | ... | @@ -183,6 +257,72 @@ |
183 | 257 | info->opcode); |
184 | 258 | break; |
185 | 259 | |
260 | + case ACPI_RSC_MOVE_GPIO_PIN: | |
261 | + | |
262 | + /* Generate and set the PIN data pointer */ | |
263 | + | |
264 | + target = (char *)ACPI_ADD_PTR(void, resource, | |
265 | + (resource->length - | |
266 | + item_count * 2)); | |
267 | + *(u16 **)destination = ACPI_CAST_PTR(u16, target); | |
268 | + | |
269 | + /* Copy the PIN data */ | |
270 | + | |
271 | + source = ACPI_ADD_PTR(void, aml, ACPI_GET16(source)); | |
272 | + acpi_rs_move_data(target, source, item_count, | |
273 | + info->opcode); | |
274 | + break; | |
275 | + | |
276 | + case ACPI_RSC_MOVE_GPIO_RES: | |
277 | + | |
278 | + /* Generate and set the resource_source string pointer */ | |
279 | + | |
280 | + target = (char *)ACPI_ADD_PTR(void, resource, | |
281 | + (resource->length - | |
282 | + item_count)); | |
283 | + *(u8 **)destination = ACPI_CAST_PTR(u8, target); | |
284 | + | |
285 | + /* Copy the resource_source string */ | |
286 | + | |
287 | + source = ACPI_ADD_PTR(void, aml, ACPI_GET16(source)); | |
288 | + acpi_rs_move_data(target, source, item_count, | |
289 | + info->opcode); | |
290 | + break; | |
291 | + | |
292 | + case ACPI_RSC_MOVE_SERIAL_VEN: | |
293 | + | |
294 | + /* Generate and set the Vendor Data pointer */ | |
295 | + | |
296 | + target = (char *)ACPI_ADD_PTR(void, resource, | |
297 | + (resource->length - | |
298 | + item_count)); | |
299 | + *(u8 **)destination = ACPI_CAST_PTR(u8, target); | |
300 | + | |
301 | + /* Copy the Vendor Data */ | |
302 | + | |
303 | + source = ACPI_ADD_PTR(void, aml, info->value); | |
304 | + acpi_rs_move_data(target, source, item_count, | |
305 | + info->opcode); | |
306 | + break; | |
307 | + | |
308 | + case ACPI_RSC_MOVE_SERIAL_RES: | |
309 | + | |
310 | + /* Generate and set the resource_source string pointer */ | |
311 | + | |
312 | + target = (char *)ACPI_ADD_PTR(void, resource, | |
313 | + (resource->length - | |
314 | + item_count)); | |
315 | + *(u8 **)destination = ACPI_CAST_PTR(u8, target); | |
316 | + | |
317 | + /* Copy the resource_source string */ | |
318 | + | |
319 | + source = | |
320 | + ACPI_ADD_PTR(void, aml, | |
321 | + (ACPI_GET16(source) + info->value)); | |
322 | + acpi_rs_move_data(target, source, item_count, | |
323 | + info->opcode); | |
324 | + break; | |
325 | + | |
186 | 326 | case ACPI_RSC_SET8: |
187 | 327 | |
188 | 328 | ACPI_MEMSET(destination, info->aml_offset, info->value); |
189 | 329 | |
... | ... | @@ -219,13 +359,18 @@ |
219 | 359 | * Optional resource_source (Index and String). This is the more |
220 | 360 | * complicated case used by the Interrupt() macro |
221 | 361 | */ |
222 | - target = | |
223 | - ACPI_ADD_PTR(char, resource, | |
224 | - info->aml_offset + (item_count * 4)); | |
362 | + target = ACPI_ADD_PTR(char, resource, | |
363 | + info->aml_offset + | |
364 | + (item_count * 4)); | |
225 | 365 | |
226 | 366 | resource->length += |
227 | 367 | acpi_rs_get_resource_source(aml_resource_length, |
228 | - (acpi_rs_length) (((item_count - 1) * sizeof(u32)) + info->value), destination, aml, target); | |
368 | + (acpi_rs_length) | |
369 | + (((item_count - | |
370 | + 1) * sizeof(u32)) + | |
371 | + info->value), | |
372 | + destination, aml, | |
373 | + target); | |
229 | 374 | break; |
230 | 375 | |
231 | 376 | case ACPI_RSC_BITMASK: |
... | ... | @@ -327,6 +472,7 @@ |
327 | 472 | { |
328 | 473 | void *source = NULL; |
329 | 474 | void *destination; |
475 | + char *target; | |
330 | 476 | acpi_rsdesc_size aml_length = 0; |
331 | 477 | u8 count; |
332 | 478 | u16 temp16 = 0; |
... | ... | @@ -334,6 +480,10 @@ |
334 | 480 | |
335 | 481 | ACPI_FUNCTION_TRACE(rs_convert_resource_to_aml); |
336 | 482 | |
483 | + if (!info) { | |
484 | + return_ACPI_STATUS(AE_BAD_PARAMETER); | |
485 | + } | |
486 | + | |
337 | 487 | /* |
338 | 488 | * First table entry must be ACPI_RSC_INITxxx and must contain the |
339 | 489 | * table length (# of table entries) |
... | ... | @@ -383,6 +533,14 @@ |
383 | 533 | ((ACPI_GET8(source) & 0x03) << info->value); |
384 | 534 | break; |
385 | 535 | |
536 | + case ACPI_RSC_3BITFLAG: | |
537 | + /* | |
538 | + * Mask and shift the flag bits | |
539 | + */ | |
540 | + ACPI_SET8(destination) |= (u8) | |
541 | + ((ACPI_GET8(source) & 0x07) << info->value); | |
542 | + break; | |
543 | + | |
386 | 544 | case ACPI_RSC_COUNT: |
387 | 545 | |
388 | 546 | item_count = ACPI_GET8(source); |
... | ... | @@ -400,6 +558,63 @@ |
400 | 558 | acpi_rs_set_resource_length(aml_length, aml); |
401 | 559 | break; |
402 | 560 | |
561 | + case ACPI_RSC_COUNT_GPIO_PIN: | |
562 | + | |
563 | + item_count = ACPI_GET16(source); | |
564 | + ACPI_SET16(destination) = (u16)aml_length; | |
565 | + | |
566 | + aml_length = (u16)(aml_length + item_count * 2); | |
567 | + target = ACPI_ADD_PTR(void, aml, info->value); | |
568 | + ACPI_SET16(target) = (u16)aml_length; | |
569 | + acpi_rs_set_resource_length(aml_length, aml); | |
570 | + break; | |
571 | + | |
572 | + case ACPI_RSC_COUNT_GPIO_VEN: | |
573 | + | |
574 | + item_count = ACPI_GET16(source); | |
575 | + ACPI_SET16(destination) = (u16)item_count; | |
576 | + | |
577 | + aml_length = | |
578 | + (u16)(aml_length + (info->value * item_count)); | |
579 | + acpi_rs_set_resource_length(aml_length, aml); | |
580 | + break; | |
581 | + | |
582 | + case ACPI_RSC_COUNT_GPIO_RES: | |
583 | + | |
584 | + /* Set resource source string length */ | |
585 | + | |
586 | + item_count = ACPI_GET16(source); | |
587 | + ACPI_SET16(destination) = (u16)aml_length; | |
588 | + | |
589 | + /* Compute offset for the Vendor Data */ | |
590 | + | |
591 | + aml_length = (u16)(aml_length + item_count); | |
592 | + target = ACPI_ADD_PTR(void, aml, info->value); | |
593 | + | |
594 | + /* Set vendor offset only if there is vendor data */ | |
595 | + | |
596 | + if (resource->data.gpio.vendor_length) { | |
597 | + ACPI_SET16(target) = (u16)aml_length; | |
598 | + } | |
599 | + | |
600 | + acpi_rs_set_resource_length(aml_length, aml); | |
601 | + break; | |
602 | + | |
603 | + case ACPI_RSC_COUNT_SERIAL_VEN: | |
604 | + | |
605 | + item_count = ACPI_GET16(source); | |
606 | + ACPI_SET16(destination) = item_count + info->value; | |
607 | + aml_length = (u16)(aml_length + item_count); | |
608 | + acpi_rs_set_resource_length(aml_length, aml); | |
609 | + break; | |
610 | + | |
611 | + case ACPI_RSC_COUNT_SERIAL_RES: | |
612 | + | |
613 | + item_count = ACPI_GET16(source); | |
614 | + aml_length = (u16)(aml_length + item_count); | |
615 | + acpi_rs_set_resource_length(aml_length, aml); | |
616 | + break; | |
617 | + | |
403 | 618 | case ACPI_RSC_LENGTH: |
404 | 619 | |
405 | 620 | acpi_rs_set_resource_length(info->value, aml); |
... | ... | @@ -413,6 +628,48 @@ |
413 | 628 | if (info->value) { |
414 | 629 | item_count = info->value; |
415 | 630 | } |
631 | + acpi_rs_move_data(destination, source, item_count, | |
632 | + info->opcode); | |
633 | + break; | |
634 | + | |
635 | + case ACPI_RSC_MOVE_GPIO_PIN: | |
636 | + | |
637 | + destination = (char *)ACPI_ADD_PTR(void, aml, | |
638 | + ACPI_GET16 | |
639 | + (destination)); | |
640 | + source = *(u16 **)source; | |
641 | + acpi_rs_move_data(destination, source, item_count, | |
642 | + info->opcode); | |
643 | + break; | |
644 | + | |
645 | + case ACPI_RSC_MOVE_GPIO_RES: | |
646 | + | |
647 | + /* Used for both resource_source string and vendor_data */ | |
648 | + | |
649 | + destination = (char *)ACPI_ADD_PTR(void, aml, | |
650 | + ACPI_GET16 | |
651 | + (destination)); | |
652 | + source = *(u8 **)source; | |
653 | + acpi_rs_move_data(destination, source, item_count, | |
654 | + info->opcode); | |
655 | + break; | |
656 | + | |
657 | + case ACPI_RSC_MOVE_SERIAL_VEN: | |
658 | + | |
659 | + destination = (char *)ACPI_ADD_PTR(void, aml, | |
660 | + (aml_length - | |
661 | + item_count)); | |
662 | + source = *(u8 **)source; | |
663 | + acpi_rs_move_data(destination, source, item_count, | |
664 | + info->opcode); | |
665 | + break; | |
666 | + | |
667 | + case ACPI_RSC_MOVE_SERIAL_RES: | |
668 | + | |
669 | + destination = (char *)ACPI_ADD_PTR(void, aml, | |
670 | + (aml_length - | |
671 | + item_count)); | |
672 | + source = *(u8 **)source; | |
416 | 673 | acpi_rs_move_data(destination, source, item_count, |
417 | 674 | info->opcode); |
418 | 675 | break; |
drivers/acpi/acpica/rsserial.c
1 | +/******************************************************************************* | |
2 | + * | |
3 | + * Module Name: rsserial - GPIO/serial_bus resource descriptors | |
4 | + * | |
5 | + ******************************************************************************/ | |
6 | + | |
7 | +/* | |
8 | + * Copyright (C) 2000 - 2011, 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 | +#include <acpi/acpi.h> | |
45 | +#include "accommon.h" | |
46 | +#include "acresrc.h" | |
47 | + | |
48 | +#define _COMPONENT ACPI_RESOURCES | |
49 | +ACPI_MODULE_NAME("rsserial") | |
50 | + | |
51 | +/******************************************************************************* | |
52 | + * | |
53 | + * acpi_rs_convert_gpio | |
54 | + * | |
55 | + ******************************************************************************/ | |
56 | +struct acpi_rsconvert_info acpi_rs_convert_gpio[17] = { | |
57 | + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GPIO, | |
58 | + ACPI_RS_SIZE(struct acpi_resource_gpio), | |
59 | + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_gpio)}, | |
60 | + | |
61 | + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_GPIO, | |
62 | + sizeof(struct aml_resource_gpio), | |
63 | + 0}, | |
64 | + | |
65 | + /* | |
66 | + * These fields are contiguous in both the source and destination: | |
67 | + * revision_id | |
68 | + * connection_type | |
69 | + */ | |
70 | + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.gpio.revision_id), | |
71 | + AML_OFFSET(gpio.revision_id), | |
72 | + 2}, | |
73 | + | |
74 | + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.producer_consumer), | |
75 | + AML_OFFSET(gpio.flags), | |
76 | + 0}, | |
77 | + | |
78 | + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.sharable), | |
79 | + AML_OFFSET(gpio.int_flags), | |
80 | + 3}, | |
81 | + | |
82 | + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.io_restriction), | |
83 | + AML_OFFSET(gpio.int_flags), | |
84 | + 0}, | |
85 | + | |
86 | + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.triggering), | |
87 | + AML_OFFSET(gpio.int_flags), | |
88 | + 0}, | |
89 | + | |
90 | + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.polarity), | |
91 | + AML_OFFSET(gpio.int_flags), | |
92 | + 1}, | |
93 | + | |
94 | + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.gpio.pin_config), | |
95 | + AML_OFFSET(gpio.pin_config), | |
96 | + 1}, | |
97 | + | |
98 | + /* | |
99 | + * These fields are contiguous in both the source and destination: | |
100 | + * drive_strength | |
101 | + * debounce_timeout | |
102 | + */ | |
103 | + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.gpio.drive_strength), | |
104 | + AML_OFFSET(gpio.drive_strength), | |
105 | + 2}, | |
106 | + | |
107 | + /* Pin Table */ | |
108 | + | |
109 | + {ACPI_RSC_COUNT_GPIO_PIN, ACPI_RS_OFFSET(data.gpio.pin_table_length), | |
110 | + AML_OFFSET(gpio.pin_table_offset), | |
111 | + AML_OFFSET(gpio.res_source_offset)}, | |
112 | + | |
113 | + {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET(data.gpio.pin_table), | |
114 | + AML_OFFSET(gpio.pin_table_offset), | |
115 | + 0}, | |
116 | + | |
117 | + /* Resource Source */ | |
118 | + | |
119 | + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.gpio.resource_source.index), | |
120 | + AML_OFFSET(gpio.res_source_index), | |
121 | + 1}, | |
122 | + | |
123 | + {ACPI_RSC_COUNT_GPIO_RES, | |
124 | + ACPI_RS_OFFSET(data.gpio.resource_source.string_length), | |
125 | + AML_OFFSET(gpio.res_source_offset), | |
126 | + AML_OFFSET(gpio.vendor_offset)}, | |
127 | + | |
128 | + {ACPI_RSC_MOVE_GPIO_RES, | |
129 | + ACPI_RS_OFFSET(data.gpio.resource_source.string_ptr), | |
130 | + AML_OFFSET(gpio.res_source_offset), | |
131 | + 0}, | |
132 | + | |
133 | + /* Vendor Data */ | |
134 | + | |
135 | + {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET(data.gpio.vendor_length), | |
136 | + AML_OFFSET(gpio.vendor_length), | |
137 | + 1}, | |
138 | + | |
139 | + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET(data.gpio.vendor_data), | |
140 | + AML_OFFSET(gpio.vendor_offset), | |
141 | + 0}, | |
142 | +}; | |
143 | + | |
144 | +/******************************************************************************* | |
145 | + * | |
146 | + * acpi_rs_convert_i2c_serial_bus | |
147 | + * | |
148 | + ******************************************************************************/ | |
149 | + | |
150 | +struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[16] = { | |
151 | + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS, | |
152 | + ACPI_RS_SIZE(struct acpi_resource_i2c_serialbus), | |
153 | + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_i2c_serial_bus)}, | |
154 | + | |
155 | + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS, | |
156 | + sizeof(struct aml_resource_i2c_serialbus), | |
157 | + 0}, | |
158 | + | |
159 | + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id), | |
160 | + AML_OFFSET(common_serial_bus.revision_id), | |
161 | + 1}, | |
162 | + | |
163 | + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type), | |
164 | + AML_OFFSET(common_serial_bus.type), | |
165 | + 1}, | |
166 | + | |
167 | + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode), | |
168 | + AML_OFFSET(common_serial_bus.flags), | |
169 | + 0}, | |
170 | + | |
171 | + {ACPI_RSC_1BITFLAG, | |
172 | + ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer), | |
173 | + AML_OFFSET(common_serial_bus.flags), | |
174 | + 1}, | |
175 | + | |
176 | + {ACPI_RSC_MOVE8, | |
177 | + ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id), | |
178 | + AML_OFFSET(common_serial_bus.type_revision_id), | |
179 | + 1}, | |
180 | + | |
181 | + {ACPI_RSC_MOVE16, | |
182 | + ACPI_RS_OFFSET(data.common_serial_bus.type_data_length), | |
183 | + AML_OFFSET(common_serial_bus.type_data_length), | |
184 | + 1}, | |
185 | + | |
186 | + /* Vendor data */ | |
187 | + | |
188 | + {ACPI_RSC_COUNT_SERIAL_VEN, | |
189 | + ACPI_RS_OFFSET(data.common_serial_bus.vendor_length), | |
190 | + AML_OFFSET(common_serial_bus.type_data_length), | |
191 | + AML_RESOURCE_I2C_MIN_DATA_LEN}, | |
192 | + | |
193 | + {ACPI_RSC_MOVE_SERIAL_VEN, | |
194 | + ACPI_RS_OFFSET(data.common_serial_bus.vendor_data), | |
195 | + 0, | |
196 | + sizeof(struct aml_resource_i2c_serialbus)}, | |
197 | + | |
198 | + /* Resource Source */ | |
199 | + | |
200 | + {ACPI_RSC_MOVE8, | |
201 | + ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index), | |
202 | + AML_OFFSET(common_serial_bus.res_source_index), | |
203 | + 1}, | |
204 | + | |
205 | + {ACPI_RSC_COUNT_SERIAL_RES, | |
206 | + ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length), | |
207 | + AML_OFFSET(common_serial_bus.type_data_length), | |
208 | + sizeof(struct aml_resource_common_serialbus)}, | |
209 | + | |
210 | + {ACPI_RSC_MOVE_SERIAL_RES, | |
211 | + ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr), | |
212 | + AML_OFFSET(common_serial_bus.type_data_length), | |
213 | + sizeof(struct aml_resource_common_serialbus)}, | |
214 | + | |
215 | + /* I2C bus type specific */ | |
216 | + | |
217 | + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.i2c_serial_bus.access_mode), | |
218 | + AML_OFFSET(i2c_serial_bus.type_specific_flags), | |
219 | + 0}, | |
220 | + | |
221 | + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.i2c_serial_bus.connection_speed), | |
222 | + AML_OFFSET(i2c_serial_bus.connection_speed), | |
223 | + 1}, | |
224 | + | |
225 | + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.i2c_serial_bus.slave_address), | |
226 | + AML_OFFSET(i2c_serial_bus.slave_address), | |
227 | + 1}, | |
228 | +}; | |
229 | + | |
230 | +/******************************************************************************* | |
231 | + * | |
232 | + * acpi_rs_convert_spi_serial_bus | |
233 | + * | |
234 | + ******************************************************************************/ | |
235 | + | |
236 | +struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[20] = { | |
237 | + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS, | |
238 | + ACPI_RS_SIZE(struct acpi_resource_spi_serialbus), | |
239 | + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_spi_serial_bus)}, | |
240 | + | |
241 | + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS, | |
242 | + sizeof(struct aml_resource_spi_serialbus), | |
243 | + 0}, | |
244 | + | |
245 | + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id), | |
246 | + AML_OFFSET(common_serial_bus.revision_id), | |
247 | + 1}, | |
248 | + | |
249 | + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type), | |
250 | + AML_OFFSET(common_serial_bus.type), | |
251 | + 1}, | |
252 | + | |
253 | + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode), | |
254 | + AML_OFFSET(common_serial_bus.flags), | |
255 | + 0}, | |
256 | + | |
257 | + {ACPI_RSC_1BITFLAG, | |
258 | + ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer), | |
259 | + AML_OFFSET(common_serial_bus.flags), | |
260 | + 1}, | |
261 | + | |
262 | + {ACPI_RSC_MOVE8, | |
263 | + ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id), | |
264 | + AML_OFFSET(common_serial_bus.type_revision_id), | |
265 | + 1}, | |
266 | + | |
267 | + {ACPI_RSC_MOVE16, | |
268 | + ACPI_RS_OFFSET(data.common_serial_bus.type_data_length), | |
269 | + AML_OFFSET(common_serial_bus.type_data_length), | |
270 | + 1}, | |
271 | + | |
272 | + /* Vendor data */ | |
273 | + | |
274 | + {ACPI_RSC_COUNT_SERIAL_VEN, | |
275 | + ACPI_RS_OFFSET(data.common_serial_bus.vendor_length), | |
276 | + AML_OFFSET(common_serial_bus.type_data_length), | |
277 | + AML_RESOURCE_SPI_MIN_DATA_LEN}, | |
278 | + | |
279 | + {ACPI_RSC_MOVE_SERIAL_VEN, | |
280 | + ACPI_RS_OFFSET(data.common_serial_bus.vendor_data), | |
281 | + 0, | |
282 | + sizeof(struct aml_resource_spi_serialbus)}, | |
283 | + | |
284 | + /* Resource Source */ | |
285 | + | |
286 | + {ACPI_RSC_MOVE8, | |
287 | + ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index), | |
288 | + AML_OFFSET(common_serial_bus.res_source_index), | |
289 | + 1}, | |
290 | + | |
291 | + {ACPI_RSC_COUNT_SERIAL_RES, | |
292 | + ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length), | |
293 | + AML_OFFSET(common_serial_bus.type_data_length), | |
294 | + sizeof(struct aml_resource_common_serialbus)}, | |
295 | + | |
296 | + {ACPI_RSC_MOVE_SERIAL_RES, | |
297 | + ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr), | |
298 | + AML_OFFSET(common_serial_bus.type_data_length), | |
299 | + sizeof(struct aml_resource_common_serialbus)}, | |
300 | + | |
301 | + /* Spi bus type specific */ | |
302 | + | |
303 | + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.spi_serial_bus.wire_mode), | |
304 | + AML_OFFSET(spi_serial_bus.type_specific_flags), | |
305 | + 0}, | |
306 | + | |
307 | + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.spi_serial_bus.device_polarity), | |
308 | + AML_OFFSET(spi_serial_bus.type_specific_flags), | |
309 | + 1}, | |
310 | + | |
311 | + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.data_bit_length), | |
312 | + AML_OFFSET(spi_serial_bus.data_bit_length), | |
313 | + 1}, | |
314 | + | |
315 | + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.clock_phase), | |
316 | + AML_OFFSET(spi_serial_bus.clock_phase), | |
317 | + 1}, | |
318 | + | |
319 | + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.spi_serial_bus.clock_polarity), | |
320 | + AML_OFFSET(spi_serial_bus.clock_polarity), | |
321 | + 1}, | |
322 | + | |
323 | + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.spi_serial_bus.device_selection), | |
324 | + AML_OFFSET(spi_serial_bus.device_selection), | |
325 | + 1}, | |
326 | + | |
327 | + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.spi_serial_bus.connection_speed), | |
328 | + AML_OFFSET(spi_serial_bus.connection_speed), | |
329 | + 1}, | |
330 | +}; | |
331 | + | |
332 | +/******************************************************************************* | |
333 | + * | |
334 | + * acpi_rs_convert_uart_serial_bus | |
335 | + * | |
336 | + ******************************************************************************/ | |
337 | + | |
338 | +struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[22] = { | |
339 | + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS, | |
340 | + ACPI_RS_SIZE(struct acpi_resource_uart_serialbus), | |
341 | + ACPI_RSC_TABLE_SIZE(acpi_rs_convert_uart_serial_bus)}, | |
342 | + | |
343 | + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_SERIAL_BUS, | |
344 | + sizeof(struct aml_resource_uart_serialbus), | |
345 | + 0}, | |
346 | + | |
347 | + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.revision_id), | |
348 | + AML_OFFSET(common_serial_bus.revision_id), | |
349 | + 1}, | |
350 | + | |
351 | + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.common_serial_bus.type), | |
352 | + AML_OFFSET(common_serial_bus.type), | |
353 | + 1}, | |
354 | + | |
355 | + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.common_serial_bus.slave_mode), | |
356 | + AML_OFFSET(common_serial_bus.flags), | |
357 | + 0}, | |
358 | + | |
359 | + {ACPI_RSC_1BITFLAG, | |
360 | + ACPI_RS_OFFSET(data.common_serial_bus.producer_consumer), | |
361 | + AML_OFFSET(common_serial_bus.flags), | |
362 | + 1}, | |
363 | + | |
364 | + {ACPI_RSC_MOVE8, | |
365 | + ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id), | |
366 | + AML_OFFSET(common_serial_bus.type_revision_id), | |
367 | + 1}, | |
368 | + | |
369 | + {ACPI_RSC_MOVE16, | |
370 | + ACPI_RS_OFFSET(data.common_serial_bus.type_data_length), | |
371 | + AML_OFFSET(common_serial_bus.type_data_length), | |
372 | + 1}, | |
373 | + | |
374 | + /* Vendor data */ | |
375 | + | |
376 | + {ACPI_RSC_COUNT_SERIAL_VEN, | |
377 | + ACPI_RS_OFFSET(data.common_serial_bus.vendor_length), | |
378 | + AML_OFFSET(common_serial_bus.type_data_length), | |
379 | + AML_RESOURCE_UART_MIN_DATA_LEN}, | |
380 | + | |
381 | + {ACPI_RSC_MOVE_SERIAL_VEN, | |
382 | + ACPI_RS_OFFSET(data.common_serial_bus.vendor_data), | |
383 | + 0, | |
384 | + sizeof(struct aml_resource_uart_serialbus)}, | |
385 | + | |
386 | + /* Resource Source */ | |
387 | + | |
388 | + {ACPI_RSC_MOVE8, | |
389 | + ACPI_RS_OFFSET(data.common_serial_bus.resource_source.index), | |
390 | + AML_OFFSET(common_serial_bus.res_source_index), | |
391 | + 1}, | |
392 | + | |
393 | + {ACPI_RSC_COUNT_SERIAL_RES, | |
394 | + ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_length), | |
395 | + AML_OFFSET(common_serial_bus.type_data_length), | |
396 | + sizeof(struct aml_resource_common_serialbus)}, | |
397 | + | |
398 | + {ACPI_RSC_MOVE_SERIAL_RES, | |
399 | + ACPI_RS_OFFSET(data.common_serial_bus.resource_source.string_ptr), | |
400 | + AML_OFFSET(common_serial_bus.type_data_length), | |
401 | + sizeof(struct aml_resource_common_serialbus)}, | |
402 | + | |
403 | + /* Uart bus type specific */ | |
404 | + | |
405 | + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.flow_control), | |
406 | + AML_OFFSET(uart_serial_bus.type_specific_flags), | |
407 | + 0}, | |
408 | + | |
409 | + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.stop_bits), | |
410 | + AML_OFFSET(uart_serial_bus.type_specific_flags), | |
411 | + 2}, | |
412 | + | |
413 | + {ACPI_RSC_3BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.data_bits), | |
414 | + AML_OFFSET(uart_serial_bus.type_specific_flags), | |
415 | + 4}, | |
416 | + | |
417 | + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.uart_serial_bus.endian), | |
418 | + AML_OFFSET(uart_serial_bus.type_specific_flags), | |
419 | + 7}, | |
420 | + | |
421 | + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.uart_serial_bus.parity), | |
422 | + AML_OFFSET(uart_serial_bus.parity), | |
423 | + 1}, | |
424 | + | |
425 | + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.uart_serial_bus.lines_enabled), | |
426 | + AML_OFFSET(uart_serial_bus.lines_enabled), | |
427 | + 1}, | |
428 | + | |
429 | + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.uart_serial_bus.rx_fifo_size), | |
430 | + AML_OFFSET(uart_serial_bus.rx_fifo_size), | |
431 | + 1}, | |
432 | + | |
433 | + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.uart_serial_bus.tx_fifo_size), | |
434 | + AML_OFFSET(uart_serial_bus.tx_fifo_size), | |
435 | + 1}, | |
436 | + | |
437 | + {ACPI_RSC_MOVE32, | |
438 | + ACPI_RS_OFFSET(data.uart_serial_bus.default_baud_rate), | |
439 | + AML_OFFSET(uart_serial_bus.default_baud_rate), | |
440 | + 1}, | |
441 | +}; |
drivers/acpi/acpica/rsutils.c
... | ... | @@ -144,6 +144,9 @@ |
144 | 144 | * since there are no alignment or endian issues |
145 | 145 | */ |
146 | 146 | case ACPI_RSC_MOVE8: |
147 | + case ACPI_RSC_MOVE_GPIO_RES: | |
148 | + case ACPI_RSC_MOVE_SERIAL_VEN: | |
149 | + case ACPI_RSC_MOVE_SERIAL_RES: | |
147 | 150 | ACPI_MEMCPY(destination, source, item_count); |
148 | 151 | return; |
149 | 152 | |
... | ... | @@ -153,6 +156,7 @@ |
153 | 156 | * misaligned memory transfers |
154 | 157 | */ |
155 | 158 | case ACPI_RSC_MOVE16: |
159 | + case ACPI_RSC_MOVE_GPIO_PIN: | |
156 | 160 | ACPI_MOVE_16_TO_16(&ACPI_CAST_PTR(u16, destination)[i], |
157 | 161 | &ACPI_CAST_PTR(u16, source)[i]); |
158 | 162 | break; |
drivers/acpi/acpica/utresrc.c
... | ... | @@ -43,7 +43,7 @@ |
43 | 43 | |
44 | 44 | #include <acpi/acpi.h> |
45 | 45 | #include "accommon.h" |
46 | -#include "amlresrc.h" | |
46 | +#include "acresrc.h" | |
47 | 47 | |
48 | 48 | #define _COMPONENT ACPI_UTILITIES |
49 | 49 | ACPI_MODULE_NAME("utresrc") |
... | ... | @@ -154,6 +154,138 @@ |
154 | 154 | "TypeF" |
155 | 155 | }; |
156 | 156 | |
157 | +const char *acpi_gbl_ppc_decode[] = { | |
158 | + "PullDefault", | |
159 | + "PullUp", | |
160 | + "PullDown", | |
161 | + "PullNone" | |
162 | +}; | |
163 | + | |
164 | +const char *acpi_gbl_ior_decode[] = { | |
165 | + "IoRestrictionNone", | |
166 | + "IoRestrictionInputOnly", | |
167 | + "IoRestrictionOutputOnly", | |
168 | + "IoRestrictionNoneAndPreserve" | |
169 | +}; | |
170 | + | |
171 | +const char *acpi_gbl_dts_decode[] = { | |
172 | + "Width8bit", | |
173 | + "Width16bit", | |
174 | + "Width32bit", | |
175 | + "Width64bit", | |
176 | + "Width128bit", | |
177 | + "Width256bit", | |
178 | +}; | |
179 | + | |
180 | +/* GPIO connection type */ | |
181 | + | |
182 | +const char *acpi_gbl_ct_decode[] = { | |
183 | + "Interrupt", | |
184 | + "I/O" | |
185 | +}; | |
186 | + | |
187 | +/* Serial bus type */ | |
188 | + | |
189 | +const char *acpi_gbl_sbt_decode[] = { | |
190 | + "/* UNKNOWN serial bus type */", | |
191 | + "I2C", | |
192 | + "SPI", | |
193 | + "UART" | |
194 | +}; | |
195 | + | |
196 | +/* I2C serial bus access mode */ | |
197 | + | |
198 | +const char *acpi_gbl_am_decode[] = { | |
199 | + "AddressingMode7Bit", | |
200 | + "AddressingMode10Bit" | |
201 | +}; | |
202 | + | |
203 | +/* I2C serial bus slave mode */ | |
204 | + | |
205 | +const char *acpi_gbl_sm_decode[] = { | |
206 | + "ControllerInitiated", | |
207 | + "DeviceInitiated" | |
208 | +}; | |
209 | + | |
210 | +/* SPI serial bus wire mode */ | |
211 | + | |
212 | +const char *acpi_gbl_wm_decode[] = { | |
213 | + "FourWireMode", | |
214 | + "ThreeWireMode" | |
215 | +}; | |
216 | + | |
217 | +/* SPI serial clock phase */ | |
218 | + | |
219 | +const char *acpi_gbl_cph_decode[] = { | |
220 | + "ClockPhaseFirst", | |
221 | + "ClockPhaseSecond" | |
222 | +}; | |
223 | + | |
224 | +/* SPI serial bus clock polarity */ | |
225 | + | |
226 | +const char *acpi_gbl_cpo_decode[] = { | |
227 | + "ClockPolarityLow", | |
228 | + "ClockPolarityHigh" | |
229 | +}; | |
230 | + | |
231 | +/* SPI serial bus device polarity */ | |
232 | + | |
233 | +const char *acpi_gbl_dp_decode[] = { | |
234 | + "PolarityLow", | |
235 | + "PolarityHigh" | |
236 | +}; | |
237 | + | |
238 | +/* UART serial bus endian */ | |
239 | + | |
240 | +const char *acpi_gbl_ed_decode[] = { | |
241 | + "LittleEndian", | |
242 | + "BigEndian" | |
243 | +}; | |
244 | + | |
245 | +/* UART serial bus bits per byte */ | |
246 | + | |
247 | +const char *acpi_gbl_bpb_decode[] = { | |
248 | + "DataBitsFive", | |
249 | + "DataBitsSix", | |
250 | + "DataBitsSeven", | |
251 | + "DataBitsEight", | |
252 | + "DataBitsNine", | |
253 | + "/* UNKNOWN Bits per byte */", | |
254 | + "/* UNKNOWN Bits per byte */", | |
255 | + "/* UNKNOWN Bits per byte */" | |
256 | +}; | |
257 | + | |
258 | +/* UART serial bus stop bits */ | |
259 | + | |
260 | +const char *acpi_gbl_sb_decode[] = { | |
261 | + "StopBitsNone", | |
262 | + "StopBitsOne", | |
263 | + "StopBitsOnePlusHalf", | |
264 | + "StopBitsTwo" | |
265 | +}; | |
266 | + | |
267 | +/* UART serial bus flow control */ | |
268 | + | |
269 | +const char *acpi_gbl_fc_decode[] = { | |
270 | + "FlowControlNone", | |
271 | + "FlowControlHardware", | |
272 | + "FlowControlXON", | |
273 | + "/* UNKNOWN flow control keyword */" | |
274 | +}; | |
275 | + | |
276 | +/* UART serial bus parity type */ | |
277 | + | |
278 | +const char *acpi_gbl_pt_decode[] = { | |
279 | + "ParityTypeNone", | |
280 | + "ParityTypeEven", | |
281 | + "ParityTypeOdd", | |
282 | + "ParityTypeMark", | |
283 | + "ParityTypeSpace", | |
284 | + "/* UNKNOWN parity keyword */", | |
285 | + "/* UNKNOWN parity keyword */", | |
286 | + "/* UNKNOWN parity keyword */" | |
287 | +}; | |
288 | + | |
157 | 289 | #endif |
158 | 290 | |
159 | 291 | /* |
160 | 292 | |
... | ... | @@ -173,10 +305,10 @@ |
173 | 305 | ACPI_AML_SIZE_SMALL(struct aml_resource_end_dependent), |
174 | 306 | ACPI_AML_SIZE_SMALL(struct aml_resource_io), |
175 | 307 | ACPI_AML_SIZE_SMALL(struct aml_resource_fixed_io), |
308 | + ACPI_AML_SIZE_SMALL(struct aml_resource_fixed_dma), | |
176 | 309 | 0, |
177 | 310 | 0, |
178 | 311 | 0, |
179 | - 0, | |
180 | 312 | ACPI_AML_SIZE_SMALL(struct aml_resource_vendor_small), |
181 | 313 | ACPI_AML_SIZE_SMALL(struct aml_resource_end_tag), |
182 | 314 | |
183 | 315 | |
... | ... | @@ -193,9 +325,19 @@ |
193 | 325 | ACPI_AML_SIZE_LARGE(struct aml_resource_address16), |
194 | 326 | ACPI_AML_SIZE_LARGE(struct aml_resource_extended_irq), |
195 | 327 | ACPI_AML_SIZE_LARGE(struct aml_resource_address64), |
196 | - ACPI_AML_SIZE_LARGE(struct aml_resource_extended_address64) | |
328 | + ACPI_AML_SIZE_LARGE(struct aml_resource_extended_address64), | |
329 | + ACPI_AML_SIZE_LARGE(struct aml_resource_gpio), | |
330 | + 0, | |
331 | + ACPI_AML_SIZE_LARGE(struct aml_resource_common_serialbus), | |
197 | 332 | }; |
198 | 333 | |
334 | +const u8 acpi_gbl_resource_aml_serial_bus_sizes[] = { | |
335 | + 0, | |
336 | + ACPI_AML_SIZE_LARGE(struct aml_resource_i2c_serialbus), | |
337 | + ACPI_AML_SIZE_LARGE(struct aml_resource_spi_serialbus), | |
338 | + ACPI_AML_SIZE_LARGE(struct aml_resource_uart_serialbus), | |
339 | +}; | |
340 | + | |
199 | 341 | /* |
200 | 342 | * Resource types, used to validate the resource length field. |
201 | 343 | * The length of fixed-length types must match exactly, variable |
202 | 344 | |
203 | 345 | |
204 | 346 | |
205 | 347 | |
... | ... | @@ -209,35 +351,49 @@ |
209 | 351 | 0, |
210 | 352 | 0, |
211 | 353 | 0, |
212 | - ACPI_SMALL_VARIABLE_LENGTH, | |
213 | - ACPI_FIXED_LENGTH, | |
214 | - ACPI_SMALL_VARIABLE_LENGTH, | |
215 | - ACPI_FIXED_LENGTH, | |
216 | - ACPI_FIXED_LENGTH, | |
217 | - ACPI_FIXED_LENGTH, | |
354 | + ACPI_SMALL_VARIABLE_LENGTH, /* 04 IRQ */ | |
355 | + ACPI_FIXED_LENGTH, /* 05 DMA */ | |
356 | + ACPI_SMALL_VARIABLE_LENGTH, /* 06 start_dependent_functions */ | |
357 | + ACPI_FIXED_LENGTH, /* 07 end_dependent_functions */ | |
358 | + ACPI_FIXED_LENGTH, /* 08 IO */ | |
359 | + ACPI_FIXED_LENGTH, /* 09 fixed_iO */ | |
360 | + ACPI_FIXED_LENGTH, /* 0_a fixed_dMA */ | |
218 | 361 | 0, |
219 | 362 | 0, |
220 | 363 | 0, |
221 | - 0, | |
222 | - ACPI_VARIABLE_LENGTH, | |
223 | - ACPI_FIXED_LENGTH, | |
364 | + ACPI_VARIABLE_LENGTH, /* 0_e vendor_short */ | |
365 | + ACPI_FIXED_LENGTH, /* 0_f end_tag */ | |
224 | 366 | |
225 | 367 | /* Large descriptors */ |
226 | 368 | |
227 | 369 | 0, |
228 | - ACPI_FIXED_LENGTH, | |
229 | - ACPI_FIXED_LENGTH, | |
370 | + ACPI_FIXED_LENGTH, /* 01 Memory24 */ | |
371 | + ACPI_FIXED_LENGTH, /* 02 generic_register */ | |
230 | 372 | 0, |
231 | - ACPI_VARIABLE_LENGTH, | |
232 | - ACPI_FIXED_LENGTH, | |
233 | - ACPI_FIXED_LENGTH, | |
234 | - ACPI_VARIABLE_LENGTH, | |
235 | - ACPI_VARIABLE_LENGTH, | |
236 | - ACPI_VARIABLE_LENGTH, | |
237 | - ACPI_VARIABLE_LENGTH, | |
238 | - ACPI_FIXED_LENGTH | |
373 | + ACPI_VARIABLE_LENGTH, /* 04 vendor_long */ | |
374 | + ACPI_FIXED_LENGTH, /* 05 Memory32 */ | |
375 | + ACPI_FIXED_LENGTH, /* 06 memory32_fixed */ | |
376 | + ACPI_VARIABLE_LENGTH, /* 07 Dword* address */ | |
377 | + ACPI_VARIABLE_LENGTH, /* 08 Word* address */ | |
378 | + ACPI_VARIABLE_LENGTH, /* 09 extended_iRQ */ | |
379 | + ACPI_VARIABLE_LENGTH, /* 0_a Qword* address */ | |
380 | + ACPI_FIXED_LENGTH, /* 0_b Extended* address */ | |
381 | + ACPI_VARIABLE_LENGTH, /* 0_c Gpio* */ | |
382 | + 0, | |
383 | + ACPI_VARIABLE_LENGTH /* 0_e *serial_bus */ | |
239 | 384 | }; |
240 | 385 | |
386 | +/* | |
387 | + * For the i_aSL compiler/disassembler, we don't want any error messages | |
388 | + * because the disassembler uses the resource validation code to determine | |
389 | + * if Buffer objects are actually Resource Templates. | |
390 | + */ | |
391 | +#ifdef ACPI_ASL_COMPILER | |
392 | +#define ACPI_RESOURCE_ERROR(plist) | |
393 | +#else | |
394 | +#define ACPI_RESOURCE_ERROR(plist) ACPI_ERROR(plist) | |
395 | +#endif | |
396 | + | |
241 | 397 | /******************************************************************************* |
242 | 398 | * |
243 | 399 | * FUNCTION: acpi_ut_walk_aml_resources |
... | ... | @@ -265,6 +421,7 @@ |
265 | 421 | u8 resource_index; |
266 | 422 | u32 length; |
267 | 423 | u32 offset = 0; |
424 | + u8 end_tag[2] = { 0x79, 0x00 }; | |
268 | 425 | |
269 | 426 | ACPI_FUNCTION_TRACE(ut_walk_aml_resources); |
270 | 427 | |
... | ... | @@ -286,6 +443,10 @@ |
286 | 443 | |
287 | 444 | status = acpi_ut_validate_resource(aml, &resource_index); |
288 | 445 | if (ACPI_FAILURE(status)) { |
446 | + /* | |
447 | + * Exit on failure. Cannot continue because the descriptor length | |
448 | + * may be bogus also. | |
449 | + */ | |
289 | 450 | return_ACPI_STATUS(status); |
290 | 451 | } |
291 | 452 | |
... | ... | @@ -300,7 +461,7 @@ |
300 | 461 | user_function(aml, length, offset, resource_index, |
301 | 462 | context); |
302 | 463 | if (ACPI_FAILURE(status)) { |
303 | - return (status); | |
464 | + return_ACPI_STATUS(status); | |
304 | 465 | } |
305 | 466 | } |
306 | 467 | |
... | ... | @@ -333,7 +494,19 @@ |
333 | 494 | |
334 | 495 | /* Did not find an end_tag descriptor */ |
335 | 496 | |
336 | - return (AE_AML_NO_RESOURCE_END_TAG); | |
497 | + if (user_function) { | |
498 | + | |
499 | + /* Insert an end_tag anyway. acpi_rs_get_list_length always leaves room */ | |
500 | + | |
501 | + (void)acpi_ut_validate_resource(end_tag, &resource_index); | |
502 | + status = | |
503 | + user_function(end_tag, 2, offset, resource_index, context); | |
504 | + if (ACPI_FAILURE(status)) { | |
505 | + return_ACPI_STATUS(status); | |
506 | + } | |
507 | + } | |
508 | + | |
509 | + return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | |
337 | 510 | } |
338 | 511 | |
339 | 512 | /******************************************************************************* |
... | ... | @@ -354,6 +527,7 @@ |
354 | 527 | |
355 | 528 | acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index) |
356 | 529 | { |
530 | + union aml_resource *aml_resource; | |
357 | 531 | u8 resource_type; |
358 | 532 | u8 resource_index; |
359 | 533 | acpi_rs_length resource_length; |
... | ... | @@ -375,7 +549,7 @@ |
375 | 549 | /* Verify the large resource type (name) against the max */ |
376 | 550 | |
377 | 551 | if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { |
378 | - return (AE_AML_INVALID_RESOURCE_TYPE); | |
552 | + goto invalid_resource; | |
379 | 553 | } |
380 | 554 | |
381 | 555 | /* |
382 | 556 | |
383 | 557 | |
... | ... | @@ -392,15 +566,17 @@ |
392 | 566 | ((resource_type & ACPI_RESOURCE_NAME_SMALL_MASK) >> 3); |
393 | 567 | } |
394 | 568 | |
395 | - /* Check validity of the resource type, zero indicates name is invalid */ | |
396 | - | |
569 | + /* | |
570 | + * Check validity of the resource type, via acpi_gbl_resource_types. Zero | |
571 | + * indicates an invalid resource. | |
572 | + */ | |
397 | 573 | if (!acpi_gbl_resource_types[resource_index]) { |
398 | - return (AE_AML_INVALID_RESOURCE_TYPE); | |
574 | + goto invalid_resource; | |
399 | 575 | } |
400 | 576 | |
401 | 577 | /* |
402 | - * 2) Validate the resource_length field. This ensures that the length | |
403 | - * is at least reasonable, and guarantees that it is non-zero. | |
578 | + * Validate the resource_length field. This ensures that the length | |
579 | + * is at least reasonable, and guarantees that it is non-zero. | |
404 | 580 | */ |
405 | 581 | resource_length = acpi_ut_get_resource_length(aml); |
406 | 582 | minimum_resource_length = acpi_gbl_resource_aml_sizes[resource_index]; |
... | ... | @@ -413,7 +589,7 @@ |
413 | 589 | /* Fixed length resource, length must match exactly */ |
414 | 590 | |
415 | 591 | if (resource_length != minimum_resource_length) { |
416 | - return (AE_AML_BAD_RESOURCE_LENGTH); | |
592 | + goto bad_resource_length; | |
417 | 593 | } |
418 | 594 | break; |
419 | 595 | |
... | ... | @@ -422,7 +598,7 @@ |
422 | 598 | /* Variable length resource, length must be at least the minimum */ |
423 | 599 | |
424 | 600 | if (resource_length < minimum_resource_length) { |
425 | - return (AE_AML_BAD_RESOURCE_LENGTH); | |
601 | + goto bad_resource_length; | |
426 | 602 | } |
427 | 603 | break; |
428 | 604 | |
... | ... | @@ -432,7 +608,7 @@ |
432 | 608 | |
433 | 609 | if ((resource_length > minimum_resource_length) || |
434 | 610 | (resource_length < (minimum_resource_length - 1))) { |
435 | - return (AE_AML_BAD_RESOURCE_LENGTH); | |
611 | + goto bad_resource_length; | |
436 | 612 | } |
437 | 613 | break; |
438 | 614 | |
439 | 615 | |
... | ... | @@ -440,9 +616,25 @@ |
440 | 616 | |
441 | 617 | /* Shouldn't happen (because of validation earlier), but be sure */ |
442 | 618 | |
443 | - return (AE_AML_INVALID_RESOURCE_TYPE); | |
619 | + goto invalid_resource; | |
444 | 620 | } |
445 | 621 | |
622 | + aml_resource = ACPI_CAST_PTR(union aml_resource, aml); | |
623 | + if (resource_type == ACPI_RESOURCE_NAME_SERIAL_BUS) { | |
624 | + | |
625 | + /* Validate the bus_type field */ | |
626 | + | |
627 | + if ((aml_resource->common_serial_bus.type == 0) || | |
628 | + (aml_resource->common_serial_bus.type > | |
629 | + AML_RESOURCE_MAX_SERIALBUSTYPE)) { | |
630 | + ACPI_RESOURCE_ERROR((AE_INFO, | |
631 | + "Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X", | |
632 | + aml_resource->common_serial_bus. | |
633 | + type)); | |
634 | + return (AE_AML_INVALID_RESOURCE_TYPE); | |
635 | + } | |
636 | + } | |
637 | + | |
446 | 638 | /* Optionally return the resource table index */ |
447 | 639 | |
448 | 640 | if (return_index) { |
... | ... | @@ -450,6 +642,22 @@ |
450 | 642 | } |
451 | 643 | |
452 | 644 | return (AE_OK); |
645 | + | |
646 | + invalid_resource: | |
647 | + | |
648 | + ACPI_RESOURCE_ERROR((AE_INFO, | |
649 | + "Invalid/unsupported resource descriptor: Type 0x%2.2X", | |
650 | + resource_type)); | |
651 | + return (AE_AML_INVALID_RESOURCE_TYPE); | |
652 | + | |
653 | + bad_resource_length: | |
654 | + | |
655 | + ACPI_RESOURCE_ERROR((AE_INFO, | |
656 | + "Invalid resource descriptor length: Type " | |
657 | + "0x%2.2X, Length 0x%4.4X, MinLength 0x%4.4X", | |
658 | + resource_type, resource_length, | |
659 | + minimum_resource_length)); | |
660 | + return (AE_AML_BAD_RESOURCE_LENGTH); | |
453 | 661 | } |
454 | 662 | |
455 | 663 | /******************************************************************************* |
include/acpi/acrestyp.h
... | ... | @@ -61,11 +61,14 @@ |
61 | 61 | #define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02 |
62 | 62 | #define ACPI_PREFETCHABLE_MEMORY (u8) 0x03 |
63 | 63 | |
64 | +/*! [Begin] no source code translation */ | |
64 | 65 | /* |
65 | 66 | * IO Attributes |
66 | - * The ISA IO ranges are: n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh. | |
67 | - * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh. | |
67 | + * The ISA IO ranges are: n000-n0FFh, n400-n4FFh, n800-n8FFh, nC00-nCFFh. | |
68 | + * The non-ISA IO ranges are: n100-n3FFh, n500-n7FFh, n900-nBFFh, nCD0-nFFFh. | |
68 | 69 | */ |
70 | +/*! [End] no source code translation !*/ | |
71 | + | |
69 | 72 | #define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 |
70 | 73 | #define ACPI_ISA_ONLY_RANGES (u8) 0x02 |
71 | 74 | #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) |
72 | 75 | |
73 | 76 | |
74 | 77 | |
75 | 78 | |
76 | 79 | |
... | ... | @@ -81,16 +84,26 @@ |
81 | 84 | #define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */ |
82 | 85 | |
83 | 86 | /* |
84 | - * IRQ Attributes | |
87 | + * Interrupt attributes - used in multiple descriptors | |
85 | 88 | */ |
89 | + | |
90 | +/* Triggering */ | |
91 | + | |
86 | 92 | #define ACPI_LEVEL_SENSITIVE (u8) 0x00 |
87 | 93 | #define ACPI_EDGE_SENSITIVE (u8) 0x01 |
88 | 94 | |
95 | +/* Polarity */ | |
96 | + | |
89 | 97 | #define ACPI_ACTIVE_HIGH (u8) 0x00 |
90 | 98 | #define ACPI_ACTIVE_LOW (u8) 0x01 |
99 | +#define ACPI_ACTIVE_BOTH (u8) 0x02 | |
91 | 100 | |
101 | +/* Sharing */ | |
102 | + | |
92 | 103 | #define ACPI_EXCLUSIVE (u8) 0x00 |
93 | 104 | #define ACPI_SHARED (u8) 0x01 |
105 | +#define ACPI_EXCLUSIVE_AND_WAKE (u8) 0x02 | |
106 | +#define ACPI_SHARED_AND_WAKE (u8) 0x03 | |
94 | 107 | |
95 | 108 | /* |
96 | 109 | * DMA Attributes |
... | ... | @@ -127,6 +140,8 @@ |
127 | 140 | #define ACPI_POS_DECODE (u8) 0x00 |
128 | 141 | #define ACPI_SUB_DECODE (u8) 0x01 |
129 | 142 | |
143 | +/* Producer/Consumer */ | |
144 | + | |
130 | 145 | #define ACPI_PRODUCER (u8) 0x00 |
131 | 146 | #define ACPI_CONSUMER (u8) 0x01 |
132 | 147 | |
... | ... | @@ -192,6 +207,21 @@ |
192 | 207 | u8 address_length; |
193 | 208 | }; |
194 | 209 | |
210 | +struct acpi_resource_fixed_dma { | |
211 | + u16 request_lines; | |
212 | + u16 channels; | |
213 | + u8 width; | |
214 | +}; | |
215 | + | |
216 | +/* Values for Width field above */ | |
217 | + | |
218 | +#define ACPI_DMA_WIDTH8 0 | |
219 | +#define ACPI_DMA_WIDTH16 1 | |
220 | +#define ACPI_DMA_WIDTH32 2 | |
221 | +#define ACPI_DMA_WIDTH64 3 | |
222 | +#define ACPI_DMA_WIDTH128 4 | |
223 | +#define ACPI_DMA_WIDTH256 5 | |
224 | + | |
195 | 225 | struct acpi_resource_vendor { |
196 | 226 | u16 byte_length; |
197 | 227 | u8 byte_data[1]; |
... | ... | @@ -329,6 +359,166 @@ |
329 | 359 | u64 address; |
330 | 360 | }; |
331 | 361 | |
362 | +struct acpi_resource_gpio { | |
363 | + u8 revision_id; | |
364 | + u8 connection_type; | |
365 | + u8 producer_consumer; /* For values, see Producer/Consumer above */ | |
366 | + u8 pin_config; | |
367 | + u8 sharable; /* For values, see Interrupt Attributes above */ | |
368 | + u8 io_restriction; | |
369 | + u8 triggering; /* For values, see Interrupt Attributes above */ | |
370 | + u8 polarity; /* For values, see Interrupt Attributes above */ | |
371 | + u16 drive_strength; | |
372 | + u16 debounce_timeout; | |
373 | + u16 pin_table_length; | |
374 | + u16 vendor_length; | |
375 | + struct acpi_resource_source resource_source; | |
376 | + u16 *pin_table; | |
377 | + u8 *vendor_data; | |
378 | +}; | |
379 | + | |
380 | +/* Values for GPIO connection_type field above */ | |
381 | + | |
382 | +#define ACPI_RESOURCE_GPIO_TYPE_INT 0 | |
383 | +#define ACPI_RESOURCE_GPIO_TYPE_IO 1 | |
384 | + | |
385 | +/* Values for pin_config field above */ | |
386 | + | |
387 | +#define ACPI_PIN_CONFIG_DEFAULT 0 | |
388 | +#define ACPI_PIN_CONFIG_PULLUP 1 | |
389 | +#define ACPI_PIN_CONFIG_PULLDOWN 2 | |
390 | +#define ACPI_PIN_CONFIG_NOPULL 3 | |
391 | + | |
392 | +/* Values for io_restriction field above */ | |
393 | + | |
394 | +#define ACPI_IO_RESTRICT_NONE 0 | |
395 | +#define ACPI_IO_RESTRICT_INPUT 1 | |
396 | +#define ACPI_IO_RESTRICT_OUTPUT 2 | |
397 | +#define ACPI_IO_RESTRICT_NONE_PRESERVE 3 | |
398 | + | |
399 | +/* Common structure for I2C, SPI, and UART serial descriptors */ | |
400 | + | |
401 | +#define ACPI_RESOURCE_SERIAL_COMMON \ | |
402 | + u8 revision_id; \ | |
403 | + u8 type; \ | |
404 | + u8 producer_consumer; /* For values, see Producer/Consumer above */\ | |
405 | + u8 slave_mode; \ | |
406 | + u8 type_revision_id; \ | |
407 | + u16 type_data_length; \ | |
408 | + u16 vendor_length; \ | |
409 | + struct acpi_resource_source resource_source; \ | |
410 | + u8 *vendor_data; | |
411 | + | |
412 | +struct acpi_resource_common_serialbus { | |
413 | +ACPI_RESOURCE_SERIAL_COMMON}; | |
414 | + | |
415 | +/* Values for the Type field above */ | |
416 | + | |
417 | +#define ACPI_RESOURCE_SERIAL_TYPE_I2C 1 | |
418 | +#define ACPI_RESOURCE_SERIAL_TYPE_SPI 2 | |
419 | +#define ACPI_RESOURCE_SERIAL_TYPE_UART 3 | |
420 | + | |
421 | +/* Values for slave_mode field above */ | |
422 | + | |
423 | +#define ACPI_CONTROLLER_INITIATED 0 | |
424 | +#define ACPI_DEVICE_INITIATED 1 | |
425 | + | |
426 | +struct acpi_resource_i2c_serialbus { | |
427 | + ACPI_RESOURCE_SERIAL_COMMON u8 access_mode; | |
428 | + u16 slave_address; | |
429 | + u32 connection_speed; | |
430 | +}; | |
431 | + | |
432 | +/* Values for access_mode field above */ | |
433 | + | |
434 | +#define ACPI_I2C_7BIT_MODE 0 | |
435 | +#define ACPI_I2C_10BIT_MODE 1 | |
436 | + | |
437 | +struct acpi_resource_spi_serialbus { | |
438 | + ACPI_RESOURCE_SERIAL_COMMON u8 wire_mode; | |
439 | + u8 device_polarity; | |
440 | + u8 data_bit_length; | |
441 | + u8 clock_phase; | |
442 | + u8 clock_polarity; | |
443 | + u16 device_selection; | |
444 | + u32 connection_speed; | |
445 | +}; | |
446 | + | |
447 | +/* Values for wire_mode field above */ | |
448 | + | |
449 | +#define ACPI_SPI_4WIRE_MODE 0 | |
450 | +#define ACPI_SPI_3WIRE_MODE 1 | |
451 | + | |
452 | +/* Values for device_polarity field above */ | |
453 | + | |
454 | +#define ACPI_SPI_ACTIVE_LOW 0 | |
455 | +#define ACPI_SPI_ACTIVE_HIGH 1 | |
456 | + | |
457 | +/* Values for clock_phase field above */ | |
458 | + | |
459 | +#define ACPI_SPI_FIRST_PHASE 0 | |
460 | +#define ACPI_SPI_SECOND_PHASE 1 | |
461 | + | |
462 | +/* Values for clock_polarity field above */ | |
463 | + | |
464 | +#define ACPI_SPI_START_LOW 0 | |
465 | +#define ACPI_SPI_START_HIGH 1 | |
466 | + | |
467 | +struct acpi_resource_uart_serialbus { | |
468 | + ACPI_RESOURCE_SERIAL_COMMON u8 endian; | |
469 | + u8 data_bits; | |
470 | + u8 stop_bits; | |
471 | + u8 flow_control; | |
472 | + u8 parity; | |
473 | + u8 lines_enabled; | |
474 | + u16 rx_fifo_size; | |
475 | + u16 tx_fifo_size; | |
476 | + u32 default_baud_rate; | |
477 | +}; | |
478 | + | |
479 | +/* Values for Endian field above */ | |
480 | + | |
481 | +#define ACPI_UART_LITTLE_ENDIAN 0 | |
482 | +#define ACPI_UART_BIG_ENDIAN 1 | |
483 | + | |
484 | +/* Values for data_bits field above */ | |
485 | + | |
486 | +#define ACPI_UART_5_DATA_BITS 0 | |
487 | +#define ACPI_UART_6_DATA_BITS 1 | |
488 | +#define ACPI_UART_7_DATA_BITS 2 | |
489 | +#define ACPI_UART_8_DATA_BITS 3 | |
490 | +#define ACPI_UART_9_DATA_BITS 4 | |
491 | + | |
492 | +/* Values for stop_bits field above */ | |
493 | + | |
494 | +#define ACPI_UART_NO_STOP_BITS 0 | |
495 | +#define ACPI_UART_1_STOP_BIT 1 | |
496 | +#define ACPI_UART_1P5_STOP_BITS 2 | |
497 | +#define ACPI_UART_2_STOP_BITS 3 | |
498 | + | |
499 | +/* Values for flow_control field above */ | |
500 | + | |
501 | +#define ACPI_UART_FLOW_CONTROL_NONE 0 | |
502 | +#define ACPI_UART_FLOW_CONTROL_HW 1 | |
503 | +#define ACPI_UART_FLOW_CONTROL_XON_XOFF 2 | |
504 | + | |
505 | +/* Values for Parity field above */ | |
506 | + | |
507 | +#define ACPI_UART_PARITY_NONE 0 | |
508 | +#define ACPI_UART_PARITY_EVEN 1 | |
509 | +#define ACPI_UART_PARITY_ODD 2 | |
510 | +#define ACPI_UART_PARITY_MARK 3 | |
511 | +#define ACPI_UART_PARITY_SPACE 4 | |
512 | + | |
513 | +/* Values for lines_enabled bitfield above */ | |
514 | + | |
515 | +#define ACPI_UART_CARRIER_DETECT (1<<2) | |
516 | +#define ACPI_UART_RING_INDICATOR (1<<3) | |
517 | +#define ACPI_UART_DATA_SET_READY (1<<4) | |
518 | +#define ACPI_UART_DATA_TERMINAL_READY (1<<5) | |
519 | +#define ACPI_UART_CLEAR_TO_SEND (1<<6) | |
520 | +#define ACPI_UART_REQUEST_TO_SEND (1<<7) | |
521 | + | |
332 | 522 | /* ACPI_RESOURCE_TYPEs */ |
333 | 523 | |
334 | 524 | #define ACPI_RESOURCE_TYPE_IRQ 0 |
... | ... | @@ -348,7 +538,10 @@ |
348 | 538 | #define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */ |
349 | 539 | #define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15 |
350 | 540 | #define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16 |
351 | -#define ACPI_RESOURCE_TYPE_MAX 16 | |
541 | +#define ACPI_RESOURCE_TYPE_GPIO 17 /* ACPI 5.0 */ | |
542 | +#define ACPI_RESOURCE_TYPE_FIXED_DMA 18 /* ACPI 5.0 */ | |
543 | +#define ACPI_RESOURCE_TYPE_SERIAL_BUS 19 /* ACPI 5.0 */ | |
544 | +#define ACPI_RESOURCE_TYPE_MAX 19 | |
352 | 545 | |
353 | 546 | /* Master union for resource descriptors */ |
354 | 547 | |
... | ... | @@ -358,6 +551,7 @@ |
358 | 551 | struct acpi_resource_start_dependent start_dpf; |
359 | 552 | struct acpi_resource_io io; |
360 | 553 | struct acpi_resource_fixed_io fixed_io; |
554 | + struct acpi_resource_fixed_dma fixed_dma; | |
361 | 555 | struct acpi_resource_vendor vendor; |
362 | 556 | struct acpi_resource_vendor_typed vendor_typed; |
363 | 557 | struct acpi_resource_end_tag end_tag; |
... | ... | @@ -370,6 +564,11 @@ |
370 | 564 | struct acpi_resource_extended_address64 ext_address64; |
371 | 565 | struct acpi_resource_extended_irq extended_irq; |
372 | 566 | struct acpi_resource_generic_register generic_reg; |
567 | + struct acpi_resource_gpio gpio; | |
568 | + struct acpi_resource_i2c_serialbus i2c_serial_bus; | |
569 | + struct acpi_resource_spi_serialbus spi_serial_bus; | |
570 | + struct acpi_resource_uart_serialbus uart_serial_bus; | |
571 | + struct acpi_resource_common_serialbus common_serial_bus; | |
373 | 572 | |
374 | 573 | /* Common fields */ |
375 | 574 |