acpi: add ssdt for pci hotplug
[seabios.git] / src / ssdt-pcihp.dsl
1 ACPI_EXTRACT_ALL_CODE ssdp_pcihp_aml
2
3 DefinitionBlock ("ssdt-pcihp.aml", "SSDT", 0x01, "BXPC", "BXSSDTPCIHP", 0x1)
4 {
5
6 /****************************************************************
7  * PCI hotplug
8  ****************************************************************/
9
10     /* Objects supplied by DSDT */
11     External (\_SB.PCI0, DeviceObj)
12     External (\_SB.PCI0.PRMV, MethodObj)
13     External (\_SB.PCI0.PCEJ, MethodObj)
14
15     Scope(\_SB.PCI0) {
16
17 #define gen_pci_device(slot)                                    \
18         Device(SL##slot) {                                      \
19             Name (_ADR, 0x##slot##0000)                         \
20             Method (_RMV) { Return (PRMV(0x##slot)) }           \
21             Name (_SUN, 0x##slot)                               \
22         }
23
24         /* VGA (slot 1) and ISA bus (slot 2) defined in DSDT */
25         gen_pci_device(03)
26         gen_pci_device(04)
27         gen_pci_device(05)
28         gen_pci_device(06)
29         gen_pci_device(07)
30         gen_pci_device(08)
31         gen_pci_device(09)
32         gen_pci_device(0a)
33         gen_pci_device(0b)
34         gen_pci_device(0c)
35         gen_pci_device(0d)
36         gen_pci_device(0e)
37         gen_pci_device(0f)
38         gen_pci_device(10)
39         gen_pci_device(11)
40         gen_pci_device(12)
41         gen_pci_device(13)
42         gen_pci_device(14)
43         gen_pci_device(15)
44         gen_pci_device(16)
45         gen_pci_device(17)
46         gen_pci_device(18)
47         gen_pci_device(19)
48         gen_pci_device(1a)
49         gen_pci_device(1b)
50         gen_pci_device(1c)
51         gen_pci_device(1d)
52         gen_pci_device(1e)
53         gen_pci_device(1f)
54
55         /* Bulk generated PCI hotplug devices */
56 #define hotplug_slot(slot)                              \
57         Device (S##slot) {                              \
58            Name (_ADR, 0x##slot##0000)                  \
59            Method (_EJ0, 1) { Return(PCEJ(0x##slot)) }  \
60            Name (_SUN, 0x##slot)                        \
61         }
62
63         hotplug_slot(01)
64         hotplug_slot(02)
65         hotplug_slot(03)
66         hotplug_slot(04)
67         hotplug_slot(05)
68         hotplug_slot(06)
69         hotplug_slot(07)
70         hotplug_slot(08)
71         hotplug_slot(09)
72         hotplug_slot(0a)
73         hotplug_slot(0b)
74         hotplug_slot(0c)
75         hotplug_slot(0d)
76         hotplug_slot(0e)
77         hotplug_slot(0f)
78         hotplug_slot(10)
79         hotplug_slot(11)
80         hotplug_slot(12)
81         hotplug_slot(13)
82         hotplug_slot(14)
83         hotplug_slot(15)
84         hotplug_slot(16)
85         hotplug_slot(17)
86         hotplug_slot(18)
87         hotplug_slot(19)
88         hotplug_slot(1a)
89         hotplug_slot(1b)
90         hotplug_slot(1c)
91         hotplug_slot(1d)
92         hotplug_slot(1e)
93         hotplug_slot(1f)
94
95 #define gen_pci_hotplug(slot)   \
96             If (LEqual(Arg0, 0x##slot)) { Notify(S##slot, Arg1) }
97
98         Method(PCNT, 2) {
99             gen_pci_hotplug(01)
100             gen_pci_hotplug(02)
101             gen_pci_hotplug(03)
102             gen_pci_hotplug(04)
103             gen_pci_hotplug(05)
104             gen_pci_hotplug(06)
105             gen_pci_hotplug(07)
106             gen_pci_hotplug(08)
107             gen_pci_hotplug(09)
108             gen_pci_hotplug(0a)
109             gen_pci_hotplug(0b)
110             gen_pci_hotplug(0c)
111             gen_pci_hotplug(0d)
112             gen_pci_hotplug(0e)
113             gen_pci_hotplug(0f)
114             gen_pci_hotplug(10)
115             gen_pci_hotplug(11)
116             gen_pci_hotplug(12)
117             gen_pci_hotplug(13)
118             gen_pci_hotplug(14)
119             gen_pci_hotplug(15)
120             gen_pci_hotplug(16)
121             gen_pci_hotplug(17)
122             gen_pci_hotplug(18)
123             gen_pci_hotplug(19)
124             gen_pci_hotplug(1a)
125             gen_pci_hotplug(1b)
126             gen_pci_hotplug(1c)
127             gen_pci_hotplug(1d)
128             gen_pci_hotplug(1e)
129             gen_pci_hotplug(1f)
130         }
131     }
132 }