diff options
author | Helge Deller <deller@gmx.de> | 2021-02-11 17:36:18 +0100 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2021-09-24 11:10:17 +0200 |
commit | 52fd5faf063bd627c5e99a13578356b0a8cc6638 (patch) | |
tree | 1673ac8bf680ecd16101da539f71548b9f7b812e | |
parent | 9a9c177f4b5391dcdf170c2b66ec28ee6540fd12 (diff) | |
download | seabios-hppa-52fd5faf063bd627c5e99a13578356b0a8cc6638.zip seabios-hppa-52fd5faf063bd627c5e99a13578356b0a8cc6638.tar.gz seabios-hppa-52fd5faf063bd627c5e99a13578356b0a8cc6638.tar.bz2 |
ata.c: Add missing endianess conversion functions
PA-RISC is big endian. Add necessary endianess conversion functions
to get disc detection correct.
Signed-off-by: Helge Deller <deller@gmx.de>
-rw-r--r-- | src/hw/ata.c | 20 |
1 files 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 |