My Project
Loading...
Searching...
No Matches
ahci.c File Reference
#include "ahci.h"
#include "../../assert.h"
#include "../../includes/mg.h"
#include "../../includes/mm.h"

Go to the source code of this file.

Data Structures

struct  _AHCI_PORT_CTX

Typedefs

typedef struct _AHCI_PORT_CTX AHCI_PORT_CTX

Functions

MTSTATUS ahci_init (void)
 #define AHCI_DEBUG_PRINT
MTSTATUS ahci_read_sector (BLOCK_DEVICE *dev, uint32_t lba, void *buf, size_t bytes)
 Read a single bytes-byte sector from the given LBA on a specific BLOCK_DEVICE.
MTSTATUS ahci_write_sector (BLOCK_DEVICE *dev, uint32_t lba, const void *buf, size_t bytes)
 Write a single bytes-byte sector to given LBA on a specific BLOCK_DEVICE.
BLOCK_DEVICEahci_get_block_device (int index)
 Retrieve a pointer to the AHCI driver's BLOCK_DEVICE instance.

Variables

BOOT_INFO boot_info_local
GOP_PARAMS gop_local
bool ahci_initialized = false

Typedef Documentation

◆ AHCI_PORT_CTX

typedef struct _AHCI_PORT_CTX AHCI_PORT_CTX

Function Documentation

◆ ahci_get_block_device()

BLOCK_DEVICE * ahci_get_block_device ( int index)

Retrieve a pointer to the AHCI driver's BLOCK_DEVICE instance.

Parameters
indexIndex of the BLOCK_DEVICE registration.
Returns
A BLOCK_DEVICE struct pointer.

Definition at line 562 of file ahci.c.

◆ ahci_init()

MTSTATUS ahci_init ( void )

#define AHCI_DEBUG_PRINT

Initialize the AHCI Driver.

Returns
True or False based if it initialized correctly or not. (if failure = bugcheck)

Definition at line 292 of file ahci.c.

◆ ahci_read_sector()

MTSTATUS ahci_read_sector ( BLOCK_DEVICE * dev,
uint32_t lba,
void * buf,
size_t bytes )

Read a single bytes-byte sector from the given LBA on a specific BLOCK_DEVICE.

Parameters
devTakes the BLOCK_DEVICE device pointer (on register_block_device)
lbaLBA to read from.
bufReturn buffer to place the data read.
Returns
True or False based on succession | buf pointer changes.

Definition at line 330 of file ahci.c.

◆ ahci_write_sector()

MTSTATUS ahci_write_sector ( BLOCK_DEVICE * dev,
uint32_t lba,
const void * buf,
size_t bytes )

Write a single bytes-byte sector to given LBA on a specific BLOCK_DEVICE.

Parameters
devTakes the BLOCK_DEVICE device pointer (on register_block_device)
lbaLBA to read from.
bufThe buffer to write to the specified LBA.
Returns
True or False based on succession

Definition at line 450 of file ahci.c.

Variable Documentation

◆ ahci_initialized

bool ahci_initialized = false

Definition at line 290 of file ahci.c.

◆ boot_info_local

BOOT_INFO boot_info_local
extern

Definition at line 27 of file kernel.c.

◆ gop_local

GOP_PARAMS gop_local
extern

Definition at line 26 of file kernel.c.