qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ben Taylor <sol10x86@cox.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] hw/ide.c patch
Date: Fri, 28 Apr 2006 14:51:39 -0400	[thread overview]
Message-ID: <11427537.1146250299116.JavaMail.root@eastrmwml05.mgt.cox.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 205 bytes --]


With this patch, I can boot and install Solaris Express from a local DVD drive.

Previously, the DVD would boot, but halfway through the questions,
it would come up and tell me it wasn't Solaris DVD.

Ben

[-- Attachment #2: solaris-ide-patch.diff --]
[-- Type: text/x-patch, Size: 3760 bytes --]

diff -ruN qemu/hw/ide.c qemu-solaris/hw/ide.c
--- qemu/hw/ide.c	2006-04-25 17:24:22.000000000 -0400
+++ qemu-solaris/hw/ide.c	2006-04-28 13:30:05.601548000 -0400
@@ -391,6 +391,10 @@
 } PCIIDEState;
 
 static void ide_dma_start(IDEState *s, IDEDMAFunc *dma_cb);
+static int ide_atapi_cmd_read_dma_cb(IDEState *s,
+                                     target_phys_addr_t phys_addr,
+                                     int transfer_size1);
+
 
 static void padstr(char *str, const char *src, int len)
 {
@@ -513,10 +517,10 @@
     padstr((uint8_t *)(p + 23), QEMU_VERSION, 8); /* firmware version */
     padstr((uint8_t *)(p + 27), "QEMU CD-ROM", 40); /* model */
     put_le16(p + 48, 1); /* dword I/O (XXX: should not be set on CDROM) */
-    put_le16(p + 49, 1 << 9); /* LBA supported, no DMA */
-    put_le16(p + 53, 3); /* words 64-70, 54-58 valid */
-    put_le16(p + 63, 0x103); /* DMA modes XXX: may be incorrect */
-    put_le16(p + 64, 1); /* PIO modes */
+    put_le16(p + 49, 1 << 8 | 1 << 9); /* DMA and LBA supported */
+    put_le16(p + 53, 7); /* words 64-70, 54-58, 88 valid */
+    put_le16(p + 63, 0x07 | 0x4 << 8); /* Multiword DMA supported/selected */
+    put_le16(p + 64, 0x03); /* PIO modes 3,4 supported */
     put_le16(p + 65, 0xb4); /* minimum DMA multiword tx cycle time */
     put_le16(p + 66, 0xb4); /* recommended DMA multiword tx cycle time */
     put_le16(p + 67, 0x12c); /* minimum PIO cycle time without flow control */
@@ -994,8 +998,14 @@
     s->elementary_transfer_size = 0;
     s->io_buffer_index = 0;
 
-    s->status = READY_STAT;
-    ide_atapi_cmd_reply_end(s);
+    if (s->atapi_dma) {
+        s->status = READY_STAT | DRQ_STAT;
+        ide_dma_start(s, ide_atapi_cmd_read_dma_cb);
+    } else {
+        s->status = READY_STAT;
+        ide_atapi_cmd_reply_end(s);
+    }
+    
 }
 
 /* start a CD-CDROM read command */
@@ -1026,14 +1036,19 @@
 #endif
         if (s->packet_transfer_size <= 0)
             break;
-        len = s->cd_sector_size - s->io_buffer_index;
-        if (len <= 0) {
-            /* transfert next data */
-            cd_read_sector(s->bs, s->lba, s->io_buffer, s->cd_sector_size);
-            s->lba++;
-            s->io_buffer_index = 0;
-            len = s->cd_sector_size;
+        if (s->lba == -1)
+            len = s->packet_transfer_size;
+        else {
+            len = s->cd_sector_size - s->io_buffer_index;
+            if (len <= 0) {
+                /* transfert next data */
+                cd_read_sector(s->bs, s->lba, s->io_buffer, s->cd_sector_size);
+                s->lba++;
+                s->io_buffer_index = 0;
+                len = s->cd_sector_size;
+            }
         }
+
         if (len > transfer_size)
             len = transfer_size;
         cpu_physical_memory_write(phys_addr, 
@@ -2488,6 +2503,11 @@
               cmd646_set_irq, d, 1);
 }
 
+// PCI 0x04: command(word), 0x06(word): status
+#define PCI_COMMAND_IOACCESS                0x0001
+#define PCI_COMMAND_MEMACCESS               0x0002
+#define PCI_COMMAND_BUSMASTER               0x0004
+
 /* hd_table must contain 4 block drivers */
 /* NOTE: for the PIIX3, the IRQs and IOports are hardcoded */
 void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table)
@@ -2507,7 +2527,9 @@
     pci_conf[0x01] = 0x80;
     pci_conf[0x02] = 0x10;
     pci_conf[0x03] = 0x70;
-    pci_conf[0x09] = 0x80; // legacy ATA mode
+    pci_conf[0x04] = PCI_COMMAND_IOACCESS | PCI_COMMAND_MEMACCESS \
+        | PCI_COMMAND_BUSMASTER;
+    pci_conf[0x09] = 0x8a; // programming interface = PCI_IDE bus master is supported
     pci_conf[0x0a] = 0x01; // class_sub = PCI_IDE
     pci_conf[0x0b] = 0x01; // class_base = PCI_mass_storage
     pci_conf[0x0e] = 0x00; // header_type

             reply	other threads:[~2006-04-28 18:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-28 18:51 Ben Taylor [this message]
2006-04-28 18:53 ` [Qemu-devel] hw/ide.c patch Hetz Ben Hamo
  -- strict thread matches above, loose matches on Subject: below --
2006-04-28 20:30 Ben Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11427537.1146250299116.JavaMail.root@eastrmwml05.mgt.cox.net \
    --to=sol10x86@cox.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).