source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm@ 236

Last change on this file since 236 was 233, checked in by gregli@…, 13 years ago

Serial Port: split single byte port and baud into two bytes, taking advantage of the two bytes in DPT_SERIAL, which supports more serial baud rates and in particular fixed a bug where a 4x client machine couldn't talk to a 115.2K server machine. This is a wide change, touching lots of files, but most are shallow changes. DetectPrint.asm took the most significant changes, now it calculates the baud rate to display instead of using characters provided by the Configurator. The Configurator now has a new menu flag, FLG_MENUITEM_CHOICESTRINGS, for specifying that values are not linear and they should be lookedup rather than indexed. Finally, another important bug fixed here is that in some error cases, the serial port code could get into an infinite loop waiting ont the hardware; now it has a timeout.

File size: 3.5 KB
RevLine 
[150]1; Project name : XTIDE Universal BIOS
2; Description : Interrupt handling related functions.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; IdeIrq_WaitForIRQ
9; Parameters:
10; DS:DI: Ptr to DPT (in RAMVARS segment)
11; Returns:
12; CF: Set if wait done by operating system
13; Cleared if BIOS must perform task flag polling
14; Corrupts registers:
15; AX
16;--------------------------------------------------------------------
17ALIGN JUMP_ALIGN
18IdeIrq_WaitForIRQ:
19
20;--------------------------------------------------------------------
21; .NotifyOperatingSystemAboutWaitingForIRQ
22; Parameters:
23; Nothing
24; Returns:
25; CF: Set if wait done by operating system
26; Cleared if BIOS must perform task flag polling
27; Corrupts registers:
28; AX
29;--------------------------------------------------------------------
30.NotifyOperatingSystemAboutWaitingForIRQ:
31 push ds
32
33 LOAD_BDA_SEGMENT_TO ds, ax, ! ; Zero AX
34 mov ah, OS_HOOK_DEVICE_BUSY ; Hard disk busy (AX=9000h)
35 cli ; Disable interrupts
36 cmp al, [BDA.bHDTaskFlg] ; Task flag already set?
37 jc SHORT .ReturnFromWaitNotify ; If so, skip OS notification
38 int BIOS_SYSTEM_INTERRUPT_15h ; OS hook, device busy
39 jnc SHORT .ReturnFromWaitNotify ; CF cleared, BIOS handles waiting
40
41 ; Make sure that OS hooks are supported, otherwise the CF means unsupported function
42 test ah, ah ; OS hook supported? (clears CF)
43 jnz SHORT .ReturnFromWaitNotify ; AH has error, BIOS must do the wait
44 stc ; Set CF since wait done by OS
45.ReturnFromWaitNotify:
[161]46 sti ; Enable interrupts
[150]47 pop ds
48 ret
49
50
51;--------------------------------------------------------------------
52; IDE Interrupt Service Routines.
53;
54; IdeIrq_InterruptServiceRoutineForIrqs2to7
55; IdeIrq_InterruptServiceRoutineForIrqs8to15
56; Parameters:
57; Nothing
58; Returns:
59; Nothing
60; Corrupts registers:
61; Nothing
62;--------------------------------------------------------------------
63ALIGN JUMP_ALIGN
64IdeIrq_InterruptServiceRoutineForIrqs2to7:
65 push di
66 push ax
67 call AcknowledgeIdeInterruptAndSetTaskFlag
68
[152]69 mov al, COMMAND_END_OF_INTERRUPT
[150]70 jmp SHORT AcknowledgeMasterInterruptController
71
72
73ALIGN JUMP_ALIGN
74IdeIrq_InterruptServiceRoutineForIrqs8to15:
75 push di
76 push ax
77 call AcknowledgeIdeInterruptAndSetTaskFlag
78
[152]79 mov al, COMMAND_END_OF_INTERRUPT
80 out SLAVE_8259_COMMAND_out, al ; Acknowledge Slave 8259
[150]81AcknowledgeMasterInterruptController:
[152]82 out MASTER_8259_COMMAND_out, al ; Acknowledge Master 8259
[150]83
84 ; Issue Int 15h, function AX=9100h (Interrupt ready)
85 mov ax, OS_HOOK_DEVICE_POST<<8 ; Interrupt ready, device 0 (HD)
86 int BIOS_SYSTEM_INTERRUPT_15h
87
88 pop ax
89 pop di
90 iret
91
92
93;--------------------------------------------------------------------
94; AcknowledgeIdeInterruptAndSetTaskFlag
95; Parameters:
96; Nothing
97; Returns:
98; Nothing
99; Corrupts registers:
100; AX
101;--------------------------------------------------------------------
102ALIGN JUMP_ALIGN
103AcknowledgeIdeInterruptAndSetTaskFlag:
104 push ds
[152]105 push si
[150]106 push dx
107 push bx
108
109 ; Reading Status Register acknowledges IDE interrupt
110 call RamVars_GetSegmentToDS
[233]111 mov bl, FLGH_DPT_INTERRUPT_IN_SERVICE
112 call FindDPT_ToDSDIforFlagsHighInBL
[150]113 mov dl, STATUS_REGISTER_in
[160]114 call IdeIO_InputToALfromIdeRegisterInDL
[150]115
[152]116 ; Clear Interrupt In-Service Flag from DPT
[158]117 and BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_INTERRUPT_IN_SERVICE
[152]118
[150]119 ; Set Task Flag
120 LOAD_BDA_SEGMENT_TO ds, ax
121 mov BYTE [BDA.bHDTaskFlg], 0FFh ; Set task flag
122
123 pop bx
124 pop dx
[152]125 pop si
[150]126 pop ds
127 ret
Note: See TracBrowser for help on using the repository browser.