forked from len0rd/rockbox
renamed biglba to lba48, plus a slight optimization
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11825 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
977c69f819
commit
bb0358647d
1 changed files with 10 additions and 17 deletions
|
@ -78,8 +78,8 @@ static long sleep_timeout = 5*HZ;
|
||||||
#ifdef HAVE_ATA_POWER_OFF
|
#ifdef HAVE_ATA_POWER_OFF
|
||||||
static int poweroff_timeout = 2*HZ;
|
static int poweroff_timeout = 2*HZ;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_BIGLBA
|
#ifdef HAVE_LBA48
|
||||||
static bool biglba = false; /* set for 48 bit addressing */
|
static bool lba48 = false; /* set for 48 bit addressing */
|
||||||
#endif
|
#endif
|
||||||
static long ata_stack[DEFAULT_STACK_SIZE/sizeof(long)];
|
static long ata_stack[DEFAULT_STACK_SIZE/sizeof(long)];
|
||||||
static const char ata_thread_name[] = "ata";
|
static const char ata_thread_name[] = "ata";
|
||||||
|
@ -257,8 +257,8 @@ int ata_read_sectors(IF_MV2(int drive,)
|
||||||
ret = 0;
|
ret = 0;
|
||||||
last_disk_activity = current_tick;
|
last_disk_activity = current_tick;
|
||||||
|
|
||||||
#ifdef HAVE_BIGLBA
|
#ifdef HAVE_LBA48
|
||||||
if (biglba)
|
if (lba48)
|
||||||
{
|
{
|
||||||
SET_REG(ATA_NSECTOR, count >> 8);
|
SET_REG(ATA_NSECTOR, count >> 8);
|
||||||
SET_REG(ATA_NSECTOR, count & 0xff);
|
SET_REG(ATA_NSECTOR, count & 0xff);
|
||||||
|
@ -274,11 +274,7 @@ int ata_read_sectors(IF_MV2(int drive,)
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if ( count == 256 )
|
SET_REG(ATA_NSECTOR, count & 0xff); /* 0 means 256 sectors */
|
||||||
SET_REG(ATA_NSECTOR, 0); /* 0 means 256 sectors */
|
|
||||||
else
|
|
||||||
SET_REG(ATA_NSECTOR, (unsigned char)count);
|
|
||||||
|
|
||||||
SET_REG(ATA_SECTOR, start & 0xff);
|
SET_REG(ATA_SECTOR, start & 0xff);
|
||||||
SET_REG(ATA_LCYL, (start >> 8) & 0xff);
|
SET_REG(ATA_LCYL, (start >> 8) & 0xff);
|
||||||
SET_REG(ATA_HCYL, (start >> 16) & 0xff);
|
SET_REG(ATA_HCYL, (start >> 16) & 0xff);
|
||||||
|
@ -452,8 +448,8 @@ int ata_write_sectors(IF_MV2(int drive,)
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_BIGLBA
|
#ifdef HAVE_LBA48
|
||||||
if (biglba)
|
if (lba48)
|
||||||
{
|
{
|
||||||
SET_REG(ATA_NSECTOR, count >> 8);
|
SET_REG(ATA_NSECTOR, count >> 8);
|
||||||
SET_REG(ATA_NSECTOR, count & 0xff);
|
SET_REG(ATA_NSECTOR, count & 0xff);
|
||||||
|
@ -469,10 +465,7 @@ int ata_write_sectors(IF_MV2(int drive,)
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if ( count == 256 )
|
SET_REG(ATA_NSECTOR, count & 0xff); /* 0 means 256 sectors */
|
||||||
SET_REG(ATA_NSECTOR, 0); /* 0 means 256 sectors */
|
|
||||||
else
|
|
||||||
SET_REG(ATA_NSECTOR, (unsigned char)count);
|
|
||||||
SET_REG(ATA_SECTOR, start & 0xff);
|
SET_REG(ATA_SECTOR, start & 0xff);
|
||||||
SET_REG(ATA_LCYL, (start >> 8) & 0xff);
|
SET_REG(ATA_LCYL, (start >> 8) & 0xff);
|
||||||
SET_REG(ATA_HCYL, (start >> 16) & 0xff);
|
SET_REG(ATA_HCYL, (start >> 16) & 0xff);
|
||||||
|
@ -985,12 +978,12 @@ int ata_init(void)
|
||||||
multisectors = identify_info[47] & 0xff;
|
multisectors = identify_info[47] & 0xff;
|
||||||
DEBUGF("ata: %d sectors per ata request\n",multisectors);
|
DEBUGF("ata: %d sectors per ata request\n",multisectors);
|
||||||
|
|
||||||
#ifdef HAVE_BIGLBA
|
#ifdef HAVE_LBA48
|
||||||
if (identify_info[83] & 0x0400 /* 48 bit address support */
|
if (identify_info[83] & 0x0400 /* 48 bit address support */
|
||||||
&& identify_info[60] == 0xFFFF /* and disk size >= 128 GiB */
|
&& identify_info[60] == 0xFFFF /* and disk size >= 128 GiB */
|
||||||
&& identify_info[61] == 0x0FFF) /* (needs BigLBA addressing) */
|
&& identify_info[61] == 0x0FFF) /* (needs BigLBA addressing) */
|
||||||
{
|
{
|
||||||
biglba = true; /* use BigLBA */
|
lba48 = true; /* use BigLBA */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
rc = freeze_lock();
|
rc = freeze_lock();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue