KolibriOS kernel
ahci.inc File Reference

Classes

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
 
struct  AHCI_CTR
 AHCI controller structure. More...
 

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, note: currently work for SATA, not SATAPI 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 out: rebases port and fills pdata with mappings More...
 
void ahci_find_cmdslot (dword pdata)
 --------------------------------------------------------— ; TODO check Find a free command list slot in: pdata - address of HBA_PORT structure out: eax - if not found -1, else slot index 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_CTR ctr1_data
 
AHCI_CTR ctr2_data
 
AHCI_CTR ctr3_data
 
AHCI_CTR ctr4_data
 
AHCI_CTR ctr5_data
 
AHCI_CTR ctr6_data
 
AHCI_CTR ctr7_data
 
AHCI_CTR ctr8_data
 
dd ctr_ptr
 
label ahci_callbacks
 
db hd_name
 
dd sata_dev_counter
 sata devices counter More...
 
dd ctr_counter
 TODO: satapi_dev_counter dd 0 ; satapi devices (optical drives) counter controllers counter. More...
 
label ahci_init
 --------------------------------------------------------------------— detect ahci controller and initialize More...
 
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
 

Function Documentation

◆ _memset()

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

doesnt clobber any registers

Source
blkdev/ahci.inc:1416

◆ ahci_find_cmdslot()

void ahci_find_cmdslot ( dword  pdata)

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

Source
blkdev/ahci.inc:1376

◆ 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:1211

◆ 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:655

◆ 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 out: rebases port and fills pdata with mappings

Source
blkdev/ahci.inc:1265

◆ 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:1184

◆ 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:1047

◆ ahci_rw_sectors()

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

Read/write sectors, note: currently work for SATA, not SATAPI return value: 0 = success, otherwise = error.

Source
blkdev/ahci.inc:789

◆ 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:1106

◆ 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:1431

Variable Documentation

◆ ahci_callbacks

label ahci_callbacks

◆ ahci_init

label ahci_init

--------------------------------------------------------------------— detect ahci controller and initialize

Source
blkdev/ahci.inc:356

◆ ahci_start_cmd

label ahci_start_cmd

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

Source
blkdev/ahci.inc:1156

◆ ahci_stop_cmd

label ahci_stop_cmd

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

Source
blkdev/ahci.inc:1169

◆ buf_phys

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

◆ buf_virt

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

◆ cmdheader

dd cmdheader
Initial value
?
Source
blkdev/ahci.inc:658
Initial value
?
Source
blkdev/ahci.inc:792

◆ cmdslot

dd cmdslot
Initial value
?
Source
blkdev/ahci.inc:657
Initial value
?
Source
blkdev/ahci.inc:791

◆ cmdtable

dd cmdtable
Initial value
?
Source
blkdev/ahci.inc:659
Initial value
?
Source
blkdev/ahci.inc:793

◆ ctr1_data

AHCI_CTR ctr1_data
Initial value
Source
blkdev/ahci.inc:323

◆ ctr2_data

AHCI_CTR ctr2_data
Initial value
Source
blkdev/ahci.inc:324

◆ ctr3_data

AHCI_CTR ctr3_data
Initial value
Source
blkdev/ahci.inc:325

◆ ctr4_data

AHCI_CTR ctr4_data
Initial value
Source
blkdev/ahci.inc:326

◆ ctr5_data

AHCI_CTR ctr5_data
Initial value
Source
blkdev/ahci.inc:327

◆ ctr6_data

AHCI_CTR ctr6_data
Initial value
Source
blkdev/ahci.inc:328

◆ ctr7_data

AHCI_CTR ctr7_data
Initial value
Source
blkdev/ahci.inc:329

◆ ctr8_data

AHCI_CTR ctr8_data
Initial value
Source
blkdev/ahci.inc:330

◆ ctr_counter

dd ctr_counter

TODO: satapi_dev_counter dd 0 ; satapi devices (optical drives) counter controllers counter.

Initial value
0
Source
blkdev/ahci.inc:350

◆ ctr_ptr

dd ctr_ptr
Initial value
?
Source
blkdev/ahci.inc:332

◆ cur_antioffset

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

◆ cur_phys

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

◆ cur_phys_page

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

◆ cur_prd

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

◆ dbc

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

◆ hd_name

db hd_name
Initial value
'sd', 0, 0, 0
Source
blkdev/ahci.inc:347

◆ modelstr

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

◆ new_phys_region_start

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

◆ next_phys_page

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

◆ numsectors

dd numsectors
Initial value
?
Source
blkdev/ahci.inc:1049
Initial value
?
Source
blkdev/ahci.inc:1108

◆ phys_page1

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

◆ phys_page23

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

◆ phys_region_start

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

◆ prdt_bytes_total

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

◆ sata_dev_counter

dd sata_dev_counter

sata devices counter

Initial value
0
Source
blkdev/ahci.inc:348

◆ tmp

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

◆ tmpstr

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

◆ vbuf_len

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

◆ vbuf_orig

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

◆ virt_page1

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

◆ virt_page23

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