Changeset 156


Ignore:
Timestamp:
Apr 8, 2017, 12:27:58 AM (8 years ago)
Author:
Ben Rietbroek
Message:

Turned 'LVM_SetDriveLetter' into a dummy function [v1.1.1-testing]

Setting LVM drive-letters is done using the LVM drive-letter
reassignment functions. This 'LVM_SetDriveLetter' function is retained
for possible future implementation as part of the reassignment logic.

CAUTION:
This is a testbuild !
AirBoot uses the BIOS to access disks and a small coding error can trash
partition tables or other vital disk structures. You are advised to make
backups of TRACK0 and EBRs before using this testbuild. More info at:
https://rousseaux.github.io/netlabs.air-boot/pdf/AirBoot-v1.1.0-manual.pdf

Location:
trunk/bootcode
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bootcode/regular/partmain.asm

    r155 r156  
    19011901        ;~ mov     al,[BPBdl]
    19021902        ;~ sub     al,3dh
    1903         ;~ call    LVM_SetDriveLetter
     1903        ;~ call    LVM_SetDriveLetter          ; !! NOT IMPLEMENTED !!
    19041904
    19051905
  • trunk/bootcode/special/lvm.asm

    r154 r156  
    298298
    299299
    300 ; Sets a drive-letter in the LVM-info of a partition. (if it exists)
    301 ;        In: BX:CX - LBA starting sector of partition to be searched
    302 ;            DL = Physical Disk in BIOS notation. (80h+)
    303 ;            AL = DriveLetter to set (can be zero to hide partition from LVM)
    304 ;       Out: CY=1 if LVM-info found, 0 if no LVM-info.
    305 LVM_SetDriveLetter      Proc Near   Uses bx cx dx si di ds es
    306 
    307         local   disk:byte
    308         local   drive_letter:byte
    309         local   pri_ind:byte
    310         local   lvm_log_high:word
    311         local   lvm_log_low:word
    312         ; For primary partitions this information is stored in the last
    313         ; sector of track0; for all four partition entries in case they
    314         ; they are all primary ones.
    315         ;
    316         ; LVM DLAT info for logical partitions is stored in the sector
    317         ; preceding the start of the partition.
    318         ;
    319         ; Because the LVM info of a logical partition is the easiest to find,
    320         ; we do that first. The LVM info for primary partitions is located
    321         ; dependent on the geometry in use, so we use a special locater
    322         ; call for that. Also, since the LVM info for primaries contains
    323         ; info on all 4 entries, we need the partition index to obtain the
    324         ; correct drive-letter.
    325         ;
    326 
    327 IFDEF   AUX_DEBUG
    328         IF 0
    329         DBG_TEXT_OUT_AUX    'LVM_SetDriveLetter:'
    330         PUSHRF
    331             ;~ call    DEBUG_DumpRegisters
    332             ;~ call    AuxIO_DumpParagraph
    333             ;~ call    AuxIO_TeletypeNL
    334         POPRF
    335         ENDIF
    336 ENDIF
    337 
    338         mov     [disk], dl
    339 
    340         ; Store the drive-letter for later use
    341         mov     [drive_letter], al
    342 
    343 
    344         ; See if this is a primary partition
    345         ; CY will be set if it is and AL will contain the 0-based
    346         ; index in the P-table.
    347         ; If it's a logical partition, CY will be clear and AL
    348         ; will be set to 0ffh indicating an invalid index.
    349         call    PART_IsPrimaryPartition
    350         mov     al,0
    351         rcl     al,1        ; CY if primary
    352         mov     dh,al       ; Save PRI or LOG
    353         mov     [pri_ind],al
    354 
    355         ; Save PRI/LOG indicator for later use
    356         push    dx
    357 
    358         ; Load *possible* LVM sector
    359         ; This load is only valid if the partition is logical, in which case
    360         ; the LVM sector is below the start of the partition.
    361         ; If primary, the LVM sector is at a location that
    362         ; DriveIO_LoadMasterLVMSector will find out.
    363 
    364         ; Push LBA address
    365         push    bx
    366         push    cx
    367 
    368         ; Adjust for logical LVM-sector
    369         sub     cx,1
    370         sbb     bx,0
    371 
    372         ; Store LBA address of LVM-sector
    373         mov     [lvm_log_low],cx
    374         mov     [lvm_log_high],bx
    375 
    376         ; Load the LVM sector
    377         push    si
    378         push    di
    379         mov     si,offset [LVMSector]
    380         mov     di,ds
    381         mov     ax, cx                      ; LBA low is now in AX
    382         call    DriveIO_ReadSectorLBA
    383         pop     di
    384         pop     si
    385 
    386         ; Restore LBA address
    387         pop     cx
    388         pop     bx
    389 
    390         ; Restore PRI/LOG partition indicator in DH
    391         pop     dx
    392 
    393         ; Test PRI or not
    394         test    dh,dh
    395         ; It's not a PRI so we can use the previously loaded LVM sector
    396         jz      LVM_SetDriveLetter_is_not_pri
    397 
    398         ;
    399         ; It's a PRI so we use the special locator function.
    400         ; This locator takes care of extended OS/2 geometry should that be used
    401         ;
    402         call    DriveIO_LoadMasterLVMSector
    403         jnc     LVM_SetDriveLetter_null_lvm_dl
    404 
    405         mov     ax, word ptr [MasterLVMLBA]                                         ; ARRAY VAN MAKEN !
    406         mov     [lvm_log_low], ax
    407         mov     [lvm_log_high], 0
    408 
    409     LVM_SetDriveLetter_is_not_pri:
    410 
    411         ;
    412         ; At this stage the LVM-info sector has been loaded at [LVMSector].
    413         ; From here we look for an LVM entry for the partition.
    414         ; If one is found, based on it's LBA-start, it's driveletter is used
    415         ; in case byte 25h in the BPB is zero.
    416         ;
    417 
    418         ; Search for the partition in the LVM info.
    419         ; If found, CY is set and SI points to LVM entry.
    420         push    si
    421         mov     ax,cx
    422         mov     dx,bx
    423         mov     si,offset [LVMSector]
    424         call    LVM_SearchForPartition
    425         mov     bx,si   ; BX now points to LVM entry
    426         pop     si
    427 
    428         mov     al,0    ; Setup null driveletter
    429         ; Oops, no valid LVM record was used so we have a null driveletter.
    430         jnc     LVM_SetDriveLetter_null_lvm_dl
    431 
    432         ;
    433         ; At this point BX points to the LVM-entry related to the
    434         ; partition, whether it was a logical or a primary one.
    435         ;
    436         mov     al, [drive_letter]
    437         mov     [bx+LocLVM_VolumeLetter],al
    438 
    439         mov     si, offset [LVMSector]
    440         call    LVM_UpdateSectorCRC
    441 
    442         mov     dl, [disk]
    443         mov     bx, [lvm_log_high]
    444         mov     ax, [lvm_log_low]
    445 
    446         call    DriveIO_SaveSector
    447 
    448     LVM_SetDriveLetter_null_lvm_dl:
     300;------------------------------------------------------------------------------
     301; Set the LVM drive-letter for a partition (if possible)
     302;------------------------------------------------------------------------------
     303; IN    : SI    - Pointer to IPT entry for partition
     304;       : AL    - LVM drive-letter
     305; OUT   : SI    - Pointer to LVM entry in loaded (and saved) LVM record
     306;       : AL    - LVM drive-letter
     307;       : CF=1  - No valid LVM sector found, AL not valid
     308; NOTE  : Besides the drive-letter, AL can be 0 (LVM hidden) or '*' (LVM auto)
     309;------------------------------------------------------------------------------
     310LVM_SetDriveLetter      Proc Near   Uses bx cx dx di
     311
     312        ; THIS IS A DUMMY FUNCTION RETURNING FAILURE
     313
     314        ; Setting LVM drive-letters is handled by the LVM drive-letter
     315        ; reassignment functions. This is because when setting LVM
     316        ; drive-letters, duplicates and other conditions need to be checked.
     317        ; This dummy is only present because it might be implemented in the
     318        ; future as part of the drive-letter reassignment logic.
     319
     320        ; Just indicate failure and return
     321        xor     ax, ax
     322        mov     si, ax
     323        stc
    449324        ret
    450325LVM_SetDriveLetter      EndP
Note: See TracChangeset for help on using the changeset viewer.