+2007-11-03 Marco Gerards <marco@gnu.org>
+
+ * disk/ata.c (grub_ata_pio_read): Don't wait for the command to
+ become activate.
+ (grub_ata_pio_write): Likewise.
+
+ (grub_atapi_identify): Wait after issuing an ATA command.
+ (grub_atapi_packet): Likewise.
+ (grub_ata_identify): Likewise.
+ (grub_ata_readwrite): Likewise.
+
2007-11-03 Marco Gerards <marco@gnu.org>
* disk/ata.c (grub_ata_pio_read): Detect and return the error code.
LDFLAGS="$TARGET_LDFLAGS"
# Defined in aclocal.m4.
-{ echo "$as_me:$LINENO: checking whether ${OBJCOPY} works for absolute addresses" >&5
-echo $ECHO_N "checking whether ${OBJCOPY} works for absolute addresses... $ECHO_C" >&6; }
-if test "${grub_cv_prog_objcopy_absolute+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat > conftest.c <<\EOF
-void
-cmain (void)
-{
- *((int *) 0x1000) = 2;
-}
-EOF
-
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && test -s conftest.o; then :
-else
- { { echo "$as_me:$LINENO: error: ${CC-cc} cannot compile C source code" >&5
-echo "$as_me: error: ${CC-cc} cannot compile C source code" >&2;}
- { (exit 1); exit 1; }; }
-fi
-grub_cv_prog_objcopy_absolute=yes
-for link_addr in 2000 8000 7C00; do
- if { ac_try='${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then :
- else
- { { echo "$as_me:$LINENO: error: ${CC-cc} cannot link at address $link_addr" >&5
-echo "$as_me: error: ${CC-cc} cannot link at address $link_addr" >&2;}
- { (exit 1); exit 1; }; }
- fi
- if { ac_try='${OBJCOPY-objcopy} -O binary conftest.exec conftest'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then :
- else
- { { echo "$as_me:$LINENO: error: ${OBJCOPY-objcopy} cannot create binary files" >&5
-echo "$as_me: error: ${OBJCOPY-objcopy} cannot create binary files" >&2;}
- { (exit 1); exit 1; }; }
- fi
- if test ! -f conftest.old || { ac_try='cmp -s conftest.old conftest'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- mv -f conftest conftest.old
- else
- grub_cv_prog_objcopy_absolute=no
- break
- fi
-done
-rm -f conftest*
-fi
-
-{ echo "$as_me:$LINENO: result: $grub_cv_prog_objcopy_absolute" >&5
-echo "${ECHO_T}$grub_cv_prog_objcopy_absolute" >&6; }
-
-if test "x$grub_cv_prog_objcopy_absolute" = xno; then
- { { echo "$as_me:$LINENO: error: GRUB requires a working absolute objcopy; upgrade your binutils" >&5
-echo "$as_me: error: GRUB requires a working absolute objcopy; upgrade your binutils" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
+#grub_PROG_OBJCOPY_ABSOLUTE
{ echo "$as_me:$LINENO: checking if C symbols get an underscore after compilation" >&5
echo $ECHO_N "checking if C symbols get an underscore after compilation... $ECHO_C" >&6; }
grub_uint16_t *buf16 = (grub_uint16_t *) buf;
unsigned int i;
- /* Make sure the read command is processed. */
- grub_ata_wait ();
-
if (grub_ata_regget (dev, GRUB_ATA_REG_STATUS) & 1)
return grub_ata_regget (dev, GRUB_ATA_REG_ERROR);
grub_uint16_t *buf16 = (grub_uint16_t *) buf;
unsigned int i;
- /* Make sure the write command is processed. */
- grub_ata_wait ();
-
/* Wait until the device is ready to write. */
grub_ata_wait_drq (dev);
grub_ata_regset (dev, GRUB_ATA_REG_DISK, 0xE0 | dev->device << 4);
grub_ata_regset (dev, GRUB_ATA_REG_CMD,
GRUB_ATA_CMD_IDENTIFY_PACKET_DEVICE);
+ grub_ata_wait ();
grub_ata_pio_read (dev, info, 256);
grub_ata_regset (dev, GRUB_ATA_REG_LBAHIGH, 0xFF);
grub_ata_regset (dev, GRUB_ATA_REG_LBAMID, 0xFF);
grub_ata_regset (dev, GRUB_ATA_REG_CMD, GRUB_ATA_CMD_PACKET);
+ grub_ata_wait ();
grub_ata_pio_write (dev, packet, 12);
grub_ata_regset (dev, GRUB_ATA_REG_DISK, 0xE0 | dev->device << 4);
grub_ata_regset (dev, GRUB_ATA_REG_CMD, GRUB_ATA_CMD_IDENTIFY_DEVICE);
+ grub_ata_wait ();
ataerr = grub_ata_pio_read (dev, info, GRUB_DISK_SECTOR_SIZE);
if (ataerr & 4)
{
/* Read 256/65536 sectors. */
grub_ata_regset (dev, GRUB_ATA_REG_CMD, cmd);
+ grub_ata_wait ();
for (sect = 0; sect < batch; sect++)
{
if (grub_ata_pio_read (dev, buf,
{
/* Write 256/65536 sectors. */
grub_ata_regset (dev, GRUB_ATA_REG_CMD, cmd_write);
+ grub_ata_wait ();
for (sect = 0; sect < batch; sect++)
{
if (grub_ata_pio_write (dev, buf,
{
/* Read sectors. */
grub_ata_regset (dev, GRUB_ATA_REG_CMD, cmd);
+ grub_ata_wait ();
for (sect = 0; sect < (size % batch); sect++)
{
if (grub_ata_pio_read (dev, buf, GRUB_DISK_SECTOR_SIZE))
} else {
/* Write sectors. */
grub_ata_regset (dev, GRUB_ATA_REG_CMD, cmd_write);
+ grub_ata_wait ();
for (sect = 0; sect < batch; sect++)
{
if (grub_ata_pio_write (dev, buf,
readcmd.length = grub_cpu_to_be32 (1);
grub_atapi_packet (dev, (char *) &readcmd);
+ grub_ata_wait ();
grub_ata_pio_read (dev, buf, GRUB_CDROM_SECTOR_SIZE);
return 0;