[SeaBIOS] [SeaBIOS PATCH 2/2] hotplug: Add device per func in ACPI DSDT tables

Amos Kong akong at redhat.com
Mon Sep 19 09:27:38 CEST 2011


Only func 0 is registered to guest driver (we can
only found func 0 in slot->funcs list of driver),
the other functions could not be cleaned when
hot-removing the whole slot. This patch adds
device per function in ACPI DSDT tables.

Have tested with linux/winxp/win7, hot-adding/hot-remving,
single/multiple function device, they are all fine.

new acpi-dst.hex(332K):
http://amos-kong.rhcloud.com/pub/acpi-dsdt.hex

Signed-off-by: Amos Kong <akong at redhat.com>
---
 src/acpi-dsdt.dsl |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl
index 08412e2..d1426ec 100644
--- a/src/acpi-dsdt.dsl
+++ b/src/acpi-dsdt.dsl
@@ -128,9 +128,9 @@ DefinitionBlock (
                 PCRM, 32,
             }
 
-#define hotplug_slot(name, nr) \
-            Device (S##name) {                    \
-               Name (_ADR, nr##0000)              \
+#define hotplug_func(name, nr, adr, fn) \
+            Device (S##name##fn) {                \
+               Name (_ADR, adr)                    \
                Method (_EJ0,1) {                  \
                     Store(ShiftLeft(1, nr), B0EJ) \
                     Return (0x0)                  \
@@ -138,6 +138,16 @@ DefinitionBlock (
                Name (_SUN, name)                  \
             }
 
+#define hotplug_slot(name, nr) \
+	    hotplug_func(name, nr, nr##0000, 0)  \
+	    hotplug_func(name, nr, nr##0001, 1)  \
+	    hotplug_func(name, nr, nr##0002, 2)  \
+	    hotplug_func(name, nr, nr##0003, 3)  \
+	    hotplug_func(name, nr, nr##0004, 4)  \
+	    hotplug_func(name, nr, nr##0005, 5)  \
+	    hotplug_func(name, nr, nr##0006, 6)  \
+	    hotplug_func(name, nr, nr##0007, 7)
+
 	    hotplug_slot(1, 0x0001)
 	    hotplug_slot(2, 0x0002)
 	    hotplug_slot(3, 0x0003)
@@ -842,13 +852,22 @@ DefinitionBlock (
             Return(0x01)
         }
 
-#define gen_pci_hotplug(nr)                                       \
+#define gen_pci_hotplug_func(nr, fn)                              \
             If (And(\_SB.PCI0.PCIU, ShiftLeft(1, nr))) {          \
-                Notify(\_SB.PCI0.S##nr, 1)                        \
+                Notify(\_SB.PCI0.S##nr##fn, 1)                    \
             }                                                     \
             If (And(\_SB.PCI0.PCID, ShiftLeft(1, nr))) {          \
-                Notify(\_SB.PCI0.S##nr, 3)                        \
+                Notify(\_SB.PCI0.S##nr##fn, 3)                    \
             }
+#define gen_pci_hotplug(nr) \
+	    gen_pci_hotplug_func(nr, 0)    \
+	    gen_pci_hotplug_func(nr, 1)    \
+	    gen_pci_hotplug_func(nr, 2)    \
+	    gen_pci_hotplug_func(nr, 3)    \
+	    gen_pci_hotplug_func(nr, 4)    \
+	    gen_pci_hotplug_func(nr, 5)    \
+	    gen_pci_hotplug_func(nr, 6)    \
+	    gen_pci_hotplug_func(nr, 7)
 
         Method(_L01) {
             gen_pci_hotplug(1)
-- 
1.7.6.1



More information about the SeaBIOS mailing list