-static void
-issue_command (struct disk *d, uint8_t command)
-{
- struct channel *c = d->channel;
-
- /* Interrupts must be enabled or our semaphore will never be
- up'd by the completion handler. */
- ASSERT (intr_get_level () == IF_ON);
-
- /* Atomically note that we expect an interrupt and send the
- command to the device. */
- intr_disable ();
- c->expecting_interrupt = true;
- outb (reg_command (c), command);
- intr_enable ();
-}
-
-static bool
-input_sector (struct channel *c, void *sector)
-{
- uint8_t status;
-
- ASSERT (sector != NULL);
-
- status = inb (reg_status (c));
- if (status & STA_DRQ)
- {
- /* Command was successful. Read data into SECTOR. */
- insw (reg_data (c), sector, DISK_SECTOR_SIZE / 2);
- return true;
- }
- else
- {
- /* Command failed. */
- return false;
- }
-}
-
-static bool
-output_sector (struct channel *c, const void *sector)
-{
- uint8_t status;
-
- ASSERT (sector != NULL);
-
- status = inb (reg_status (c));
- if (status & STA_DRQ)
- {
- /* Command was successful. Write data into SECTOR. */
- outsw (reg_data (c), sector, DISK_SECTOR_SIZE / 2);
- return true;
- }
- else
- {
- /* Command failed. */
- return false;
- }
-}
-
-static void
-printk_ata_string (char *string, size_t word_cnt)
-{
- int last;
- int i;
-
- for (last = word_cnt * 2 - 1; last >= 0; last--)
- {
- int c = string[last ^ 1];
- if (c != '\0' && !isspace (c))
- break;
- }
-
- for (i = 0; i <= last; i++)
- printk ("%c", string[i ^ 1]);
-}
-