Skip to content

Commit

Permalink
[kernel][driver][ata] Add SATA PIO read sector support
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonBrave committed Jul 31, 2022
1 parent 696ed2c commit 26bbbf5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions kernel/driver/ahci/ahci.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ int ahci_exec_pio_in(struct AHCIController* ahci, unsigned int port, uint8_t cmd
fis->lba_47_40 = (lba >> 40) & 0xff;
fis->count_7_0 = cont & 0xff;
fis->count_15_8 = (cont >> 8) & 0xff;
fis->device = (1 << 6); // Bit 6 shall be set to one
// Set receive buffer
cmd_table->prdt[0].dba = V2P(buf);
cmd_table->prdt[0].dba_upper = 0;
Expand Down
4 changes: 3 additions & 1 deletion kernel/driver/ata/ata.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ int ata_read(void* private, unsigned int begin, int count, void* buf) {
}
}
} else if (dev->transport == ATA_TRANSPORT_SERIAL_ATA) {
panic("SATA not supported");
if (sata_exec_pio_in(&dev->sata, ATA_COMMAND_READ_SECTOR, begin, count, buf, count)) {
return ERROR_READ_FAIL;
}
}
return 0;
}
Expand Down

0 comments on commit 26bbbf5

Please sign in to comment.