Detect ATA driver via PCI
This commit is contained in:
@ -106,67 +106,6 @@ uint64_t ata_probesize_bytes(uint16_t iobase, uint16_t ctrlbase, int devno) {
|
||||
}
|
||||
}
|
||||
|
||||
void ata_probe(void) {
|
||||
uint64_t probesize;
|
||||
|
||||
probesize = ata_probesize_bytes(0x1F0, 0x3F6, ATA_MASTER);
|
||||
if (probesize > 0) {
|
||||
|
||||
char hs[20];
|
||||
LOG("ata", "found ATA primary bus master, size = %s\n", human_size(probesize, hs, sizeof(hs)));
|
||||
|
||||
AtaSdInitExtra extra = {
|
||||
.devno = ATA_MASTER,
|
||||
.capacity = probesize,
|
||||
.iobase = 0x1F0,
|
||||
.ctrlbase = 0x3F6,
|
||||
};
|
||||
storedev_create(STOREDEV_ATASD, "atasd0m", (void *)&extra);
|
||||
}
|
||||
|
||||
probesize = ata_probesize_bytes(0x1F0, 0x3F6, ATA_SLAVE);
|
||||
if (probesize > 0) {
|
||||
char hs[20];
|
||||
LOG("ata", "found ATA primary bus slave, size = %s\n", human_size(probesize, hs, sizeof(hs)));
|
||||
|
||||
AtaSdInitExtra extra = {
|
||||
.devno = ATA_SLAVE,
|
||||
.capacity = probesize,
|
||||
.iobase = 0x1F0,
|
||||
.ctrlbase = 0x3F6,
|
||||
};
|
||||
storedev_create(STOREDEV_ATASD, "atasd0s", (void *)&extra);
|
||||
}
|
||||
|
||||
probesize = ata_probesize_bytes(0x170, 0x376, ATA_MASTER);
|
||||
if (probesize > 0) {
|
||||
char hs[20];
|
||||
LOG("ata", "found ATA secondary bus master, size = %s\n", human_size(probesize, hs, sizeof(hs)));
|
||||
|
||||
AtaSdInitExtra extra = {
|
||||
.devno = ATA_MASTER,
|
||||
.capacity = probesize,
|
||||
.iobase = 0x170,
|
||||
.ctrlbase = 0x376,
|
||||
};
|
||||
storedev_create(STOREDEV_ATASD, "atasd1m", (void *)&extra);
|
||||
}
|
||||
|
||||
probesize = ata_probesize_bytes(0x170, 0x376, ATA_SLAVE);
|
||||
if (probesize > 0) {
|
||||
char hs[20];
|
||||
LOG("ata", "found ATA secondary bus slave, size = %s\n", human_size(probesize, hs, sizeof(hs)));
|
||||
|
||||
AtaSdInitExtra extra = {
|
||||
.devno = ATA_SLAVE,
|
||||
.capacity = probesize,
|
||||
.iobase = 0x170,
|
||||
.ctrlbase = 0x376,
|
||||
};
|
||||
storedev_create(STOREDEV_ATASD, "atasd1s", (void *)&extra);
|
||||
}
|
||||
}
|
||||
|
||||
void ata_setup(uint16_t iobase, uint16_t ctrlbase, int devno, uint16_t sectors, uint64_t lba) {
|
||||
io_out8(ctrlbase, 0x02);
|
||||
|
||||
|
||||
@ -28,7 +28,6 @@ int32_t atasd_read(struct StoreDev *sd, uint8_t *const buffer, ptrdiff_t sector,
|
||||
int32_t atasd_write(struct StoreDev *sd, const uint8_t *const buffer, ptrdiff_t sector, ptrdiff_t off, size_t size);
|
||||
int32_t atasd_cleanup(struct StoreDev *sd);
|
||||
size_t atasd_capacity(struct StoreDev *sd);
|
||||
|
||||
void ata_probe(void);
|
||||
uint64_t ata_probesize_bytes(uint16_t iobase, uint16_t ctrlbase, int devno);
|
||||
|
||||
#endif // STOREDEV_ATASD_H_
|
||||
|
||||
@ -21,8 +21,6 @@ void storedev_init(void) {
|
||||
STOREDEV_LIST.head = NULL;
|
||||
|
||||
LOG("storedev", "init\n");
|
||||
|
||||
ata_probe();
|
||||
}
|
||||
|
||||
int32_t storedev_dev_read(Dev *dev, uint8_t *buffer, size_t len, uint64_t pid) {
|
||||
|
||||
Reference in New Issue
Block a user