|
|
|
@ -4,10 +4,10 @@
|
|
|
|
|
#include <arch/generic/interrupt.h>
|
|
|
|
|
#include <arch/i386/io.h>
|
|
|
|
|
#include <drivers/pci.h>
|
|
|
|
|
#include <fs/mbr.h>
|
|
|
|
|
#include <misc.h>
|
|
|
|
|
#include <utils/bit.h>
|
|
|
|
|
#include <utils/crc32.h>
|
|
|
|
|
#include <fs/mbr.h>
|
|
|
|
|
|
|
|
|
|
#define BASE_PRI_IO 0x1F0
|
|
|
|
|
#define BASE_PRI_CTRL 0x3F6
|
|
|
|
@ -125,7 +125,7 @@ void ata_init(uint8_t bus, uint8_t dev, uint8_t func, pci_config_t *p_config) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
a_config.base_pri_io = p_config->bar[0] & 0xfffffffc;
|
|
|
|
|
a_config.base_pri_io = p_config->bar[0] & 0xfffffffc;
|
|
|
|
|
a_config.base_pri_ctrl = p_config->bar[1] & 0xfffffffc;
|
|
|
|
|
} else {
|
|
|
|
|
a_config.base_pri_io = BASE_PRI_IO;
|
|
|
|
@ -142,7 +142,7 @@ void ata_init(uint8_t bus, uint8_t dev, uint8_t func, pci_config_t *p_config) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
a_config.base_sec_io = p_config->bar[2] & 0xfffffffc;
|
|
|
|
|
a_config.base_sec_io = p_config->bar[2] & 0xfffffffc;
|
|
|
|
|
a_config.base_sec_ctrl = p_config->bar[3] & 0xfffffffc;
|
|
|
|
|
} else {
|
|
|
|
|
a_config.base_sec_io = BASE_SEC_IO;
|
|
|
|
@ -163,18 +163,18 @@ void ata_init(uint8_t bus, uint8_t dev, uint8_t func, pci_config_t *p_config) {
|
|
|
|
|
PRINTK("ata: a_config.base_sec_ctrl = %#08x", a_config.base_sec_ctrl);
|
|
|
|
|
PRINTK("ata: a_config.base_busmaster = %#08x", a_config.base_busmaster);
|
|
|
|
|
|
|
|
|
|
PRINTK("ata: detecting devices");
|
|
|
|
|
ata_pio_detect(0);
|
|
|
|
|
// ata_pio_detect(1);
|
|
|
|
|
// ata_pio_detect(2);
|
|
|
|
|
// ata_pio_detect(3);
|
|
|
|
|
|
|
|
|
|
if (a_config.irq_pri != 0) {
|
|
|
|
|
irq_register(a_config.irq_pri, ata_irq_handler);
|
|
|
|
|
}
|
|
|
|
|
if (a_config.irq_sec != 0 && a_config.irq_pri != a_config.irq_sec) {
|
|
|
|
|
irq_register(a_config.irq_sec, ata_irq_handler);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PRINTK("ata: detecting devices");
|
|
|
|
|
ata_pio_detect(0);
|
|
|
|
|
ata_pio_detect(1);
|
|
|
|
|
// ata_pio_detect(2);
|
|
|
|
|
// ata_pio_detect(3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ata_exit(void) {
|
|
|
|
@ -229,13 +229,13 @@ static bool ata_pio_detect(uint8_t drive) {
|
|
|
|
|
" .magic = %04x\r\n"
|
|
|
|
|
"};",
|
|
|
|
|
header.disk_id, header.reserved,
|
|
|
|
|
header.partitions[0].flags, header.partitions[0].chs_start, header.partitions[0].type,
|
|
|
|
|
header.partitions[0].flags, header.partitions[0].chs_start, header.partitions[0].type,
|
|
|
|
|
header.partitions[0].chs_end, header.partitions[0].lba_start, header.partitions[0].num_sectors,
|
|
|
|
|
header.partitions[1].flags, header.partitions[1].chs_start, header.partitions[1].type,
|
|
|
|
|
header.partitions[1].flags, header.partitions[1].chs_start, header.partitions[1].type,
|
|
|
|
|
header.partitions[1].chs_end, header.partitions[1].lba_start, header.partitions[1].num_sectors,
|
|
|
|
|
header.partitions[2].flags, header.partitions[2].chs_start, header.partitions[2].type,
|
|
|
|
|
header.partitions[2].flags, header.partitions[2].chs_start, header.partitions[2].type,
|
|
|
|
|
header.partitions[2].chs_end, header.partitions[2].lba_start, header.partitions[2].num_sectors,
|
|
|
|
|
header.partitions[3].flags, header.partitions[3].chs_start, header.partitions[3].type,
|
|
|
|
|
header.partitions[3].flags, header.partitions[3].chs_start, header.partitions[3].type,
|
|
|
|
|
header.partitions[3].chs_end, header.partitions[3].lba_start, header.partitions[3].num_sectors,
|
|
|
|
|
header.magic
|
|
|
|
|
);
|
|
|
|
|