]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/disk/ahci.c (grub_ahci_pciinit): Detect ATAPI devices.
authorVladimir Serbinenko <phcoder@gmail.com>
Sun, 3 Nov 2013 12:52:36 +0000 (13:52 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Sun, 3 Nov 2013 12:52:36 +0000 (13:52 +0100)
* grub-core/disk/ata.c (grub_ata_identify): Use atapi_identify if
device is known to be ATAPI.

ChangeLog
grub-core/disk/ahci.c
grub-core/disk/ata.c

index a6c135e2f90d4aba7de310b59197a04529d1f972..738ecefcc84f35797c0c40c19467b224df628a06 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-11-03  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/disk/ahci.c (grub_ahci_pciinit): Detect ATAPI devices.
+       * grub-core/disk/ata.c (grub_ata_identify): Use atapi_identify if
+       device is known to be ATAPI.
+
 2013-11-03  Mike Frysinger <vapier>
 
        * configure.ac: Don't add target-prefix.
index 0f57856628c777939002d689563b00d75705794a..0b13fb8ebeddfe99299755355c63c76f11f6f3a1 100644 (file)
@@ -133,6 +133,7 @@ struct grub_ahci_device
   volatile struct grub_ahci_cmd_table *command_table;
   struct grub_pci_dma_chunk *rfis;
   int present;
+  int atapi;
 };
 
 static grub_err_t 
@@ -616,6 +617,10 @@ grub_ahci_pciinit (grub_pci_device_t dev,
        grub_dma_free (failed_adevs[i]->rfis);
       }
 
+  for (i = 0; i < nports; i++)
+    if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].sig >> 16) == 0xeb14)
+      adevs[i]->atapi = 1;
+
   for (i = 0; i < nports; i++)
     if (adevs[i])
       {
@@ -1075,6 +1080,7 @@ grub_ahci_open (int id, int devnum, struct grub_ata *ata)
 
   ata->data = dev;
   ata->dma = 1;
+  ata->atapi = dev->atapi;
   ata->maxbuffer = GRUB_AHCI_PRDT_MAX_CHUNK_LENGTH;
   ata->present = &dev->present;
 
index a79519cc7dac34be87c53b27ef1ec5f9156ba8ff..2b988490ff7194441916c326b568ddfaf5d5e5f3 100644 (file)
@@ -108,6 +108,9 @@ grub_ata_identify (struct grub_ata *dev)
   grub_uint16_t *info16;
   grub_err_t err;
 
+  if (dev->atapi)
+    return grub_atapi_identify (dev);
+
   info64 = grub_malloc (GRUB_DISK_SECTOR_SIZE);
   info32 = (grub_uint32_t *) info64;
   info16 = (grub_uint16_t *) info64;
@@ -129,7 +132,7 @@ grub_ata_identify (struct grub_ata *dev)
       grub_free (info16);
       grub_errno = GRUB_ERR_NONE;
       if ((sts & (GRUB_ATA_STATUS_BUSY | GRUB_ATA_STATUS_DRQ
-         | GRUB_ATA_STATUS_ERR)) == GRUB_ATA_STATUS_ERR
+                  | GRUB_ATA_STATUS_ERR)) == GRUB_ATA_STATUS_ERR
          && (parms.taskfile.error & 0x04 /* ABRT */))
        /* Device without ATA IDENTIFY, try ATAPI.  */
        return grub_atapi_identify (dev);
@@ -363,7 +366,7 @@ grub_ata_real_open (int id, int bus)
   struct grub_ata *ata;
   grub_ata_dev_t p;
 
-  ata = grub_malloc (sizeof (*ata));
+  ata = grub_zalloc (sizeof (*ata));
   if (!ata)
     return NULL;
   for (p = grub_ata_dev_list; p; p = p->next)