Lines Matching +full:address +full:- +full:width
1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
4 * Module Name: hwvalid - I/O request validation
6 * Copyright (C) 2000 - 2023, Intel Corp.
18 acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width);
22 * conditionally illegal. This table must remain ordered by port address.
37 * RTC: Real-time clock
77 * PARAMETERS: Address Address of I/O port/register
82 * DESCRIPTION: Validates an I/O request (address/length). Certain ports are
90 acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width) in acpi_hw_validate_io_request() argument
109 last_address = address + byte_width - 1; in acpi_hw_validate_io_request()
112 "Address %8.8X%8.8X LastAddress %8.8X%8.8X Length %X", in acpi_hw_validate_io_request()
113 ACPI_FORMAT_UINT64(address), in acpi_hw_validate_io_request()
116 /* Maximum 16-bit address in I/O space */ in acpi_hw_validate_io_request()
120 "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X", in acpi_hw_validate_io_request()
121 ACPI_FORMAT_UINT64(address), byte_width)); in acpi_hw_validate_io_request()
125 /* Exit if requested address is not within the protected port table */ in acpi_hw_validate_io_request()
127 if (address > acpi_protected_ports[ACPI_PORT_INFO_ENTRIES - 1].end) { in acpi_hw_validate_io_request()
135 * Check if the requested address range will write to a reserved in acpi_hw_validate_io_request()
138 * 1) Address range is contained completely in the port address range in acpi_hw_validate_io_request()
139 * 2) Address range overlaps port range at the port range start in acpi_hw_validate_io_request()
140 * 3) Address range overlaps port range at the port range end in acpi_hw_validate_io_request()
141 * 4) Address range completely encompasses the port range in acpi_hw_validate_io_request()
143 if ((address <= port_info->end) in acpi_hw_validate_io_request()
144 && (last_address >= port_info->start)) { in acpi_hw_validate_io_request()
148 if (port_info->osi_dependency == ACPI_ALWAYS_ILLEGAL || in acpi_hw_validate_io_request()
149 acpi_gbl_osi_data == port_info->osi_dependency) { in acpi_hw_validate_io_request()
151 "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)\n", in acpi_hw_validate_io_request()
152 ACPI_FORMAT_UINT64(address), in acpi_hw_validate_io_request()
153 byte_width, port_info->name, in acpi_hw_validate_io_request()
154 port_info->start, in acpi_hw_validate_io_request()
155 port_info->end)); in acpi_hw_validate_io_request()
161 /* Finished if address range ends before the end of this port */ in acpi_hw_validate_io_request()
163 if (last_address <= port_info->end) { in acpi_hw_validate_io_request()
175 * PARAMETERS: Address Address of I/O port/register to read
177 * Width Number of bits
181 * DESCRIPTION: Read data from an I/O port or register. This is a front-end
183 * address and the length.
187 acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width) in acpi_hw_read_port() argument
193 /* Truncate address to 16 bits if requested */ in acpi_hw_read_port()
196 address &= ACPI_UINT16_MAX; in acpi_hw_read_port()
201 status = acpi_hw_validate_io_request(address, width); in acpi_hw_read_port()
203 status = acpi_os_read_port(address, value, width); in acpi_hw_read_port()
216 for (i = 0, *value = 0; i < width; i += 8) { in acpi_hw_read_port()
220 if (acpi_hw_validate_io_request(address, 8) == AE_OK) { in acpi_hw_read_port()
221 status = acpi_os_read_port(address, &one_byte, 8); in acpi_hw_read_port()
229 address++; in acpi_hw_read_port()
239 * PARAMETERS: Address Address of I/O port/register to write
241 * Width Number of bits
245 * DESCRIPTION: Write data to an I/O port or register. This is a front-end
247 * address and the length.
251 acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width) in acpi_hw_write_port() argument
256 /* Truncate address to 16 bits if requested */ in acpi_hw_write_port()
259 address &= ACPI_UINT16_MAX; in acpi_hw_write_port()
264 status = acpi_hw_validate_io_request(address, width); in acpi_hw_write_port()
266 status = acpi_os_write_port(address, value, width); in acpi_hw_write_port()
279 for (i = 0; i < width; i += 8) { in acpi_hw_write_port()
283 if (acpi_hw_validate_io_request(address, 8) == AE_OK) { in acpi_hw_write_port()
285 acpi_os_write_port(address, (value >> i) & 0xFF, 8); in acpi_hw_write_port()
291 address++; in acpi_hw_write_port()
301 * PARAMETERS: Address Address of I/O port/register blobk
311 acpi_status acpi_hw_validate_io_block(u64 address, u32 bit_width, u32 count) in acpi_hw_validate_io_block() argument
315 while (count--) { in acpi_hw_validate_io_block()
316 status = acpi_hw_validate_io_request((acpi_io_address)address, in acpi_hw_validate_io_block()
321 address += ACPI_DIV_8(bit_width); in acpi_hw_validate_io_block()