summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2006-12-20 22:08:29 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2006-12-20 22:08:29 +0000
commitbb0358647d68e989d065ea70d95746fd2b6f4cad (patch)
treebfc387fbd2e26ca61311fce561f69f8c2c843c70
parent977c69f8196ccee2f6397a31b1546f036063f389 (diff)
downloadrockbox-bb0358647d68e989d065ea70d95746fd2b6f4cad.zip
rockbox-bb0358647d68e989d065ea70d95746fd2b6f4cad.tar.gz
rockbox-bb0358647d68e989d065ea70d95746fd2b6f4cad.tar.bz2
rockbox-bb0358647d68e989d065ea70d95746fd2b6f4cad.tar.xz
renamed biglba to lba48, plus a slight optimization
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11825 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/ata.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index f5b8810..1491d23 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -78,8 +78,8 @@ static long sleep_timeout = 5*HZ;
#ifdef HAVE_ATA_POWER_OFF
static int poweroff_timeout = 2*HZ;
#endif
-#ifdef HAVE_BIGLBA
-static bool biglba = false; /* set for 48 bit addressing */
+#ifdef HAVE_LBA48
+static bool lba48 = false; /* set for 48 bit addressing */
#endif
static long ata_stack[DEFAULT_STACK_SIZE/sizeof(long)];
static const char ata_thread_name[] = "ata";
@@ -257,8 +257,8 @@ int ata_read_sectors(IF_MV2(int drive,)
ret = 0;
last_disk_activity = current_tick;
-#ifdef HAVE_BIGLBA
- if (biglba)
+#ifdef HAVE_LBA48
+ if (lba48)
{
SET_REG(ATA_NSECTOR, count >> 8);
SET_REG(ATA_NSECTOR, count & 0xff);
@@ -274,11 +274,7 @@ int ata_read_sectors(IF_MV2(int drive,)
else
#endif
{
- if ( count == 256 )
- SET_REG(ATA_NSECTOR, 0); /* 0 means 256 sectors */
- else
- SET_REG(ATA_NSECTOR, (unsigned char)count);
-
+ SET_REG(ATA_NSECTOR, count & 0xff); /* 0 means 256 sectors */
SET_REG(ATA_SECTOR, start & 0xff);
SET_REG(ATA_LCYL, (start >> 8) & 0xff);
SET_REG(ATA_HCYL, (start >> 16) & 0xff);
@@ -452,8 +448,8 @@ int ata_write_sectors(IF_MV2(int drive,)
return -2;
}
-#ifdef HAVE_BIGLBA
- if (biglba)
+#ifdef HAVE_LBA48
+ if (lba48)
{
SET_REG(ATA_NSECTOR, count >> 8);
SET_REG(ATA_NSECTOR, count & 0xff);
@@ -469,10 +465,7 @@ int ata_write_sectors(IF_MV2(int drive,)
else
#endif
{
- if ( count == 256 )
- SET_REG(ATA_NSECTOR, 0); /* 0 means 256 sectors */
- else
- SET_REG(ATA_NSECTOR, (unsigned char)count);
+ SET_REG(ATA_NSECTOR, count & 0xff); /* 0 means 256 sectors */
SET_REG(ATA_SECTOR, start & 0xff);
SET_REG(ATA_LCYL, (start >> 8) & 0xff);
SET_REG(ATA_HCYL, (start >> 16) & 0xff);
@@ -985,12 +978,12 @@ int ata_init(void)
multisectors = identify_info[47] & 0xff;
DEBUGF("ata: %d sectors per ata request\n",multisectors);
-#ifdef HAVE_BIGLBA
+#ifdef HAVE_LBA48
if (identify_info[83] & 0x0400 /* 48 bit address support */
&& identify_info[60] == 0xFFFF /* and disk size >= 128 GiB */
&& identify_info[61] == 0x0FFF) /* (needs BigLBA addressing) */
{
- biglba = true; /* use BigLBA */
+ lba48 = true; /* use BigLBA */
}
#endif
rc = freeze_lock();