diff --git a/ChangeLog b/ChangeLog index 92be5fbd9..f67df7648 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-06-06 Vladimir Serbinenko + + * grub-core/disk/pata.c (grub_pata_pio_read) + [GRUB_MACHINE_MIPS_QEMU_MIPS]: Don't byteswap even on mipseb. + (grub_pata_pio_write) [GRUB_MACHINE_MIPS_QEMU_MIPS]: Likewise. + 2012-06-06 Vladimir Serbinenko Extend automated tests to qemu-mips. diff --git a/grub-core/disk/pata.c b/grub-core/disk/pata.c index 5fc11ee91..00b04e2d4 100644 --- a/grub-core/disk/pata.c +++ b/grub-core/disk/pata.c @@ -113,6 +113,14 @@ grub_pata_wait (void) grub_millisleep (50); } +#ifdef GRUB_MACHINE_MIPS_QEMU_MIPS +#define grub_ata_to_cpu16(x) ((grub_uint16_t) (x)) +#define grub_cpu_to_ata16(x) ((grub_uint16_t) (x)) +#else +#define grub_ata_to_cpu16 grub_le_to_cpu16 +#define grub_cpu_to_ata16 grub_cpu_to_le16 +#endif + static void grub_pata_pio_read (struct grub_pata_device *dev, char *buf, grub_size_t size) { @@ -121,10 +129,10 @@ grub_pata_pio_read (struct grub_pata_device *dev, char *buf, grub_size_t size) /* Read in the data, word by word. */ for (i = 0; i < size / 2; i++) grub_set_unaligned16 (buf + 2 * i, - grub_le_to_cpu16 (grub_inw(dev->ioaddress + grub_ata_to_cpu16 (grub_inw(dev->ioaddress + GRUB_ATA_REG_DATA))); if (size & 1) - buf[size - 1] = (char) grub_le_to_cpu16 (grub_inw (dev->ioaddress + buf[size - 1] = (char) grub_ata_to_cpu16 (grub_inw (dev->ioaddress + GRUB_ATA_REG_DATA)); } @@ -135,7 +143,7 @@ grub_pata_pio_write (struct grub_pata_device *dev, char *buf, grub_size_t size) /* Write the data, word by word. */ for (i = 0; i < size / 2; i++) - grub_outw(grub_cpu_to_le16 (grub_get_unaligned16 (buf + 2 * i)), dev->ioaddress + GRUB_ATA_REG_DATA); + grub_outw(grub_cpu_to_ata16 (grub_get_unaligned16 (buf + 2 * i)), dev->ioaddress + GRUB_ATA_REG_DATA); } /* ATA pass through support, used by hdparm.mod. */