ahci: add ahci driver

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-07-14 19:03:10 -04:00
commit 105bdb4464
11 changed files with 522 additions and 260 deletions

28
include/kernel/sg.h Normal file
View file

@ -0,0 +1,28 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _SG_H_
#define _SG_H_
#include <kernel/types.h>
struct sg_entry {
paddr_t paddr;
size_t len;
};
struct sg_list {
struct sg_entry *entries;
size_t count;
size_t max_count;
};
#define SG_STATIC(name, n) \
struct sg_entry name##_buf[n]; \
struct sg_list name = {.entries = name##_buf, .count = 0, .max_count = (n)}
#define sg_for_each(entry, sg) for (struct sg_entry *entry = (sg)->entries; entry < (sg)->entries + (sg)->count; entry++)
void sg_init(struct sg_list *sg, struct sg_entry *buf, size_t n);
int sg_append(struct sg_list *sg, paddr_t paddr, size_t len);
void sg_reset(struct sg_list *sg);
#endif /* _SG_H_ */