15#ifndef __ATA_INTERNAL_H__
16#define __ATA_INTERNAL_H__
38#define CF_LE_W(v) le16toh(v)
39#define CF_LE_L(v) le32toh(v)
40#define CT_LE_W(v) htole16(v)
41#define CT_LE_L(v) htole32(v)
43#define ATA_UNDEFINED_VALUE (-1)
46#define ATA_SECTOR_SIZE 512
49#define ATA_MAX_CMD_REG_OFFSET 8
55#define ATA_COMMAND_TYPE_NON_DATA 0
56#define ATA_COMMAND_TYPE_PIO_IN 1
57#define ATA_COMMAND_TYPE_PIO_OUT 2
58#define ATA_COMMAND_TYPE_DMA 3
68#define ATA_COMMAND_NOP 0x00
69#define ATA_COMMAND_READ_SECTORS 0x20
70#define ATA_COMMAND_WRITE_SECTORS 0x30
71#define ATA_COMMAND_READ_VERIFY_SECTORS 0x40
72#define ATA_COMMAND_SEEK 0x70
73#define ATA_COMMAND_EXECUTE_DEVICE_DIAGNOSTIC 0x90
74#define ATA_COMMAND_INITIALIZE_DEVICE_PARAMETERS 0x91
75#define ATA_COMMAND_DOWNLOAD_MICROCODE 0x92
76#define ATA_COMMAND_READ_MULTIPLE 0xc4
77#define ATA_COMMAND_WRITE_MULTIPLE 0xc5
78#define ATA_COMMAND_SET_MULTIPLE_MODE 0xc6
79#define ATA_COMMAND_READ_DMA 0xc8
80#define ATA_COMMAND_WRITE_DMA 0xca
81#define ATA_COMMAND_STANDBY_IMMEDIATE 0xe0
82#define ATA_COMMAND_IDLE_IMMEDIATE 0xe1
83#define ATA_COMMAND_STANDBY 0xe2
84#define ATA_COMMAND_IDLE 0xe3
85#define ATA_COMMAND_READ_BUFFER 0xe4
86#define ATA_COMMAND_CHECK_POWER_MODE 0xe5
87#define ATA_COMMAND_SLEEP 0xe6
88#define ATA_COMMAND_WRITE_BUFFER 0xe8
89#define ATA_COMMAND_IDENTIFY_DEVICE 0xec
90#define ATA_COMMAND_SET_FEATURES 0xef
93#define ATA_COMMAND_MEDIA_LOCK 0xde
94#define ATA_COMMAND_MEDIA_UNLOCK 0xdf
95#define ATA_COMMAND_MEDIA_EJECT 0xed
99#define ATA_COMMAND_RECALIBRATE 0x10
100#define ATA_COMMAND_READ_SECTOR_NON_RETRY 0x21
101#define ATA_COMMAND_READ_LONG_RETRY 0x22
102#define ATA_COMMAND_READ_LONG_NON_RETRY 0x23
103#define ATA_COMMAND_WRITE_SECTOR_NON_RETRY 0x31
104#define ATA_COMMAND_WRITE_LONG_RETRY 0x32
105#define ATA_COMMAND_WRITE_LONG_NON_RETRY 0x33
106#define ATA_COMMAND_WRITE_VERIFY 0x3c
107#define ATA_COMMAND_READ_VERIFY_SECTOR_NON_RETRY 0x41
108#define ATA_COMMAND_FORMAT_TRACK 0x50
109#define ATA_COMMAND_READ_DMA_NON_RETRY 0xc9
110#define ATA_COMMAND_WRITE_DMA_NON_RETRY 0xcb
111#define ATA_COMMAND_ACKNOWLEGE_MEDIA_CHANGE 0xdb
112#define ATA_COMMAND_BOOT_POST_BOOT 0xdc
113#define ATA_COMMAND_BOOT_PRE_BOOT 0xdd
114#define ATA_COMMAND_WRITE_SAME 0xe9
117#define ATA_COMMAND_CFA_REQUEST_EXTENDED_ERROR_CODE 0x03
118#define ATA_COMMAND_CFA_WRITE_SECTORS_WITHOUT_ERASE 0x38
119#define ATA_COMMAND_CFA_TRANSLATE_SECTOR 0x87
120#define ATA_COMMAND_CFA_ERASE_SECTORS 0xc0
121#define ATA_COMMAND_CFA_WRITE_MULTIPLE_WITHOUT_ERASE 0xcd
124#define ATA_COMMAND_DEVICE_RESET 0x08
125#define ATA_COMMAND_PACKET 0xa0
126#define ATA_COMMAND_IDENTIFY_PACKET_DEVICE 0xa1
127#define ATA_COMMAND_SERVICE 0xa2
130#define ATA_COMMAND_SECURITY_SET_PASSWORD 0xf1
131#define ATA_COMMAND_SECURITY_UNLOCK 0xf2
132#define ATA_COMMAND_SECURITY_ERASE_PREPARE 0xf3
133#define ATA_COMMAND_SECURITY_ERASE_UNIT 0xf4
134#define ATA_COMMAND_SECURITY_FREEZE_LOCK 0xf5
135#define ATA_COMMAND_SECURITY_DISABLE_PASSWORD 0xf6
138#define ATA_COMMAND_SMART 0xb0
139#define ATA_COMMAND_READ_DMA_QUEUED 0xc7
140#define ATA_COMMAND_WRITE_DMA_QUEUED 0xcc
141#define ATA_COMMAND_GET_MEDIA_STATUS 0xda
142#define ATA_COMMAND_FLUSH_CACHE 0xe7
143#define ATA_COMMAND_READ_NATIVE_MAX_ADDRESS 0xf8
144#define ATA_COMMAND_SET_MAX_ADDRESS 0xf9
146#define ATA_REGISTERS_VALUE(reg) (1 << (reg))
149#define ATA_IDENT_WORD_RW_MULT 47
150#define ATA_IDENT_WORD_CAPABILITIES 49
151#define ATA_IDENT_WORD_FIELD_VALIDITY 53
152#define ATA_IDENT_WORD_NUM_OF_CURR_LOG_CLNDS 54
153#define ATA_IDENT_WORD_NUM_OF_CURR_LOG_HEADS 55
154#define ATA_IDENT_WORD_NUM_OF_CURR_LOG_SECS 56
155#define ATA_IDENT_WORD_MULT_SECS 59
156#define ATA_IDENT_WORD_NUM_OF_USR_SECS0 60
157#define ATA_IDENT_WORD_NUM_OF_USR_SECS1 61
158#define ATA_IDENT_WORD_PIO_SPPRTD 64
160#define ATA_IDENT_BIT_VALID 0x02
166#define ATA_REGISTERS_POSITION 0xfc
168#define ATA_MAX_RTEMS_INT_VEC_NUMBER 255
170#define ATA_MAX_NAME_LENGTH 10
173#define ATA_DEV0_PASSED_DEV1_PASSED_OR_NOT_PRSNT 0x01
174#define ATA_DEV0_PASSED_DEV1_FAILED 0x81
175#define ATA_DEV1_PASSED_DEV0_FAILED 0x80
180#define ATA_DEV_INFO(controller_minor, dev) \
181 ata_ide_ctrls[controller_minor].device[dev]
211#define ATA_EXEC_CALLBACK(areq, status) \
213 if ((areq)->breq != NULL) \
214 rtems_blkdev_request_done((areq)->breq, status); \
218typedef enum ata_msg_type_s {
222 ATA_MSG_PROCESS_NEXT_EVT
233#define ATA_FILL_MSG(msg, evt_type, ctrl, err)\
235 msg.type = evt_type;\
236 msg.ctrl_minor = ctrl;\
240#define ATA_SEND_EVT(msg, type, ctrl, err)\
242 rtems_status_code rc;\
243 ATA_FILL_MSG(msg, type, ctrl, err);\
244 rc = rtems_message_queue_send(ata_queue_id, &msg,\
245 sizeof(ata_queue_msg_t));\
246 if (rc != RTEMS_SUCCESSFUL)\
247 rtems_fatal_error_occurred(RTEMS_INTERNAL_ERROR);\
277 uint32_t lba_sectors;
282 uint16_t modes_available;
283 uint16_t mode_active;
308 uint16_t *sector_buffer,
312void ata_process_request_on_init_phase(
Block Device Disk Management API.
uint32_t rtems_device_minor_number
This integer type represents the minor number of devices.
Definition: io.h:115
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:85
Objects_Id rtems_id
This type represents RTEMS object identifiers.
Definition: types.h:94
This header file defines the RTEMS Classic API.
This structure represents a chain node.
Definition: chain.h:78
Definition: ata_internal.h:271
Definition: ata_internal.h:291
Definition: ata_internal.h:263
Definition: ata_internal.h:254
Definition: ata_internal.h:226
Definition: ata_internal.h:186
Definition: ata_internal.h:193
Definition: ata_internal.h:298
The block device transfer request is used to read or write a number of blocks from or to the device.
Definition: blkdev.h:102
Block device scatter or gather buffer structure.
Definition: blkdev.h:68
This header file provides interfaces of the system endianness support.
This union represents a chain control block.
Definition: chain.h:96