mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
Author: Pavel Roskin <proski@gnu.org>
struct ata_sector was meant to facilitate taking upper and lower byte of the sector. However, the implementation is incorrect, as "struct" and "union" are swapped in the definition. What's worse, it's an overkill for that simple task. The code should be transparent without knowing how struct ata_sector is defined. [laurent: Original patch modified to remove useless "& 0xff"] git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@489 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
@@ -764,7 +764,6 @@ ob_ide_read_ata_chs(struct ide_drive *drive, unsigned long long block,
|
|||||||
unsigned int sect = (block % drive->sect) + 1;
|
unsigned int sect = (block % drive->sect) + 1;
|
||||||
unsigned int head = (track % drive->head);
|
unsigned int head = (track % drive->head);
|
||||||
unsigned int cyl = (track / drive->head);
|
unsigned int cyl = (track / drive->head);
|
||||||
struct ata_sector ata_sector;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* fill in chs command to read from disk at given location
|
* fill in chs command to read from disk at given location
|
||||||
@@ -772,8 +771,7 @@ ob_ide_read_ata_chs(struct ide_drive *drive, unsigned long long block,
|
|||||||
cmd->buffer = buf;
|
cmd->buffer = buf;
|
||||||
cmd->buflen = sectors * 512;
|
cmd->buflen = sectors * 512;
|
||||||
|
|
||||||
ata_sector.all = sectors;
|
cmd->nsector = sectors & 0xff;
|
||||||
cmd->nsector = ata_sector.low;
|
|
||||||
cmd->sector = sect;
|
cmd->sector = sect;
|
||||||
cmd->lcyl = cyl;
|
cmd->lcyl = cyl;
|
||||||
cmd->hcyl = cyl >> 8;
|
cmd->hcyl = cyl >> 8;
|
||||||
@@ -815,19 +813,17 @@ ob_ide_read_ata_lba48(struct ide_drive *drive, unsigned long long block,
|
|||||||
unsigned char *buf, unsigned int sectors)
|
unsigned char *buf, unsigned int sectors)
|
||||||
{
|
{
|
||||||
struct ata_command *cmd = &drive->channel->ata_cmd;
|
struct ata_command *cmd = &drive->channel->ata_cmd;
|
||||||
struct ata_sector ata_sector;
|
|
||||||
|
|
||||||
memset(cmd, 0, sizeof(*cmd));
|
memset(cmd, 0, sizeof(*cmd));
|
||||||
|
|
||||||
cmd->buffer = buf;
|
cmd->buffer = buf;
|
||||||
cmd->buflen = sectors * 512;
|
cmd->buflen = sectors * 512;
|
||||||
ata_sector.all = sectors;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* we are using tasklet addressing here
|
* we are using tasklet addressing here
|
||||||
*/
|
*/
|
||||||
cmd->task[2] = ata_sector.low;
|
cmd->task[2] = sectors;
|
||||||
cmd->task[3] = ata_sector.high;
|
cmd->task[3] = sectors >> 8;
|
||||||
cmd->task[4] = block;
|
cmd->task[4] = block;
|
||||||
cmd->task[5] = block >> 8;
|
cmd->task[5] = block >> 8;
|
||||||
cmd->task[6] = block >> 16;
|
cmd->task[6] = block >> 16;
|
||||||
|
|||||||
@@ -208,20 +208,6 @@ enum {
|
|||||||
atapi_ddir_write,
|
atapi_ddir_write,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ata_sector {
|
|
||||||
u16 all;
|
|
||||||
union {
|
|
||||||
#ifdef CONFIG_BIG_ENDIAN
|
|
||||||
u8 high;
|
|
||||||
u8 low;
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_LITTLE_ENDIAN
|
|
||||||
u8 low;
|
|
||||||
u8 high;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
static int ob_ide_atapi_request_sense(struct ide_drive *drive);
|
static int ob_ide_atapi_request_sense(struct ide_drive *drive);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user