#include "disk.h"
#include <stdbool.h>
-#include "debug.h"
-#include "io.h"
-#include "interrupt.h"
-#include "lib.h"
-#include "synch.h"
#include "timer.h"
+#include "lib/debug.h"
+#include "lib/lib.h"
+#include "threads/io.h"
+#include "threads/interrupt.h"
+#include "threads/synch.h"
/* ATA command block port addresses. */
#define reg_data(CHANNEL) ((CHANNEL)->reg_base + 0) /* Data. */
int dev_no; /* Device 0 or 1 for master or slave. */
bool is_ata; /* 1=This device is an ATA disk. */
- disk_sector_no capacity; /* Capacity in sectors (if is_ata is true). */
+ disk_sector_t capacity; /* Capacity in sectors (if is_ata is true). */
};
/* An ATA channel (aka controller).
static bool check_device_type (struct disk *);
static void identify_ata_device (struct disk *);
-static void select_sector (struct disk *, disk_sector_no);
+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 *);
}
/* Register interrupt handler. */
- intr_register (c->irq, 0, IF_OFF, interrupt_handler, c->name);
+ intr_register (c->irq, 0, INTR_OFF, interrupt_handler, c->name);
/* Reset hardware. */
reset_channel (c);
/* Returns the size of disk D, measured in DISK_SECTOR_SIZE-byte
sectors. */
-disk_sector_no
+disk_sector_t
disk_size (struct disk *d)
{
ASSERT (d != NULL);
/* Reads sector SEC_NO from disk D into BUFFER, which must have
room for DISK_SECTOR_SIZE bytes. */
void
-disk_read (struct disk *d, disk_sector_no sec_no, void *buffer)
+disk_read (struct disk *d, disk_sector_t sec_no, void *buffer)
{
struct channel *c;
DISK_SECTOR_SIZE bytes. Returns after the disk has
acknowledged receiving the data. */
void
-disk_write (struct disk *d, disk_sector_no sec_no, const void *buffer)
+disk_write (struct disk *d, disk_sector_t sec_no, const void *buffer)
{
struct channel *c;
writes SEC_NO to the disk's sector selection registers. (We
use LBA mode.) */
static void
-select_sector (struct disk *d, disk_sector_no sec_no)
+select_sector (struct disk *d, disk_sector_t sec_no)
{
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);
+ ASSERT (intr_get_level () == INTR_ON);
c->expecting_interrupt = true;
outb (reg_command (c), command);