Rev 4581 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4581 | Rev 4718 | ||
---|---|---|---|
Line 52... | Line 52... | ||
52 | #include <fibril_sync.h> |
52 | #include <fibril_sync.h> |
53 | #include <devmap.h> |
53 | #include <devmap.h> |
54 | #include <sys/types.h> |
54 | #include <sys/types.h> |
55 | #include <errno.h> |
55 | #include <errno.h> |
56 | #include <bool.h> |
56 | #include <bool.h> |
- | 57 | #include <task.h> |
|
57 | 58 | ||
58 | #include "ata_bd.h" |
59 | #include "ata_bd.h" |
59 | 60 | ||
60 | #define NAME "ata_bd" |
61 | #define NAME "ata_bd" |
61 | 62 | ||
Line 93... | Line 94... | ||
93 | 94 | ||
94 | if (ata_bd_init() != EOK) |
95 | if (ata_bd_init() != EOK) |
95 | return -1; |
96 | return -1; |
96 | 97 | ||
97 | /* Put drives to reset, disable interrupts. */ |
98 | /* Put drives to reset, disable interrupts. */ |
98 | printf("Reset drives...\n"); |
99 | printf("Reset drives... "); |
- | 100 | fflush(stdout); |
|
- | 101 | ||
99 | pio_write_8(&ctl->device_control, DCR_SRST); |
102 | pio_write_8(&ctl->device_control, DCR_SRST); |
100 | /* FIXME: Find out how to do this properly. */ |
103 | /* FIXME: Find out how to do this properly. */ |
101 | async_usleep(100); |
104 | async_usleep(100); |
102 | pio_write_8(&ctl->device_control, 0); |
105 | pio_write_8(&ctl->device_control, 0); |
103 | 106 | ||
104 | do { |
107 | do { |
105 | status = pio_read_8(&cmd->status); |
108 | status = pio_read_8(&cmd->status); |
106 | } while ((status & SR_BSY) != 0); |
109 | } while ((status & SR_BSY) != 0); |
107 | printf("Done\n"); |
110 | printf("Done\n"); |
108 | 111 | ||
109 | printf("Status = 0x%x\n", pio_read_8(&cmd->status)); |
- | |
110 | - | ||
111 | (void) drive_identify(0, &disk[0]); |
112 | (void) drive_identify(0, &disk[0]); |
112 | (void) drive_identify(1, &disk[1]); |
113 | (void) drive_identify(1, &disk[1]); |
113 | 114 | ||
114 | n_disks = 0; |
115 | n_disks = 0; |
115 | 116 | ||
Line 133... | Line 134... | ||
133 | printf("No disks detected.\n"); |
134 | printf("No disks detected.\n"); |
134 | return -1; |
135 | return -1; |
135 | } |
136 | } |
136 | 137 | ||
137 | printf(NAME ": Accepting connections\n"); |
138 | printf(NAME ": Accepting connections\n"); |
- | 139 | task_retval(0); |
|
138 | async_manager(); |
140 | async_manager(); |
139 | 141 | ||
140 | /* Not reached */ |
142 | /* Not reached */ |
141 | return 0; |
143 | return 0; |
142 | } |
144 | } |
Line 145... | Line 147... | ||
145 | { |
147 | { |
146 | uint16_t data; |
148 | uint16_t data; |
147 | uint8_t status; |
149 | uint8_t status; |
148 | size_t i; |
150 | size_t i; |
149 | 151 | ||
150 | printf("Identify drive %d\n", disk_id); |
152 | printf("Identify drive %d... ", disk_id); |
- | 153 | fflush(stdout); |
|
- | 154 | ||
151 | pio_write_8(&cmd->drive_head, ((disk_id != 0) ? DHR_DRV : 0)); |
155 | pio_write_8(&cmd->drive_head, ((disk_id != 0) ? DHR_DRV : 0)); |
152 | async_usleep(100); |
156 | async_usleep(100); |
153 | pio_write_8(&cmd->command, CMD_IDENTIFY_DRIVE); |
157 | pio_write_8(&cmd->command, CMD_IDENTIFY_DRIVE); |
154 | 158 | ||
155 | status = pio_read_8(&cmd->status); |
159 | status = pio_read_8(&cmd->status); |
156 | printf("Status = 0x%x\n", status); |
- | |
157 | 160 | ||
158 | d->present = false; |
161 | d->present = false; |
159 | 162 | ||
160 | /* |
163 | /* |
161 | * Detect if drive is present. This is Qemu only! Need to |
164 | * Detect if drive is present. This is Qemu only! Need to |