doc: add moar docs

This commit is contained in:
d0p1 🏳️‍⚧️ 2024-07-24 15:24:52 +02:00
parent 67e14345ff
commit 4105a83947
3 changed files with 66 additions and 4 deletions

View file

@ -7,7 +7,7 @@ struc Buffer {
.block dd ? .block dd ?
.ulock dd ? .ulock dd ?
.refcount dd ? .refcount dd ?
.data db 512 dup(?) .data db 1024 dup(?)
} }
DEFN Buffer DEFN Buffer

View file

@ -14,9 +14,26 @@ ATA_CHAN1_IO = 0x170
ATA_CHAN2_IO = 0x1E8 ATA_CHAN2_IO = 0x1E8
ATA_CHAN3_IO = 0x168 ATA_CHAN3_IO = 0x168
;; Constant: ATA_DATA
;; Read/Write data
ATA_DATA = 0x0 ATA_DATA = 0x0
;; Constant: ATA_ERROR ;; Constant: ATA_ERROR
;; ;;
;; > ┌────┬─────┬────┬───┬────┬──┬───┬───┐
;; > │AMNF│TKZNF│ABRT│MCR│IDNF│MC│UNC│BBK│
;; > └────┴─────┴────┴───┴────┴──┴───┴───┘
;; > 7 6 5 4 3 2 1 0
;;
;; AMNF - Address mark not found.
;; TKZNF - Track zero not found.
;; ABRT - Aborted command.
;; MCR - Media change request.
;; IDNF - ID not found.
;; MC - Media changed
;; UNC - Uncorrectable data error.
;; BBK - Bad Block detected.
;;
ATA_ERROR = 0x1 ATA_ERROR = 0x1
ATA_ERROR_AMNF = 0x01 ATA_ERROR_AMNF = 0x01
ATA_ERROR_TKZNF = 0x02 ATA_ERROR_TKZNF = 0x02
@ -27,11 +44,21 @@ ATA_ERROR_MC = 0x20
ATA_ERROR_UNC = 0x40 ATA_ERROR_UNC = 0x40
ATA_ERROR_BBK = 0x80 ATA_ERROR_BBK = 0x80
;; Constant: ATA_FEATURES
ATA_FEATURES = 0x1 ATA_FEATURES = 0x1
;; Constant: ATA_SECCOUNT
ATA_SECCOUNT = 0x2 ATA_SECCOUNT = 0x2
;; Constant: ATA_SECNUM
ATA_SECNUM = 0x3 ATA_SECNUM = 0x3
;; Constant: ATA_CYLLO
ATA_CYLLO = 0x4 ATA_CYLLO = 0x4
;; Constant: ATA_CYLHI
ATA_CYLHI = 0x5 ATA_CYLHI = 0x5
;; Constant: ATA_DRVHEAD ;; Constant: ATA_DRVHEAD
;; Drive/Head register ;; Drive/Head register
;; ;;
@ -39,8 +66,18 @@ ATA_DRVHEAD = 0x6
ATA_DRVHEAD_DRV = 0x10 ATA_DRVHEAD_DRV = 0x10
ATA_DRVHEAD_LBA = 0x40 ATA_DRVHEAD_LBA = 0x40
;; Constant: ATA_COMMAND
ATA_COMMAND = 0x7 ATA_COMMAND = 0x7
;; Constant: ATA_CMD_RESTORE
;; Recalibrate
ATA_CMD_RESTORE = 0x10
;; Constant: ATA_CMD_DIAGNOSTIC
;; Execute device diagnostic
ATA_CMD_DIAGNOSTIC = 0x90
;; Constant: ATA_CMD_IDENTIFY
ATA_CMD_IDENTIFY = 0xA0
;; Constant: ATA_STATUS ;; Constant: ATA_STATUS
;; ;;
ATA_STATUS = 0x7 ATA_STATUS = 0x7
@ -60,14 +97,13 @@ ATA_CTRL_nIEN = 0x02
ATA_CTRL_SRST = 0x04 ATA_CTRL_SRST = 0x04
ATA_CTRL_HOB = 0x80 ATA_CTRL_HOB = 0x80
;; Constant: ATA_DRVADDR
;;
ATA_DRVADDR = 0x1 ATA_DRVADDR = 0x1
ATA_DRVADDR_DS0 = 0x01 ATA_DRVADDR_DS0 = 0x01
ATA_DRVADDR_DS1 = 0x02 ATA_DRVADDR_DS1 = 0x02
ATA_DRVADDR_WTG = 0x40 ATA_DRVADDR_WTG = 0x40
ATA_CMD_RESTORE = 0x10
ATA_CMD_DIAGNOSTIC = 0x90
ATA_CMD_IDENTIFY = 0xA0
;; Function: ata_wait ;; Function: ata_wait
;; ;;
@ -88,6 +124,7 @@ ata_wait:
@@: @@:
ret ret
;; Function: ata_select
ata_select: ata_select:
ret ret
@ -215,4 +252,7 @@ aAtaChans:
dw ATA_CHAN3_IO dw ATA_CHAN3_IO
.end: .end:
ata_bdevsw:
dd 0
szMsgAtaFound db "ATA: hd%u found", 0 szMsgAtaFound db "ATA: hd%u found", 0

View file

@ -15,6 +15,14 @@ struc Device {
} }
DEFN Device DEFN Device
;; Struc: BlkDev
;;
;; .open - Open the device in preparation for I/O operations
;; .strategy - Start a read or write operation, and return immediately.
;; .close - Close a device.
;; .dump - Write all physical memory to the device.
;; .psize - Return the size of a disk-drive partition.
;;
struc BlkDev { struc BlkDev {
.open dd ? .open dd ?
.strategy dd ? .strategy dd ?
@ -24,6 +32,18 @@ struc BlkDev {
.psize dd ? .psize dd ?
} }
;; Struc: CharDev
;;
;; .open - open the device.
;; .close - close the device..
;; .read - do an input operation.
;; .write - do an output operation.
;; .ioctl - do an I/O control operation.
;; .select - poll device for I/O readiness.
;; .stop - stop output on the device.
;; .mmap - map device offset to memory location
;; .reset - reinitialize device after a bus reset.
;;
struc CharDev { struc CharDev {
.open dd ? .open dd ?
.close dd ? .close dd ?
@ -38,6 +58,7 @@ struc CharDev {
aBlockDevices: aBlockDevices:
dd floppy_bdevsw dd floppy_bdevsw
dd ata_bdevsw
.end: .end:
aCharDevices: aCharDevices:
@ -54,6 +75,7 @@ aDevices:
dd ata_device dd ata_device
.end: .end:
;; Function: dev_init
dev_init: dev_init:
mov ecx, aDevices mov ecx, aDevices
@@: @@: