Changeset 540 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm


Ignore:
Timestamp:
Apr 13, 2013, 3:40:27 PM (11 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Improved interrupt handling: INT 15h AH=91h is no longer called if AH=90h was not called.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm

    r535 r540  
    3333IdeIrq_WaitForIRQ:
    3434    push    ds
    35 
    3635    LOAD_BDA_SEGMENT_TO ds, ax, !       ; Zero AX
    3736    mov     ah, OS_HOOK_DEVICE_BUSY     ; Hard disk busy (AX=9000h)
    3837    cli                                 ; Disable interrupts
    39     cmp     al, [BDA.bHDTaskFlg]        ; Task flag already set?
    40     jc      SHORT .ReturnFromWaitNotify ;  If so, skip OS notification
     38    dec     BYTE [BDA.bHDTaskFlg]       ; Clear to zero if still waiting for IRQ
     39    pop     ds
     40    jnz     SHORT .ReturnFromWaitNotify ; IRQ already! (CompactFlash was faster than CPU)   
    4141    int     BIOS_SYSTEM_INTERRUPT_15h   ; OS hook, device busy
    4242
    4343.ReturnFromWaitNotify:
    4444    sti                                 ; Enable interrupts
    45     pop     ds
    4645    ret
    4746
     
    6160ALIGN JUMP_ALIGN
    6261IdeIrq_InterruptServiceRoutineForIrqs2to7:
    63     push    di
    6462    push    ax
    65     call    AcknowledgeIdeInterruptAndSetTaskFlag
     63    mov     al, COMMAND_END_OF_INTERRUPT
    6664
    67     mov     al, COMMAND_END_OF_INTERRUPT
     65%ifdef USE_AT
    6866    jmp     SHORT AcknowledgeMasterInterruptController
    69 
    7067
    7168ALIGN JUMP_ALIGN
    7269IdeIrq_InterruptServiceRoutineForIrqs8to15:
    73     push    di
    7470    push    ax
    75     call    AcknowledgeIdeInterruptAndSetTaskFlag
    76 
    7771    mov     al, COMMAND_END_OF_INTERRUPT
    7872    out     SLAVE_8259_COMMAND_out, al  ; Acknowledge Slave 8259
     73    JMP_DELAY
    7974AcknowledgeMasterInterruptController:
     75%endif ; USE_AT
     76
    8077    out     MASTER_8259_COMMAND_out, al ; Acknowledge Master 8259
    8178
     79    ; Set Task Flag
     80    push    ds
     81    LOAD_BDA_SEGMENT_TO ds, ax, !       ; Clear AL and CF for INT 15h
     82    dec     BYTE [BDA.bHDTaskFlg]       ; Set task flag (or clear if IRQ occurred before call to INT 15h AH=90h)
     83    sti                                 ; Enable interrupts
     84    pop     ds
     85
    8286    ; Issue Int 15h, function AX=9100h (Interrupt ready)
    83     clc                                 ; Must be called with CF clear
    84     mov     ax, OS_HOOK_DEVICE_POST<<8  ; Interrupt ready, device 0 (HD)
     87    jz      SHORT .DoNotPostSinceIrqOccurredBeforeWait
     88    mov     ah, OS_HOOK_DEVICE_POST     ; Interrupt ready, device 0 (HD)
    8589    int     BIOS_SYSTEM_INTERRUPT_15h
     90.DoNotPostSinceIrqOccurredBeforeWait:
    8691
    8792    pop     ax
    88     pop     di
    8993    iret
    90 
    91 
    92 ;--------------------------------------------------------------------
    93 ; AcknowledgeIdeInterruptAndSetTaskFlag
    94 ;   Parameters:
    95 ;       Nothing
    96 ;   Returns:
    97 ;       Nothing
    98 ;   Corrupts registers:
    99 ;       AX
    100 ;--------------------------------------------------------------------
    101 ALIGN JUMP_ALIGN
    102 AcknowledgeIdeInterruptAndSetTaskFlag:
    103     push    ds
    104     push    si
    105     push    dx
    106     push    bx
    107 
    108     ; Reading Status Register acknowledges IDE interrupt
    109     call    RamVars_GetSegmentToDS
    110     mov     bl, FLGH_DPT_INTERRUPT_IN_SERVICE
    111     call    FindDPT_ToDSDIforFlagsHighInBL
    112     INPUT_TO_AL_FROM_IDE_REGISTER STATUS_REGISTER_in
    113 
    114     ; Clear Interrupt In-Service Flag from DPT
    115     and     BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_INTERRUPT_IN_SERVICE
    116 
    117     ; Set Task Flag
    118     LOAD_BDA_SEGMENT_TO ds, ax
    119     mov     BYTE [BDA.bHDTaskFlg], 0FFh     ; Set task flag
    120 
    121     pop     bx
    122     pop     dx
    123     pop     si
    124     pop     ds
    125     ret
Note: See TracChangeset for help on using the changeset viewer.