KolibriOS kernel
ahci.inc File Reference

Classes

struct  AHCI_DATA
 
struct  HBA_MEM
 Generic Host Control registers. More...
 
struct  HBA_PORT
 Port Control registers. More...
 
struct  HBA_CMD_HDR
 Command header structure, size = 32 bytes. More...
 
struct  HBA_PRDT_ENTRY
 Physical region descriptor table entry, size = 16 bytes. More...
 
struct  HBA_CMD_TBL
 
struct  PORT_DATA
 Contains virtual mappings for port phys memory regions. More...
 
struct  FIS_REG_H2D
 Register FIS ? Host to Device. More...
 
struct  FIS_REG_D2H
 Register FIS ? Device to Host. More...
 
struct  FIS_DATA
 Data FIS ? Bidirectional. More...
 
struct  FIS_PIO_SETUP
 PIO Setup ? Device to Host. More...
 
struct  FIS_DMA_SETUP
 DMA Setup ? Device to Host. More...
 
struct  FIS_DEV_BITS
 Set device bits FIS - device to host. More...
 
struct  HBA_FIS
 

Functions

void ahci_port_identify (dword pdata)
 Identify drive on port ; TODO check in: pdata - address of PORT_DATA structure. More...
 
void ahci_querymedia (arg_t pdata, arg_t mediainfo)
 
void ahci_rw_sectors (dword pdata, dword vbuf, qword startsector, dword numsectors, dword is_write)
 Read/write sectors return value: 0 = success, otherwise = error. More...
 
void ahci_read (dword pdata, dword buffer, qword startsector, dword numsectors_ptr)
 Read sectors return value: 0 = success, otherwise = error. More...
 
void ahci_write (dword pdata, dword buffer, qword startsector, dword numsectors_ptr)
 Write sectors return value: 0 = success, otherwise = error. More...
 
void ahci_port_wait (dword port, dword timeout)
 waits until the port is no longer busy before issuing a new command in: [port] - address of HBA_PORT structure [timeout] - timeout (in iterations) out: eax = 0 if success, 1 if timeout expired More...
 
void ahci_port_cmd_wait (dword port, dword cmdslot)
 Wait for command completion in: [port] - address of HBA_PORT structure [cmdslot] - number of command slot out: eax = 0 if success, 1 if error , timeout: dword. More...
 
void ahci_port_rebase (dword port, dword portno, dword pdata)
 ------------------------------------------------------------------------— in: port - address of HBA_PORT structure portno - port index (0..31) pdata - address of PORT_DATA structure More...
 
void _memset (dword dest, byte val, dword cnt)
 doesnt clobber any registers More...
 
void swap_bytes_in_words (dword base, dword len)
 Swaps byte order in words base - address of first word len - how many words to swap bytes in doesnt clobber any registers. More...
 

Variables

AHCI_DATA ahci_controller
 
rb port_data_arr
 
MUTEX ahci_mutex
 
label ahci_callbacks
 
db hd_name
 
dd hd_counter
 
label ahci_init
 
rb modelstr
 
dd cmdslot
 
dd cmdheader
 
dd cmdtable
 
dd buf_phys
 
dd buf_virt
 
dd vbuf_orig
 
dd vbuf_len
 
dd phys_region_start
 
dd new_phys_region_start
 
dd cur_prd
 
dd cur_phys
 
dd dbc
 
dd cur_phys_page
 
dd next_phys_page
 
dd cur_antioffset
 
dd prdt_bytes_total
 
rb tmpstr
 
dd numsectors
 
label ahci_start_cmd
 Start command engine in: eax - address of HBA_PORT structure. More...
 
label ahci_stop_cmd
 Stop command engine in: eax - address of HBA_PORT structure. More...
 
dd phys_page1
 
dd virt_page1
 
dd phys_page23
 
dd virt_page23
 
dd tmp
 
label ahci_find_cmdslot
 --------------------------------------------------------— ; TODO check Find a free command list slot in: eax - address of HBA_PORT structure out: eax - if not found -1, else slot index More...
 

Function Documentation

◆ _memset()

void _memset ( dword  dest,
byte  val,
dword  cnt 
)

doesnt clobber any registers

Source
blkdev/ahci.inc:1373

◆ ahci_port_cmd_wait()

void ahci_port_cmd_wait ( dword  port,
dword  cmdslot 
)

Wait for command completion in: [port] - address of HBA_PORT structure [cmdslot] - number of command slot out: eax = 0 if success, 1 if error , timeout: dword.

Source
blkdev/ahci.inc:1175

◆ ahci_port_identify()

void ahci_port_identify ( dword  pdata)

Identify drive on port ; TODO check in: pdata - address of PORT_DATA structure.

Source
blkdev/ahci.inc:626

◆ ahci_port_rebase()

void ahci_port_rebase ( dword  port,
dword  portno,
dword  pdata 
)

------------------------------------------------------------------------— in: port - address of HBA_PORT structure portno - port index (0..31) pdata - address of PORT_DATA structure

Source
blkdev/ahci.inc:1227

◆ ahci_port_wait()

void ahci_port_wait ( dword  port,
dword  timeout 
)

waits until the port is no longer busy before issuing a new command in: [port] - address of HBA_PORT structure [timeout] - timeout (in iterations) out: eax = 0 if success, 1 if timeout expired

Source
blkdev/ahci.inc:1148

◆ ahci_querymedia()

void ahci_querymedia ( arg_t  pdata,
arg_t  mediainfo 
)

◆ ahci_read()

void ahci_read ( dword  pdata,
dword  buffer,
qword  startsector,
dword  numsectors_ptr 
)

Read sectors return value: 0 = success, otherwise = error.

Source
blkdev/ahci.inc:1019

◆ ahci_rw_sectors()

void ahci_rw_sectors ( dword  pdata,
dword  vbuf,
qword  startsector,
dword  numsectors,
dword  is_write 
)

Read/write sectors return value: 0 = success, otherwise = error.

Source
blkdev/ahci.inc:761

◆ ahci_write()

void ahci_write ( dword  pdata,
dword  buffer,
qword  startsector,
dword  numsectors_ptr 
)

Write sectors return value: 0 = success, otherwise = error.

Source
blkdev/ahci.inc:1074

◆ swap_bytes_in_words()

void swap_bytes_in_words ( dword  base,
dword  len 
)

Swaps byte order in words base - address of first word len - how many words to swap bytes in doesnt clobber any registers.

Source
blkdev/ahci.inc:1388

Variable Documentation

◆ ahci_callbacks

label ahci_callbacks

◆ ahci_controller

AHCI_DATA ahci_controller
Initial value
Source
blkdev/ahci.inc:318

◆ ahci_find_cmdslot

label ahci_find_cmdslot

--------------------------------------------------------— ; TODO check Find a free command list slot in: eax - address of HBA_PORT structure out: eax - if not found -1, else slot index

Source
blkdev/ahci.inc:1338

◆ ahci_init

label ahci_init

◆ ahci_mutex

MUTEX ahci_mutex
Initial value
Source
blkdev/ahci.inc:320

◆ ahci_start_cmd

label ahci_start_cmd

Start command engine in: eax - address of HBA_PORT structure.

Source
blkdev/ahci.inc:1120

◆ ahci_stop_cmd

label ahci_stop_cmd

Stop command engine in: eax - address of HBA_PORT structure.

Source
blkdev/ahci.inc:1133

◆ buf_phys

dd buf_phys
Initial value
?
Source
blkdev/ahci.inc:631

◆ buf_virt

dd buf_virt
Initial value
?
Source
blkdev/ahci.inc:632

◆ cmdheader

dd cmdheader
Initial value
?
Source
blkdev/ahci.inc:629
Initial value
?
Source
blkdev/ahci.inc:764

◆ cmdslot

dd cmdslot
Initial value
?
Source
blkdev/ahci.inc:628
Initial value
?
Source
blkdev/ahci.inc:763

◆ cmdtable

dd cmdtable
Initial value
?
Source
blkdev/ahci.inc:630
Initial value
?
Source
blkdev/ahci.inc:765

◆ cur_antioffset

dd cur_antioffset
Initial value
?
Source
blkdev/ahci.inc:775

◆ cur_phys

dd cur_phys
Initial value
?
Source
blkdev/ahci.inc:771

◆ cur_phys_page

dd cur_phys_page
Initial value
?
Source
blkdev/ahci.inc:773

◆ cur_prd

dd cur_prd
Initial value
?
Source
blkdev/ahci.inc:770

◆ dbc

dd dbc
Initial value
?
Source
blkdev/ahci.inc:772

◆ hd_counter

dd hd_counter
Initial value
0
Source
blkdev/ahci.inc:336

◆ hd_name

db hd_name
Initial value
'hd', 0, 0, 0
Source
blkdev/ahci.inc:335

◆ modelstr

rb modelstr
Initial value
42
Source
blkdev/ahci.inc:623

◆ new_phys_region_start

dd new_phys_region_start
Initial value
?
Source
blkdev/ahci.inc:769

◆ next_phys_page

dd next_phys_page
Initial value
?
Source
blkdev/ahci.inc:774

◆ numsectors

dd numsectors
Initial value
?
Source
blkdev/ahci.inc:1021
Initial value
?
Source
blkdev/ahci.inc:1076

◆ phys_page1

dd phys_page1
Initial value
?
Source
blkdev/ahci.inc:1229

◆ phys_page23

dd phys_page23
Initial value
?
Source
blkdev/ahci.inc:1231

◆ phys_region_start

dd phys_region_start
Initial value
?
Source
blkdev/ahci.inc:768

◆ port_data_arr

rb port_data_arr
Initial value
(sizeof.PORT_DATA*AHCI_MAX_PORTS)
Source
blkdev/ahci.inc:319

◆ prdt_bytes_total

dd prdt_bytes_total
Initial value
?
Source
blkdev/ahci.inc:776

◆ tmp

dd tmp
Initial value
?
Source
blkdev/ahci.inc:1233

◆ tmpstr

rb tmpstr
Initial value
16
Source
blkdev/ahci.inc:1015

◆ vbuf_len

dd vbuf_len
Initial value
?
Source
blkdev/ahci.inc:767

◆ vbuf_orig

dd vbuf_orig
Initial value
?
Source
blkdev/ahci.inc:766

◆ virt_page1

dd virt_page1
Initial value
?
Source
blkdev/ahci.inc:1230

◆ virt_page23

dd virt_page23
Initial value
?
Source
blkdev/ahci.inc:1232