Changeset 144


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

Scan the disks for info prior to partition scanning [v1.1.1-testing]

This populates the DISKINFO structures for each disk found, which means
that size, BIOS geometry, LVM info etc. is now available.

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/airboot.asm

    r142 r144  
    11381138ENDIF
    11391139
    1140 ; -----------------------------------------------------------------------------
    1141 ;                                                               PARTITION SCAN
    1142 ; -----------------------------------------------------------------------------
    1143 
    1144 
    1145 
    1146 
    1147 
    1148 
    1149                 ;
    1150                 ; BOOKMARK: Scan all partitions
     1140
     1141; -----------------------------------------------------------------------------
     1142;                                                                   SCAN DISKS
     1143; -----------------------------------------------------------------------------
     1144
     1145                ;
     1146                ; Scan disks for information like size etc.
     1147                ;
     1148                call    DriveIO_ScanDisks
     1149
     1150
     1151
     1152; -----------------------------------------------------------------------------
     1153;                                                          SCAN FOR PARTITIONS
     1154; -----------------------------------------------------------------------------
     1155
     1156                ;
     1157                ; Scan disks for partitions
    11511158                ;
    11521159                call    PARTSCAN_ScanForPartitions
     1160
     1161                ;
    11531162                ; Internal Partition Table is now populated.
     1163                ;
     1164
    11541165
    11551166;!
  • trunk/bootcode/regular/partscan.asm

    r125 r144  
    5252    PSSFP_HarddiscLoop:
    5353
     54; ========================================================= [ Scan Partitions ]
     55
    5456        push    dx
    55 
    56 ; ================================================ [ Locate Master LVM Sector ]
    57 
    58         ; Locate the Master LVM sector for this disk.
    59         ; If one is found, BX:AX will hold its LBA address, otherwise zero.
    60         ; Note that if LVM is set to be ignored in the SETUP, checking for a
    61         ; signature will not be done and thus no Master LVM sector will be
    62         ; found.
    63         call    DriveIO_LocateMasterLVMSector
    64 
    65         ; Put the LBA address in the BSS location for this disk
    66         xor     bh, bh                          ; Zero upper part of index
    67         mov     bl, dl                          ; Get BIOS drive-number
    68         sub     bl, 80h                         ; Now 0-based index
    69         shl     bx, 3                           ; Mult by 4 for DWORD
    70         add     bx, offset [LVM_MasterSecs]     ; Add the base offset
    71         mov     [bx+00h], ax                    ; Store LBA low
    72         xor     ax, ax                          ; LBA high always zero
    73         mov     [bx+02h], ax                    ; Store LBA high
    74 
    75 ;!
    76 ;! DEBUG_BLOCK
    77 ;! Check stored Master LVM LBA address.
    78 ;!
    79 IFDEF   AUX_DEBUG
    80         IF 0
    81         DBG_TEXT_OUT_AUX    '[Master LVM Sector]'
    82         PUSHRF
    83             xor     bh, bh
    84             mov     bl, dl
    85             sub     bl, 80h
    86             shl     bx, 3
    87             add     bx, offset [LVM_MasterSecs]
    88             mov     al, [bx]
    89             mov     ah, dl
    90             call    DEBUG_DumpRegisters
    91         POPRF
    92         ENDIF
    93 ENDIF
    94 
    95 ; ========================================================= [ Scan Partitions ]
    96 
    9757        call    PARTSCAN_ScanDriveForPartitions
    9858        pop     dx
     
    10464IFDEF   AUX_DEBUG
    10565        IF 0
    106         pushf
    107         pusha
     66        PUSHRF
    10867            call    DEBUG_DumpHidePartTables
    109         popa
    110         popf
     68        POPRF
    11169        ENDIF
    11270ENDIF
     
    11775IFDEF   AUX_DEBUG
    11876        IF 0
    119         pushf
    120         pusha
    121         call    DEBUG_DumpHidePartTables
    122         popa
    123         popf
     77        PUSHRF
     78            call    DEBUG_DumpHidePartTables
     79        POPRF
    12480        ENDIF
    12581ENDIF
    12682
    12783        ; Now we copy the new IPT over the old one...
    128         mov     si, offset NewPartTable
    129         mov     di, offset PartitionTable
     84        mov     si, offset [NewPartTable]
     85        mov     di, offset [PartitionTable]
    13086        ;movzx   ax, NewPartitions
    13187        mov   al,NewPartitions
     
    13995
    14096        ; and the New Logical Drive Letter table as well...
    141         mov     si, offset NewDriveLetters
    142         mov     di, offset DriveLetters
     97        mov     si, offset [NewDriveLetters]
     98        mov     di, offset [DriveLetters]
    14399        mov     cx, LocIPT_MaxPartitions
    144100        rep     movsb
    145101
    146102        ; ...and finally check, if we need to set a Drive-Letter
    147         mov     dl, AutoDrvLetter
     103        mov     dl, [AutoDrvLetter]
    148104        or      dl, dl
    149105        jz      PSSFP_NoAutoDriveLetter
    150106        ;movzx   cx, CFG_Partitions
    151         mov   cl,CFG_Partitions
     107        mov   cl, [CFG_Partitions]
    152108        mov   ch,0
    153109
    154110        or      cx, cx
    155111        jz      PSSFP_NoAutoDriveLetter
    156         mov     si, offset PartitionTable
    157         mov     di, offset DriveLetters
    158         mov     ax, wptr [AutoDrvLetterSerial]
    159         mov     bx, wptr [AutoDrvLetterSerial+2]
     112        mov     si, offset [PartitionTable]
     113        mov     di, offset [DriveLetters]
     114        mov     ax, word ptr [AutoDrvLetterSerial+00h]
     115        mov     bx, word ptr [AutoDrvLetterSerial+02h]
    160116    PSSFP_AutoDrvLetterLoop:
    161117        cmp     ax, [si+LocIPT_Serial]
     
    433389
    434390IFDEF   AUX_DEBUG
    435         IF 1
     391        IF 0
    436392        DBG_TEXT_OUT_AUX    'PARTSCAN_CheckThisPartition:'
    437393        PUSHRF
Note: See TracChangeset for help on using the changeset viewer.