Changeset 200 in xtideuniversalbios for trunk


Ignore:
Timestamp:
Nov 22, 2011, 8:38:36 AM (13 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
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc

    r193 r200  
    6565ADDRESSING_MODE_LBA48           EQU     3   ; 48-bit LBA Addressing Mode
    6666
    67 %macro CustomDPT_GetUnshiftedAddressModeToALZF 0
    68     mov     al, [di+DPT.bFlagsLow]
    69     and     al, MASKL_DPT_ADDRESSING_MODE
    70 %endmacro
    71 
    7267; Number of Sectors per Track is fixed to 63 for LBA assist calculation.
    7368; 1024 cylinders, 256 heads, 63 sectors = 8.4 GB limit (but DOS does not support more than 255 heads)
  • trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc

    r199 r200  
    100100;   baud rate = b, where 00 = 2400, 01 = 9600, 10 = 38.4K, 11 = 115.2K
    101101;
    102 DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTMASK        EQU     0fch
    103 DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTBITS        EQU     03fh
    104 DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT    EQU     240h
    105 DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDMASK        EQU     3h
    106 DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDBITS        EQU     3h
     102; 240h/2400baud corresponds to 0 for a PackedPortAndBaud value, which is reserved (in case we need
     103; it to know if a value has been set).  Which is why ..._MINPORT is 248h.
     104;
     105DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTMASK            EQU     0fch
     106DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTBITS            EQU     03fh
     107DEVICE_SERIAL_PACKEDPORTANDBAUD_PORT_FIELD_POSITION EQU     2
     108DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT        EQU     240h
     109DEVICE_SERIAL_PACKEDPORTANDBAUD_MINPORT             EQU     248h        ; minimum port value that the user can set
     110DEVICE_SERIAL_PACKEDPORTANDBAUD_MAXPORT             EQU     438h        ; or (..._PORTMASK << 1) + ..._STARTINGPORT
     111
     112DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDMASK            EQU     3h
     113DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDBITS            EQU     3h
     114DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUD_FIELD_POSITION EQU     0
    107115
    108116; Defines for IDEVARS.wSerialPrintBaud
  • 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
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Inc/Help/Bootmenu_SerialDetect.txt

    r199 r200  
    1 Set to true, at the end of normal drive detection, COM ports 1-7 (in reverse order) will be scanned for a connection to a serial drive server. This option provides flexibility with the COM port and baud rate to be used, it need not be configured ahead of time, but at the expense of a slower boot process. Even when set to false, this functionality can still be invoked by holding down the ALT key at the end of normal drive detection.
     1Set to Yes, at the end of normal drive detection, COM ports 1-7 (in reverse order) will be scanned for a connection to a serial drive server. This option provides flexibility with the COM port and baud rate to be used, it need not be configured ahead of time, but at the expense of a slower boot process. Even when this option is set to No, this functionality can still be invoked by holding down the ALT key at the end of normal drive detection. Note that if any serial drives are detected during the normal drive detection, no scan will take place (to avoid finding the same drive twice).
     2
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/IdeControllerMenu.asm

    r199 r200  
    119119    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  NULL
    120120    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgIdeCmdPort
    121     at  MENUITEM.itemValue + ITEM_VALUE.wMinValue,                  dw  240h
    122     at  MENUITEM.itemValue + ITEM_VALUE.wMaxValue,                  dw  438h
     121    at  MENUITEM.itemValue + ITEM_VALUE.wMinValue,                  dw  DEVICE_SERIAL_PACKEDPORTANDBAUD_MINPORT
     122    at  MENUITEM.itemValue + ITEM_VALUE.wMaxValue,                  dw  DEVICE_SERIAL_PACKEDPORTANDBAUD_MAXPORT
    123123    at  MENUITEM.itemValue + ITEM_VALUE.fnValueReader,              dw  IdeControllerMenu_SerialReadPort
    124124    at  MENUITEM.itemValue + ITEM_VALUE.fnValueWriter,              dw  IdeControllerMenu_SerialWritePort
     
    538538.custom:
    539539        mov     al,'x'                              ; ASCII value 'x' for custom
    540         mov     ah,0                                ; 240h is default custom value
     540        mov     ah,1 << DEVICE_SERIAL_PACKEDPORTANDBAUD_PORT_FIELD_POSITION ; 248h
    541541        jmp     IdeControllerMenu_SerialWriteCOM_PackAndRet
    542542
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Strings.asm

    r199 r200  
    135135g_szNfoIdeSerialCOM:    db  "Select a COM port by number.",NULL
    136136g_szNfoIdeSerialBaud:   db  "Select the COM port's Baud Rate. The server must match this speed. Note UART clock multipliers may impact the actual speed.",NULL
    137 g_szNfoIdeSerialPort:   db  "Select a COM port by custom I/O port address. Address must be in the range 240h and 438h and be on an 8-byte boundary.", NULL
     137g_szNfoIdeSerialPort:   db  "Select a COM port by custom I/O port address. Address must be in the range 248h to 438h and be on an 8-byte boundary.", NULL
    138138
    139139g_szHelpIdeCmdPort:     incbin  "IDE_CommandPort.txt"
Note: See TracChangeset for help on using the changeset viewer.