Move 0xE0 to callers rather than to have it in drivers
This commit is contained in:
parent
a934071d76
commit
d9675dbee3
4 changed files with 11 additions and 9 deletions
|
@ -72,6 +72,8 @@ grub_hdparm_do_ata_cmd (grub_ata_t ata, grub_uint8_t cmd,
|
||||||
apt.taskfile.cmd = cmd;
|
apt.taskfile.cmd = cmd;
|
||||||
apt.taskfile.features = features;
|
apt.taskfile.features = features;
|
||||||
apt.taskfile.sectors = sectors;
|
apt.taskfile.sectors = sectors;
|
||||||
|
apt.taskfile.disk = 0xE0;
|
||||||
|
|
||||||
apt.buffer = buffer;
|
apt.buffer = buffer;
|
||||||
apt.size = size;
|
apt.size = size;
|
||||||
|
|
||||||
|
@ -88,6 +90,7 @@ grub_hdparm_do_check_powermode_cmd (grub_ata_t ata)
|
||||||
grub_memset (&apt, 0, sizeof (apt));
|
grub_memset (&apt, 0, sizeof (apt));
|
||||||
|
|
||||||
apt.taskfile.cmd = GRUB_ATA_CMD_CHECK_POWER_MODE;
|
apt.taskfile.cmd = GRUB_ATA_CMD_CHECK_POWER_MODE;
|
||||||
|
apt.taskfile.disk = 0xE0;
|
||||||
|
|
||||||
if (ata->dev->readwrite (ata, &apt))
|
if (ata->dev->readwrite (ata, &apt))
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -105,6 +108,7 @@ grub_hdparm_do_smart_cmd (grub_ata_t ata, grub_uint8_t features)
|
||||||
apt.taskfile.features = features;
|
apt.taskfile.features = features;
|
||||||
apt.taskfile.lba_mid = 0x4f;
|
apt.taskfile.lba_mid = 0x4f;
|
||||||
apt.taskfile.lba_high = 0xc2;
|
apt.taskfile.lba_high = 0xc2;
|
||||||
|
apt.taskfile.disk = 0xE0;
|
||||||
|
|
||||||
if (ata->dev->readwrite (ata, &apt))
|
if (ata->dev->readwrite (ata, &apt))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -408,7 +408,6 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
|
||||||
for (i = 0; i < sizeof (parms->taskfile.raw); i++)
|
for (i = 0; i < sizeof (parms->taskfile.raw); i++)
|
||||||
dev->command_table[0].cfis[register_map[i]] = parms->taskfile.raw[i];
|
dev->command_table[0].cfis[register_map[i]] = parms->taskfile.raw[i];
|
||||||
|
|
||||||
dev->command_table[0].cfis[7] |= (parms->cmdsize ? 0 : 0xE0);
|
|
||||||
grub_dprintf ("ahci", "cfis: %02x %02x %02x %02x %02x %02x %02x %02x\n",
|
grub_dprintf ("ahci", "cfis: %02x %02x %02x %02x %02x %02x %02x %02x\n",
|
||||||
dev->command_table[0].cfis[0], dev->command_table[0].cfis[1],
|
dev->command_table[0].cfis[0], dev->command_table[0].cfis[1],
|
||||||
dev->command_table[0].cfis[2], dev->command_table[0].cfis[3],
|
dev->command_table[0].cfis[2], dev->command_table[0].cfis[3],
|
||||||
|
|
|
@ -70,7 +70,7 @@ grub_atapi_identify (struct grub_ata *dev)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
grub_memset (&parms, 0, sizeof (parms));
|
grub_memset (&parms, 0, sizeof (parms));
|
||||||
parms.taskfile.disk = 0;
|
parms.taskfile.disk = 0xE0;
|
||||||
parms.taskfile.cmd = GRUB_ATA_CMD_IDENTIFY_PACKET_DEVICE;
|
parms.taskfile.cmd = GRUB_ATA_CMD_IDENTIFY_PACKET_DEVICE;
|
||||||
parms.size = GRUB_DISK_SECTOR_SIZE;
|
parms.size = GRUB_DISK_SECTOR_SIZE;
|
||||||
parms.buffer = info;
|
parms.buffer = info;
|
||||||
|
@ -108,7 +108,7 @@ grub_ata_identify (struct grub_ata *dev)
|
||||||
grub_memset (&parms, 0, sizeof (parms));
|
grub_memset (&parms, 0, sizeof (parms));
|
||||||
parms.buffer = info;
|
parms.buffer = info;
|
||||||
parms.size = GRUB_DISK_SECTOR_SIZE;
|
parms.size = GRUB_DISK_SECTOR_SIZE;
|
||||||
parms.taskfile.disk = 0;
|
parms.taskfile.disk = 0xE0;
|
||||||
|
|
||||||
parms.taskfile.cmd = GRUB_ATA_CMD_IDENTIFY_DEVICE;
|
parms.taskfile.cmd = GRUB_ATA_CMD_IDENTIFY_DEVICE;
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ grub_ata_setaddress (struct grub_ata *dev,
|
||||||
"sector %d cannot be addressed "
|
"sector %d cannot be addressed "
|
||||||
"using CHS addressing", sector);
|
"using CHS addressing", sector);
|
||||||
|
|
||||||
parms->taskfile.disk = head;
|
parms->taskfile.disk = 0xE0 | head;
|
||||||
parms->taskfile.sectnum = sect;
|
parms->taskfile.sectnum = sect;
|
||||||
parms->taskfile.cyllsb = cylinder & 0xFF;
|
parms->taskfile.cyllsb = cylinder & 0xFF;
|
||||||
parms->taskfile.cylmsb = cylinder >> 8;
|
parms->taskfile.cylmsb = cylinder >> 8;
|
||||||
|
@ -207,7 +207,7 @@ grub_ata_setaddress (struct grub_ata *dev,
|
||||||
case GRUB_ATA_LBA:
|
case GRUB_ATA_LBA:
|
||||||
if (size == 256)
|
if (size == 256)
|
||||||
size = 0;
|
size = 0;
|
||||||
parms->taskfile.disk = ((sector >> 24) & 0x0F);
|
parms->taskfile.disk = 0xE0 | ((sector >> 24) & 0x0F);
|
||||||
|
|
||||||
parms->taskfile.sectors = size;
|
parms->taskfile.sectors = size;
|
||||||
parms->taskfile.lba_low = sector & 0xFF;
|
parms->taskfile.lba_low = sector & 0xFF;
|
||||||
|
@ -219,7 +219,7 @@ grub_ata_setaddress (struct grub_ata *dev,
|
||||||
if (size == 65536)
|
if (size == 65536)
|
||||||
size = 0;
|
size = 0;
|
||||||
|
|
||||||
parms->taskfile.disk = 0;
|
parms->taskfile.disk = 0xE0;
|
||||||
|
|
||||||
/* Set "Previous". */
|
/* Set "Previous". */
|
||||||
parms->taskfile.sectors = size & 0xFF;
|
parms->taskfile.sectors = size & 0xFF;
|
||||||
|
|
|
@ -151,9 +151,8 @@ grub_pata_readwrite (struct grub_ata *disk,
|
||||||
parms->taskfile.lba_low, parms->size);
|
parms->taskfile.lba_low, parms->size);
|
||||||
|
|
||||||
/* Set registers. */
|
/* Set registers. */
|
||||||
grub_pata_regset (dev, GRUB_ATA_REG_DISK, (parms->cmdsize ? 0 : 0xE0)
|
grub_pata_regset (dev, GRUB_ATA_REG_DISK, (dev->device << 4)
|
||||||
| dev->device << 4
|
| (parms->taskfile.disk & 0xef));
|
||||||
| (parms->taskfile.disk & 0xf));
|
|
||||||
if (grub_pata_check_ready (dev))
|
if (grub_pata_check_ready (dev))
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue