Changeset 203 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Device/Serial
- Timestamp:
- Nov 23, 2011, 8:42:19 PM (13 years ago)
- google:author:
- gregli@hotmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Device/Serial
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.