git-svn-id: https://spexeah.com:8443/svn/Asuro@414 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c

This commit is contained in:
kieron 2018-04-09 12:23:33 +00:00
parent ab718554f5
commit cde83a6545
17 changed files with 58 additions and 18 deletions

BIN
Asuro.iso

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -134,6 +134,7 @@ function sendPacket(p_data : void; p_len : uint16) : sint32;
implementation implementation
var var
bus, slot, func : uint8;
loaded : boolean; loaded : boolean;
card_type : TCardType; card_type : TCardType;
bar_type : uint8; bar_type : uint8;
@ -265,13 +266,18 @@ begin
ptr:= puint8(kalloc(sizeof(TE1000_rx_desc) * E1000_NUM_RX_DESC + 16)); ptr:= puint8(kalloc(sizeof(TE1000_rx_desc) * E1000_NUM_RX_DESC + 16));
descs:= PE1000_rx_desc(ptr); descs:= PE1000_rx_desc(ptr);
for i:=0 to E1000_NUM_RX_DESC do begin for i:=0 to E1000_NUM_RX_DESC do begin
rx_descs[i]:= PE1000_rx_desc(uint32(descs + i*16)); rx_descs[i]:= @descs[i];//PE1000_rx_desc(uint32(descs) + i*16);
rx_descs[i]^.address:= uint64(kalloc(8192 + 16)); rx_descs[i]^.address:= uint64(kalloc(8192 + 16));
rx_descs[i]^.status:= 0; rx_descs[i]^.status:= 0;
end; end;
outptr:= puint8(uint32(ptr) - KERNEL_VIRTUAL_BASE); outptr:= puint8(vtop(uint32(ptr)));//puint8(uint32(ptr) - KERNEL_VIRTUAL_BASE);
console.output('E1000 Driver', 'RX VMem: ');
console.writehexln(uint32(ptr));
console.output('E1000 Driver', 'RX Mem: ');
console.writehexln(uint32(outptr));
writeCommand(REG_TXDESCLO, uint32(uint64(outptr) SHR 32)); writeCommand(REG_TXDESCLO, uint32(uint64(outptr) SHR 32));
writeCommand(REG_TXDESCHI, uint32(uint64(outptr) AND $FFFFFFFF)); writeCommand(REG_TXDESCHI, uint32(uint64(outptr) AND $FFFFFFFF));
@ -298,16 +304,21 @@ begin
ptr:= puint8(kalloc(sizeof(TE1000_tx_desc) * (E1000_NUM_TX_DESC + 16))); ptr:= puint8(kalloc(sizeof(TE1000_tx_desc) * (E1000_NUM_TX_DESC + 16)));
descs:= PE1000_tx_desc(ptr); descs:= PE1000_tx_desc(ptr);
for i:=0 to E1000_NUM_TX_DESC do begin for i:=0 to E1000_NUM_TX_DESC do begin
tx_descs[i]:= PE1000_tx_desc(uint32(descs + i*16)); tx_descs[i]:= @descs[i];//PE1000_tx_desc(uint32(descs + i*16));
tx_descs[i]^.address:= 0; tx_descs[i]^.address:= 0;
tx_descs[i]^.cmd:= 0; tx_descs[i]^.cmd:= 0;
tx_descs[i]^.status:= TSTA_DD; tx_descs[i]^.status:= TSTA_DD;
end; end;
outptr:= puint8(uint32(ptr) - KERNEL_VIRTUAL_BASE); outptr:= puint8(vtop(uint32(ptr))); //puint8(uint32(ptr) - KERNEL_VIRTUAL_BASE);
writeCommand(REG_TXDESCHI, uint32(uint64(outptr) SHR 32)); console.output('E1000 Driver', 'TX VMem: ');
writeCommand(REG_TXDESCLO, uint32(uint64(outptr) AND $FFFFFFFF)); console.writehexln(uint32(ptr));
console.output('E1000 Driver', 'TX Mem: ');
console.writehexln(uint32(outptr));
writeCommand(REG_TXDESCHI, 0);
writeCommand(REG_TXDESCLO, uint32(outptr));
writeCommand(REG_TXDESCLEN, E1000_NUM_TX_DESC * 16); writeCommand(REG_TXDESCLEN, E1000_NUM_TX_DESC * 16);
@ -379,12 +390,22 @@ end;
procedure fire(); interrupt; procedure fire(); interrupt;
var var
status : uint32; status : uint32;
data : uint32;
begin begin
console.outputln('E1000 Driver', 'Interrupt begin.');
CLI; CLI;
requestConfig(bus, slot, func, 1);
data := inl($CFC);
data := data AND $FFF7FFFF;
writeConfig(bus, slot, func, 1, data);
status:= readCommand($0C); status:= readCommand($0C);
//console.outputln('E1000 Driver', 'Interrupt Fired.');
//console.output('E1000 Driver', 'Int Status: '); console.output('E1000 Driver', 'Int Status: ');
//console.writehexln(status); console.writehexln(status);
if (status AND $04) > 0 then begin if (status AND $04) > 0 then begin
startLink(); startLink();
end else if (Status AND $10) > 0 then begin end else if (Status AND $10) > 0 then begin
@ -392,8 +413,11 @@ begin
end else if (Status AND $80) > 0 then begin end else if (Status AND $80) > 0 then begin
handleReceive(); handleReceive();
end; end;
outb($20, $20);
outb($A0, $20); outb($A0, $20);
outb($20, $20);
console.outputln('E1000 Driver', 'Interrupt End.');
end; end;
procedure console_command_mac(params : PParamList); procedure console_command_mac(params : PParamList);
@ -455,6 +479,9 @@ begin
kpalloc(io_base); kpalloc(io_base);
kpalloc(mem_base); kpalloc(mem_base);
bus:= PCI_Info^.bus;
slot:= PCI_Info^.slot;
func:= PCI_Info^.func;
setBusMaster(PCI_Info^.bus, PCI_Info^.slot, PCI_Info^.func, true); setBusMaster(PCI_Info^.bus, PCI_Info^.slot, PCI_Info^.func, true);
eeprom_exists:= false; eeprom_exists:= false;
@ -475,7 +502,8 @@ begin
end; end;
IDT.set_gate(32 + PCI_Info^.interrupt_line, uint32(@fire), $08, ISR_RING_0); IDT.set_gate(32 + PCI_Info^.interrupt_line, uint32(@fire), $08, ISR_RING_0);
enableInturrupt();
//enableInturrupt();
rxinit(); rxinit();
txinit(); txinit();
@ -544,7 +572,7 @@ var
old_cur : uint8; old_cur : uint8;
begin begin
tx_descs[tx_curr]^.address:= uint32(uint32(p_data) - KERNEL_VIRTUAL_BASE); tx_descs[tx_curr]^.address:= uint32(vtop(uint32(p_data)));
tx_descs[tx_curr]^.length:= p_len; tx_descs[tx_curr]^.length:= p_len;
tx_descs[tx_curr]^.cmd:= CMD_EOP OR CMD_IFCS OR CMD_RS OR CMD_RPS; tx_descs[tx_curr]^.cmd:= CMD_EOP OR CMD_IFCS OR CMD_RS OR CMD_RPS;
tx_descs[tx_curr]^.status:= 0; tx_descs[tx_curr]^.status:= 0;

View File

@ -36,8 +36,7 @@ uses
testdriver, testdriver,
E1000, E1000,
AHCI_OLD, AHCI_OLD,
IDE, IDE;
storagemanagement;
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall; procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
@ -95,7 +94,6 @@ begin
terminal.registerCommand('BSOD', @terminal_command_bsod, 'Force a Panic Screen.'); terminal.registerCommand('BSOD', @terminal_command_bsod, 'Force a Panic Screen.');
drivermanagement.init(); drivermanagement.init();
storagemanagement.init();
console.init(); console.init();
@ -142,7 +140,7 @@ begin
testdriver.init(); testdriver.init();
E1000.init(); E1000.init();
//AHCI_OLD.init(); //AHCI_OLD.init();
IDE.init(); //IDE.init();
//Nothing beyond here //Nothing beyond here
USB.init(); USB.init();
pci.init(); pci.init();

View File

@ -48,6 +48,7 @@ procedure free_page(page_number : uint16);
procedure free_page_at_address(address : uint32); procedure free_page_at_address(address : uint32);
function new_page_directory : uint32; function new_page_directory : uint32;
function new_kernel_mapped_page_directory : uint32; function new_kernel_mapped_page_directory : uint32;
function vtop(address : uint32) : uint32;
implementation implementation
@ -153,6 +154,19 @@ begin
end; end;
end; end;
function vtop(address : uint32) : uint32;
var
idx : uint32;
paddress : uint32;
loadd : uint32;
begin
idx:= address SHR 22;
paddress:= uint32(KERNEL_PAGE_DIRECTORY^[idx].address) SHL 12;
loadd:= address AND $FFFFFF;
vtop:= paddress + loadd;
end;
function new_page(page_number : uint16) : boolean; function new_page(page_number : uint16) : boolean;
var var
block : uint16; block : uint16;