All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ide_ioport_read: Return lower octet of data register instead of 0xFF
@ 2022-05-20 23:52 Lev Kujawski
  2022-05-24  9:52 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Lev Kujawski @ 2022-05-20 23:52 UTC (permalink / raw)
  To: qemu-trivial
  Cc: Lev Kujawski, John Snow, open list:IDE, open list:All patches CC here

Prior to this patch, the pre-GRUB Solaris x86 bootloader would fail to
load on QEMU with the following screen output:

SunOS Secondary Boot version 3.00

prom_panic: Could not mount filesystem.
Entering boot debugger:
[136419]: _

This occurs because the bootloader issues an ATA IDENTIFY DEVICE
command, and then reads the resulting 256 words of parameter
information using inb rather than the correct inw. As the previous
behavior of QEMU was to return 0xFF and not advance the drive's sector
buffer, DRQ would never be cleared and the bootloader would be blocked
from selecting a secondary ATA device, such as an optical drive.

Resolves:
* [Bug 1639394] Unable to boot Solaris 8/9 x86 under Fedora 24

Signed-off-by: Lev Kujawski <lkujaw@member.fsf.org>
---
 hw/ide/core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/ide/core.c b/hw/ide/core.c
index 3a5afff5d7..c2caa54285 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2166,7 +2166,11 @@ uint32_t ide_ioport_read(void *opaque, uint32_t addr)
     hob = bus->cmd & (IDE_CTRL_HOB);
     switch (reg_num) {
     case ATA_IOPORT_RR_DATA:
-        ret = 0xff;
+        /*
+         * The pre-GRUB Solaris x86 bootloader relies upon inb
+         * consuming a word from the drive's sector buffer.
+         */
+        ret = ide_data_readw(bus, addr) & 0xff;
         break;
     case ATA_IOPORT_RR_ERROR:
         if ((!bus->ifs[0].blk && !bus->ifs[1].blk) ||
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ide_ioport_read: Return lower octet of data register instead of 0xFF
  2022-05-20 23:52 [PATCH] ide_ioport_read: Return lower octet of data register instead of 0xFF Lev Kujawski
@ 2022-05-24  9:52 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2022-05-24  9:52 UTC (permalink / raw)
  To: Lev Kujawski
  Cc: qemu-trivial, John Snow, open list : IDE,
	open list : All patches CC here

Queued, thanks.  The same change needs to be done in hw/ide/macio.c:

diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index f08318cf97..1c15c37ec5 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -267,7 +267,9 @@ static uint64_t pmac_ide_read(void *opaque, hwaddr addr, unsigned size)

     switch (reg) {
     case 0x0:
-        if (size == 2) {
+        if (size == 1) {
+            retval = ide_data_readw(&d->bus, 0) & 0xFF;
+        } else if (size == 2) {
             retval = ide_data_readw(&d->bus, 0);
         } else if (size == 4) {
             retval = ide_data_readl(&d->bus, 0);

while (unintentionally) hw/ide/mmio.c already works fine.

Paolo




^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-24  9:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-20 23:52 [PATCH] ide_ioport_read: Return lower octet of data register instead of 0xFF Lev Kujawski
2022-05-24  9:52 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.