Rev 3771 | Rev 3777 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3771 | Rev 3774 | ||
---|---|---|---|
Line 69... | Line 69... | ||
69 | format binary as "mnt" |
69 | format binary as "mnt" |
Line 70... | Line 70... | ||
70 | 70 | ||
71 | include 'macros.inc' |
71 | include 'macros.inc' |
Line 72... | Line 72... | ||
72 | include 'struct.inc' |
72 | include 'struct.inc' |
Line 73... | Line 73... | ||
73 | 73 | ||
74 | $Revision: 3771 $ |
74 | $Revision: 3774 $ |
Line 360... | Line 360... | ||
360 | call mutex_init |
360 | call mutex_init |
361 | mov ecx, ide_channel1_mutex |
361 | mov ecx, ide_channel1_mutex |
362 | call mutex_init |
362 | call mutex_init |
363 | mov ecx, ide_channel2_mutex |
363 | mov ecx, ide_channel2_mutex |
364 | call mutex_init |
364 | call mutex_init |
365 | - | ||
- | 365 | ;----------------------------------------------------------------------------- |
|
366 | ; SAVE REAL MODE VARIABLES |
366 | ; SAVE REAL MODE VARIABLES |
- | 367 | ;----------------------------------------------------------------------------- |
|
- | 368 | save_variables_IDE_controller: |
|
367 | xor eax, eax |
369 | xor eax, eax |
368 | mov ax, [BOOT_VARS + BOOT_IDE_INTERR_16] |
370 | mov ax, [BOOT_VARS + BOOT_IDE_INTERR_16] |
369 | mov [IDE_Interrupt], ax |
371 | mov [IDE_Interrupt], ax |
- | 372 | ;-------------------------------------- |
|
370 | mov ax, [BOOT_VARS + BOOT_IDE_PI_16] |
373 | mov ax, [BOOT_VARS + BOOT_IDE_PI_16] |
371 | mov [IDEContrProgrammingInterface], ax |
374 | mov [IDEContrProgrammingInterface], ax |
- | 375 | ;-------------------------------------- |
|
372 | mov ax, [BOOT_VARS + BOOT_IDE_BASE_ADDR] |
376 | mov ax, [BOOT_VARS + BOOT_IDE_BASE_ADDR] |
373 | mov [IDEContrRegsBaseAddr], ax |
377 | mov [IDEContrRegsBaseAddr], ax |
- | 378 | ;-------------------------------------- |
|
374 | mov ax, [BOOT_VARS + BOOT_IDE_BAR0_16] |
379 | mov ax, [BOOT_VARS + BOOT_IDE_BAR0_16] |
375 | mov [IDE_BAR0_val], ax |
- | |
376 | - | ||
377 | cmp ax, 0 |
380 | cmp ax, 0 |
378 | je @f |
381 | je @f |
379 | cmp ax, 1 |
382 | cmp ax, 1 |
- | 383 | jne .no_PATA_BAR0 |
|
- | 384 | @@: |
|
- | 385 | mov ax, 0x1F0 |
|
380 | je @f |
386 | jmp @f |
- | 387 | .no_PATA_BAR0: |
|
381 | and ax, 0xfff0 |
388 | and ax, 0xFFFC |
- | 389 | @@: |
|
382 | mov [StandardATABases], ax |
390 | mov [StandardATABases], ax |
383 | mov [hd_address_table], eax |
391 | mov [hd_address_table], eax |
384 | mov [hd_address_table+8], eax |
392 | mov [hd_address_table+8], eax |
385 | @@: |
- | |
- | 393 | mov [IDE_BAR0_val], ax |
|
- | 394 | ;-------------------------------------- |
|
386 | mov ax, [BOOT_VARS + BOOT_IDE_BAR1_16] |
395 | mov ax, [BOOT_VARS + BOOT_IDE_BAR1_16] |
- | 396 | cmp ax, 0 |
|
- | 397 | je @f |
|
- | 398 | cmp ax, 1 |
|
- | 399 | jne .no_PATA_BAR1 |
|
- | 400 | @@: |
|
- | 401 | mov ax, 0x3F4 |
|
- | 402 | jmp @f |
|
- | 403 | .no_PATA_BAR1: |
|
- | 404 | and ax, 0xFFFC |
|
- | 405 | @@: |
|
387 | mov [IDE_BAR1_val], ax |
406 | mov [IDE_BAR1_val], ax |
- | 407 | ;-------------------------------------- |
|
388 | mov ax, [BOOT_VARS + BOOT_IDE_BAR2_16] |
408 | mov ax, [BOOT_VARS + BOOT_IDE_BAR2_16] |
389 | mov [IDE_BAR2_val], ax |
- | |
390 | - | ||
391 | cmp ax, 0 |
409 | cmp ax, 0 |
392 | je @f |
410 | je @f |
393 | cmp ax, 1 |
411 | cmp ax, 1 |
- | 412 | jne .no_PATA_BAR2 |
|
- | 413 | @@: |
|
- | 414 | mov ax, 0x170 |
|
394 | je @f |
415 | jmp @f |
- | 416 | .no_PATA_BAR2: |
|
395 | and ax, 0xfff0 |
417 | and ax, 0xFFFC |
- | 418 | @@: |
|
396 | mov [StandardATABases+2], ax |
419 | mov [StandardATABases+2], ax |
397 | mov [hd_address_table+16], eax |
420 | mov [hd_address_table+16], eax |
398 | mov [hd_address_table+24], eax |
421 | mov [hd_address_table+24], eax |
399 | @@: |
- | |
- | 422 | mov [IDE_BAR2_val], ax |
|
- | 423 | ;-------------------------------------- |
|
400 | mov ax, [BOOT_VARS + BOOT_IDE_BAR3_16] |
424 | mov ax, [BOOT_VARS + BOOT_IDE_BAR3_16] |
- | 425 | cmp ax, 0 |
|
- | 426 | je @f |
|
- | 427 | cmp ax, 1 |
|
- | 428 | jne .no_PATA_BAR3 |
|
- | 429 | @@: |
|
- | 430 | mov ax, 0x374 |
|
- | 431 | jmp @f |
|
- | 432 | .no_PATA_BAR3: |
|
- | 433 | and ax, 0xFFFC |
|
- | 434 | @@: |
|
401 | mov [IDE_BAR3_val], ax |
435 | mov [IDE_BAR3_val], ax |
Line 402... | Line 436... | ||
402 | 436 | ||
Line 403... | Line 437... | ||
403 | ; --------------- APM --------------------- |
437 | ; --------------- APM --------------------- |
Line 726... | Line 760... | ||
726 | ; for IDE partitions is in the PIO mode. |
760 | ; for IDE partitions is in the PIO mode. |
727 | ;-------------------------------------- |
761 | ;-------------------------------------- |
728 | .disable_IDE_interrupt: |
762 | .disable_IDE_interrupt: |
729 | ; Disable interrupts in IDE controller for PIO |
763 | ; Disable interrupts in IDE controller for PIO |
730 | mov al, 2 |
764 | mov al, 2 |
731 | mov dx, [IDE_BAR1_val] ;0x3F6 |
765 | mov dx, [IDE_BAR1_val] ;0x3F4 |
732 | add dx, 2 |
766 | add dx, 2 ;0x3F6 |
733 | out dx, al |
767 | out dx, al |
734 | mov dx, [IDE_BAR3_val] ;0x76 |
768 | mov dx, [IDE_BAR3_val] ;0x374 |
735 | add dx, 2 |
769 | add dx, 2 ;0x376 |
736 | out dx, al |
770 | out dx, al |
737 | ;----------------------------------------------------------------------------- |
771 | ;----------------------------------------------------------------------------- |
738 | ;!!!!!!!!!!!!!!!!!!!!!!!!!! |
772 | ;!!!!!!!!!!!!!!!!!!!!!!!!!! |
739 | ; mov esi, boot_detectdisks |
773 | ; mov esi, boot_detectdisks |
740 | ; call boot_log |
774 | ; call boot_log |
Line 981... | Line 1015... | ||
981 | ; call kb_read |
1015 | ; call kb_read |
982 | ;// mike.dld [ |
1016 | ;// mike.dld [ |
983 | call set_lights |
1017 | call set_lights |
984 | ;// mike.dld ] |
1018 | ;// mike.dld ] |
985 | stdcall attach_int_handler, 1, irq1, 0 |
1019 | stdcall attach_int_handler, 1, irq1, 0 |
986 | DEBUGF 1, "K : IRQ0 error code %x\n", eax |
1020 | DEBUGF 1, "K : IRQ1 error code %x\n", eax |
987 | .no_keyboard: |
1021 | .no_keyboard: |
Line 988... | Line 1022... | ||
988 | 1022 | ||
Line 989... | Line 1023... | ||
989 | ; SET MOUSE |
1023 | ; SET MOUSE |
Line 1106... | Line 1140... | ||
1106 | je .end_set_interrupts |
1140 | je .end_set_interrupts |
Line 1107... | Line 1141... | ||
1107 | 1141 | ||
1108 | mov ax, [IDE_Interrupt] |
1142 | mov ax, [IDE_Interrupt] |
1109 | movzx eax, al |
1143 | movzx eax, al |
1110 | stdcall attach_int_handler, eax, IDE_common_irq_handler, 0 |
1144 | stdcall attach_int_handler, eax, IDE_common_irq_handler, 0 |
Line 1111... | Line 1145... | ||
1111 | DEBUGF 1, "K : Set IDE IRQ%d return code %x\n", [IDE_Interrupt]:2, eax |
1145 | DEBUGF 1, "K : Set IDE IRQ%d return code %x\n", [IDE_Interrupt]:1, eax |
1112 | 1146 | ||
1113 | stdcall enable_irq, eax |
1147 | stdcall enable_irq, eax |
1114 | ;-------------------------------------- |
1148 | ;-------------------------------------- |
1115 | .enable_IDE_interrupt: |
1149 | .enable_IDE_interrupt: |
1116 | mov esi, boot_enabling_ide |
1150 | mov esi, boot_enabling_ide |
1117 | call boot_log |
1151 | call boot_log |
1118 | ; Enable interrupts in IDE controller for DMA |
1152 | ; Enable interrupts in IDE controller for DMA |
1119 | mov al, 0 |
1153 | mov al, 0 |
1120 | mov dx, [IDE_BAR1_val] ;0x3F6 |
1154 | mov dx, [IDE_BAR1_val] ;0x3F4 |
1121 | add dx, 2 |
1155 | add dx, 2 ;0x3F6 |
1122 | out dx, al |
1156 | out dx, al |
1123 | mov dx, [IDE_BAR3_val] ;0x76 |
1157 | mov dx, [IDE_BAR3_val] ;0x374 |
1124 | add dx, 2 |
1158 | add dx, 2 ;0x376 |
1125 | out dx, al |
1159 | out dx, al |
1126 | ;-------------------------------------- |
1160 | ;-------------------------------------- |
1127 | .end_set_interrupts: |
1161 | .end_set_interrupts: |