slab: upgrade kmalloc to allow DMA regions

these DMA regions are only meant to comply with certain AHCI
requirements, and are not yet general purpose
This commit is contained in:
Michael Shaw 2023-05-08 01:14:11 -04:00
commit 8544efe1ab
7 changed files with 89 additions and 36 deletions

View file

@ -143,7 +143,7 @@ bool ahci_access_sectors(struct sata_device *dev, paddr_t lba, uint16_t count, p
memset(cmdtbl, 0, sizeof(struct hba_cmd_tbl) + (cmdheader->prdt_len - 1) * sizeof(struct hba_prdt_entry));
int i;
for (i = 0; i < cmdheader->prdt_len - 1; i++) {
for (i = 0; i < cmdheader->prdt_len; i++) {
cmdtbl->prdt_entry[i].data_base = buf;
cmdtbl->prdt_entry[i].byte_count = 8 * 1024 - 1;
cmdtbl->prdt_entry[i].interrupt = 1;
@ -151,10 +151,6 @@ bool ahci_access_sectors(struct sata_device *dev, paddr_t lba, uint16_t count, p
count -= 16;
}
cmdtbl->prdt_entry[i].data_base = buf;
cmdtbl->prdt_entry[i].byte_count = (count << 9) - 1;
cmdtbl->prdt_entry[i].interrupt = 1;
struct fis_reg_h2d *cmdfis = (struct fis_reg_h2d *)(&cmdtbl->cfis);
cmdfis->fis_type = FIS_REG_H2D;
cmdfis->cmd_mode = 1;

View file

@ -99,7 +99,7 @@ struct pci_device *pci_find_device(uint8_t class, uint8_t subclass)
void pci_init()
{
pci_devices = kzalloc(sizeof(struct pci_device) * MAX_PCI_DEVICES);
pci_devices = kzalloc(sizeof(struct pci_device) * MAX_PCI_DEVICES, ALLOC_KERN);
pci_device_count = 0;
for (int bus = 0; bus < 256; bus++)