PA-RISC is big endian. Add necessary endianess conversion functions to get disc detection correct.
Signed-off-by: Helge Deller deller@gmx.de --- src/hw/ata.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/hw/ata.c b/src/hw/ata.c index af44541..5616360 100644 --- a/src/hw/ata.c +++ b/src/hw/ata.c @@ -701,7 +701,7 @@ ata_extract_model(char *model, u32 size, u16 *buffer) // Read model name int i; for (i=0; i<size/2; i++) - *(u16*)&model[i*2] = be16_to_cpu(buffer[27+i]); + *(u16*)&model[i*2] = cpu_to_le16(be16_to_cpu(buffer[27+i])); model[size] = 0x00; nullTrailingSpace(model); return model; @@ -720,7 +720,7 @@ init_atadrive(struct atadrive_s *dummy, u16 *buffer) adrive->chan_gf = dummy->chan_gf; adrive->slave = dummy->slave; adrive->drive.cntl_id = adrive->chan_gf->ataid * 2 + dummy->slave; - adrive->drive.removable = (buffer[0] & 0x80) ? 1 : 0; + adrive->drive.removable = le16_to_cpu((buffer[0]) & 0x80) ? 1 : 0; return adrive; }
@@ -740,7 +740,7 @@ init_drive_atapi(struct atadrive_s *dummy, u16 *buffer) adrive->drive.type = DTYPE_ATA_ATAPI; adrive->drive.blksize = CDROM_SECTOR_SIZE; adrive->drive.sectors = (u64)-1; - u8 iscd = ((buffer[0] >> 8) & 0x1f) == 0x05; + u8 iscd = ((le16_to_cpu(buffer[0]) >> 8) & 0x1f) == 0x05; char model[MAXMODEL+1]; char *desc = znprintf(MAXDESCSIZE , "DVD/CD [ata%d-%d: %s ATAPI-%d %s]" @@ -781,15 +781,15 @@ init_drive_ata(struct atadrive_s *dummy, u16 *buffer) adrive->drive.type = DTYPE_ATA; adrive->drive.blksize = DISK_SECTOR_SIZE;
- adrive->drive.pchs.cylinder = buffer[1]; - adrive->drive.pchs.head = buffer[3]; - adrive->drive.pchs.sector = buffer[6]; + adrive->drive.pchs.cylinder = le16_to_cpu(buffer[1]); + adrive->drive.pchs.head = le16_to_cpu(buffer[3]); + adrive->drive.pchs.sector = le16_to_cpu(buffer[6]);
u64 sectors; - if (buffer[83] & (1 << 10)) // word 83 - lba48 support - sectors = *(u64*)&buffer[100]; // word 100-103 + if (le16_to_cpu(buffer[83]) & (1 << 10)) // word 83 - lba48 support + sectors = le64_to_cpu(*(u64*)&buffer[100]); // word 100-103 else - sectors = *(u32*)&buffer[60]; // word 60 and word 61 + sectors = le32_to_cpu(*(u32*)&buffer[60]); // word 60 and word 61 adrive->drive.sectors = sectors; u64 adjsize = sectors >> 11; char adjprefix = 'M'; @@ -913,7 +913,7 @@ ata_detect(void *data) continue; }
- u16 resetresult = buffer[93]; + u16 resetresult = le16_to_cpu(buffer[93]); dprintf(6, "ata_detect resetresult=%04x\n", resetresult); if (!slave && (resetresult & 0xdf61) == 0x4041) // resetresult looks valid and device 0 is responding to -- 2.29.2