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.
This commit is contained in:
marco_g 2007-11-03 15:45:07 +00:00
parent cf8f780b84
commit bb06ab2eb2
3 changed files with 20 additions and 77 deletions

View file

@ -1,3 +1,14 @@
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.

72
configure vendored
View file

@ -6676,77 +6676,7 @@ CPPFLAGS="$TARGET_CPPFLAGS"
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; }

View file

@ -168,9 +168,6 @@ grub_ata_pio_read (struct grub_ata_device *dev, char *buf,
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);
@ -194,9 +191,6 @@ grub_ata_pio_write (struct grub_ata_device *dev, char *buf,
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);
@ -242,6 +236,7 @@ grub_atapi_identify (struct grub_ata_device *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);
@ -263,6 +258,7 @@ grub_atapi_packet (struct grub_ata_device *dev, char *packet)
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);
@ -286,6 +282,7 @@ grub_ata_identify (struct grub_ata_device *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_DEVICE);
grub_ata_wait ();
ataerr = grub_ata_pio_read (dev, info, GRUB_DISK_SECTOR_SIZE);
if (ataerr & 4)
@ -526,6 +523,7 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
{
/* 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,
@ -539,6 +537,7 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
{
/* 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,
@ -558,6 +557,7 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
{
/* 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))
@ -567,6 +567,7 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
} 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,
@ -653,6 +654,7 @@ grub_atapi_readsector (struct grub_ata_device *dev,
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;