[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 24/30] libqos/ahci: track sector size
From: |
John Snow |
Subject: |
[Qemu-devel] [PULL 24/30] libqos/ahci: track sector size |
Date: |
Fri, 8 Jun 2018 13:47:27 -0400 |
It's not always 512, and it does wind up mattering for PIO tranfers,
because this means DRQ blocks are four times as big for ATAPI.
Replace an instance of 2048 with the correct define, too.
This patch by itself winds changing no behavior. fis->count is ignored
for CMD_PACKET, and sect_count only gets used in non-ATAPI cases.
Signed-off-by: John Snow <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden
Signed-off-by: John Snow <address@hidden>
---
tests/libqos/ahci.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c
index bc201d762b..63e1f9b92d 100644
--- a/tests/libqos/ahci.c
+++ b/tests/libqos/ahci.c
@@ -90,6 +90,7 @@ struct AHCICommand {
uint32_t interrupts;
uint64_t xbytes;
uint32_t prd_size;
+ uint32_t sector_size;
uint64_t buffer;
AHCICommandProp *props;
/* Data to be transferred to the guest */
@@ -796,7 +797,7 @@ static void command_header_init(AHCICommand *cmd)
static void command_table_init(AHCICommand *cmd)
{
RegH2DFIS *fis = &(cmd->fis);
- uint16_t sect_count = (cmd->xbytes / AHCI_SECTOR_SIZE);
+ uint16_t sect_count = (cmd->xbytes / cmd->sector_size);
fis->fis_type = REG_H2D_FIS;
fis->flags = REG_H2D_FIS_CMD; /* "Command" bit */
@@ -819,7 +820,7 @@ static void command_table_init(AHCICommand *cmd)
if (cmd->props->lba28 || cmd->props->lba48) {
fis->device = ATA_DEVICE_LBA;
}
- fis->count = (cmd->xbytes / AHCI_SECTOR_SIZE);
+ fis->count = (cmd->xbytes / cmd->sector_size);
}
fis->icc = 0x00;
fis->control = 0x00;
@@ -857,6 +858,7 @@ AHCICommand *ahci_command_create(uint8_t command_name)
cmd->xbytes = props->size;
cmd->prd_size = 4096;
cmd->buffer = 0xabad1dea;
+ cmd->sector_size = props->atapi ? ATAPI_SECTOR_SIZE : AHCI_SECTOR_SIZE;
if (!cmd->props->ncq) {
cmd->interrupts = AHCI_PX_IS_DHRS;
@@ -1033,7 +1035,7 @@ void ahci_command_set_buffer(AHCICommand *cmd, uint64_t
buffer)
static void ahci_atapi_set_size(AHCICommand *cmd, uint64_t xbytes)
{
unsigned char *cbd = cmd->atapi_cmd;
- uint64_t nsectors = xbytes / 2048;
+ uint64_t nsectors = xbytes / ATAPI_SECTOR_SIZE;
uint32_t tmp;
g_assert(cbd);
@@ -1080,7 +1082,7 @@ void ahci_command_set_sizes(AHCICommand *cmd, uint64_t
xbytes,
cmd->prd_size = prd_size;
}
cmd->xbytes = xbytes;
- sect_count = (cmd->xbytes / AHCI_SECTOR_SIZE);
+ sect_count = (cmd->xbytes / cmd->sector_size);
if (cmd->props->ncq) {
NCQFIS *nfis = (NCQFIS *)&(cmd->fis);
--
2.14.3
- [Qemu-devel] [PULL 07/30] ahci: fix spacing damage on ahci_port_write, (continued)
- [Qemu-devel] [PULL 07/30] ahci: fix spacing damage on ahci_port_write, John Snow, 2018/06/08
- [Qemu-devel] [PULL 20/30] tests/boot-sector: Add magic bytes to s390x boot code header, John Snow, 2018/06/08
- [Qemu-devel] [PULL 23/30] MAINTAINERS: Add the cdrom-test to John's section, John Snow, 2018/06/08
- [Qemu-devel] [PULL 19/30] ahci: make ahci_mem_write traces more descriptive, John Snow, 2018/06/08
- [Qemu-devel] [PULL 28/30] ide: make ide_transfer_stop idempotent, John Snow, 2018/06/08
- [Qemu-devel] [PULL 22/30] tests/cdrom-test: Test that -cdrom parameter is working, John Snow, 2018/06/08
- [Qemu-devel] [PULL 21/30] tests/cdrom-test: Test booting from CD-ROM ISO image file, John Snow, 2018/06/08
- [Qemu-devel] [PULL 25/30] ahci: move PIO Setup FIS before transfer, fix it for ATAPI commands, John Snow, 2018/06/08
- [Qemu-devel] [PULL 30/30] ide: introduce ide_transfer_start_norecurse, John Snow, 2018/06/08
- [Qemu-devel] [PULL 29/30] atapi: call ide_set_irq before ide_transfer_start, John Snow, 2018/06/08
- [Qemu-devel] [PULL 24/30] libqos/ahci: track sector size,
John Snow <=
- Re: [Qemu-devel] [PULL 00/30] Ide patches, Peter Maydell, 2018/06/11