| 1 |
qemu: bios: pci hotplug support (Marcelo Tosatti)
|
| 2 |
|
| 3 |
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
|
| 4 |
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
|
| 5 |
|
| 6 |
Index: bochs/bios/acpi-dsdt.dsl
|
| 7 |
===================================================================
|
| 8 |
--- bochs.orig/bios/acpi-dsdt.dsl
|
| 9 |
+++ bochs/bios/acpi-dsdt.dsl
|
| 10 |
@@ -91,6 +91,61 @@ DefinitionBlock (
|
| 11 |
prt_slot3(0x001f),
|
| 12 |
})
|
| 13 |
|
| 14 |
+ OperationRegion(PCST, SystemIO, 0xae00, 0x08)
|
| 15 |
+ Field (PCST, DWordAcc, NoLock, WriteAsZeros)
|
| 16 |
+ {
|
| 17 |
+ PCIU, 32,
|
| 18 |
+ PCID, 32,
|
| 19 |
+ }
|
| 20 |
+
|
| 21 |
+ OperationRegion(SEJ, SystemIO, 0xae08, 0x04)
|
| 22 |
+ Field (SEJ, DWordAcc, NoLock, WriteAsZeros)
|
| 23 |
+ {
|
| 24 |
+ B0EJ, 32,
|
| 25 |
+ }
|
| 26 |
+
|
| 27 |
+#define hotplug_slot(name, nr) \
|
| 28 |
+ Device (S##name) { \
|
| 29 |
+ Name (_ADR, nr##0000) \
|
| 30 |
+ Method (_EJ0,1) { \
|
| 31 |
+ Store(ShiftLeft(1, nr), B0EJ) \
|
| 32 |
+ Return (0x0) \
|
| 33 |
+ } \
|
| 34 |
+ Name (_SUN, name) \
|
| 35 |
+ }
|
| 36 |
+
|
| 37 |
+ hotplug_slot(1, 0x0001)
|
| 38 |
+ hotplug_slot(2, 0x0002)
|
| 39 |
+ hotplug_slot(3, 0x0003)
|
| 40 |
+ hotplug_slot(4, 0x0004)
|
| 41 |
+ hotplug_slot(5, 0x0005)
|
| 42 |
+ hotplug_slot(6, 0x0006)
|
| 43 |
+ hotplug_slot(7, 0x0007)
|
| 44 |
+ hotplug_slot(8, 0x0008)
|
| 45 |
+ hotplug_slot(9, 0x0009)
|
| 46 |
+ hotplug_slot(10, 0x000a)
|
| 47 |
+ hotplug_slot(11, 0x000b)
|
| 48 |
+ hotplug_slot(12, 0x000c)
|
| 49 |
+ hotplug_slot(13, 0x000d)
|
| 50 |
+ hotplug_slot(14, 0x000e)
|
| 51 |
+ hotplug_slot(15, 0x000f)
|
| 52 |
+ hotplug_slot(16, 0x0010)
|
| 53 |
+ hotplug_slot(17, 0x0011)
|
| 54 |
+ hotplug_slot(18, 0x0012)
|
| 55 |
+ hotplug_slot(19, 0x0013)
|
| 56 |
+ hotplug_slot(20, 0x0014)
|
| 57 |
+ hotplug_slot(21, 0x0015)
|
| 58 |
+ hotplug_slot(22, 0x0016)
|
| 59 |
+ hotplug_slot(23, 0x0017)
|
| 60 |
+ hotplug_slot(24, 0x0018)
|
| 61 |
+ hotplug_slot(25, 0x0019)
|
| 62 |
+ hotplug_slot(26, 0x001a)
|
| 63 |
+ hotplug_slot(27, 0x001b)
|
| 64 |
+ hotplug_slot(28, 0x001c)
|
| 65 |
+ hotplug_slot(29, 0x001d)
|
| 66 |
+ hotplug_slot(30, 0x001e)
|
| 67 |
+ hotplug_slot(31, 0x001f)
|
| 68 |
+
|
| 69 |
Name (_CRS, ResourceTemplate ()
|
| 70 |
{
|
| 71 |
WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
|
| 72 |
@@ -605,8 +660,50 @@ DefinitionBlock (
|
| 73 |
Method(_L00) {
|
| 74 |
Return(0x01)
|
| 75 |
}
|
| 76 |
+
|
| 77 |
+#define gen_pci_hotplug(nr) \
|
| 78 |
+ If (And(\_SB.PCI0.PCIU, ShiftLeft(1, nr))) { \
|
| 79 |
+ Notify(\_SB.PCI0.S##nr, 1) \
|
| 80 |
+ } \
|
| 81 |
+ If (And(\_SB.PCI0.PCID, ShiftLeft(1, nr))) { \
|
| 82 |
+ Notify(\_SB.PCI0.S##nr, 3) \
|
| 83 |
+ }
|
| 84 |
+
|
| 85 |
Method(_L01) {
|
| 86 |
- Return(0x01)
|
| 87 |
+ gen_pci_hotplug(1)
|
| 88 |
+ gen_pci_hotplug(2)
|
| 89 |
+ gen_pci_hotplug(3)
|
| 90 |
+ gen_pci_hotplug(4)
|
| 91 |
+ gen_pci_hotplug(5)
|
| 92 |
+ gen_pci_hotplug(6)
|
| 93 |
+ gen_pci_hotplug(7)
|
| 94 |
+ gen_pci_hotplug(8)
|
| 95 |
+ gen_pci_hotplug(9)
|
| 96 |
+ gen_pci_hotplug(10)
|
| 97 |
+ gen_pci_hotplug(11)
|
| 98 |
+ gen_pci_hotplug(12)
|
| 99 |
+ gen_pci_hotplug(13)
|
| 100 |
+ gen_pci_hotplug(14)
|
| 101 |
+ gen_pci_hotplug(15)
|
| 102 |
+ gen_pci_hotplug(16)
|
| 103 |
+ gen_pci_hotplug(17)
|
| 104 |
+ gen_pci_hotplug(18)
|
| 105 |
+ gen_pci_hotplug(19)
|
| 106 |
+ gen_pci_hotplug(20)
|
| 107 |
+ gen_pci_hotplug(21)
|
| 108 |
+ gen_pci_hotplug(22)
|
| 109 |
+ gen_pci_hotplug(23)
|
| 110 |
+ gen_pci_hotplug(24)
|
| 111 |
+ gen_pci_hotplug(25)
|
| 112 |
+ gen_pci_hotplug(26)
|
| 113 |
+ gen_pci_hotplug(27)
|
| 114 |
+ gen_pci_hotplug(28)
|
| 115 |
+ gen_pci_hotplug(29)
|
| 116 |
+ gen_pci_hotplug(30)
|
| 117 |
+ gen_pci_hotplug(31)
|
| 118 |
+
|
| 119 |
+ Return (0x01)
|
| 120 |
+
|
| 121 |
}
|
| 122 |
Method(_L02) {
|
| 123 |
Return(0x01)
|
| 124 |
|
| 125 |
--
|
| 126 |
|
| 127 |
|
| 128 |
|