summaryrefslogtreecommitdiff
path: root/src/kernel/ata.h
blob: 7c42cdbe8eef010fe87f62521e9b47fba2edfd68 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
enum {
  ATA_STATUS_BUSY        = 0x80,
  ATA_STATUS_DRIVE_READY = 0x40,
  ATA_STATUS_DRIVE_FAULT = 0x20,
  ATA_STATUS_SEEK_DONE   = 0x10,
  ATA_STATUS_DATA_READY  = 0x08,
  ATA_STATUS_CORRECTED   = 0x04,
  ATA_STATUS_INDEX       = 0x02,
  ATA_STATUS_ERROR       = 0x01
};

enum {
  ATA_ERROR_BAD_BLOCK      = 0x80,
  ATA_ERROR_UNCORRECTABLE  = 0x40,
  ATA_ERROR_MEDIA_SWAPPED  = 0x20,
  ATA_ERROR_NO_ID_MARK     = 0x10,
  ATA_ERROR_MEDIA_SWAPPING = 0x08,
  ATA_ERROR_ABORTED_CMD    = 0x04,
  ATA_ERROR_NO_TRACK_ZERO  = 0x02,
  ATA_ERROR_NO_ADDR_MARK   = 0x01
};

enum {
  ATA_CMD_READ      = 0x20,
  ATA_CMD_WRITE     = 0x30,
  ATA_CMD_WRITE_EXT = 0x34,
  ATA_CMD_READ_EXT  = 0x40,
  ATAPI_CMD         = 0xa0,
  ATAPI_CMD_ID      = 0xa1,
  ATA_CMD_FLUSH     = 0xe7,
  ATA_CMD_FLUSH_EXT = 0xea,
  ATA_CMD_ID        = 0xec,
};

enum {
  ATAPI_CMD_EJECT = 0x1b,
  ATAPI_CMD_READ  = 0xa8
};

enum {
  ATA_REG_DATA       = 0x0,
  ATA_REG_ERROR      = 0x1,
  ATA_REG_FEAT       = 0x1,
  ATA_REG_COUNT_LOW  = 0x2,
  ATA_REG_LBA0       = 0x3,
  ATA_REG_LBA1       = 0x4,
  ATA_REG_LBA2       = 0x5,
  ATA_REG_SELECT     = 0x6,
  ATA_REG_CMD        = 0x7,
  ATA_REG_STATUS     = 0x7,
  ATA_REG_COUNT_HIGH = 0x8,
  ATA_REG_LBA3       = 0x9,
  ATA_REG_LBA4       = 0xa,
  ATA_REG_LBA5       = 0xb,
  ATA_REG_CONTROL    = 0xc,
  ATA_REG_ALT_STATUS = 0xc,
  ATA_REG_ADDR       = 0xd
};

enum {
  ATA_MASTER_SELECT = 0xa0,
  ATA_SLAVE_SELECT  = 0xb0
};

enum {
  ATA_SET_EXT = 0x04000000
};

enum {
  ATA_CAP_LBA = 0x00000200
};

enum {
  ATA_CONTROL_NO_IRQS = 0x02
};