FrostWing
A lightweight raw-control operating system.
Loading...
Searching...
No Matches
ahci.h File Reference

Header definitions and structures for the AHCI Driver. More...

#include <basics.h>
#include <graphics.h>
Include dependency graph for ahci.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ahci_port_mem_t
struct  ahci_port_t
 AHCI port registers and command header pointer. More...
struct  ahci_hba_mem_t
struct  ahci_disk_info_t
struct  block_device_info_t
struct  general_partition_t
struct  mount_entry

Typedefs

typedef struct mount_entry mount_entry_t

Enumerations

enum  block_device_type_t { BLOCK_DEVICE_AHCI = 0 , BLOCK_DEVICE_NVME }
enum  partition_fs_type_t {
  FS_UNKNOWN = 0 , FS_FAT12 , FS_FAT16 , FS_FAT32 ,
  FS_EXFAT , FS_EXT2 , FS_EXT3 , FS_EXT4 ,
  FS_XFS , FS_BTRFS , FS_NTFS , FS_ISO9660 ,
  FS_UDF , FS_PROC , FS_DEV
}
 GENERAL PARITION LAYOUT BEGIN. More...
enum  partition_table_type_t { PART_TABLE_MBR , PART_TABLE_GPT }

Functions

struct __attribute__ ((packed))
 AHCI command header structure.
void detect_ahci_devices (ahci_hba_mem_t *ahci_ctrl)
 Probes and detects all AHCI devices connected to the controller.
void handle_sata_disk (int portno)
void handle_satapi_disk (int portno)
void ahci_init_port (int portno)
int ahci_read_sector (int portno, uint64_t lba, void *buffer, uint32_t count)
int ahci_write_sector (int portno, uint64_t lba, void *buffer, uint32_t count)
int ahci_identify (int portno, void *buffer)
int block_register_device (block_device_type_t type, int backend_index, uint64_t total_sectors, uint32_t sector_size, const char *name)
block_device_info_tblock_get_device (int device_id)
const char * block_get_device_name (int device_id)
int block_read_sector (int device_id, uint64_t lba, void *buffer, uint32_t count)
int block_write_sector (int device_id, uint64_t lba, void *buffer, uint32_t count)
general_partition_tadd_general_partition (partition_table_type_t table_type, int64 lba_start, int64 lba_end, int64 sector_count, int64 ahci_port, bool bootable, partition_fs_type_t fs_type, cstring name, uint8_t mbr_type, const uint8_t *gpt_guid)
general_partition_tsearch_general_partition (cstring partition_name)
mount_entry_t * add_mount (const char *mount_point, const char *part_name, partition_fs_type_t type, void *fs_ptr)
mount_entry_t * find_mount_by_point (const char *mount_point)

Variables

 ahci_cmd_header_t
 prdt_entry_t
 ahci_cmd_table_t
static ahci_port_mem_t port_mem [32]
ahci_disk_info_t ahci_disks [32]
general_partition_t ahci_partitions [MAX_PARTITIONS]
mount_entry_t mounted_partitions [MAX_PARTITIONS]
block_device_info_t block_devices [MAX_BLOCK_DEVICES]
int general_partition_count
int mounted_partition_count
int block_device_count
ahci_hba_mem_tglobal_ahci_ctrl
 Global AHCI controller pointer.

Detailed Description

Header definitions and structures for the AHCI Driver.

Author
Pradosh (prado.nosp@m.shga.nosp@m.me@gm.nosp@m.ail..nosp@m.com)
Version
0.1
Date
2023-12-16

Definition in file ahci.h.

Enumeration Type Documentation

◆ block_device_type_t

enum block_device_type_t

Definition at line 147 of file ahci.h.

◆ partition_fs_type_t

GENERAL PARITION LAYOUT BEGIN.

Definition at line 163 of file ahci.h.

◆ partition_table_type_t

enum partition_table_type_t

Definition at line 190 of file ahci.h.

Function Documentation

◆ __attribute__()

struct __attribute__ ( (packed) )

AHCI command header structure.

AHCI command table structure.

Physical Region Descriptor Table (PRDT) entry.

Represents the command header for a single AHCI port.

Definition at line 1 of file ahci.h.

◆ detect_ahci_devices()

void detect_ahci_devices ( ahci_hba_mem_t * ahci_ctrl)

Probes and detects all AHCI devices connected to the controller.

Parameters
ahci_ctrlPointer to the AHCI controller structure.

Variable Documentation

◆ ahci_cmd_header_t

ahci_cmd_header_t

Definition at line 57 of file ahci.h.

◆ ahci_cmd_table_t

ahci_cmd_table_t

Definition at line 87 of file ahci.h.

◆ port_mem

ahci_port_mem_t port_mem[32]
static

Definition at line 95 of file ahci.h.

◆ prdt_entry_t

prdt_entry_t

Definition at line 76 of file ahci.h.