Dropping support for secondary ata bus temporarily
This commit is contained in:
parent
f9b550b006
commit
1062bd43c7
2
makefile
2
makefile
|
|
@ -19,7 +19,7 @@ all: bootloader tools kernel
|
||||||
# sudo mkdir mount/sys # for system files
|
# sudo mkdir mount/sys # for system files
|
||||||
# ./diskwrite -v -o image.bin
|
# ./diskwrite -v -o image.bin
|
||||||
# ./diskwrite -v -l kernel.elf idm.elf -o image.bin
|
# ./diskwrite -v -l kernel.elf idm.elf -o image.bin
|
||||||
qemu-system-i386 -hda image.bin -hdb test.bin --no-reboot --no-shutdown -m 32m -smp 2 -serial mon:stdio -D intlog.txt -d int
|
qemu-system-i386 -hda image.bin -hdc test.bin --no-reboot --no-shutdown -m 32m -smp 2 -serial mon:stdio -D intlog.txt -d int
|
||||||
sudo umount mount
|
sudo umount mount
|
||||||
|
|
||||||
tools:
|
tools:
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ uint32_t module_api(uint32_t func, ...){
|
||||||
vector_push(modules, structure);
|
vector_push(modules, structure);
|
||||||
pm_free(tmp);
|
pm_free(tmp);
|
||||||
return_value = 0;
|
return_value = 0;
|
||||||
printf("vector size -> %d", structure->key);
|
// printf("vector size -> %d", structure->key);
|
||||||
break;
|
break;
|
||||||
case MODULE_API_ADDINT:
|
case MODULE_API_ADDINT:
|
||||||
uint32_t int_index = va_arg(vars, uint32_t);
|
uint32_t int_index = va_arg(vars, uint32_t);
|
||||||
|
|
|
||||||
|
|
@ -510,8 +510,8 @@ uint8_t ata_identify(uint32_t index, uint16_t disk){
|
||||||
itoa(ata_drives, fname + strlen(fname), 10);
|
itoa(ata_drives, fname + strlen(fname), 10);
|
||||||
vfile_t *new_file = fcreate(api, fname, VFILE_DEVICE, ata_write, ata_read);
|
vfile_t *new_file = fcreate(api, fname, VFILE_DEVICE, ata_write, ata_read);
|
||||||
new_file->mount_id = index;
|
new_file->mount_id = index;
|
||||||
// free(api, fname);
|
puts(api, "KIDM", "Valid Drive!\n");
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ide_init(uint32_t BARS[5]){
|
void ide_init(uint32_t BARS[5]){
|
||||||
|
|
@ -521,49 +521,46 @@ void ide_init(uint32_t BARS[5]){
|
||||||
}
|
}
|
||||||
drives[primary_index].type = TYPE_TMP;
|
drives[primary_index].type = TYPE_TMP;
|
||||||
uint32_t primary_slave_index = find_free_drive();
|
uint32_t primary_slave_index = find_free_drive();
|
||||||
if(primary_slave_index == -1){
|
if(primary_slave_index != -1){
|
||||||
return;
|
drives[primary_slave_index].type = TYPE_TMP;
|
||||||
}
|
}
|
||||||
drives[primary_slave_index].type = TYPE_TMP;
|
// uint32_t secondary_index = find_free_drive();
|
||||||
uint32_t secondary_index = find_free_drive();
|
// if(secondary_index != -1){
|
||||||
if(secondary_index == -1){
|
// drives[secondary_index].type = TYPE_TMP;
|
||||||
return;
|
// }
|
||||||
}
|
// uint32_t secondary_slave_index = find_free_drive();
|
||||||
drives[secondary_index].type = TYPE_TMP;
|
// if(secondary_slave_index != -1){
|
||||||
uint32_t secondary_slave_index = find_free_drive();
|
// drives[secondary_slave_index].type = TYPE_TMP;
|
||||||
if(secondary_slave_index == -1){
|
// }
|
||||||
return;
|
|
||||||
}
|
|
||||||
drives[secondary_slave_index].type = TYPE_TMP;
|
|
||||||
for(int i = 0; i < 2; i++){
|
for(int i = 0; i < 2; i++){
|
||||||
drives[primary_index].BARs[i] = BARS[i];
|
drives[primary_index].BARs[i] = BARS[i];
|
||||||
drives[primary_slave_index].BARs[i] = BARS[i];
|
drives[primary_slave_index].BARs[i] = BARS[i];
|
||||||
drives[secondary_index].BARs[i] = BARS[i+2];
|
// drives[secondary_index].BARs[i] = BARS[i+2];
|
||||||
drives[secondary_slave_index].BARs[i] = BARS[i+2];
|
// drives[secondary_slave_index].BARs[i] = BARS[i+2];
|
||||||
}
|
}
|
||||||
drives[primary_index].BARs[4] = BARS[4];
|
drives[primary_index].BARs[4] = BARS[4];
|
||||||
drives[primary_slave_index].BARs[4] = BARS[4];
|
drives[primary_slave_index].BARs[4] = BARS[4];
|
||||||
drives[primary_slave_index].flags.slave = 1;
|
drives[primary_slave_index].flags.slave = 1;
|
||||||
drives[secondary_index].BARs[4] = BARS[4];
|
// drives[secondary_index].BARs[4] = BARS[4];
|
||||||
drives[secondary_slave_index].BARs[4] = BARS[4];
|
// drives[secondary_slave_index].BARs[4] = BARS[4];
|
||||||
drives[secondary_slave_index].flags.slave = 1;
|
// drives[secondary_slave_index].flags.slave = 1;
|
||||||
//now call ATA IDENTIFY
|
//now call ATA IDENTIFY
|
||||||
uint8_t master_status = ata_identify(primary_index, ATA_MASTER);
|
uint8_t master_status = ata_identify(primary_index, ATA_MASTER);
|
||||||
uint8_t slave_status = ata_identify(primary_slave_index, ATA_SLAVE);
|
uint8_t slave_status = ata_identify(primary_slave_index, ATA_SLAVE);
|
||||||
if(!master_status){
|
if(master_status == -1){
|
||||||
drives[primary_index].type = TYPE_NULL;
|
drives[primary_index].type = TYPE_NULL;
|
||||||
}
|
}
|
||||||
if(!slave_status){
|
if(slave_status == -1){
|
||||||
drives[primary_slave_index].type = TYPE_NULL;
|
drives[primary_slave_index].type = TYPE_NULL;
|
||||||
}
|
}
|
||||||
master_status = ata_identify(secondary_index, ATA_MASTER);
|
// master_status = ata_identify(secondary_index, ATA_MASTER);
|
||||||
slave_status = ata_identify(secondary_slave_index, ATA_SLAVE);
|
// slave_status = ata_identify(secondary_slave_index, ATA_SLAVE);
|
||||||
if(!master_status){
|
// if(master_status == -1){
|
||||||
drives[secondary_index].type = TYPE_NULL;
|
// drives[secondary_index].type = TYPE_NULL;
|
||||||
}
|
// }
|
||||||
if(!slave_status){
|
// if(slave_status == -1){
|
||||||
drives[secondary_slave_index].type = TYPE_NULL;
|
// drives[secondary_slave_index].type = TYPE_NULL;
|
||||||
}
|
// }
|
||||||
// outb(BARS[4] >> 1, 0x0);
|
// outb(BARS[4] >> 1, 0x0);
|
||||||
// int volatile tt = 0;
|
// int volatile tt = 0;
|
||||||
// while(tt < 50000){
|
// while(tt < 50000){
|
||||||
|
|
@ -601,10 +598,10 @@ void init(KOS_MAPI_FP module_api, uint32_t api_version){
|
||||||
BARs[0] = (ATA_PRIMARY_BUS) | 1;
|
BARs[0] = (ATA_PRIMARY_BUS) | 1;
|
||||||
BARs[1] = (ATA_PRIMARY_BUS + 0x206) | 1;
|
BARs[1] = (ATA_PRIMARY_BUS + 0x206) | 1;
|
||||||
}
|
}
|
||||||
if(PCI_IDE_SECONDARY_NATIVE(~progif)){
|
// if(PCI_IDE_SECONDARY_NATIVE(~progif)){
|
||||||
BARs[2] = (ATA_SECONDARY_BUS) | 1;
|
// BARs[2] = (ATA_SECONDARY_BUS) | 1;
|
||||||
BARs[3] = (ATA_SECONDARY_BUS + 0x206) | 1;
|
// BARs[3] = (ATA_SECONDARY_BUS + 0x206) | 1;
|
||||||
}
|
// }
|
||||||
ide_init(BARs);
|
ide_init(BARs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue