ata.h File Reference

ATA devices. More...

#include <stdint.h>
#include <gpxe/blockdev.h>
#include <gpxe/uaccess.h>
#include <gpxe/refcnt.h>

Go to the source code of this file.

Data Structures

union  ata_lba
 An ATA Logical Block Address. More...
union  ata_fifo
 An ATA 2-byte FIFO register. More...
struct  ata_cb
 ATA command block. More...
struct  ata_command
 An ATA command. More...
struct  ata_identity
 Structure returned by ATA IDENTIFY command. More...
struct  ata_device
 An ATA device. More...

Defines

#define ATA_DEV_OBSOLETE   0xa0
 Obsolete bits in the ATA device register.
#define ATA_DEV_LBA   0x40
 LBA flag in the ATA device register.
#define ATA_DEV_SLAVE   0x10
 Slave ("device 1") flag in the ATA device register.
#define ATA_DEV_MASTER   0x00
 Master ("device 0") flag in the ATA device register.
#define ATA_DEV_MASK   0xf0
 Mask of non-LBA portion of device register.
#define ATA_CMD_READ   0x20
 "Read sectors" command
#define ATA_CMD_READ_EXT   0x24
 "Read sectors (ext)" command
#define ATA_CMD_WRITE   0x30
 "Write sectors" command
#define ATA_CMD_WRITE_EXT   0x34
 "Write sectors (ext)" command
#define ATA_CMD_IDENTIFY   0xec
 "Identify" command
#define ATA_SUPPORTS_LBA48   ( 1 << 10 )
 Supports LBA48 flag.
#define ATA_SECTOR_SIZE   512
 ATA sector size.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
int init_atadev (struct ata_device *ata)
 Initialise ATA device.


Detailed Description

ATA devices.

Definition in file ata.h.


Define Documentation

#define ATA_DEV_OBSOLETE   0xa0

Obsolete bits in the ATA device register.

Definition at line 112 of file ata.h.

Referenced by ata_identify(), ata_read(), and ata_write().

#define ATA_DEV_LBA   0x40

LBA flag in the ATA device register.

Definition at line 115 of file ata.h.

Referenced by ata_identify(), ata_read(), and ata_write().

#define ATA_DEV_SLAVE   0x10

Slave ("device 1") flag in the ATA device register.

Definition at line 118 of file ata.h.

Referenced by aoe_send_command().

#define ATA_DEV_MASTER   0x00

Master ("device 0") flag in the ATA device register.

Definition at line 121 of file ata.h.

#define ATA_DEV_MASK   0xf0

Mask of non-LBA portion of device register.

Definition at line 124 of file ata.h.

Referenced by aoe_send_command().

#define ATA_CMD_READ   0x20

"Read sectors" command

Definition at line 127 of file ata.h.

Referenced by ata_read().

#define ATA_CMD_READ_EXT   0x24

"Read sectors (ext)" command

Definition at line 130 of file ata.h.

Referenced by ata_read().

#define ATA_CMD_WRITE   0x30

"Write sectors" command

Definition at line 133 of file ata.h.

Referenced by ata_write().

#define ATA_CMD_WRITE_EXT   0x34

"Write sectors (ext)" command

Definition at line 136 of file ata.h.

Referenced by ata_write().

#define ATA_CMD_IDENTIFY   0xec

"Identify" command

Definition at line 139 of file ata.h.

Referenced by ata_identify().

#define ATA_SUPPORTS_LBA48   ( 1 << 10 )

Supports LBA48 flag.

Definition at line 178 of file ata.h.

Referenced by ata_identify().

#define ATA_SECTOR_SIZE   512

ATA sector size.

Definition at line 181 of file ata.h.

Referenced by aoe_rx_ata(), aoe_send_command(), and ata_identify().


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER   ) 

int init_atadev ( struct ata_device ata  ) 

Initialise ATA device.

Parameters:
ata ATA device
Return values:
rc Return status code
Initialises an ATA device. The ata_device::command field and the ATA_FL_SLAVE portion of the ata_device::flags field must already be filled in. This function will configure ata_device::blockdev, including issuing an IDENTIFY DEVICE call to determine the block size and total device size.

Fill in read and write methods, and get device capacity

Definition at line 184 of file ata.c.

References ata_identify(), ata_device::blockdev, and block_device::op.

Referenced by aoeboot().

00184                                            {
00185         /** Fill in read and write methods, and get device capacity */
00186         ata->blockdev.op = &ata_operations;
00187         return ata_identify ( &ata->blockdev );
00188 }


Generated on Tue Apr 6 20:01:48 2010 for gPXE by  doxygen 1.5.7.1