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     * Memory32Fixed() Memory Resource Descriptor Macro
32     */
33    Name (P414, Package (0x03)
34    {
35        ResourceTemplate ()
36        {
37            Memory32Fixed (ReadOnly,
38                0xF0F1F2F3,         // Address Base
39                0xF4F5F6F7,         // Address Length
40                )
41        },
42
43        ResourceTemplate ()
44        {
45            Memory32Fixed (ReadWrite,
46                0xF0F1F2F3,         // Address Base
47                0xF4F5F6F7,         // Address Length
48                )
49        },
50
51        ResourceTemplate ()
52        {
53            Memory32Fixed (ReadWrite,
54                0x00000000,         // Address Base
55                0x00000000,         // Address Length
56                )
57        }
58    })
59    /*
60     ACPI Specification, Revision 3.0, September 2, 2004
61     6.4.3.4   32-Bit Fixed Memory Range Descriptor
62     32-Bit Fixed Memory Range Descriptor layout:
63     Byte 0 (Tag Bits): Value = 10000110B (0x86) (Type = 1, Large item name = 6)
64     Byte 1 (Length, bits[7:0]): Value = 00001001B (9)
65     Byte 2 (Length, bits[15:8]): Value = 00000000B (0)
66     Byte 3 (Information):
67     Bit[7:1]	Ignored
68     Bit[0]		Write status, _RW
69     1	writeable (read/write)
70     0	non-writeable (read-only)
71     Byte 4 (Range base address, _BAS, bits[7:0])
72     Byte 5 (Range base address, _BAS, bits[15:8])
73     Byte 6 (Range base address, _BAS, bits[23:16])
74     Byte 7 (Range base address, _BAS, bits[31:24])
75     Byte 8 (Range length, _LEN bits[7:0])
76     Byte 9 (Range length, _LEN, bits[15:8])
77     Byte 10 (Range length, _LEN, bits[23:16])
78     Byte 11 (Range length, _LEN, bits[31:24])
79     */
80    Name (P415, Package (0x03)
81    {
82        ResourceTemplate ()
83        {
84            Memory32Fixed (ReadOnly,
85                0xF0F1F2F3,         // Address Base
86                0xF4F5F6F7,         // Address Length
87                )
88        },
89
90        ResourceTemplate ()
91        {
92            Memory32Fixed (ReadWrite,
93                0xF0F1F2F3,         // Address Base
94                0xF4F5F6F7,         // Address Length
95                )
96        },
97
98        ResourceTemplate ()
99        {
100            Memory32Fixed (ReadWrite,
101                0x00000000,         // Address Base
102                0x00000000,         // Address Length
103                )
104        }
105    })
106    Method (RT0B, 0, Serialized)
107    {
108        /* Emit test header, set the filename */
109
110        THDR (__METHOD__, "Memory32Fixed Resource Descriptor Macro", "memory32fixed.asl")
111        /* Main test case for packages above */
112
113        M330 (__METHOD__, 0x03, "p414", P414, P415)
114        /* Check resource descriptor tag offsets */
115
116        Local0 = ResourceTemplate ()
117            {
118                Memory32Fixed (ReadOnly,
119                    0xF0F1F2F3,         // Address Base
120                    0xF4F5F6F7,         // Address Length
121                    )
122                Memory32Fixed (ReadOnly,
123                    0xF0F1F2F3,         // Address Base
124                    0xF4F5F6F7,         // Address Length
125                    )
126            }
127        M331 (__METHOD__, 0x01, 0x18, 0x18, 0x78, 0x78, "_RW")
128        M331 (__METHOD__, 0x02, 0x20, 0x20, 0x80, 0x80, "_BAS")
129        M331 (__METHOD__, 0x03, 0x40, 0x40, 0xA0, 0xA0, "_LEN")
130    }
131