hwvalid.c revision 1.1.1.2.4.2 1 1.1.1.2.4.2 rmind
2 1.1.1.2.4.2 rmind /******************************************************************************
3 1.1.1.2.4.2 rmind *
4 1.1.1.2.4.2 rmind * Module Name: hwvalid - I/O request validation
5 1.1.1.2.4.2 rmind *
6 1.1.1.2.4.2 rmind *****************************************************************************/
7 1.1.1.2.4.2 rmind
8 1.1.1.2.4.2 rmind /*
9 1.1.1.2.4.2 rmind * Copyright (C) 2000 - 2011, Intel Corp.
10 1.1.1.2.4.2 rmind * All rights reserved.
11 1.1.1.2.4.2 rmind *
12 1.1.1.2.4.2 rmind * Redistribution and use in source and binary forms, with or without
13 1.1.1.2.4.2 rmind * modification, are permitted provided that the following conditions
14 1.1.1.2.4.2 rmind * are met:
15 1.1.1.2.4.2 rmind * 1. Redistributions of source code must retain the above copyright
16 1.1.1.2.4.2 rmind * notice, this list of conditions, and the following disclaimer,
17 1.1.1.2.4.2 rmind * without modification.
18 1.1.1.2.4.2 rmind * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 1.1.1.2.4.2 rmind * substantially similar to the "NO WARRANTY" disclaimer below
20 1.1.1.2.4.2 rmind * ("Disclaimer") and any redistribution must be conditioned upon
21 1.1.1.2.4.2 rmind * including a substantially similar Disclaimer requirement for further
22 1.1.1.2.4.2 rmind * binary redistribution.
23 1.1.1.2.4.2 rmind * 3. Neither the names of the above-listed copyright holders nor the names
24 1.1.1.2.4.2 rmind * of any contributors may be used to endorse or promote products derived
25 1.1.1.2.4.2 rmind * from this software without specific prior written permission.
26 1.1.1.2.4.2 rmind *
27 1.1.1.2.4.2 rmind * Alternatively, this software may be distributed under the terms of the
28 1.1.1.2.4.2 rmind * GNU General Public License ("GPL") version 2 as published by the Free
29 1.1.1.2.4.2 rmind * Software Foundation.
30 1.1.1.2.4.2 rmind *
31 1.1.1.2.4.2 rmind * NO WARRANTY
32 1.1.1.2.4.2 rmind * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 1.1.1.2.4.2 rmind * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 1.1.1.2.4.2 rmind * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 1.1.1.2.4.2 rmind * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 1.1.1.2.4.2 rmind * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 1.1.1.2.4.2 rmind * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 1.1.1.2.4.2 rmind * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 1.1.1.2.4.2 rmind * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 1.1.1.2.4.2 rmind * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 1.1.1.2.4.2 rmind * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 1.1.1.2.4.2 rmind * POSSIBILITY OF SUCH DAMAGES.
43 1.1.1.2.4.2 rmind */
44 1.1.1.2.4.2 rmind
45 1.1.1.2.4.2 rmind #define __HWVALID_C__
46 1.1.1.2.4.2 rmind
47 1.1.1.2.4.2 rmind #include "acpi.h"
48 1.1.1.2.4.2 rmind #include "accommon.h"
49 1.1.1.2.4.2 rmind
50 1.1.1.2.4.2 rmind #define _COMPONENT ACPI_HARDWARE
51 1.1.1.2.4.2 rmind ACPI_MODULE_NAME ("hwvalid")
52 1.1.1.2.4.2 rmind
53 1.1.1.2.4.2 rmind /* Local prototypes */
54 1.1.1.2.4.2 rmind
55 1.1.1.2.4.2 rmind static ACPI_STATUS
56 1.1.1.2.4.2 rmind AcpiHwValidateIoRequest (
57 1.1.1.2.4.2 rmind ACPI_IO_ADDRESS Address,
58 1.1.1.2.4.2 rmind UINT32 BitWidth);
59 1.1.1.2.4.2 rmind
60 1.1.1.2.4.2 rmind
61 1.1.1.2.4.2 rmind /*
62 1.1.1.2.4.2 rmind * Protected I/O ports. Some ports are always illegal, and some are
63 1.1.1.2.4.2 rmind * conditionally illegal. This table must remain ordered by port address.
64 1.1.1.2.4.2 rmind *
65 1.1.1.2.4.2 rmind * The table is used to implement the Microsoft port access rules that
66 1.1.1.2.4.2 rmind * first appeared in Windows XP. Some ports are always illegal, and some
67 1.1.1.2.4.2 rmind * ports are only illegal if the BIOS calls _OSI with a WinXP string or
68 1.1.1.2.4.2 rmind * later (meaning that the BIOS itelf is post-XP.)
69 1.1.1.2.4.2 rmind *
70 1.1.1.2.4.2 rmind * This provides ACPICA with the desired port protections and
71 1.1.1.2.4.2 rmind * Microsoft compatibility.
72 1.1.1.2.4.2 rmind *
73 1.1.1.2.4.2 rmind * Description of port entries:
74 1.1.1.2.4.2 rmind * DMA: DMA controller
75 1.1.1.2.4.2 rmind * PIC0: Programmable Interrupt Controller (8259A)
76 1.1.1.2.4.2 rmind * PIT1: System Timer 1
77 1.1.1.2.4.2 rmind * PIT2: System Timer 2 failsafe
78 1.1.1.2.4.2 rmind * RTC: Real-time clock
79 1.1.1.2.4.2 rmind * CMOS: Extended CMOS
80 1.1.1.2.4.2 rmind * DMA1: DMA 1 page registers
81 1.1.1.2.4.2 rmind * DMA1L: DMA 1 Ch 0 low page
82 1.1.1.2.4.2 rmind * DMA2: DMA 2 page registers
83 1.1.1.2.4.2 rmind * DMA2L: DMA 2 low page refresh
84 1.1.1.2.4.2 rmind * ARBC: Arbitration control
85 1.1.1.2.4.2 rmind * SETUP: Reserved system board setup
86 1.1.1.2.4.2 rmind * POS: POS channel select
87 1.1.1.2.4.2 rmind * PIC1: Cascaded PIC
88 1.1.1.2.4.2 rmind * IDMA: ISA DMA
89 1.1.1.2.4.2 rmind * ELCR: PIC edge/level registers
90 1.1.1.2.4.2 rmind * PCI: PCI configuration space
91 1.1.1.2.4.2 rmind */
92 1.1.1.2.4.2 rmind static const ACPI_PORT_INFO AcpiProtectedPorts[] =
93 1.1.1.2.4.2 rmind {
94 1.1.1.2.4.2 rmind {"DMA", 0x0000, 0x000F, ACPI_OSI_WIN_XP},
95 1.1.1.2.4.2 rmind {"PIC0", 0x0020, 0x0021, ACPI_ALWAYS_ILLEGAL},
96 1.1.1.2.4.2 rmind {"PIT1", 0x0040, 0x0043, ACPI_OSI_WIN_XP},
97 1.1.1.2.4.2 rmind {"PIT2", 0x0048, 0x004B, ACPI_OSI_WIN_XP},
98 1.1.1.2.4.2 rmind {"RTC", 0x0070, 0x0071, ACPI_OSI_WIN_XP},
99 1.1.1.2.4.2 rmind {"CMOS", 0x0074, 0x0076, ACPI_OSI_WIN_XP},
100 1.1.1.2.4.2 rmind {"DMA1", 0x0081, 0x0083, ACPI_OSI_WIN_XP},
101 1.1.1.2.4.2 rmind {"DMA1L", 0x0087, 0x0087, ACPI_OSI_WIN_XP},
102 1.1.1.2.4.2 rmind {"DMA2", 0x0089, 0x008B, ACPI_OSI_WIN_XP},
103 1.1.1.2.4.2 rmind {"DMA2L", 0x008F, 0x008F, ACPI_OSI_WIN_XP},
104 1.1.1.2.4.2 rmind {"ARBC", 0x0090, 0x0091, ACPI_OSI_WIN_XP},
105 1.1.1.2.4.2 rmind {"SETUP", 0x0093, 0x0094, ACPI_OSI_WIN_XP},
106 1.1.1.2.4.2 rmind {"POS", 0x0096, 0x0097, ACPI_OSI_WIN_XP},
107 1.1.1.2.4.2 rmind {"PIC1", 0x00A0, 0x00A1, ACPI_ALWAYS_ILLEGAL},
108 1.1.1.2.4.2 rmind {"IDMA", 0x00C0, 0x00DF, ACPI_OSI_WIN_XP},
109 1.1.1.2.4.2 rmind {"ELCR", 0x04D0, 0x04D1, ACPI_ALWAYS_ILLEGAL},
110 1.1.1.2.4.2 rmind {"PCI", 0x0CF8, 0x0CFF, ACPI_OSI_WIN_XP}
111 1.1.1.2.4.2 rmind };
112 1.1.1.2.4.2 rmind
113 1.1.1.2.4.2 rmind #define ACPI_PORT_INFO_ENTRIES ACPI_ARRAY_LENGTH (AcpiProtectedPorts)
114 1.1.1.2.4.2 rmind
115 1.1.1.2.4.2 rmind
116 1.1.1.2.4.2 rmind /******************************************************************************
117 1.1.1.2.4.2 rmind *
118 1.1.1.2.4.2 rmind * FUNCTION: AcpiHwValidateIoRequest
119 1.1.1.2.4.2 rmind *
120 1.1.1.2.4.2 rmind * PARAMETERS: Address Address of I/O port/register
121 1.1.1.2.4.2 rmind * BitWidth Number of bits (8,16,32)
122 1.1.1.2.4.2 rmind *
123 1.1.1.2.4.2 rmind * RETURN: Status
124 1.1.1.2.4.2 rmind *
125 1.1.1.2.4.2 rmind * DESCRIPTION: Validates an I/O request (address/length). Certain ports are
126 1.1.1.2.4.2 rmind * always illegal and some ports are only illegal depending on
127 1.1.1.2.4.2 rmind * the requests the BIOS AML code makes to the predefined
128 1.1.1.2.4.2 rmind * _OSI method.
129 1.1.1.2.4.2 rmind *
130 1.1.1.2.4.2 rmind ******************************************************************************/
131 1.1.1.2.4.2 rmind
132 1.1.1.2.4.2 rmind static ACPI_STATUS
133 1.1.1.2.4.2 rmind AcpiHwValidateIoRequest (
134 1.1.1.2.4.2 rmind ACPI_IO_ADDRESS Address,
135 1.1.1.2.4.2 rmind UINT32 BitWidth)
136 1.1.1.2.4.2 rmind {
137 1.1.1.2.4.2 rmind UINT32 i;
138 1.1.1.2.4.2 rmind UINT32 ByteWidth;
139 1.1.1.2.4.2 rmind ACPI_IO_ADDRESS LastAddress;
140 1.1.1.2.4.2 rmind const ACPI_PORT_INFO *PortInfo;
141 1.1.1.2.4.2 rmind
142 1.1.1.2.4.2 rmind
143 1.1.1.2.4.2 rmind ACPI_FUNCTION_TRACE (HwValidateIoRequest);
144 1.1.1.2.4.2 rmind
145 1.1.1.2.4.2 rmind
146 1.1.1.2.4.2 rmind /* Supported widths are 8/16/32 */
147 1.1.1.2.4.2 rmind
148 1.1.1.2.4.2 rmind if ((BitWidth != 8) &&
149 1.1.1.2.4.2 rmind (BitWidth != 16) &&
150 1.1.1.2.4.2 rmind (BitWidth != 32))
151 1.1.1.2.4.2 rmind {
152 1.1.1.2.4.2 rmind return (AE_BAD_PARAMETER);
153 1.1.1.2.4.2 rmind }
154 1.1.1.2.4.2 rmind
155 1.1.1.2.4.2 rmind PortInfo = AcpiProtectedPorts;
156 1.1.1.2.4.2 rmind ByteWidth = ACPI_DIV_8 (BitWidth);
157 1.1.1.2.4.2 rmind LastAddress = Address + ByteWidth - 1;
158 1.1.1.2.4.2 rmind
159 1.1.1.2.4.2 rmind ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Address %p LastAddress %p Length %X",
160 1.1.1.2.4.2 rmind ACPI_CAST_PTR (void, Address), ACPI_CAST_PTR (void, LastAddress),
161 1.1.1.2.4.2 rmind ByteWidth));
162 1.1.1.2.4.2 rmind
163 1.1.1.2.4.2 rmind /* Maximum 16-bit address in I/O space */
164 1.1.1.2.4.2 rmind
165 1.1.1.2.4.2 rmind if (LastAddress > ACPI_UINT16_MAX)
166 1.1.1.2.4.2 rmind {
167 1.1.1.2.4.2 rmind ACPI_ERROR ((AE_INFO,
168 1.1.1.2.4.2 rmind "Illegal I/O port address/length above 64K: %p/0x%X",
169 1.1.1.2.4.2 rmind ACPI_CAST_PTR (void, Address), ByteWidth));
170 1.1.1.2.4.2 rmind return_ACPI_STATUS (AE_LIMIT);
171 1.1.1.2.4.2 rmind }
172 1.1.1.2.4.2 rmind
173 1.1.1.2.4.2 rmind /* Exit if requested address is not within the protected port table */
174 1.1.1.2.4.2 rmind
175 1.1.1.2.4.2 rmind if (Address > AcpiProtectedPorts[ACPI_PORT_INFO_ENTRIES - 1].End)
176 1.1.1.2.4.2 rmind {
177 1.1.1.2.4.2 rmind return_ACPI_STATUS (AE_OK);
178 1.1.1.2.4.2 rmind }
179 1.1.1.2.4.2 rmind
180 1.1.1.2.4.2 rmind /* Check request against the list of protected I/O ports */
181 1.1.1.2.4.2 rmind
182 1.1.1.2.4.2 rmind for (i = 0; i < ACPI_PORT_INFO_ENTRIES; i++, PortInfo++)
183 1.1.1.2.4.2 rmind {
184 1.1.1.2.4.2 rmind /*
185 1.1.1.2.4.2 rmind * Check if the requested address range will write to a reserved
186 1.1.1.2.4.2 rmind * port. Four cases to consider:
187 1.1.1.2.4.2 rmind *
188 1.1.1.2.4.2 rmind * 1) Address range is contained completely in the port address range
189 1.1.1.2.4.2 rmind * 2) Address range overlaps port range at the port range start
190 1.1.1.2.4.2 rmind * 3) Address range overlaps port range at the port range end
191 1.1.1.2.4.2 rmind * 4) Address range completely encompasses the port range
192 1.1.1.2.4.2 rmind */
193 1.1.1.2.4.2 rmind if ((Address <= PortInfo->End) && (LastAddress >= PortInfo->Start))
194 1.1.1.2.4.2 rmind {
195 1.1.1.2.4.2 rmind /* Port illegality may depend on the _OSI calls made by the BIOS */
196 1.1.1.2.4.2 rmind
197 1.1.1.2.4.2 rmind if (AcpiGbl_OsiData >= PortInfo->OsiDependency)
198 1.1.1.2.4.2 rmind {
199 1.1.1.2.4.2 rmind ACPI_DEBUG_PRINT ((ACPI_DB_IO,
200 1.1.1.2.4.2 rmind "Denied AML access to port 0x%p/%X (%s 0x%.4X-0x%.4X)",
201 1.1.1.2.4.2 rmind ACPI_CAST_PTR (void, Address), ByteWidth, PortInfo->Name,
202 1.1.1.2.4.2 rmind PortInfo->Start, PortInfo->End));
203 1.1.1.2.4.2 rmind
204 1.1.1.2.4.2 rmind return_ACPI_STATUS (AE_AML_ILLEGAL_ADDRESS);
205 1.1.1.2.4.2 rmind }
206 1.1.1.2.4.2 rmind }
207 1.1.1.2.4.2 rmind
208 1.1.1.2.4.2 rmind /* Finished if address range ends before the end of this port */
209 1.1.1.2.4.2 rmind
210 1.1.1.2.4.2 rmind if (LastAddress <= PortInfo->End)
211 1.1.1.2.4.2 rmind {
212 1.1.1.2.4.2 rmind break;
213 1.1.1.2.4.2 rmind }
214 1.1.1.2.4.2 rmind }
215 1.1.1.2.4.2 rmind
216 1.1.1.2.4.2 rmind return_ACPI_STATUS (AE_OK);
217 1.1.1.2.4.2 rmind }
218 1.1.1.2.4.2 rmind
219 1.1.1.2.4.2 rmind
220 1.1.1.2.4.2 rmind /******************************************************************************
221 1.1.1.2.4.2 rmind *
222 1.1.1.2.4.2 rmind * FUNCTION: AcpiHwReadPort
223 1.1.1.2.4.2 rmind *
224 1.1.1.2.4.2 rmind * PARAMETERS: Address Address of I/O port/register to read
225 1.1.1.2.4.2 rmind * Value Where value is placed
226 1.1.1.2.4.2 rmind * Width Number of bits
227 1.1.1.2.4.2 rmind *
228 1.1.1.2.4.2 rmind * RETURN: Status and value read from port
229 1.1.1.2.4.2 rmind *
230 1.1.1.2.4.2 rmind * DESCRIPTION: Read data from an I/O port or register. This is a front-end
231 1.1.1.2.4.2 rmind * to AcpiOsReadPort that performs validation on both the port
232 1.1.1.2.4.2 rmind * address and the length.
233 1.1.1.2.4.2 rmind *
234 1.1.1.2.4.2 rmind *****************************************************************************/
235 1.1.1.2.4.2 rmind
236 1.1.1.2.4.2 rmind ACPI_STATUS
237 1.1.1.2.4.2 rmind AcpiHwReadPort (
238 1.1.1.2.4.2 rmind ACPI_IO_ADDRESS Address,
239 1.1.1.2.4.2 rmind UINT32 *Value,
240 1.1.1.2.4.2 rmind UINT32 Width)
241 1.1.1.2.4.2 rmind {
242 1.1.1.2.4.2 rmind ACPI_STATUS Status;
243 1.1.1.2.4.2 rmind UINT32 OneByte;
244 1.1.1.2.4.2 rmind UINT32 i;
245 1.1.1.2.4.2 rmind
246 1.1.1.2.4.2 rmind
247 1.1.1.2.4.2 rmind /* Truncate address to 16 bits if requested */
248 1.1.1.2.4.2 rmind
249 1.1.1.2.4.2 rmind if (AcpiGbl_TruncateIoAddresses)
250 1.1.1.2.4.2 rmind {
251 1.1.1.2.4.2 rmind Address &= ACPI_UINT16_MAX;
252 1.1.1.2.4.2 rmind }
253 1.1.1.2.4.2 rmind
254 1.1.1.2.4.2 rmind /* Validate the entire request and perform the I/O */
255 1.1.1.2.4.2 rmind
256 1.1.1.2.4.2 rmind Status = AcpiHwValidateIoRequest (Address, Width);
257 1.1.1.2.4.2 rmind if (ACPI_SUCCESS (Status))
258 1.1.1.2.4.2 rmind {
259 1.1.1.2.4.2 rmind Status = AcpiOsReadPort (Address, Value, Width);
260 1.1.1.2.4.2 rmind return (Status);
261 1.1.1.2.4.2 rmind }
262 1.1.1.2.4.2 rmind
263 1.1.1.2.4.2 rmind if (Status != AE_AML_ILLEGAL_ADDRESS)
264 1.1.1.2.4.2 rmind {
265 1.1.1.2.4.2 rmind return (Status);
266 1.1.1.2.4.2 rmind }
267 1.1.1.2.4.2 rmind
268 1.1.1.2.4.2 rmind /*
269 1.1.1.2.4.2 rmind * There has been a protection violation within the request. Fall
270 1.1.1.2.4.2 rmind * back to byte granularity port I/O and ignore the failing bytes.
271 1.1.1.2.4.2 rmind * This provides Windows compatibility.
272 1.1.1.2.4.2 rmind */
273 1.1.1.2.4.2 rmind for (i = 0, *Value = 0; i < Width; i += 8)
274 1.1.1.2.4.2 rmind {
275 1.1.1.2.4.2 rmind /* Validate and read one byte */
276 1.1.1.2.4.2 rmind
277 1.1.1.2.4.2 rmind if (AcpiHwValidateIoRequest (Address, 8) == AE_OK)
278 1.1.1.2.4.2 rmind {
279 1.1.1.2.4.2 rmind Status = AcpiOsReadPort (Address, &OneByte, 8);
280 1.1.1.2.4.2 rmind if (ACPI_FAILURE (Status))
281 1.1.1.2.4.2 rmind {
282 1.1.1.2.4.2 rmind return (Status);
283 1.1.1.2.4.2 rmind }
284 1.1.1.2.4.2 rmind
285 1.1.1.2.4.2 rmind *Value |= (OneByte << i);
286 1.1.1.2.4.2 rmind }
287 1.1.1.2.4.2 rmind
288 1.1.1.2.4.2 rmind Address++;
289 1.1.1.2.4.2 rmind }
290 1.1.1.2.4.2 rmind
291 1.1.1.2.4.2 rmind return (AE_OK);
292 1.1.1.2.4.2 rmind }
293 1.1.1.2.4.2 rmind
294 1.1.1.2.4.2 rmind
295 1.1.1.2.4.2 rmind /******************************************************************************
296 1.1.1.2.4.2 rmind *
297 1.1.1.2.4.2 rmind * FUNCTION: AcpiHwWritePort
298 1.1.1.2.4.2 rmind *
299 1.1.1.2.4.2 rmind * PARAMETERS: Address Address of I/O port/register to write
300 1.1.1.2.4.2 rmind * Value Value to write
301 1.1.1.2.4.2 rmind * Width Number of bits
302 1.1.1.2.4.2 rmind *
303 1.1.1.2.4.2 rmind * RETURN: Status
304 1.1.1.2.4.2 rmind *
305 1.1.1.2.4.2 rmind * DESCRIPTION: Write data to an I/O port or register. This is a front-end
306 1.1.1.2.4.2 rmind * to AcpiOsWritePort that performs validation on both the port
307 1.1.1.2.4.2 rmind * address and the length.
308 1.1.1.2.4.2 rmind *
309 1.1.1.2.4.2 rmind *****************************************************************************/
310 1.1.1.2.4.2 rmind
311 1.1.1.2.4.2 rmind ACPI_STATUS
312 1.1.1.2.4.2 rmind AcpiHwWritePort (
313 1.1.1.2.4.2 rmind ACPI_IO_ADDRESS Address,
314 1.1.1.2.4.2 rmind UINT32 Value,
315 1.1.1.2.4.2 rmind UINT32 Width)
316 1.1.1.2.4.2 rmind {
317 1.1.1.2.4.2 rmind ACPI_STATUS Status;
318 1.1.1.2.4.2 rmind UINT32 i;
319 1.1.1.2.4.2 rmind
320 1.1.1.2.4.2 rmind
321 1.1.1.2.4.2 rmind /* Truncate address to 16 bits if requested */
322 1.1.1.2.4.2 rmind
323 1.1.1.2.4.2 rmind if (AcpiGbl_TruncateIoAddresses)
324 1.1.1.2.4.2 rmind {
325 1.1.1.2.4.2 rmind Address &= ACPI_UINT16_MAX;
326 1.1.1.2.4.2 rmind }
327 1.1.1.2.4.2 rmind
328 1.1.1.2.4.2 rmind /* Validate the entire request and perform the I/O */
329 1.1.1.2.4.2 rmind
330 1.1.1.2.4.2 rmind Status = AcpiHwValidateIoRequest (Address, Width);
331 1.1.1.2.4.2 rmind if (ACPI_SUCCESS (Status))
332 1.1.1.2.4.2 rmind {
333 1.1.1.2.4.2 rmind Status = AcpiOsWritePort (Address, Value, Width);
334 1.1.1.2.4.2 rmind return (Status);
335 1.1.1.2.4.2 rmind }
336 1.1.1.2.4.2 rmind
337 1.1.1.2.4.2 rmind if (Status != AE_AML_ILLEGAL_ADDRESS)
338 1.1.1.2.4.2 rmind {
339 1.1.1.2.4.2 rmind return (Status);
340 1.1.1.2.4.2 rmind }
341 1.1.1.2.4.2 rmind
342 1.1.1.2.4.2 rmind /*
343 1.1.1.2.4.2 rmind * There has been a protection violation within the request. Fall
344 1.1.1.2.4.2 rmind * back to byte granularity port I/O and ignore the failing bytes.
345 1.1.1.2.4.2 rmind * This provides Windows compatibility.
346 1.1.1.2.4.2 rmind */
347 1.1.1.2.4.2 rmind for (i = 0; i < Width; i += 8)
348 1.1.1.2.4.2 rmind {
349 1.1.1.2.4.2 rmind /* Validate and write one byte */
350 1.1.1.2.4.2 rmind
351 1.1.1.2.4.2 rmind if (AcpiHwValidateIoRequest (Address, 8) == AE_OK)
352 1.1.1.2.4.2 rmind {
353 1.1.1.2.4.2 rmind Status = AcpiOsWritePort (Address, (Value >> i) & 0xFF, 8);
354 1.1.1.2.4.2 rmind if (ACPI_FAILURE (Status))
355 1.1.1.2.4.2 rmind {
356 1.1.1.2.4.2 rmind return (Status);
357 1.1.1.2.4.2 rmind }
358 1.1.1.2.4.2 rmind }
359 1.1.1.2.4.2 rmind
360 1.1.1.2.4.2 rmind Address++;
361 1.1.1.2.4.2 rmind }
362 1.1.1.2.4.2 rmind
363 1.1.1.2.4.2 rmind return (AE_OK);
364 1.1.1.2.4.2 rmind }
365 1.1.1.2.4.2 rmind
366 1.1.1.2.4.2 rmind
367