Changeset 200 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src


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.

Location:
trunk/XTIDE_Universal_BIOS/Src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm

    r194 r200  
    254254;   Returns:
    255255;       BP:     Popped from stack
     256;       CF:     Set since menu event was handled successfully       
    256257;   Corrupts registers:
    257258;       AX, DI
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm

    r194 r200  
    5454;--------------------------------------------------------------------
    5555.PushAddressingMode:
    56     CustomDPT_GetUnshiftedAddressModeToALZF
     56    AccessDPT_GetUnshiftedAddressModeToALZF
    5757    ;;
    5858    ;; This multiply both shifts the addressing mode bits down to low order bits, and
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm

    r170 r200  
    7979    push    dx                          ; Store base port address
    8080    xor     cx, cx                      ; Assume no errors
    81     call    FindDPT_ToDSDIForIdeMasterAtPortDX
     81    FindDPT_ToDSDIForIdeMasterAtPortDX
    8282    jnc     SHORT .InitializeSlave      ; Master drive not present
    8383    call    AH9h_InitializeDriveForUse
     
    8585.InitializeSlave:
    8686    pop     dx                          ; Restore base port address
    87     call    FindDPT_ToDSDIForIdeSlaveAtPortDX
     87    FindDPT_ToDSDIForIdeSlaveAtPortDX
    8888    jnc     SHORT .CombineErrors        ; Slave drive not present
    8989    call    AH9h_InitializeDriveForUse
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Address.asm

    r194 r200  
    8787        call    Address_ExtractLCHSparametersFromOldInt13hAddress
    8888           
    89         CustomDPT_GetUnshiftedAddressModeToALZF
     89        AccessDPT_GetUnshiftedAddressModeToALZF
    9090       
    9191;;; 0: ADDR_DPT_LCHS       
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm

    r199 r200  
    2020    call    RamVars_GetIdeControllerCountToCX
    2121    mov     bp, ROMVARS.ideVars0            ; CS:BP now points to first IDEVARS
    22 .DriveDetectLoop:
    23     mov     si, g_szDetect
     22
     23.DriveDetectLoop:                           ; Loop through IDEVARS
     24    mov     si, g_szDetect                  ; Setup standard print string
    2425%ifdef MODULE_SERIAL
    2526    cmp     byte [cs:bp+IDEVARS.bDevice], DEVICE_SERIAL_PORT
    26     jnz     .DriveNotSerial
     27    jnz     .DriveNotSerial                 ; Special print string for serial drives
    2728    mov     si, g_szDetectCOM
    2829.DriveNotSerial:
     
    3132    add     bp, BYTE IDEVARS_size           ; Point to next IDEVARS
    3233    loop    .DriveDetectLoop
     34       
    3335%ifdef MODULE_SERIAL
    34     mov     al,[cs:ROMVARS.wFlags]
    35     or      al,[es:BDA.bKBFlgs1]
    36     and     al,8        ; 8 = alt key depressed, same as FLG_ROMVARS_SERIAL_ALWAYSDETECT
    37     jz      .done
    38     mov     bp, ROMVARS.ideVarsSerialAuto
    39     mov     si, g_szDetectCOMAuto
     36    call    FindDPT_ToDSDIforSerialDevice   ; Did we already find any serial drives?
     37    jc      .done                           ; Yes, do not scan
     38    mov     al,[cs:ROMVARS.wFlags]          ; Configurator set to always scan?
     39    or      al,[es:BDA.bKBFlgs1]            ; Or, did the user hold down the ALT key?
     40    and     al,8                            ; 8 = alt key depressed, same as FLG_ROMVARS_SERIAL_ALWAYSDETECT
     41    jz      .done                           
     42    mov     bp, ROMVARS.ideVarsSerialAuto   ; Point to our special IDEVARS sructure, just for serial scans
     43    mov     si, g_szDetectCOMAuto           ; Special, special print string for serial drives during a scan
    4044;;; fall-through                   
    4145%else
     
    4448
    4549%if FLG_ROMVARS_SERIAL_SCANDETECT != 8
    46 %error "DetectDrives is currently coded to assume that FLG_ROMVARS_SERIAL_ALWAYSDETECT is the same bit as the ALT key code in the BDA.  Changes in the code will be needed if these values are no longer the same."
     50%error "DetectDrives is currently coded to assume that FLG_ROMVARS_SERIAL_SCANDETECT is the same bit as the ALT key code in the BDA.  Changes in the code will be needed if these values are no longer the same."
    4751%endif
    4852
     
    7074    pop     si
    7175
     76%ifdef MODULE_SERIAL
     77;
     78; This block of code checks to see if we found a master during a serial drives scan.  If no master
     79; was found, there is no point in scanning for a slave as the server will not return a slave without a master,
     80; as there is very little point given the drives are emulated.  Performing the slave scan will take
     81; time to rescan all the COM port and baud rate combinations.
     82;
     83    jnc     .masterFound
     84    pop     cx
     85    jcxz    .done       ; note that CX will only be zero after the .DriveDetectLoop, indicating a serial scan
     86    push    cx
     87.masterFound:
     88%endif
     89       
    7290    mov     ax, g_szSlave
    7391    mov     bh, MASK_DRVNHEAD_SET | FLG_DRVNHEAD_DRV
    7492    call    StartDetectionWithDriveSelectByteInBHandStringInAX
    7593    pop     cx
     94       
    7695.done: 
    7796    ret
     
    87106;       ES:     Zero (BDA segment)
    88107;   Returns:
    89 ;       Nothing
     108;       CF:     Set on failure, Clear on success
     109;               Note that this is set in the last thing both cases
     110;               do: printing the drive name, or printing "Not Found"
    90111;   Corrupts registers:
    91112;       AX, BX, CX, DX, SI, DI
     
    150171;       Nothing
    151172;   Returns:
    152 ;       Nothing
     173;       CF:     Set (from BootMenuPrint_NullTerminatedStringFromCSSIandSetCF)
    153174;   Corrupts registers:
    154175;       AX, SI
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm

    r199 r200  
    8888    pop     bx
    8989    pop     di
     90    clc                         ; return success up through DetectDrives
    9091    ret
    9192
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm

    r193 r200  
    124124.ReturnPointerToDRVPARAMS:
    125125    ret
     126
     127;--------------------------------------------------------------------
     128; AccessDPT_GetUnshiftedAddressModeToALZF
     129;   Parameters:
     130;       DS:DI:  Ptr to Disk Parameter Table
     131;   Returns:
     132;       AL:     Addressing Mode (L-CHS, P-CHS, LBA28, LBA48)
     133;               unshifted (still shifted where it is in bFlagsLow)
     134;       ZF:     Set based on value in AL
     135;   Corrupts registers:
     136;       AL
     137;--------------------------------------------------------------------
     138;
     139; Converted to a macro since only called in two places, and the call/ret overhead
     140; is not worth it for these two instructions (4 bytes total)
     141;
     142%macro AccessDPT_GetUnshiftedAddressModeToALZF 0
     143    mov     al, [di+DPT.bFlagsLow]
     144    and     al, MASKL_DPT_ADDRESSING_MODE
     145%endmacro
     146
     147       
  • 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.