* 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.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-06-06 12:38:49 +02:00
parent 37ba07ebaf
commit 5b25873518
2 changed files with 17 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2012-06-06 Vladimir Serbinenko <phcoder@gmail.com>
* 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 <phcoder@gmail.com> 2012-06-06 Vladimir Serbinenko <phcoder@gmail.com>
Extend automated tests to qemu-mips. Extend automated tests to qemu-mips.

View file

@ -113,6 +113,14 @@ grub_pata_wait (void)
grub_millisleep (50); 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 static void
grub_pata_pio_read (struct grub_pata_device *dev, char *buf, grub_size_t size) 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. */ /* Read in the data, word by word. */
for (i = 0; i < size / 2; i++) for (i = 0; i < size / 2; i++)
grub_set_unaligned16 (buf + 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))); + GRUB_ATA_REG_DATA)));
if (size & 1) 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)); + 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. */ /* Write the data, word by word. */
for (i = 0; i < size / 2; i++) 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. */ /* ATA pass through support, used by hdparm.mod. */