diff --git a/kernel/drivers/atapi/ata.c b/kernel/drivers/atapi/ata.c new file mode 100644 index 0000000..e69de29 diff --git a/kernel/drivers/atapi/ata.h b/kernel/drivers/atapi/ata.h new file mode 100644 index 0000000..abaa7c6 --- /dev/null +++ b/kernel/drivers/atapi/ata.h @@ -0,0 +1,60 @@ +#ifndef KATA_H +#define KATA_H + +#include + +#define IDE_PRIMARY_IO_BASE 0x1F0 +#define IDE_PRIMARY_CRTL_BASE 0x3F6 + +#define IDE_SECONDARY_IO_BASE 0x170 +#define IDE_SECONDARY_CRTL_BASE 0x376 + +#define IO_DATA_REG 0x00 +#define IO_ERROR_REG 0x01 +#define IO_FEATURE_REG 0x01 +#define IO_SECTOR_COUNT_REG 0x02 +#define IO_SECTOR_NUM_REG 0x03 +#define IO_LBA_LO_REG 0x03 +#define IO_CYL_LO_REG 0x04 +#define IO_LBA_MID_REG 0x04 +#define IO_LBA_HI_REG 0x05 +#define IO_CYL_HI_REG 0x05 +#define IO_DRIVE_SELECT_REG 0x06 +#define IO_STATUS_REG 0x07 +#define IO_CMD_REG 0x07 + +#define CTRL_ALT_STATUS_REG 0x00 +#define CTRL_DEV_CTRL_REG 0x00 +#define CTRL_DRIVE_ADDR_REG 0x01 + +#define ERROR_REG_AMNF 0b00000001 // Address mark not found +#define ERROR_REG_TKZNF 0b00000010 // Track zero not found +#define ERROR_REG_ABRT 0b00000100 // Aborted command +#define ERROR_REG_MCR 0b00001000 // Media change request +#define ERROR_REG_IDNF 0b00010000 // ID not found +#define ERROR_REG_MC 0b00100000 // Media changed +#define ERROR_REG_UNC 0b01000000 // Uncorrectable data error +#define ERROR_REG_BBK 0b10000000 // Bad Block detected + +#define DRIVE_SELECT_REG_BN 0b00000111 +#define DRIVE_SELECT_REG_DRV 0b00010000 +#define DRIVE_SELECT_REG_LBAA 0b01000000 + +#define STATUS_REG_ERR 0b00000001 +#define STATUS_REG_IDX 0b00000010 +#define STATUS_REG_CORR 0b00000100 +#define STATUS_REG_DRQ 0b00001000 +#define STATUS_REG_SRV 0b00010000 +#define STATUS_REG_DF 0b00100000 +#define STATUS_REG_RDY 0b01000000 +#define STATUS_REG_BSY 0b10000000 + +#define DEV_CTRL_REG_nIEN 0b00000001 +#define DEV_CTRL_REG_SRST 0b00000010 +#define DEV_CTRL_REG_HOB 0b10000000 + +#define DRIVE_ADDR_REG_DS0 0b00000001 +#define DRIVE_ADDR_REG_DS1 0b00000010 +#define DRIVE_ADDR_REG 0b00111100 + +#endif \ No newline at end of file diff --git a/kernel/drivers/atapi/ata_stubs.S b/kernel/drivers/atapi/ata_stubs.S new file mode 100644 index 0000000..fab91c8 --- /dev/null +++ b/kernel/drivers/atapi/ata_stubs.S @@ -0,0 +1,7 @@ +#include "drivers/atapi/ata.h" + +.code32 + +.global ident_drives +ident_drives: + ret \ No newline at end of file