Skip to contentSkip to conversation

DSDT: add floppy-related objects

PATCH In review Denis V. Lunev 5 participants 14 messages Dec 14, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 DSDT: add floppy-related objects

From: Roman Kagan <[email protected]>

On x86-based systems Linux determines the presence and the type of floppy drives via a query of a CMOS field. So does SeaBIOS when populating the return data for int 0x13 function 0x08.

Windows doesn't; instead, it requests this information from BIOS via int 0x13/0x08 or through ACPI objects _FDE (Floppy Drive Enumerate) and _FDI (Floppy Drive Information). On UEFI systems only ACPI-based detection is supported.

QEMU used not to provide those objects in its DSDT; as a result floppy drives were invisible to Windows on UEFI/OVMF.

This patch implements those objects in ASL, making the ACPI interpreter query the CMOS field and populate the objects. The data values used for _FDI (which, per ACPI spec, is supposed to be equivalent to BIOS int 0x13/0x08) are taken from SeaBIOS.

CC Michael S. Tsirkin <[email protected]>
CC Igor Mammedov <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Richard Henderson <[email protected]>
CC Eduardo Habkost <[email protected]>
---
 hw/i386/acpi-dsdt-isa.dsl | 109 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 109 insertions(+)
hw/i386/acpi-dsdt-isa.dsl +109 -0
index 89caa16..8b03e2b 100644
@@ -23,6 +23,8 @@ Scope(\_SB.PCI0.ISA) {
             IRQNoFlags() { 8 }
             IO(Decode16, 0x0072, 0x0072, 0x02, 0x06)
         })
+
+        OperationRegion(CMS0,  SystemCMOS,  Zero,  0x40)
     }
 
     Device(KBD) {
@@ -63,6 +65,113 @@ Scope(\_SB.PCI0.ISA) {
             IRQNoFlags() { 6 }
             DMA(Compatibility, NotBusMaster, Transfer8) { 2 }
         })
+
+        Field(^RTC.CMS0, ByteAcc, NoLock, Preserve) {
+            Offset(0x10),
+            FDTS, 8
+        }
+
+        Method(FDTY, 1, NotSerialized) {
+            If (LEqual(Arg0, 0x00)) {
+                Return (And(ShiftRight(FDTS, 0x04), 0x0F))
+            } ElseIf (LEqual(Arg0, 0x01)) {
+                Return (And(FDTS, 0x0F))
+            } Else {
+                Return (0x00)
+            }
+        }
+
+        Method(_FDE, 0, NotSerialized) {
+            Store(Buffer(0x14) {}, Local0)
+            CreateDWordField(Local0, 0x00, FDAE)
+            CreateDWordField(Local0, 0x04, FDBE)
+            CreateDWordField(Local0, 0x10, TAPE)
+
+            If (LNotEqual(FDTY(0x00), 0)) {
+                Store(0x01, FDAE)
+            }
+            If (LNotEqual(FDTY(0x01), 0)) {
+                Store(0x01, FDBE)
+            }
+            Store(0x02, TAPE)
+
+            Return (Local0)
+        }
+
+        Method(FSTA, 1, NotSerialized) {
+            If (LEqual(FDTY(Arg0), 0x00)) {
+                Return (0x00)
+            } Else {
+                Return (0x0F)
+            }
+        }
+
+        Method(XFDI, 1, NotSerialized) {
+            Store(FDTY(Arg0), Local0)
+
+            Store(Package (0x10) {
+                    0x00,  // Drive Number
+                    0x00,  // Device Type
+                    0x00,  // Maximum Cylinder Number
+                    0x00,  // Maximum Sector Number
+                    0x00,  // Maximum Head Number
+                    /* SeaBIOS uses the below values regardless of the drive
+                     * type, so shall we */
+                    0xAF,  // disk_specify_1
+                    0x02,  // disk_specify_2
+                    0x25,  // disk_motor_wait
+                    0x02,  // disk_sector_siz
+                    0x12,  // disk_eot
+                    0x1B,  // disk_rw_gap
+                    0xFF,  // disk_dtl
+                    0x6C,  // disk_formt_gap
+                    0xF6,  // disk_fill
+                    0x0F,  // disk_head_sttl
+                    0x08,  // disk_motor_strt
+                }, Local1)
+
+            Store(Arg0, Index(Local1, 0x00))
+            Store(Local0, Index(Local1, 0x01))
+
+            If (LEqual(Local0, 4)) {
+                /* 1.44 Mb 3"5 drive */
+                Store(0x4F, Index(Local1, 0x02))
+                Store(0x12, Index(Local1, 0x03))
+                Store(0x01, Index(Local1, 0x04))
+            } ElseIf (LEqual(Local0, 5)) {
+                /* 2.88 Mb 3"5 drive */
+                Store(0x4F, Index(Local1, 0x02))
+                Store(0x24, Index(Local1, 0x03))
+                Store(0x01, Index(Local1, 0x04))
+            } ElseIf (LEqual(Local0, 2)) {
+                /* 1.2 Mb 5"5 drive */
+                Store(0x4F, Index(Local1, 0x02))
+                Store(0x0F, Index(Local1, 0x03))
+                Store(0x01, Index(Local1, 0x04))
+            }
+
+            Return (Local1)
+        }
+
+        Device(FLPA) {
+            Name(_ADR, 0x00)
+            Method(_STA, 0, NotSerialized) {
+                Return (FSTA(_ADR))
+            }
+            Method(_FDI, 0, NotSerialized) {
+                Return (XFDI(_ADR))
+            }
+        }
+
+        Device(FLPB) {
+            Name(_ADR, 0x01)
+            Method(_STA, 0, NotSerialized) {
+                Return (FSTA(_ADR))
+            }
+            Method(_FDI, 0, NotSerialized) {
+                Return (XFDI(_ADR))
+            }
+        }
     }
 
     Device(LPT) {
Signature · 1 line
2.1.4
#1 lore raw
Quoted 19 lines · Denis V. Lunev

From: Roman Kagan <[email protected]>

On x86-based systems Linux determines the presence and the type of floppy drives via a query of a CMOS field. So does SeaBIOS when populating the return data for int 0x13 function 0x08.

Windows doesn't; instead, it requests this information from BIOS via int 0x13/0x08 or through ACPI objects _FDE (Floppy Drive Enumerate) and _FDI (Floppy Drive Information). On UEFI systems only ACPI-based detection is supported.

QEMU used not to provide those objects in its DSDT; as a result floppy drives were invisible to Windows on UEFI/OVMF.

This patch implements those objects in ASL, making the ACPI interpreter query the CMOS field and populate the objects. The data values used for _FDI (which, per ACPI spec, is supposed to be equivalent to BIOS int 0x13/0x08) are taken from SeaBIOS.

Quoted 7 lines
CC Michael S. Tsirkin <[email protected]>
CC Igor Mammedov <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Richard Henderson <[email protected]>
CC Eduardo Habkost <[email protected]>

This is not a regression, so I'm inclined not to merge this for 2.5. Pls correct me if I'm wrong.

Quoted 133 lines
---
 hw/i386/acpi-dsdt-isa.dsl | 109 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 109 insertions(+)
hw/i386/acpi-dsdt-isa.dsl +109 -0
index 89caa16..8b03e2b 100644
@@ -23,6 +23,8 @@ Scope(\_SB.PCI0.ISA) {
             IRQNoFlags() { 8 }
             IO(Decode16, 0x0072, 0x0072, 0x02, 0x06)
         })
+
+        OperationRegion(CMS0,  SystemCMOS,  Zero,  0x40)
     }
 
     Device(KBD) {
@@ -63,6 +65,113 @@ Scope(\_SB.PCI0.ISA) {
             IRQNoFlags() { 6 }
             DMA(Compatibility, NotBusMaster, Transfer8) { 2 }
         })
+
+        Field(^RTC.CMS0, ByteAcc, NoLock, Preserve) {
+            Offset(0x10),
+            FDTS, 8
+        }
+
+        Method(FDTY, 1, NotSerialized) {
+            If (LEqual(Arg0, 0x00)) {
+                Return (And(ShiftRight(FDTS, 0x04), 0x0F))
+            } ElseIf (LEqual(Arg0, 0x01)) {
+                Return (And(FDTS, 0x0F))
+            } Else {
+                Return (0x00)
+            }
+        }
+
+        Method(_FDE, 0, NotSerialized) {
+            Store(Buffer(0x14) {}, Local0)
+            CreateDWordField(Local0, 0x00, FDAE)
+            CreateDWordField(Local0, 0x04, FDBE)
+            CreateDWordField(Local0, 0x10, TAPE)
+
+            If (LNotEqual(FDTY(0x00), 0)) {
+                Store(0x01, FDAE)
+            }
+            If (LNotEqual(FDTY(0x01), 0)) {
+                Store(0x01, FDBE)
+            }
+            Store(0x02, TAPE)
+
+            Return (Local0)
+        }
+
+        Method(FSTA, 1, NotSerialized) {
+            If (LEqual(FDTY(Arg0), 0x00)) {
+                Return (0x00)
+            } Else {
+                Return (0x0F)
+            }
+        }
+
+        Method(XFDI, 1, NotSerialized) {
+            Store(FDTY(Arg0), Local0)
+
+            Store(Package (0x10) {
+                    0x00,  // Drive Number
+                    0x00,  // Device Type
+                    0x00,  // Maximum Cylinder Number
+                    0x00,  // Maximum Sector Number
+                    0x00,  // Maximum Head Number
+                    /* SeaBIOS uses the below values regardless of the drive
+                     * type, so shall we */
+                    0xAF,  // disk_specify_1
+                    0x02,  // disk_specify_2
+                    0x25,  // disk_motor_wait
+                    0x02,  // disk_sector_siz
+                    0x12,  // disk_eot
+                    0x1B,  // disk_rw_gap
+                    0xFF,  // disk_dtl
+                    0x6C,  // disk_formt_gap
+                    0xF6,  // disk_fill
+                    0x0F,  // disk_head_sttl
+                    0x08,  // disk_motor_strt
+                }, Local1)
+
+            Store(Arg0, Index(Local1, 0x00))
+            Store(Local0, Index(Local1, 0x01))
+
+            If (LEqual(Local0, 4)) {
+                /* 1.44 Mb 3"5 drive */
+                Store(0x4F, Index(Local1, 0x02))
+                Store(0x12, Index(Local1, 0x03))
+                Store(0x01, Index(Local1, 0x04))
+            } ElseIf (LEqual(Local0, 5)) {
+                /* 2.88 Mb 3"5 drive */
+                Store(0x4F, Index(Local1, 0x02))
+                Store(0x24, Index(Local1, 0x03))
+                Store(0x01, Index(Local1, 0x04))
+            } ElseIf (LEqual(Local0, 2)) {
+                /* 1.2 Mb 5"5 drive */
+                Store(0x4F, Index(Local1, 0x02))
+                Store(0x0F, Index(Local1, 0x03))
+                Store(0x01, Index(Local1, 0x04))
+            }
+
+            Return (Local1)
+        }
+
+        Device(FLPA) {
+            Name(_ADR, 0x00)
+            Method(_STA, 0, NotSerialized) {
+                Return (FSTA(_ADR))
+            }
+            Method(_FDI, 0, NotSerialized) {
+                Return (XFDI(_ADR))
+            }
+        }
+
+        Device(FLPB) {
+            Name(_ADR, 0x01)
+            Method(_STA, 0, NotSerialized) {
+                Return (FSTA(_ADR))
+            }
+            Method(_FDI, 0, NotSerialized) {
+                Return (XFDI(_ADR))
+            }
+        }
     }
 
     Device(LPT) {
Signature · 1 line
2.1.4
#2 lore raw
Quoted 27 lines · Michael S. Tsirkin
Quoted 19 lines · Denis V. Lunev

From: Roman Kagan <[email protected]>

On x86-based systems Linux determines the presence and the type of floppy drives via a query of a CMOS field. So does SeaBIOS when populating the return data for int 0x13 function 0x08.

Windows doesn't; instead, it requests this information from BIOS via int 0x13/0x08 or through ACPI objects _FDE (Floppy Drive Enumerate) and _FDI (Floppy Drive Information). On UEFI systems only ACPI-based detection is supported.

QEMU used not to provide those objects in its DSDT; as a result floppy drives were invisible to Windows on UEFI/OVMF.

This patch implements those objects in ASL, making the ACPI interpreter query the CMOS field and populate the objects. The data values used for _FDI (which, per ACPI spec, is supposed to be equivalent to BIOS int 0x13/0x08) are taken from SeaBIOS.

Quoted 7 lines
CC Michael S. Tsirkin <[email protected]>
CC Igor Mammedov <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Richard Henderson <[email protected]>
CC Eduardo Habkost <[email protected]>
Quoted 3 lines

This is not a regression, so I'm inclined not to merge this for 2.5. Pls correct me if I'm wrong.

this was a question actually.

Yes, this is not a regression but user observable bug. The floppy is not available in Windows UEFI guests and it is not that easy to get VirtIO drivers in this case installed especially for root disk.

Den

#3 lore raw
Quoted 8 lines · Denis V. Lunev
Quoted 1 line

this was a question actually.

Yes, this is not a regression but user observable bug. The floppy is not available in Windows UEFI guests and it is not that easy to get VirtIO drivers in this case installed especially for root disk.

Isn't a CD enough for everything except Windows XP (EOLed) and 2003 (not supporting UEFI anyway)?

Paolo

#4 lore raw
Quoted 4 lines · Paolo Bonzini
Quoted 2 lines · Denis V. Lunev

this was a question actually.

Quoted 8 lines
Quoted 4 lines

Yes, this is not a regression but user observable bug. The floppy is not available in Windows UEFI guests and it is not that easy to get VirtIO drivers in this case installed especially for root disk.

Isn't a CD enough for everything except Windows XP (EOLed) and 2003 (not supporting UEFI anyway)?

Paolo

The problem comes from unattended installation. As far as we have tried unattended answers file should come on USB flash or on floppy.

In the other case the ISO with Windows distro should be modified. This option we can not afford as we do not control ISO's on the client side :(

Den

#5 lore raw
Quoted 3 lines · Denis V. Lunev

The problem comes from unattended installation. As far as we have tried unattended answers file should come on USB flash or on floppy.

Yes, the answers file cannot use an ISO indeed. But as you said it can be USB mass storage.

In any case, even if this is a bug that we want to add to 2.5.1, it's definitely too late for 2.5---at any time after soft freeze.

Paolo

Quoted 3 lines

In the other case the ISO with Windows distro should be modified. This option we can not afford as we do not control ISO's on the client side :(

#6 lore raw
Quoted 10 lines · Paolo Bonzini
Quoted 3 lines · Denis V. Lunev

The problem comes from unattended installation. As far as we have tried unattended answers file should come on USB flash or on floppy.

Yes, the answers file cannot use an ISO indeed. But as you said it can be USB mass storage.

In any case, even if this is a bug that we want to add to 2.5.1, it's definitely too late for 2.5---at any time after soft freeze.

ok. 2.5.1 would be really great. Thank you for a prompt reply.

Though I have a question about the freeze policy as other people still accepting user-visible bugfixes after a soft freeze.

By the way, any opinion about the patch itself? :)

Den

#7 lore raw
Quoted 8 lines · Denis V. Lunev
Quoted 3 lines

In any case, even if this is a bug that we want to add to 2.5.1, it's definitely too late for 2.5---at any time after soft freeze.

ok. 2.5.1 would be really great. Thank you for a prompt reply.

Though I have a question about the freeze policy as other people still accepting user-visible bugfixes after a soft freeze.

Of course things are up to the individual maintainer but, in general, I think that guest-visible changes should be vetted very carefully after soft freeze.

It depends on the effect of the change. Changing ACPI tables is quite more far reaching than, say, fixing an infinite loop in a device model (which has never been triggered so far, or we would have had a bug reported).

Paolo

#8 lore raw
In reply to Denis V. Lunev
Quoted 32 lines · Denis V. Lunev
Quoted 27 lines · Michael S. Tsirkin
Quoted 19 lines · Denis V. Lunev

From: Roman Kagan <[email protected]>

On x86-based systems Linux determines the presence and the type of floppy drives via a query of a CMOS field. So does SeaBIOS when populating the return data for int 0x13 function 0x08.

Windows doesn't; instead, it requests this information from BIOS via int 0x13/0x08 or through ACPI objects _FDE (Floppy Drive Enumerate) and _FDI (Floppy Drive Information). On UEFI systems only ACPI-based detection is supported.

QEMU used not to provide those objects in its DSDT; as a result floppy drives were invisible to Windows on UEFI/OVMF.

This patch implements those objects in ASL, making the ACPI interpreter query the CMOS field and populate the objects. The data values used for _FDI (which, per ACPI spec, is supposed to be equivalent to BIOS int 0x13/0x08) are taken from SeaBIOS.

Quoted 7 lines
CC Michael S. Tsirkin <[email protected]>
CC Igor Mammedov <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Richard Henderson <[email protected]>
CC Eduardo Habkost <[email protected]>
Quoted 3 lines

This is not a regression, so I'm inclined not to merge this for 2.5. Pls correct me if I'm wrong.

Quoted 8 lines

this was a question actually.

Yes, this is not a regression but user observable bug. The floppy is not available in Windows UEFI guests and it is not that easy to get VirtIO drivers in this case installed especially for root disk.

Den

So it's an important patch but I don't think it's a showstopper for 2.5, and this is too risky to merge without doing another rc. This can go into 2.5.1 perhaps.

Signature · 1 line
MST
#9 lore raw
In reply to Denis V. Lunev
Quoted 11 lines · On Mon, 14 Dec 2015 11:22:39 +0300 "Denis V. Lunev" <[email protected]> wrote:

From: Roman Kagan <[email protected]>

On x86-based systems Linux determines the presence and the type of floppy drives via a query of a CMOS field. So does SeaBIOS when populating the return data for int 0x13 function 0x08.

Windows doesn't; instead, it requests this information from BIOS via int 0x13/0x08 or through ACPI objects _FDE (Floppy Drive Enumerate) and _FDI (Floppy Drive Information). On UEFI systems only ACPI-based detection is supported.

Quoted 7 lines

QEMU used not to provide those objects in its DSDT; as a result floppy drives were invisible to Windows on UEFI/OVMF.

This patch implements those objects in ASL, making the ACPI interpreter query the CMOS field and populate the objects. The data values used for _FDI (which, per ACPI spec, is supposed to be equivalent to BIOS int 0x13/0x08) are taken from SeaBIOS.

We are in process of removing static DSDT (ASL template) and replacing it with dynamically generated one.
So please do not add new ASL to it, instead of it
please redo patch using AML API and it would be better if you do it on top of following series:
"[PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL
templates support"
http://qemu.patchew.org/series/%[email protected]%3E

to avoid touching ASL code and avoid conflicts with API changes Patch also could be simpler if you generate _FDE,_FDI dynamically instead of trying to detect drive presence from guest side.
See below for comments.

Quoted 36 lines
CC Michael S. Tsirkin <[email protected]>
CC Igor Mammedov <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Richard Henderson <[email protected]>
CC Eduardo Habkost <[email protected]>
---
 hw/i386/acpi-dsdt-isa.dsl | 109

++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+)

hw/i386/acpi-dsdt-isa.dsl +8 -0
index 89caa16..8b03e2b 100644
@@ -23,6 +23,8 @@ Scope(\_SB.PCI0.ISA) {
             IRQNoFlags() { 8 }
             IO(Decode16, 0x0072, 0x0072, 0x02, 0x06)
         })
+
+        OperationRegion(CMS0,  SystemCMOS,  Zero,  0x40)
     }
 
     Device(KBD) {
@@ -63,6 +65,113 @@ Scope(\_SB.PCI0.ISA) {
             IRQNoFlags() { 6 }
             DMA(Compatibility, NotBusMaster, Transfer8) { 2 }
         })
+
+        Field(^RTC.CMS0, ByteAcc, NoLock, Preserve) {
+            Offset(0x10),
+            FDTS, 8
+        }
+

hw/i386/acpi-dsdt-isa.dsl Scope(\_SB.PCI0.ISA) { · line 83

Quoted 10 lines
hw/i386/acpi-dsdt-isa.dsl +10 -0
+        Method(FDTY, 1, NotSerialized) {
+            If (LEqual(Arg0, 0x00)) {
+                Return (And(ShiftRight(FDTS, 0x04), 0x0F))
+            } ElseIf (LEqual(Arg0, 0x01)) {
+                Return (And(FDTS, 0x0F))
+            } Else {
+                Return (0x00)
+            }
+        }
+

Assuming you generate AML dynamically, you can drop above hunks altogether since it's generated by QEMU and you can detect floppy drive presence when building static _FDE.

Quoted 6 lines
hw/i386/acpi-dsdt-isa.dsl +6 -0
+        Method(_FDE, 0, NotSerialized) {
+            Store(Buffer(0x14) {}, Local0)
+            CreateDWordField(Local0, 0x00, FDAE)
+            CreateDWordField(Local0, 0x04, FDBE)
+            CreateDWordField(Local0, 0x10, TAPE)
+

hw/i386/acpi-dsdt-isa.dsl Scope(\_SB.PCI0.ISA) { · line 99

Quoted 10 lines
hw/i386/acpi-dsdt-isa.dsl +10 -0
+            If (LNotEqual(FDTY(0x00), 0)) {
+                Store(0x01, FDAE)
+            }
+            If (LNotEqual(FDTY(0x01), 0)) {
+                Store(0x01, FDBE)
+            }
+            Store(0x02, TAPE)
+
+            Return (Local0)
+        }

replace above function with:
uint32_t fde_buf = { fda_present, fdb_present, 0, 0, 0x2}; aml_name_decl("_FDE", aml_buffer(0x14, fde_buf));

hw/i386/acpi-dsdt-isa.dsl Scope(\_SB.PCI0.ISA) { · line 107

Quoted 8 lines
hw/i386/acpi-dsdt-isa.dsl +8 -0
+
+        Method(FSTA, 1, NotSerialized) {
+            If (LEqual(FDTY(Arg0), 0x00)) {
+                Return (0x00)
+            } Else {
+                Return (0x0F)
+            }
+        }

Drop above, it's not needed, since QEMU does all detection

Quoted 37 lines
hw/i386/acpi-dsdt-isa.dsl +11 -0
+
+        Method(XFDI, 1, NotSerialized) {
+            Store(FDTY(Arg0), Local0)
+
+            Store(Package (0x10) {
+                    0x00,  // Drive Number
+                    0x00,  // Device Type
+                    0x00,  // Maximum Cylinder Number
+                    0x00,  // Maximum Sector Number
+                    0x00,  // Maximum Head Number
+                    /* SeaBIOS uses the below values regardless of

the drive

hw/i386/acpi-dsdt-isa.dsl +25 -0
+                     * type, so shall we */
+                    0xAF,  // disk_specify_1
+                    0x02,  // disk_specify_2
+                    0x25,  // disk_motor_wait
+                    0x02,  // disk_sector_siz
+                    0x12,  // disk_eot
+                    0x1B,  // disk_rw_gap
+                    0xFF,  // disk_dtl
+                    0x6C,  // disk_formt_gap
+                    0xF6,  // disk_fill
+                    0x0F,  // disk_head_sttl
+                    0x08,  // disk_motor_strt
+                }, Local1)
+
+            Store(Arg0, Index(Local1, 0x00))
+            Store(Local0, Index(Local1, 0x01))
+
+            If (LEqual(Local0, 4)) {
+                /* 1.44 Mb 3"5 drive */
+                Store(0x4F, Index(Local1, 0x02))
+                Store(0x12, Index(Local1, 0x03))
+                Store(0x01, Index(Local1, 0x04))
+            } ElseIf (LEqual(Local0, 5)) {
+                /* 2.88 Mb 3"5 drive */
+                Store(0x4F, Index(Local1, 0x02))

hw/i386/acpi-dsdt-isa.dsl Scope(\_SB.PCI0.ISA) { · line 153

Quoted 10 lines
hw/i386/acpi-dsdt-isa.dsl +10 -0
+                Store(0x24, Index(Local1, 0x03))
+                Store(0x01, Index(Local1, 0x04))
+            } ElseIf (LEqual(Local0, 2)) {
+                /* 1.2 Mb 5"5 drive */
+                Store(0x4F, Index(Local1, 0x02))
+                Store(0x0F, Index(Local1, 0x03))
+                Store(0x01, Index(Local1, 0x04))
+            }
+
+            Return (Local1)

do the same as with _FDE, the only difference is that instead of buffer place directly encoded package in it, for example look for comment:
/* create S3_ / S4_ / S5_ packages if necessary */

also there is no need to make it function, just put _FDI package for a particular floppy drive right inside of it.

Quoted 11 lines
hw/i386/acpi-dsdt-isa.dsl +11 -0
+        }
+
+        Device(FLPA) {
+            Name(_ADR, 0x00)
+            Method(_STA, 0, NotSerialized) {
+                Return (FSTA(_ADR))
+            }
+            Method(_FDI, 0, NotSerialized) {
+                Return (XFDI(_ADR))
+            }
+        }

hw/i386/acpi-dsdt-isa.dsl Scope(\_SB.PCI0.ISA) { · line 174

Quoted 10 lines
hw/i386/acpi-dsdt-isa.dsl +10 -0
+
+        Device(FLPB) {
+            Name(_ADR, 0x01)
+            Method(_STA, 0, NotSerialized) {
+                Return (FSTA(_ADR))
+            }
+            Method(_FDI, 0, NotSerialized) {
+                Return (XFDI(_ADR))
+            }
+        }

generate a device description only if the corresponding drive is present drop _STA since its assumed that device is present if there isn't _STA object.

Quoted 3 lines
     }
 
     Device(LPT) {
#10 lore raw
Quoted 30 lines · Igor Mammedov
Quoted 11 lines · On Mon, 14 Dec 2015 11:22:39 +0300 "Denis V. Lunev" <[email protected]> wrote:

From: Roman Kagan <[email protected]>

On x86-based systems Linux determines the presence and the type of floppy drives via a query of a CMOS field. So does SeaBIOS when populating the return data for int 0x13 function 0x08.

Windows doesn't; instead, it requests this information from BIOS via int 0x13/0x08 or through ACPI objects _FDE (Floppy Drive Enumerate) and _FDI (Floppy Drive Information). On UEFI systems only ACPI-based detection is supported.

Quoted 7 lines

QEMU used not to provide those objects in its DSDT; as a result floppy drives were invisible to Windows on UEFI/OVMF.

This patch implements those objects in ASL, making the ACPI interpreter query the CMOS field and populate the objects. The data values used for _FDI (which, per ACPI spec, is supposed to be equivalent to BIOS int 0x13/0x08) are taken from SeaBIOS.

We are in process of removing static DSDT (ASL template) and replacing it with dynamically generated one.
So please do not add new ASL to it, instead of it
please redo patch using AML API and it would be better if you do it on top of following series:
"[PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL
templates support"
http://qemu.patchew.org/series/%[email protected]%3E

Quoted 5 lines

to avoid touching ASL code and avoid conflicts with API changes Patch also could be simpler if you generate _FDE,_FDI dynamically instead of trying to detect drive presence from guest side.
See below for comments.

Igor,

do you have any GIT tree we could be based on :) ?

Den

#11 lore raw
Quoted 41 lines · On Mon, 14 Dec 2015 18:11:53 +0300 "Denis V. Lunev" <[email protected]> wrote:
Quoted 30 lines · Igor Mammedov
Quoted 11 lines · On Mon, 14 Dec 2015 11:22:39 +0300 "Denis V. Lunev" <[email protected]> wrote:

From: Roman Kagan <[email protected]>

On x86-based systems Linux determines the presence and the type of floppy drives via a query of a CMOS field. So does SeaBIOS when populating the return data for int 0x13 function 0x08.

Windows doesn't; instead, it requests this information from BIOS via int 0x13/0x08 or through ACPI objects _FDE (Floppy Drive Enumerate) and _FDI (Floppy Drive Information). On UEFI systems only ACPI-based detection is supported.

Quoted 7 lines

QEMU used not to provide those objects in its DSDT; as a result floppy drives were invisible to Windows on UEFI/OVMF.

This patch implements those objects in ASL, making the ACPI interpreter query the CMOS field and populate the objects. The data values used for _FDI (which, per ACPI spec, is supposed to be equivalent to BIOS int 0x13/0x08) are taken from SeaBIOS.

We are in process of removing static DSDT (ASL template) and replacing it with dynamically generated one.
So please do not add new ASL to it, instead of it please redo patch using AML API and it would be better if you do it on top of following series:
"[PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL
templates support"
http://qemu.patchew.org/series/%[email protected]%3E

Quoted 5 lines

to avoid touching ASL code and avoid conflicts with API changes Patch also could be simpler if you generate _FDE,_FDI dynamically instead of trying to detect drive presence from guest side.
See below for comments.

Igor,

do you have any GIT tree we could be based on :) ?

Den

Quoted 7 lines · On Thu, 10 Dec 2015 17:44:30 +0100 Igor Mammedov <[email protected]> wrote:

forgot to mention
git tree for testing is available at:

[email protected]:imammedo/qemu.git drop_ASL_support_v1 or
https://github.com/imammedo/qemu/commits/drop_ASL_support_v1

Quoted 5 lines

and fixed-up series with fixed comments is at:

[email protected]:imammedo/qemu.git drop_ASL_support_wip or
https://github.com/imammedo/qemu/commits/drop_ASL_support_wip

if you have in mind 2.5 stable tree for the patch then it would be better to put stuff in SSDT, that way it could be used for stable and later in 2.6 I could clean it up, when merging DSDT with SSDT. Just make sure to put it in some place that avoids conflicts with above series.
That way you won't depend on huge ACPI refactoring.

#12 lore raw
In reply to Igor Mammedov
Quoted 21 lines · Igor Mammedov
Quoted 11 lines · On Mon, 14 Dec 2015 11:22:39 +0300 "Denis V. Lunev" <[email protected]> wrote:

From: Roman Kagan <[email protected]>

On x86-based systems Linux determines the presence and the type of floppy drives via a query of a CMOS field. So does SeaBIOS when populating the return data for int 0x13 function 0x08.

Windows doesn't; instead, it requests this information from BIOS via int 0x13/0x08 or through ACPI objects _FDE (Floppy Drive Enumerate) and _FDI (Floppy Drive Information). On UEFI systems only ACPI-based detection is supported.

Quoted 7 lines

QEMU used not to provide those objects in its DSDT; as a result floppy drives were invisible to Windows on UEFI/OVMF.

This patch implements those objects in ASL, making the ACPI interpreter query the CMOS field and populate the objects. The data values used for _FDI (which, per ACPI spec, is supposed to be equivalent to BIOS int 0x13/0x08) are taken from SeaBIOS.

Quoted 8 lines

We are in process of removing static DSDT (ASL template) and replacing it with dynamically generated one.
So please do not add new ASL to it, instead of it
please redo patch using AML API and it would be better if you do it on top of following series:
"[PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL
templates support"
http://qemu.patchew.org/series/%[email protected]%3E

Yes we do know about this effort. However we thought of this patch as a bugfix rather than a new feature so we did it against the current tree, to make it easy both to merge in the master and to backport to the branches so that the distros could pick it up in their packages.

Do I get you right that we should better direct this patch to qemu-stable, and cook up a new one on top of your series for master?

Roman.

#13 lore raw
Quoted 31 lines · On Mon, 14 Dec 2015 18:38:03 +0300 Roman Kagan <[email protected]> wrote:
Quoted 21 lines · Igor Mammedov
Quoted 11 lines · On Mon, 14 Dec 2015 11:22:39 +0300 "Denis V. Lunev" <[email protected]> wrote:

From: Roman Kagan <[email protected]>

On x86-based systems Linux determines the presence and the type of floppy drives via a query of a CMOS field. So does SeaBIOS when populating the return data for int 0x13 function 0x08.

Windows doesn't; instead, it requests this information from BIOS via int 0x13/0x08 or through ACPI objects _FDE (Floppy Drive Enumerate) and _FDI (Floppy Drive Information). On UEFI systems only ACPI-based detection is supported.

Quoted 7 lines

QEMU used not to provide those objects in its DSDT; as a result floppy drives were invisible to Windows on UEFI/OVMF.

This patch implements those objects in ASL, making the ACPI interpreter query the CMOS field and populate the objects. The data values used for _FDI (which, per ACPI spec, is supposed to be equivalent to BIOS int 0x13/0x08) are taken from SeaBIOS.

Quoted 8 lines

We are in process of removing static DSDT (ASL template) and replacing it with dynamically generated one.
So please do not add new ASL to it, instead of it please redo patch using AML API and it would be better if you do it on top of following series:
"[PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL
templates support"
http://qemu.patchew.org/series/%[email protected]%3E

Quoted 8 lines

Yes we do know about this effort. However we thought of this patch as a bugfix rather than a new feature so we did it against the current tree, to make it easy both to merge in the master and to backport to the branches so that the distros could pick it up in their packages.

Do I get you right that we should better direct this patch to qemu-stable, and cook up a new one on top of your series for master?

You can do just single patch for both trees without dependency on above series, just put new AML into SSDT as described in comments.

Quoted 2 lines

Roman.