|
| #define | reg_data(CHANNEL) ((CHANNEL)->reg_base + 0) /* Data. */ |
| |
| #define | reg_error(CHANNEL) ((CHANNEL)->reg_base + 1) /* Error. */ |
| |
| #define | reg_nsect(CHANNEL) ((CHANNEL)->reg_base + 2) /* Sector Count. */ |
| |
| #define | reg_lbal(CHANNEL) ((CHANNEL)->reg_base + 3) /* LBA 0:7. */ |
| |
| #define | reg_lbam(CHANNEL) ((CHANNEL)->reg_base + 4) /* LBA 15:8. */ |
| |
| #define | reg_lbah(CHANNEL) ((CHANNEL)->reg_base + 5) /* LBA 23:16. */ |
| |
| #define | reg_device(CHANNEL) ((CHANNEL)->reg_base + 6) /* Device/LBA 27:24. */ |
| |
| #define | reg_status(CHANNEL) ((CHANNEL)->reg_base + 7) /* Status (r/o). */ |
| |
| #define | reg_command(CHANNEL) reg_status (CHANNEL) /* Command (w/o). */ |
| |
| #define | reg_ctl(CHANNEL) ((CHANNEL)->reg_base + 0x206) /* Control (w/o). */ |
| |
| #define | reg_alt_status(CHANNEL) reg_ctl (CHANNEL) /* Alt Status (r/o). */ |
| |
| #define | STA_BSY 0x80 /* Busy. */ |
| |
| #define | STA_DRDY 0x40 /* Device Ready. */ |
| |
| #define | STA_DRQ 0x08 /* Data Request. */ |
| |
| #define | CTL_SRST 0x04 /* Software Reset. */ |
| |
| #define | DEV_MBS 0xa0 /* Must be set. */ |
| |
| #define | DEV_LBA 0x40 /* Linear based addressing. */ |
| |
| #define | DEV_DEV 0x10 /* Select device: 0=master, 1=slave. */ |
| |
| #define | CMD_IDENTIFY_DEVICE 0xec /* IDENTIFY DEVICE. */ |
| |
| #define | CMD_READ_SECTOR_RETRY 0x20 /* READ SECTOR with retries. */ |
| |
| #define | CMD_WRITE_SECTOR_RETRY 0x30 /* WRITE SECTOR with retries. */ |
| |
| #define | CHANNEL_CNT 2 |
| |
|
| static void | reset_channel (struct channel *) |
| |
| static bool | check_device_type (struct disk *) |
| |
| static void | identify_ata_device (struct disk *) |
| |
| static void | select_sector (struct disk *, disk_sector_t) |
| |
| static void | issue_pio_command (struct channel *, uint8_t command) |
| |
| static void | input_sector (struct channel *, void *) |
| |
| static void | output_sector (struct channel *, const void *) |
| |
| static void | wait_until_idle (const struct disk *) |
| |
| static bool | wait_while_busy (const struct disk *) |
| |
| static void | select_device (const struct disk *) |
| |
| static void | select_device_wait (const struct disk *) |
| |
| static void | interrupt_handler (struct intr_frame *) |
| |
| void | disk_init (void) |
| |
| void | disk_print_stats (void) |
| |
| struct disk * | disk_get (int chan_no, int dev_no) |
| |
| disk_sector_t | disk_size (struct disk *d) |
| |
| void | disk_read (struct disk *d, disk_sector_t sec_no, void *buffer) |
| |
| void | disk_write (struct disk *d, disk_sector_t sec_no, const void *buffer) |
| |
| static void | print_ata_string (char *string, size_t size) |
| |
| static void | inspect_read_cnt (struct intr_frame *f) |
| |
| static void | inspect_write_cnt (struct intr_frame *f) |
| |
| void | register_disk_inspect_intr (void) |
| |