1    /*
2     * Some or all of this work - Copyright (c) 2006 - 2021, Intel Corp.
3     * All rights reserved.
4     *
5     * Redistribution and use in source and binary forms, with or without modification,
6     * are permitted provided that the following conditions are met:
7     *
8     * Redistributions of source code must retain the above copyright notice,
9     * this list of conditions and the following disclaimer.
10     * Redistributions in binary form must reproduce the above copyright notice,
11     * this list of conditions and the following disclaimer in the documentation
12     * and/or other materials provided with the distribution.
13     * Neither the name of Intel Corporation nor the names of its contributors
14     * may be used to endorse or promote products derived from this software
15     * without specific prior written permission.
16     *
17     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19     * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20     * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21     * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22     * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23     * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25     * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27     */
28    /*
29     * Resource Descriptor macros
30     *
31     * IO Resource Descriptor Macro
32     */
33    Name (P408, Package (0x03)
34    {
35        ResourceTemplate ()
36        {
37            IO (Decode10,
38                0xF0F1,             // Range Minimum
39                0xF2F3,             // Range Maximum
40                0xF4,               // Alignment
41                0xF5,               // Length
42                )
43        },
44
45        ResourceTemplate ()
46        {
47            IO (Decode16,
48                0xF0F1,             // Range Minimum
49                0xF2F3,             // Range Maximum
50                0xF4,               // Alignment
51                0xF5,               // Length
52                )
53        },
54
55        ResourceTemplate ()
56        {
57            IO (Decode16,
58                0x0000,             // Range Minimum
59                0x0000,             // Range Maximum
60                0x00,               // Alignment
61                0x00,               // Length
62                )
63        }
64    })
65    /*
66     ACPI Specification, Revision 3.0, September 2, 2004
67     6.4.2.5   I/O Port Descriptor
68     I/O Port Descriptor layout:
69     Byte 0 (Tag Bits): Value = 01000111B (0x47) (Type = 0, Small item name = 0x8, Length = 7)
70     Byte 1 (Information): 0000000dB
71     Bits[7:1] 	Reserved and must be 0
72     Bit[0] 	 	(_DEC)
73     1	The logical device decodes 16-bit addresses
74     0	The logical device only decodes address bits[9:0]
75     Byte 2 (Range minimum base address, _MIN bits[7:0])
76     Byte 3 (Range minimum base address, _MIN bits[15:8])
77     Byte 4 (Range maximum base address, _MAX bits[7:0])
78     Byte 5 (Range maximum base address, _MAX bits[15:8])
79     Byte 6 (Base alignment, _ALN): Alignment for minimum base address,
80     increment in 1-byte blocks.
81     Byte 7 (Range length, _LEN): The number of contiguous I/O ports requested.
82     */
83    Name (P409, Package (0x03)
84    {
85        ResourceTemplate ()
86        {
87            IO (Decode10,
88                0xF0F1,             // Range Minimum
89                0xF2F3,             // Range Maximum
90                0xF4,               // Alignment
91                0xF5,               // Length
92                )
93        },
94
95        ResourceTemplate ()
96        {
97            IO (Decode16,
98                0xF0F1,             // Range Minimum
99                0xF2F3,             // Range Maximum
100                0xF4,               // Alignment
101                0xF5,               // Length
102                )
103        },
104
105        ResourceTemplate ()
106        {
107            IO (Decode16,
108                0x0000,             // Range Minimum
109                0x0000,             // Range Maximum
110                0x00,               // Alignment
111                0x00,               // Length
112                )
113        }
114    })
115    Method (RT05, 0, Serialized)
116    {
117        /* Emit test header, set the filename */
118
119        THDR (__METHOD__, "IO Resource Descriptor Macro", "io.asl")
120        /* Main test case for packages above */
121
122        M330 (__METHOD__, 0x03, "p408", P408, P409)
123        /* Check resource descriptor tag offsets */
124
125        Local0 = ResourceTemplate ()
126            {
127                IO (Decode16,
128                    0xF0F1,             // Range Minimum
129                    0xF2F3,             // Range Maximum
130                    0xF4,               // Alignment
131                    0xF5,               // Length
132                    )
133                IO (Decode16,
134                    0xF0F1,             // Range Minimum
135                    0xF2F3,             // Range Maximum
136                    0xF4,               // Alignment
137                    0xF5,               // Length
138                    )
139            }
140        M331 (__METHOD__, 0x01, 0x08, 0x08, 0x48, 0x48, "_DEC")
141        M331 (__METHOD__, 0x02, 0x10, 0x10, 0x50, 0x50, "_MIN")
142        M331 (__METHOD__, 0x03, 0x20, 0x20, 0x60, 0x60, "_MAX")
143        M331 (__METHOD__, 0x04, 0x30, 0x30, 0x70, 0x70, "_ALN")
144        M331 (__METHOD__, 0x05, 0x38, 0x38, 0x78, 0x78, "_LEN")
145    }
146