Ignore:
Timestamp:
Nov 22, 2011, 8:38:36 AM (12 years ago)
Author:
gregli@…
google:author:
gregli@hotmail.com
Message:

Added logic to skip scanning COM ports if a COM port was already found during the normal detection process, to avoid finding the same serial drive twice and preseting the OS with two drives which in reality point to the same physical file on the server. Also added logic to skip scanning for the slave serial drive if the master was not found. And various small optimizations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm

    r181 r200  
    5050    ret
    5151
    52 
    5352;--------------------------------------------------------------------
    5453; Finds Disk Parameter Table for
     
    6766;   Corrupts registers:
    6867;       SI
    69 ;--------------------------------------------------------------------
    70 ALIGN JUMP_ALIGN
    71 FindDPT_ToDSDIForIdeMasterAtPortDX:
     68;
     69; Converted to macros since there is only once call site for each of these
     70;
     71;--------------------------------------------------------------------
     72   
     73%macro FindDPT_ToDSDIForIdeMasterAtPortDX 0
    7274    mov     si, IterateToMasterAtPortCallback
    73     jmp     SHORT IterateAllDPTs
    74 
    75 ALIGN JUMP_ALIGN
    76 FindDPT_ToDSDIForIdeSlaveAtPortDX:
     75    call    IterateAllDPTs
     76%endmacro
     77
     78%macro FindDPT_ToDSDIForIdeSlaveAtPortDX 0
    7779    mov     si, IterateToSlaveAtPortCallback
    78     jmp     SHORT IterateAllDPTs
    79 
     80    call    IterateAllDPTs
     81%endmacro
     82
     83       
    8084;--------------------------------------------------------------------
    8185; Iteration callback for finding DPT using
     
    113117    jne     SHORT ReturnWrongDPT
    114118    mov     dl, ch                              ; Return drive number in DL
     119
     120ReturnRightDPT:
    115121    stc                                         ; Set CF since wanted DPT
    116122    ret
     
    118124
    119125;--------------------------------------------------------------------
    120 ; IterateToDptWithInterruptInServiceFlagSet
     126; IterateToDptWithFlagsHighSet:
    121127;   Parameters:
    122128;       DS:DI:  Ptr to DPT to examine
     129;       AL:     Bit in bFlagsHigh to test
    123130;   Returns:
    124131;       CF:     Set if wanted DPT found
     
    128135;--------------------------------------------------------------------
    129136ALIGN JUMP_ALIGN
    130 IterateToDptWithInterruptInServiceFlagSet:
    131     test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_INTERRUPT_IN_SERVICE
    132     jz      SHORT ReturnWrongDPT
    133     stc                                     ; Set CF since wanted DPT
    134     ret
     137IterateToDptWithFlagsHighSet:
     138    test    BYTE [di+DPT.bFlagsHigh], al    ; Clears CF (but we need the clc below anyway callers above)
     139    jnz     SHORT ReturnRightDPT
     140
    135141ReturnWrongDPT:
    136142    clc                                     ; Clear CF since wrong DPT
    137143    ret
    138144
    139 
    140145;--------------------------------------------------------------------
    141146; FindDPT_ToDSDIforInterruptInService
     147; FindDPT_ToDSDIforSerialDevice
    142148;   Parameters:
    143149;       DS:     RAMVARS segment
     
    147153;               Cleared if DPT not found
    148154;   Corrupts registers:
    149 ;       SI
    150 ;--------------------------------------------------------------------
    151 ALIGN JUMP_ALIGN
     155;       SI, AX, BX (for SerialDevice only)
     156;--------------------------------------------------------------------
     157ALIGN JUMP_ALIGN
     158       
     159%ifdef MODULE_SERIAL
     160FindDPT_ToDSDIforSerialDevice: 
     161    mov     al, FLGH_DPT_SERIAL_DEVICE
     162
     163    SKIP2B  bx
     164%endif
     165       
     166; do not align due to SKIP2B above
    152167FindDPT_ToDSDIforInterruptInService:
    153     mov     si, IterateToDptWithInterruptInServiceFlagSet
     168    mov     al, FLGH_DPT_INTERRUPT_IN_SERVICE
     169
     170    mov     si, IterateToDptWithFlagsHighSet
    154171    ; Fall to IterateAllDPTs
    155 
    156172
    157173;--------------------------------------------------------------------
     
    166182;       DS:DI:      Ptr to wanted DPT (if found)
    167183;       CF:         Set if wanted DPT found
    168 ;                   Cleared if DPT not found
    169 ;                   Unchanged if no drives
     184;                   Cleared if DPT not found, or no DPTs present
    170185;   Corrupts registers:
    171186;       Nothing unless corrupted by callback function
     
    175190    push    cx
    176191    mov     cx, [RAMVARS.wDrvCntAndFirst]
    177     jcxz    .AllDptsIterated            ; Return if no drives
     192    jcxz    .NotFound                   ; Return if no drives
    178193    mov     di, RAMVARS_size            ; Point DS:DI to first DPT
    179194ALIGN JUMP_ALIGN
     
    185200    dec     cl                          ; Decrement drives left
    186201    jnz     SHORT .LoopWhileDPTsLeft
     202.NotFound:     
    187203    clc                                 ; Clear CF since DPT not found
    188204ALIGN JUMP_ALIGN
Note: See TracChangeset for help on using the changeset viewer.