* 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.
This commit is contained in:
Vladimir Serbinenko 2013-11-03 13:52:36 +01:00
parent ee7fb780c8
commit a1dcc2cb98
3 changed files with 17 additions and 2 deletions

View file

@ -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> 2013-11-03 Mike Frysinger <vapier>
* configure.ac: Don't add target-prefix. * configure.ac: Don't add target-prefix.

View file

@ -133,6 +133,7 @@ struct grub_ahci_device
volatile struct grub_ahci_cmd_table *command_table; volatile struct grub_ahci_cmd_table *command_table;
struct grub_pci_dma_chunk *rfis; struct grub_pci_dma_chunk *rfis;
int present; int present;
int atapi;
}; };
static grub_err_t static grub_err_t
@ -616,6 +617,10 @@ grub_ahci_pciinit (grub_pci_device_t dev,
grub_dma_free (failed_adevs[i]->rfis); 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++) for (i = 0; i < nports; i++)
if (adevs[i]) if (adevs[i])
{ {
@ -1075,6 +1080,7 @@ grub_ahci_open (int id, int devnum, struct grub_ata *ata)
ata->data = dev; ata->data = dev;
ata->dma = 1; ata->dma = 1;
ata->atapi = dev->atapi;
ata->maxbuffer = GRUB_AHCI_PRDT_MAX_CHUNK_LENGTH; ata->maxbuffer = GRUB_AHCI_PRDT_MAX_CHUNK_LENGTH;
ata->present = &dev->present; ata->present = &dev->present;

View file

@ -108,6 +108,9 @@ grub_ata_identify (struct grub_ata *dev)
grub_uint16_t *info16; grub_uint16_t *info16;
grub_err_t err; grub_err_t err;
if (dev->atapi)
return grub_atapi_identify (dev);
info64 = grub_malloc (GRUB_DISK_SECTOR_SIZE); info64 = grub_malloc (GRUB_DISK_SECTOR_SIZE);
info32 = (grub_uint32_t *) info64; info32 = (grub_uint32_t *) info64;
info16 = (grub_uint16_t *) info64; info16 = (grub_uint16_t *) info64;
@ -129,7 +132,7 @@ grub_ata_identify (struct grub_ata *dev)
grub_free (info16); grub_free (info16);
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;
if ((sts & (GRUB_ATA_STATUS_BUSY | GRUB_ATA_STATUS_DRQ 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 */)) && (parms.taskfile.error & 0x04 /* ABRT */))
/* Device without ATA IDENTIFY, try ATAPI. */ /* Device without ATA IDENTIFY, try ATAPI. */
return grub_atapi_identify (dev); return grub_atapi_identify (dev);
@ -363,7 +366,7 @@ grub_ata_real_open (int id, int bus)
struct grub_ata *ata; struct grub_ata *ata;
grub_ata_dev_t p; grub_ata_dev_t p;
ata = grub_malloc (sizeof (*ata)); ata = grub_zalloc (sizeof (*ata));
if (!ata) if (!ata)
return NULL; return NULL;
for (p = grub_ata_dev_list; p; p = p->next) for (p = grub_ata_dev_list; p; p = p->next)