#pragma once

#define ATA_PROGIF_PRIMARY_NATIVE				(1 << 0)
#define ATA_PROGIF_CAN_MODIFY_PRIMARY_NATIVE	(1 << 1)
#define ATA_PROGIF_SECONDARY_NATIVE				(1 << 2)
#define ATA_PROGIF_CAN_MODIFY_SECONDARY_NATIVE	(1 << 3)

#define ATA_PORT_DATA				0x00
#define ATA_PORT_ERROR				0x00
#define ATA_PORT_SECTOR_COUNT		0x02
#define ATA_PORT_LBA0				0x03
#define ATA_PORT_LBA1				0x04
#define ATA_PORT_LBA2				0x05
#define ATA_PORT_DRIVE_SELECT		0x06
#define ATA_PORT_COMMAND			0x07
#define ATA_PORT_STATUS				0x07

#define ATA_PORT_CONTROL			0x10
#define ATA_PORT_ALT_STATUS			0x10

#define ATA_CONTROL_nIEN			0x02

#define ATA_ERROR_AMNF				0x01
#define ATA_ERROR_TKZNF				0x02
#define ATA_ERROR_ABRT				0x04
#define ATA_ERROR_MCR				0x08
#define ATA_ERROR_IDNF				0x10
#define ATA_ERROR_MC				0x20
#define ATA_ERROR_UNC				0x40
#define ATA_ERROR_BBK				0x80

#define ATA_STATUS_ERR				0x01
#define ATA_STATUS_DF				0x02
#define ATA_STATUS_DRQ				0x08
#define ATA_STATUS_BSY				0x80

#define ATA_COMMAND_READ_SECTORS	0x20
#define ATA_COMMAND_READ_DMA		0xC8
#define ATA_COMMAND_READ_DMA_EXT	0x25
#define ATA_COMMAND_WRITE_SECTORS	0x30
#define ATA_COMMAND_WRITE_DMA		0xCA
#define ATA_COMMAND_WRITE_DMA_EXT	0x35
#define ATA_COMMAND_IDENTIFY_PACKET	0xA1
#define ATA_COMMAND_CACHE_FLUSH		0xE7
#define ATA_COMMAND_IDENTIFY		0xEC

#define ATA_IDENTIFY_SIGNATURE		0
#define ATA_IDENTIFY_MODEL			27
#define ATA_IDENTIFY_CAPABILITIES	49
#define ATA_IDENTIFY_LBA_COUNT		60
#define ATA_IDENTIFY_COMMAND_SET	82
#define ATA_IDENTIFY_LBA_COUNT_EXT	100
#define ATA_IDENTIFY_SECTOR_INFO	106
#define ATA_IDENTIFY_SECTOR_WORDS	117

#define ATA_COMMANDSET_LBA48_SUPPORTED	(1 << 26)

#define ATA_CAPABILITIES_LBA (1 << 9)
#define ATA_CAPABILITIES_DMA (1 << 8)
