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