BiOS boot spec

Source: Internet
Author: User

Http://www.wretch.cc/blog/hyper0672/9867131
The following is a post

For complete files, refer
Http://www.phoenix.com/NR/rdonlyres/56E38DE2-3E6F-4743-835F-B4A53726ABED/0/specsbbs101.pdf
Below are some highlights

BBS (BiOS boot Specification) is used to regulate how the BIOS chooses the boot device. It contains
1. Identify the IPL (initial Program Load) device in the system
2. Search for each device and check whether the device can start the system based on the user's choice.

IPL (initial Program Load) device:
IPL devie refers to the device that can start and load and execute the operating system. He includes physical or virtual devices such as floppy, hard drives, CD-ROM, PCMCIA conrtollers/CARDS, PNP cards, legacy cards and even network, serial port, parallel port, etc.
All IPL can be categorized into the following three types:
1. baid
2. PNP card (can be subdivided into BCV and Bev devices)
3. Legacy IPL Device

Baid (BiOS aware IPL device ):
This type of IPL requires BIOSProgramCodeTo provide the ability to start the system. Generally, the started program code is built in the int 19 h (BiOS bootstrap loader) service. Common devices are as follows:
First Floppy Drive, first ATA Hard Drive, pci ata card drive, atapi CD-ROM drive, PCMCIA controller bootable card, Ethernet controller code embedded in BIOS

PNP cards:
This type of IPL device must be attached to the option Rom in the C0000h-EFFFFh (2 k boundary ). In addition, the option Rom must contain the PNP option Rom header (table 2 ). In addition, boot information is recorded in the PNP expansion header (table 3), which contains BCV or Bev metrics.

BCV (BOOT connection vector ):
BCV is an indicator pointing to a piece of program code in option Rom. This program code initializes the device and detects hardware (for example, whether a SCSI device is connected to the system), or hook the INT 13 h service (disk I/O) if necessary ). Common examples include:
Pnp scsi card drive, non-PNP card PNP expansion Header

Bev (bootstrap entry vector ):
Bev is an indicator pointing to a piece of program code that is responsible for loading the operating system in option Rom, and hook int 18 h or Int 19 h services when necessary. It is usually used in network remote boot of a network card device. Common examples include:
PNP Token Ring card, PNP ethernet card, non-PNP card PNP expansion Header

Legacy IPL devices:
This device is a standard ISA card that contains an option ROM on the C0000h-EFFFFh (2 k boundary ). This type of device does not have any information about the PNP expansion header on option Rom. When its option Rom is found by BIOS, an initialized program is executed first. During the execution of this program, int 19 h, int 18 h, and INT 13 H will be hook as needed.

IPL table
Each baid and Bev device must have a corresponding field in the IPL table.
Example
0: floppy:
1: Hard Drive C:
2: CD-ROM
3: Bev #1
4: Bev #2

IPL priority
IPL priority determines the order in which IPL is started. It exists in non-volatile memory and can be modified by users. In an int 19 h (loading the operating system) call, it must be accessible and start the program according to the order in the table.
Example
0: 3 (BEV #1)
1: 4 (BEV #2)
2: 1 (hard drive C :)
3: 2 (CD-ROM)
4: 0 (floppy :)

IPL priority pseudo docode
Created at BIOS build time:
First few IPL table entries are filled in by the baids.
Maxiplcount = number of entries in IPL table.
Baidcount = number of baids in the system.
Maxbevcount = (maxiplcount-baidcount ).
The NV memory space for the IPL priority is reserved.
Assumptions:
· The default for the IPL priority will automatically be
Created during post in case the Nv memory gets initialize upted.
· Nvbevcount = number of Bev devices found last time-
Stored in NV memory.
· Postbevcount = number of Bev devices found this time.
Execution at post time:
· All option ROMs with a PNP expansion header are identified
And their initialization entry points are called.
· Additional IPL table entries are filled in with the bev
Devices Found.
· If (NV memory is already upted)
· Set Default IPL priority by first placing the baids,
And then adding in the BEVS in the order they were found.
· Else
· The IPL priority is retrieved from NV memory.
· Deltabevcount = (nvbevcount-postbevcount ).
· If (deltabevcount! = 0)
· If (deltabevcount> 0)
· For (I = 0; I! = Deltabevcount; ++ I)
· Add a new Bev device to the end of IPL priority.
· Else
· For (I = 0; I! = Deltabevcount; -- I)
· Delete the bev device nearest the end of IPL priority.
· Endif
· Save the postbevcount in NV memory as nvbevcount.
· Save the new IPL priority in NV memory.
· (Optional)-display a message that the IPL priority
Changed and allow the user to enter setup to reconfigure
The IPL priority.
· Endif
· Endif
· Invoke int 19 h.

BCV priority
In the bios int 13 H (disk I/O) service, the drive letter 00-7fh is floppy disk, and the 80-FFH is fixed disk. The correspondence between these codes and the physical disk must be completed in BIOS. It is worth noting that, since only the first floppy disk and the first Fixed Disk can be used to start (codenamed 00 h and 80 h), according to the different startup settings, you must also adjust the INT 13 H hook sequence to enable smooth startup.
For example, if the ATA Hard Disk occupies 80 h, and SCSI only occupies the drive letter after 81 h, then the SCSI hard disk cannot be used as the boot hard disk.

Example
BCV table
0: ata drives
1: Legacy cards
2: BCV #1
3: BCV #2

BCV priority
0: 2 (BCV #1)
1: 0 (ATA drives)
2: 1 (legacy cards)
3: 3 (BCV #2)

The INT 13 H supports the following types of devices:
1. ata drive
2. PNP cards with bcvs
3. Legacy cards with option ROMs
4. Hard drive baid

Key Points of INT 13 H
1. When INT 13 H is hooked, the old INT 13 H vector must be saved.
2. The number of hard disks already installed must be saved in "0040: 0075 ".
3. The first hard disk to be installed will get the code 80 h, which also indicates that it is a boot Hard Disk
4. Once int is installed for 13 H, it cannot be uninstalled.

BCV post pseudo code

Created at BIOS build time:
· First two BCV table entries are filled in by Ata support and
Legacy option Rom
Support.
· The NV memory space for the IPL priority is reserved.
Assumptions:
· The default for the BCV priority will automatically be
Created during post in case the Nv memory gets initialize upted.
1. Call the video option Rom.
2. initialize the first two BCV table entries with ATA support
And legacy cards respectively. These two entries will always
Exist in the BCV table and will always be in that order.
3. Identify all option ROMs with bcvs and add any that are
Found to the BCV table.
4. Call all the BCV option roms in the order they reside in
The BCV table and store their return value in ax upon return.
5. If NV memory is already upted, set defaults for BCV priority
And bcvcount.
6. Check if the number of BCV devices found this time matches
The number found last time. If not, update the BCV priority
And bcvcount accordingly.
7. For (I = 0; I <Index = "BCV">

Int 19 h
During this service call, all IPL has been identified and the INT 13 H device has been installed. After a call, it calls its boot handler according to the device in IPL priority. The first device with a successful call is responsible for loading the operating system. If the operating system has not been loaded after all the devices have been called, it will display an error message and wait for the restart to start.
The following is the pseudo code of int 19 h.
· Iplcount = current number of baids and Bev devices at this boot.
· For (I = 0; I <currentipl = "IPL">

int 18 h
the original int 18 h action is to give control to the bios, display an error message, and wait for the user to press the button for the next action. In BBS, the int 18 h function is redefined as the interrupt vector of the error response. Note that int 18 h does not return to the program that calls it, And the stack is reset at the beginning.
The following is a pseudo code of int 18 h
· reset stack.
· if (all IPL devices have been attempted)
· print an error message that no o/s was found.
· wait for a key stroke.
· execute the int 19 h instruction.
· else
· Determine which IPL device failed to boot.
· jump to a label in the int 19 h handler to try the next
IPL device.
· endif

Boot menu (optional)
During post, some BIOS allows users to use a specific hot key to call the boot menu and use it to change the boot device used for int 19 h. Note that this action does not change the content of IPL priority, but simply selects the device to start.
The following is the pseudo code
If (a boot menu selection was made)
Currentipl = IPL priority [boot menu selection].
Use currentipl to select the baid or Bev table entry.
Do a far call to the boot handler, if successful we never return.
If (we get control back via retf, or an int 18 h ):
Clean up the stack if necessary.
Endif
Endif

Related tables

Table 1-IPL table and BCV table entry data structure
Name offset size description
Devicetype 00 h word see definitions below
Statusflags 02 h word see bit definitions below
Boothandler 04 H far PTR far pointer to address of boot Handler
Descstring 08 h far PTR far pointer to asciiz description string
Expansion 0ch DWORD reserved for future expansion

Devicetype:
00 H = Reserved
01 H = floppy
02 h = Hard Disk
03 H = CD-ROM
04 H = PCMCIA
05 h = USB device
06 h = Embedded Network
07h .. 7fh = Reserved
80 h = Bev Device
81h .. Feh = Reserved
FFH = unknown

Table 2-PNP option Rom Header
Offset size value description
00 h byte 55 h signature byte 1
01 H byte aah signature byte 2
02 h byte varies option Rom length in 512-byte Blocks
03 h DWORD varies initialization entry point
07 h 17 bytes varies reserved.
18 h word varies offset to PCI data structure
1ah word varies offset to expansion header Structure

Table 3-PNP expansion header
0 ffset size value description
00 h byte '$ 'signature byte 1
01 H byte 'P' signature byte 2
02 h byte 'n' signature byte 3
03 h byte 'P' signature byte 4
04 H byte 01 h structure revision
05 h byte varies length (in 16 byte increments)
06 h word varies offset of next header (0000 h if none ).
08 h byte 00 h reserved
09 h byte varies checksum
0ah DWORD varies device identifier
0eh word varies pointer to manufacturer string (optional)
10 h word varies pointer to product name string (optional)
12 H 3 bytes varies device type code
15 h byte varies device indicators
16 h word varies boot connection vector (BCV ), 0000 h if none
18 h word varies disconnect vector (DV), 0000 h if none
1ah word varies Bootstrap entry vector (BEV ), 0000 h if none
1ch word 0000 h reserved
1eh word varies static resource information vector, 0000 h if none

Table 4-PCI data structure
00 h byte 'P' signature byte 1
01 H byte 'C' signature byte 2
02 h byte 'I' signature byte 3
03 h byte 'R' signature byte 4
04 H word varies vendor Identification
06 h word varies device identification
08 h word varies pointer to vital product data
0ah word varies PCI data structure Length
0ch byte varies PCI data structure Revision
0dh 3 bytes varies class code
10 h word varies image Length
12 h word varies revision level of code/Data
14 h byte varies code type
15 h byte varies indicator
16 h word reserved

 

Read the full text

Category:View BIOS comments

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.