Changeset 203 in xtideuniversalbios
- Timestamp:
- Nov 23, 2011, 8:42:19 PM (13 years ago)
- google:author:
- gregli@hotmail.com
- Location:
- trunk
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Inc/RamVars.inc
r179 r203 13 13 .bHDSwap resb 1 ; Hard Drive to swap to 80h and vice versa 14 14 .bXlatedDrv resb 1 ; Drive number after translation 15 resb 1 ; For WORD alignment 15 %ifdef MODULE_SERIAL 16 .bLastSerial resb 1 ; Packed Port and Baud for last serial drive detected 17 ; (using space of an alignment byte, 18 ; used during and after boot (int13/25h case)) 19 %else 20 resb 1 ; alignment 21 %endif 16 22 endstruc 17 23 -
trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc
r200 r203 100 100 ; baud rate = b, where 00 = 2400, 01 = 9600, 10 = 38.4K, 11 = 115.2K 101 101 ; 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. 102 ; 240h/2400baud corresponds to 0 for a PackedPortAndBaud value, which triggers auto detect code. 103 ; Which means 240h is not usable, and is why ..._MINPORT is 248h. A value is reserved at the upper 104 ; end of the spectrum in case it is needed (whcih is why it is 430h instead of 438h). 104 105 ; 105 106 DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTMASK EQU 0fch … … 107 108 DEVICE_SERIAL_PACKEDPORTANDBAUD_PORT_FIELD_POSITION EQU 2 108 109 DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT EQU 240h 109 DEVICE_SERIAL_PACKEDPORTANDBAUD_MINPORT EQU 248h 110 DEVICE_SERIAL_PACKEDPORTANDBAUD_MAXPORT EQU 43 8h ; or (..._PORTMASK<< 1) + ..._STARTINGPORT110 DEVICE_SERIAL_PACKEDPORTANDBAUD_MINPORT EQU 248h ; minimum port value that the user can set 111 DEVICE_SERIAL_PACKEDPORTANDBAUD_MAXPORT EQU 430h ; or ((..._PORTMASK-1) << 1) + ..._STARTINGPORT 111 112 112 113 DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDMASK EQU 3h -
trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm
r199 r203 39 39 40 40 SerialCommand_UART_scratch EQU 7 41 42 ; note that the actual StaringPoint port address is not achievable (results in 0 which triggers auto detect)43 SerialCommand_PackedPortAndBaud_StartingPort EQU 240h44 45 SerialCommand_PackedPortAndBaud_PortMask EQU 0fch ; upper 6 bits - 240h through 438h46 SerialCommand_PackedPortAndBaud_BaudMask EQU 3 ; lower 2 bits - 4 baud rates47 41 48 42 SerialCommand_Protocol_Write EQU 3 … … 479 473 480 474 481 ; To return the port number and baud rate to the FinalizeDPT routine, we482 ; stuff the value in a "vendor" specific area of the 512-byte IdentifyDevice483 ; sector.484 ;485 SerialCommand_IdentifyDevice_PackedPortAndBaud equ (157*2)486 487 475 ;-------------------------------------------------------------------- 488 476 ; SerialCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH … … 494 482 ; Returns: 495 483 ; AH: INT 13h Error Code 484 ; NOTE: Not set (or checked) during drive detection 496 485 ; CF: Cleared if success, Set if error 497 486 ; Corrupts registers: … … 500 489 ALIGN JUMP_ALIGN 501 490 SerialCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH: 502 503 mov dx,[cs:bp+IDEVARS.bSerialCOMDigit] 491 ; 492 ; To improve boot time, we do our best to avoid looking for slave serial drives when we already know the results 493 ; from the looking for a master. This is particuarly true when doing a COM port scan, as we will end up running 494 ; through all the COM ports and baud rates a second time. 495 ; 496 ; But drive detection isn't the only case - we also need to get the right drive when called on int13h/25h. 497 ; 498 ; The decision tree: 499 ; 500 ; Master: 501 ; bSerialPackedPortAndBaud Non-Zero: -> Continue with bSerialPackedAndBaud (1) 502 ; bSerialPackedPortAndBaud Zero: 503 ; bLastSerial Zero: -> Scan (2) 504 ; bLastSerial Non-Zero: -> Continue with bLastSerial (3) 505 ; 506 ; Slave: 507 ; bSerialPackedPortAndBaud Non-Zero: 508 ; bLastSerial Zero: -> Error - Not Found (4) 509 ; bLastSerial Non-Zero: -> Continue with bSerialPackedAndBaud (5) 510 ; bSerialPackedPortAndBaud Zero: 511 ; bLastSerial Zero: -> Error - Not Found (4) 512 ; bLastSerial Non-Zero: -> Continue with bLastSerial (6) 513 ; 514 ; (1) This was a port/baud that was explicilty set with the configurator. In the drive detection case, as this 515 ; is the Master, we are checking out a new controller, and so don't care about the value of bLastSerial. 516 ; And as with the int13h/25h case, we just go off and get the needed information using the user's setting. 517 ; (2) We are using the special .ideVarsSerialAuto strucutre. During drive detection, we would only be here 518 ; if bLastSerial is zero (since we only scan if no explicit drives are set), so we go off to scan. 519 ; (3) We are using the special .ideVarsSerialAuto strucutre. We won't get here during drive detection, but 520 ; we might get here on an int13h/25h call. If we have scanned COM drives, they are the ONLY serial drives 521 ; in use, and so bLastSerial will reflect the port/baud setting for the scanned COM drives. 522 ; (4) No master has been found yet, therefore no slave should be found. Avoiding the slave reduces boot time, 523 ; especially in the full COM port scan case. Note that this is different from the hardware IDE, where we 524 ; will scan for a slave even if a master is not present. Note that if ANY master had been previously found, 525 ; we will do the slave scan, which isn't harmful, it just wates time. But the most common case (by a wide 526 ; margin) will be just one serial controller. 527 ; (5) A COM port scan for a master had been previously completed, and a drive was found. In a multiple serial 528 ; controller scenario being called with int13h/25h, we need to use the value in bSerialPackedPortAndBaud 529 ; to make sure we get the proper drive. 530 ; (6) A COM port scan for a master had been previously completed, and a drive was found. We would only get here 531 ; if no serial drive was explicitly set by the user in the configurator or that drive had not been found. 532 ; Instead of performing the full COM port scan for the slave, use the port/baud value stored during the 533 ; master scan. 534 ; 535 mov dl,[cs:bp+IDEVARS.bSerialPackedPortAndBaud] 536 mov al, byte [RAMVARS.xlateVars+XLATEVARS.bLastSerial] 537 538 test bh, FLG_DRVNHEAD_DRV 539 jz .master 540 541 test al,al ; Take care of the case that is different between master and slave. 542 jz .error ; Because we do this here, the jz after the "or" below will not be taken 543 544 ; fall-through 545 .master: 504 546 test dl,dl 505 j z SerialCommand_AutoSerial506 507 xchg dh,dl ; dh (the COM character to print) will be transmitted to the server,508 ; so we know this is not an auto detect547 jnz .identifyDeviceInDL 548 549 or dl,al ; Move bLast into position in dl, as well as test for zero 550 jz .scanSerial 509 551 510 552 ; fall-through 511 SerialCommand_IdentifyDeviceInDL_DriveInBH: 553 .identifyDeviceInDL: 512 554 513 555 push bp ; setup fake IDEREGS_AND_INTPACK … … 524 566 525 567 mov bp,sp 526 527 568 call SerialCommand_OutputWithParameters_DeviceInDL 528 569 … … 533 574 534 575 pop bp 535 536 ; place packed port/baud in vendor area of packet, read by FinalizeDPT 537 mov byte [es:si+SerialCommand_IdentifyDevice_PackedPortAndBaud], dl 538 576 ; 577 ; place packed port/baud in RAMVARS, read by FinalizeDPT and DetectDrives 578 ; 579 ; Note that this will be set during an int13h/25h call as well. Which is OK since it is only used (at the 580 ; top of this routine) for drives found during a COM scan, and we only COM scan if there were no other 581 ; COM drives found. So we will only reaffirm the port/baud for the one COM port/baud that has a drive. 582 ; 583 jc .notFound ; only store bLastSerial if success 584 mov byte [RAMVARS.xlateVars+XLATEVARS.bLastSerial], dl 585 586 .notFound: 539 587 ret 540 588 … … 546 594 ; 547 595 548 SerialCommand_ScanPortAddresses:db DEVICE_SERIAL_COM7 >> 2549 550 551 552 553 554 555 596 .scanPortAddresses: db DEVICE_SERIAL_COM7 >> 2 597 db DEVICE_SERIAL_COM6 >> 2 598 db DEVICE_SERIAL_COM5 >> 2 599 db DEVICE_SERIAL_COM4 >> 2 600 db DEVICE_SERIAL_COM3 >> 2 601 db DEVICE_SERIAL_COM2 >> 2 602 db DEVICE_SERIAL_COM1 >> 2 603 db 0 556 604 557 605 ALIGN JUMP_ALIGN 558 SerialCommand_AutoSerial:559 mov di, SerialCommand_ScanPortAddresses-1606 .scanSerial: 607 mov di,.scanPortAddresses-1 560 608 561 609 .nextPort: … … 565 613 mov dh,0 ; shift from one byte to two 566 614 eSHL_IM dx, 2 567 jz .e xitNotFound615 jz .error 568 616 569 617 ; … … 603 651 604 652 .testFirstBaud: 605 call SerialCommand_IdentifyDeviceInDL_DriveInBH653 call .identifyDeviceInDL 606 654 jc .nextBaud 607 655 608 656 ret 609 657 610 .e xitNotFound:658 .error: 611 659 stc 612 mov ah,1613 660 ; mov ah,1 ; setting the error code is unnecessary as this path can only be taken during 661 ; drive detection, and drive detection works off CF and does not check AH 614 662 ret 663 664 -
trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialDPT.asm
r181 r203 17 17 SerialDPT_Finalize: 18 18 or byte [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE 19 mov al, byte [es:si+SerialCommand_IdentifyDevice_PackedPortAndBaud]19 mov al, [RAMVARS.xlateVars+XLATEVARS.bLastSerial] 20 20 mov byte [di+DPT.bSerialPortAndBaud], al 21 21 ret -
trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm
r200 r203 23 23 .DriveDetectLoop: ; Loop through IDEVARS 24 24 mov si, g_szDetect ; Setup standard print string 25 %ifdef MODULE_SERIAL 25 %ifdef MODULE_SERIAL 26 26 cmp byte [cs:bp+IDEVARS.bDevice], DEVICE_SERIAL_PORT 27 27 jnz .DriveNotSerial ; Special print string for serial drives … … 29 29 .DriveNotSerial: 30 30 %endif 31 31 32 call .DetectDrives_WithIDEVARS ; Detect Master and Slave 32 33 add bp, BYTE IDEVARS_size ; Point to next IDEVARS 33 34 loop .DriveDetectLoop 35 36 %ifdef MODULE_SERIAL 37 ; 38 ; if serial drive detected, do not scan (avoids duplicate drives and isn't needed - we have a connection) 39 ; Note that XLATEVARS.bLastSerial is zero'd in RamVars_Initialize, called in Initialize_AutoDetectDrives; 40 ; bLastSerial it set in the detection code of SerialCommand.asm 41 ; 42 cmp byte [RAMVARS.xlateVars+XLATEVARS.bLastSerial],cl ; cx = zero after the loop above 43 ; less instruction bytes than using immediate 44 jnz .done 34 45 35 %ifdef MODULE_SERIAL36 call FindDPT_ToDSDIforSerialDevice ; Did we already find any serial drives?37 jc .done ; Yes, do not scan38 46 mov al,[cs:ROMVARS.wFlags] ; Configurator set to always scan? 39 47 or al,[es:BDA.bKBFlgs1] ; Or, did the user hold down the ALT key? 40 48 and al,8 ; 8 = alt key depressed, same as FLG_ROMVARS_SERIAL_ALWAYSDETECT 41 49 jz .done 50 42 51 mov bp, ROMVARS.ideVarsSerialAuto ; Point to our special IDEVARS sructure, just for serial scans 43 52 mov si, g_szDetectCOMAuto ; Special, special print string for serial drives during a scan … … 74 83 pop si 75 84 76 %ifdef MODULE_SERIAL77 ;78 ; This block of code checks to see if we found a master during a serial drives scan. If no master79 ; 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 take81 ; time to rescan all the COM port and baud rate combinations.82 ;83 jnc .masterFound84 pop cx85 jcxz .done ; note that CX will only be zero after the .DriveDetectLoop, indicating a serial scan86 push cx87 .masterFound:88 %endif89 90 85 mov ax, g_szSlave 91 86 mov bh, MASK_DRVNHEAD_SET | FLG_DRVNHEAD_DRV … … 106 101 ; ES: Zero (BDA segment) 107 102 ; Returns: 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" 103 ; None 111 104 ; Corrupts registers: 112 105 ; AX, BX, CX, DX, SI, DI … … 144 137 ;call ReadAtapiInfoFromDrive ; Assume CD-ROM 145 138 ;jnc SHORT _CreateBiosTablesForCDROM 146 jmp short DetectDrives_DriveNotFound 139 140 ;jmp short DetectDrives_DriveNotFound 141 ;;; fall-through instead of previous jmp instruction 142 ;-------------------------------------------------------------------- 143 ; DetectDrives_DriveNotFound 144 ; Parameters: 145 ; Nothing 146 ; Returns: 147 ; CF: Set (from BootMenuPrint_NullTerminatedStringFromCSSIandSetCF) 148 ; Corrupts registers: 149 ; AX, SI 150 ;-------------------------------------------------------------------- 151 DetectDrives_DriveNotFound: 152 mov si, g_szNotFound 153 jmp BootMenuPrint_NullTerminatedStringFromCSSIandSetCF 147 154 148 155 … … 166 173 jmp short DetectPrint_DriveNameFromBootnfoInESBX 167 174 168 ;--------------------------------------------------------------------169 ; DetectDrives_DriveNotFound170 ; Parameters:171 ; Nothing172 ; Returns:173 ; CF: Set (from BootMenuPrint_NullTerminatedStringFromCSSIandSetCF)174 ; Corrupts registers:175 ; AX, SI176 ;--------------------------------------------------------------------177 DetectDrives_DriveNotFound:178 mov si, g_szNotFound179 jmp BootMenuPrint_NullTerminatedStringFromCSSIandSetCF180 175 -
trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm
r200 r203 88 88 pop bx 89 89 pop di 90 clc ; return success up through DetectDrives91 90 ret 92 91 -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm
r200 r203 124 124 125 125 ;-------------------------------------------------------------------- 126 ; IterateToDptWith FlagsHighSet:126 ; IterateToDptWithInterruptInServiceFlagSet 127 127 ; Parameters: 128 128 ; DS:DI: Ptr to DPT to examine 129 ; AL: Bit in bFlagsHigh to test130 129 ; Returns: 131 130 ; CF: Set if wanted DPT found … … 135 134 ;-------------------------------------------------------------------- 136 135 ALIGN JUMP_ALIGN 137 IterateToDptWithFlagsHighSet: 138 test BYTE [di+DPT.bFlagsHigh], al ; Clears CF (but we need the clc below anyway callers above) 136 IterateToDptWithInterruptInServiceFlagSet: 137 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_INTERRUPT_IN_SERVICE ; Clears CF (but we need the clc 138 ; below anyway for callers above) 139 139 jnz SHORT ReturnRightDPT 140 140 … … 145 145 ;-------------------------------------------------------------------- 146 146 ; FindDPT_ToDSDIforInterruptInService 147 ; FindDPT_ToDSDIforSerialDevice148 147 ; Parameters: 149 148 ; DS: RAMVARS segment … … 153 152 ; Cleared if DPT not found 154 153 ; Corrupts registers: 155 ; SI , AX, BX (for SerialDevice only)154 ; SI 156 155 ;-------------------------------------------------------------------- 157 156 ALIGN JUMP_ALIGN 158 159 %ifdef MODULE_SERIAL160 FindDPT_ToDSDIforSerialDevice:161 mov al, FLGH_DPT_SERIAL_DEVICE162 163 SKIP2B bx164 %endif165 166 ; do not align due to SKIP2B above167 157 FindDPT_ToDSDIforInterruptInService: 168 mov al, FLGH_DPT_INTERRUPT_IN_SERVICE 169 170 mov si, IterateToDptWithFlagsHighSet 158 mov si, IterateToDptWithInterruptInServiceFlagSet 171 159 ; Fall to IterateAllDPTs 172 160 -
trunk/XTIDE_Universal_BIOS/makefile
r197 r203 87 87 TARGET = $(BUILD_DIR)/$(PROG) 88 88 89 # Target size of the ROM, used by checksum Perl script 90 ROMSIZE = 8192 89 91 90 92 ######################### … … 140 142 @echo Deleted "(*.*)" from "$(BUILD_DIR)/" 141 143 144 checksum: all 145 @perl ..\tools\checksum.pl $(TARGET)_at.bin $(ROMSIZE) 146 @perl ..\tools\checksum.pl $(TARGET)_xtp.bin $(ROMSIZE) 147 @perl ..\tools\checksum.pl $(TARGET)_xt.bin $(ROMSIZE) 148 142 149 src\StringsCompressed.asm: src\Strings.asm 143 $(AS) src\Strings.asm $(ASFLAGS) $(DEFS_XT) -DMODULE_STRINGS_COMPRESSED_PRECOMPRESS -o build\Strings.bin -l build\StringsPrecompress.lst 144 perl ..\tools\StringsCompress.pl < build\StringsPrecompress.lst > src\StringsCompressed.asm 150 @$(AS) src\Strings.asm $(ASFLAGS) $(DEFS_XT) -DMODULE_STRINGS_COMPRESSED_PRECOMPRESS -o build\Strings.bin -l build\StringsPrecompress.lst 151 @perl ..\tools\StringsCompress.pl < build\StringsPrecompress.lst > src\StringsCompressed.asm 152 @echo StringsCompressed.asm updated! 145 153 146 154 $(SRC_ASM): src\StringsCompressed.asm -
trunk/XTIDE_Universal_BIOS_Configurator_v2/Inc/Help/IDE_SerialPort.txt
r202 r203 1 Select a serial port by I/O address. Supported values are between 240h and 43 8h, and must be on an 8-byte boundary. If the entered value corresponds to one of the established COM port numbers, then the selection of serial port will use COM numbers instead.1 Select a serial port by I/O address. Supported values are between 240h and 430h, and must be on an 8-byte boundary. If the entered value corresponds to one of the established COM port numbers, then the selection of serial port will use COM numbers instead. -
trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Strings.asm
r200 r203 134 134 g_szNfoIdeIRQ: db "IRQ channel to use.",NULL 135 135 g_szNfoIdeSerialCOM: db "Select a COM port by number.",NULL 136 g_szNfoIdeSerialBaud: db "Select the COM port's Baud Rate. The server must match this speed. Note UART clock multipliers may impact the actual speed.",NULL137 g_szNfoIdeSerialPort: db "Select a COM port by custom I/O port address. Address must be in the range 248h to 43 8h and be on an 8-byte boundary.", NULL136 g_szNfoIdeSerialBaud: db "Select the COM port's Baud Rate. The server must match this speed. Note that 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 248h to 430h and be on an 8-byte boundary.", NULL 138 138 139 139 g_szHelpIdeCmdPort: incbin "IDE_CommandPort.txt" … … 254 254 g_szNfoBootFloppyDrvs: db "Number of Floppy Drives to display on boot menu.",NULL 255 255 g_szNfoBootSwap: db "Drive Number Translation (swap first drive with selected).",NULL 256 g_szNfoSerialDetect: db " Will scan COM ports for a serial drive. Can also be invoked by holding down ALT at the end of standarddrive detection.",NULL256 g_szNfoSerialDetect: db "Scans all standard COM ports for serial drives. This can also be invoked by holding down ALT at the end of normal drive detection.",NULL 257 257 258 258 g_szHelpBootTimeout: incbin "Bootmenu_Timeout.txt"
Note:
See TracChangeset
for help on using the changeset viewer.