continue ahci development

This commit is contained in:
Michael Shaw 2023-05-06 21:30:05 -04:00
commit aa3eb7805d
4 changed files with 27 additions and 3 deletions

View file

@ -20,6 +20,9 @@ static int ahci_port_type(hbaport_t *port)
if (det != HBA_PORT_DET_PRESENT)
return AHCI_DEV_NULL;
if(port->clb_low == 0 && port->clb_high == 0)
return AHCI_DEV_NULL;
switch (port->sig) {
case SATA_SIG_ATAPI:
return AHCI_DEV_SATAPI;

View file

@ -236,8 +236,11 @@ struct hba_cmd_tbl {
typedef volatile struct {
/* 0x00 */
paddr_t clb;
paddr_t fb;
paddr32_t clb_low;
paddr32_t clb_high;
paddr32_t fb_low;
paddr32_t fb_high;
/* 0x10 */
uint32_t is;
@ -286,7 +289,7 @@ typedef volatile struct {
uint8_t reserved[0x74];
/* 0xA0 */
char vendor[0x60];
uint8_t vendor[0x60];
/* 0x100 */
hbaport_t ports[32];

View file

@ -31,9 +31,22 @@ struct rsdt {
uint32_t sdt[];
} PACKED;
struct mcfg {
struct acpi_sdt_header h;
uint64_t reserved;
struct {
uint64_t base_addr;
uint16_t seg_group;
uint8_t start_bus;
uint8_t end_bus;
uint32_t reserved;
} PACKED cfg[];
} PACKED;
void acpi_init();
extern struct madt *__madt;
extern struct mcfg *__mcfg;
#endif /* __ASM__ */
#endif /* _ACPI_H_ */

View file

@ -12,6 +12,7 @@ struct limine_rsdp_request rsdp_req = { .id = LIMINE_RSDP_REQUEST, .revision = 0
static struct rsdp *rsdp = NULL;
struct madt *__madt = NULL;
struct mcfg *__mcfg = NULL;
static void rsdt_parse(struct rsdt *rsdt)
{
@ -30,6 +31,10 @@ static void rsdt_parse(struct rsdt *rsdt)
__madt = (struct madt *)h;
}
if(!(memcmp(h->signature, "MCFG", 4))) {
__mcfg = (struct mcfg *)h;
}
#ifdef KDEBUG
char buf[8] = { 0 };
memcpy(buf, h->signature, 4);