Your SlideShare is downloading. ×
01. Bios Introduction
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

01. Bios Introduction

5,436
views

Published on

Published in: Technology

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,436
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
205
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. A.學習目標 (BIOS Introduction) a.瞭解 BIOS 在 PC 中扮演的角色及相關的解釋名詞。 b.瞭解基本的 System Memory Map。 c.關於 BIOS Training Course 接下來課程的基本介紹。 B.大綱 1. BIOS Brief Introduction 1.1. What is BIOS? 1.2. BIOS Definition 1.3 System Memory Map 1.4 BIOS Category 1.5 BIOS Vendor 1.6 Vendors of Flash ROM 1.7 First Instruction Executed 2. BIOS Develop and Debug Tools: ADU& RW 3. What is SF100? C. BIOS Introduction 1. BIOS Brief Introduction 1.1. What is BIOS? Acronym: Basic Input Output System Function: Perform all necessary functions Properly initialize the system's hardware (POST-Power on Self Test) Keyboard, video display, communications ports, and disk drives Store medium: Flash ROM (Read Only Memory) Interface: Between OS/AP and H/W (Firmware 韌體) Language: Assembler or C (EFI BIOS) 1.2. BIOS Definition BIOS -- Basic Input and Output System, is used for initializing, testing and putting the PC into the ready state so that an OS may be started. Part of the BIOS remains in the system main memory after POST (Power on Self Test). BIOS provides a consistent software interface to varying types of the hardware devices. It also provides the basic system level services to OS. The BIOS is also used for helping IHV to fix their hardware design bugs by using the SMM mode of the IA architecture. BIOS,基本輸入輸出系統(Basic Input-Output System),其內容儲存在主機板上的一 個 ROM 內,主要儲存著有關系統最重要的基本輸入輸出程式,系統訊息設置、Post 程式 和 Boot to OS 程式等。 所有會在 BIOS 之前發生的操作就只有 Power On,也就是按下電腦上電源開關的那一 瞬間。在 Power On 階段一開始,會進入 BIOS 的啟動流程,當使用者按下電源開關, CPU 會先被啟動去尋找 BIOS 中的第一道指令,接著 BIOS 會在 Flash Memory 中執行, 1
  • 2. 配合著 CMOS 中使用者所喜好的設置,然後 BIOS 會將自己解壓縮到電腦的主記憶體 中繼續執行。 BIOS 的基本功能: (1) POST (Power On Self Test) 開 機 自 我 測 試 包括對 CPU 各項暫存器、Memory、ROM、Main board、CMOS 記憶體,video display、communications ports、disk drives 及 Keyboard 進行測試。 (2) Initialize 初始化硬體,設置其基本狀態,使得整個計算機達到所謂的 Ready State,使得硬體 能夠按照 PC 的架構工作,BIOS 必須要按照由 IHV 提供的手冊將硬體設置好,比如 寫幾個必須的 register 之類的,做一些 enable 的工作。 初始化立的內容大致上有: (a) Build up Interrupt Vector Table (建立中斷向量表) (b) System Resources Allocation (c) Register (d) I/O Device Note: IVH (Independent Hardware Vendor) An organization that makes electronic equipment. It implies a company that specializes in a niche area, such as display adapters or disk controllers, rather than a computer systems manufacturer. (3) 系統設置程式 記錄系統的設定值,並且儲存在 CMOS or FLASH Memory 的 ESCD 區域,主要 儲存著系統基本情況、CPU 特性、軟硬碟驅動器、顯示器、鍵盤等部件的訊息。 BIOS 在 ROM 晶片中裝有"系統設置程式",主要用來設置 CMOS RAM 中的各項參數。這個 程式在開機時按下某個特定鍵即可進入設置狀態,並提供了良好的介面供操作人員 使用。事實上,這個設置 CMOS 參數的過程,習慣上也稱為" BIOS 設置"。一旦 CMOS RAM 晶片中關於微機的配置訊息不正確時,輕者會使得系統整體執行性能 降低、軟硬碟驅動器等部件不能識別,嚴重時就會由此引發系統的軟硬體故障。 CMOS 設置程式:當 BIOS 啟動時會先去確認 CMOS 中的資料是否正確。如果正確 便會將之前使用者存儲在 CMOS 的資料,加上已存或找到的硬體資訊,整合成一 個表格,寫到記憶體中,也就是所謂的 SMBIOS。如果發現錯誤,則會自動以預 2
  • 3. 設值取代 CMOS 提供的資料。所以這份寫入記憶體的 SMBIOS 表格,就是使用者 進入 BIOS 選項後,可以看到或選擇的所有資訊。 (4) Boot to OS 啟動 OS Loader 引導載入作業系統。 啟動操作系統,這也是 BIOS 必須要做的事情之一。啟動的方式是由 BIOS 規定,操 作系統必須按照 BIOS 的要求來設計。這也是為什麼操作系統從 DOS 一直到 Vista, 都只能把自己的 loader 放在 MBR,因為 BIOS 只讀 MBR。當然,在 EFI 時代,這一 點有所改變,EFI 支援的 Boot From File 不在需要 MBR。 系統在完成 POST 自檢後, ROM BIOS 就首先按照系統 CMOS 設置中儲存的啟動 順序搜尋軟硬碟驅動器及 CD-ROM、網路服務器等有效地啟動驅動器,讀入操作系 統啟始記錄,然後將系統控制權交給啟始記錄,並由啟始記錄來完成系統的順利啟 動 (Between OS/AP and H/W) (5)程 式 服 務 處 理 和 中斷服務程式 *(提供常駐程式庫) 在 OS 啟動起來以後,BIOS 的一部分繼續常駐於記憶體,提供 OS 以及其他軟體基 本的系統服務,這兩部分是兩個獨立的內容,但在使用上密切相關。 程式服務處理程式主要是為應用程式和作業系統服務,這些服務主要與輸入 輸出 設備有關,例如讀磁片、檔輸出到印表機等。為了完成這些操作,BIOS 必須直接與電 腦的 I/O 設備打交道,它通過 I/O Port 發出命令,向各種外部設備傳送資料以及接 收資料,使程式能夠脫離具體的硬體操作,而硬體中斷處理則分別處理 PC 硬體的需 求,因此這兩部分分別為軟體和硬體服務,組合到一起,使電腦系統正常運行。 BIOS 的服務功能是通過調用中斷服務程式來實現的,這些服務分為很多組,每組有 一個專門的中斷。例如視頻服務(10H);螢幕列印(05H);磁片及串列口服務(14H)等。 每一組又根據具體功能細分為不同的服務號。應用程式需要進行操作只需要在程式中 用相應的指令說明即可,無需直接控制。 3
  • 4. BIOS 會告訴 CPU 各硬體設備的 IRQ,當周邊裝置、介面卡,或零件有狀況,就會 發出 IRQ 中斷通知,接著 CPU 就會根據 IRQ 訊號使用相對應的硬體完成工作, 之後該設備再送出 EOI(end of interrupt)的訊號方式通知 CPU,然後返回原先被中 斷的程式繼續執行。 (6)修復硬體缺陷 IA32e 有個模式叫 System Management Mode,BIOS 在每次開機時進 SMM,利用 BIOS 中的 Microcode 修正 CPU 硬體上的 bug,這叫做 CPU Microcode update。這樣 CPU 不用回收出問題 CPU。 1.3 System Memory Map 這是一張 DOS 下的 System Memory Map,看起來非常簡單,但是他有一些重要的資訊, 很值得一開始學習 BIOS 的我們仔細去看一看。 (1.) Interrupt Vector Table 內中放 4byte 為一組的 pointer 指到真正 interrupt code 存放的 memory 位置,所以根據這個範圍 0000:0000h~0000:0400h 我們可以知道,DOS 下最 多只能有 100 個 Interrupt。 (2.) BIOS Data Area 放有關於 PC 的一些 information(沒有固定的放置方法)。 (3.) System BIOS、Extended BIOS 範圍內放 runtime service。 (4.) C000:0000 放 VGA 相關的資料 Note: 個人電腦的 RAM 共可分為 5 種記憶體.. 4
  • 5. 傳統記憶體(Conventional Memory):640k 以下。 延伸式記憶體(Extended Memory):1M 以上。 擴展式記憶體( Expanded Memory):另一種添加記憶體的方式,但是它不像延伸記憶體般線 性地排列在 1MB 之後,而是獨立於一旁,只要透過一塊 640K~1MB 間的位址空間,大小 64KB 的頁框(Page Frame),就可以將我們想要存放的資料或程式碼映射(Mapping)到擴展記 憶體上。早期的擴展記憶體是附在一張擴展記憶體擴充卡上。 UMB (Upper Memory Block):640K 到 1M 之間的記憶體稱為 UPPER MEMORY AREA (A0000H – FFFFFH),保留做為 ROM BIOS 及視訊等使用未被使用的記憶空間稱為 Upper Memory Block ,簡稱 UMB。 HMA (High Memory Area): 早期 cpu 的 register 是 16bits 所能定址的記憶空間為 0000:0000 – FFFF:FFFF,但位址線只有 20 條,所以當超過 1MEGA 就會繞回(wrapping)。現在的 CPU 其位址線都已超過 20 條,我們可以令 A20 enable,使 wrapping 的現象不再發生,如此即可控 制 1M 以上的記憶空間了。此塊區域(FFFF:0010 – FFFF:FFFF)約 64K 稱為 HMA(High Memory Area)。 1.4 BIOS Category (1.) System BIOS (2.) Video BIOS (3) KBC BIOS (4) I/O BIOS - SCSI BIOS or BOOT ROM (PXE ROM) 1.5 BIOS Vendor (1)Phoenix BIOS (Award BIOS 被這家併購了) (2)AMI BIOS (3)Insyde Software 1.6 Vendors of Flash ROM (1) SST (2) Winbond (3) MXIC (4) Atmel 1.7 First Instruction Executed The first instruction that is fetched and executed following a hardware reset is located at physical address FFFFFFF0H. This address is 16 bytes below the processor supper most physical address. The EPROM contains the software-initialization code must be located at this address. The address FFFFFFF0H is beyond the 1-M Byte addressable range of the processor while in real-address mode. hardware reset 後第一條指令的抓取和執行定址在 FFFFFFF0H 物理位址。 這一位址是處理器能定址到的最高的 16 位元組物理位址, 5
  • 6. EPROM 包含的軟體初始化代碼正是定位在這裡(即 FFFFFFF0H)。 FFFFFFF0H 已經超出了處理器在實模式下可定址的 1M 位元組範圍。 The processor is initialized to this starting address as flows. The CS register has two parts: the visible segment selector part and the hidden base address part. In real-address mode, the base address is normally formed by shifting the 16-bit segment selector value 4 bits to the left to produce a 20-bit base address. However, during a hardware reset, the segment selector in the CS register is loaded with F000H and the base address is loaded with FFFF0000H. The starting address is thus formed by adding the base address to the value in the EIP register (that is, FFFF0000+FFF0H=FFFFFFF0H) 處理器是這樣初始化這個開始位址的: CS register 有兩個部分:可見的段選擇器部分和隱藏的基底位址部分。 在 Real mode 下,正常是把 segment selector 左移 4 位而得到 20 位的 base address。(CS base address = CS segment selector*16) 然而,在 hardware reset 期間 CS register 被載入為 F000H 並且 base address 被載入為 FFFF0000H。所以開始位址是通過 base address + EIP register 的值得到的也就是, FFFF0000+FFFF0H=(FFFFFFF0H) The first time the CS register is loaded with a new value after a hardware reset, the processor will follow the normal rule for address translation in real-address mode (that is ,[CS base address=CS segment selector*16]). To insure that the base address in the CS register remains unchanged until the EPROM based software-initialization code is completed, the code must not contain a far jump or allow an interrupt to occur(which would cause the CS selector value to be changed). 在 hardware reset 後,CS register 第一次被載入了一個新值,處理器會依照一般的 real address mode 轉換規則(也就是,CS base address =CS selector * 16)。 為了確保在 CS register 存放的 base address 不被改變,直到 EPROM 的軟體初始化代碼完 成,代碼千萬不要包含 far jump 或者允許中斷發生 (這樣會導致 CS selector value 改變)。 2. BIOS Develop and Debug Tools: ADU & RW-Everything ADU Award Doctor Utility ADU is Award Doctor Utility Acronym. This utility access hardware including: PCI Winbond(I Memory(Normal/Flat Mode) O) CMOS(IO) ISA(IO) IO Space(IO) 6
  • 7. ITE(IO) ClockGen(SMBus) SMSC(IO) Read Byte(SMBus) SPD(SMBus) Read Block(SMBus) main function of ADU utility. PCI Get PCI register show device information. Ex. We show VIA IEEE1394 controller, and we can see INT IRQ line is 07h locate in 3Ch. 7
  • 8. Memory Flat mode I set start address in 000FFFF0h (F000:FFF0). We can see “EA 5B”. This is BIOS first instruction executed. Normal mode Flat mode and Normal mode is mean different memory address mode. CMOS Dump CMOS data, for RTC example: RTC, record the system time/data.
  • 9. RW-Everything This utility access almost all the computer hardware, including: PCI (PCI Express) CPU MSR Registers PCI Index/Data Memory ATA/ATAPI Identify Data Memory Index/Data ACPI Tables Dump (include AML decode) I/O Space Embedded Controller I/O Index/Data Super I/O USB Information Clock Generator SMBIOS Structures DIMM SPD PCI Option ROMs SMBus Device MP Configuration Table Remote Acce Now I explain the main function of RW utility. PCI (PCI Express) To dump PCI register (256Bytes). Select different PCI device To express the info which be selected Binary to Text expression PCI device summary
  • 10. Info When I select first two bytes that I can to know it is Vendor ID form info. 11hex >> 17dec Text Hex value mapping to ASCII code. Hex ASCII Summary Mapping register, show device summary follow PCI specification. Device summary
  • 11. Memory Dump Dump all data of main memory. Dump memory, we must set a star address and will show a block value (FFh 256Byte). Set star address Hex ASCII Range search Search function Search function:We can set a range and key-in a keyword to search in memory. Set range Ex. We search signature “RSD PTR” (find ACPI table), set Rang in E&F segments. After Answer search we can get a string (in FA8C0). .
  • 12. ACPI Show all about ACPI table. RSDP is ACPI table entry pointer, it record RSDT address. RSDP address Point to RSDT address RSDT is ACPI table root, record all ACPI table address. List of all ACPI table In top, we could select different ACPI table to watch each RSDT address table’s detail information. 0 Point to all of ACPI table Ex. check DSDT table could get ASL code
  • 13. USB Work mode (USB2.0) USB2.0 EHCI Device Name USB Device SMBIOS SMBIOS Entry SMBIOS structure point and length System information o Device info
  • 14. 3. What is SF100? SF100 is used to program the SPI flash memory soldered on application board. SF100 must be a coworker with Dediprog SF software. As below is the application window of Dediprog SF software. 2. How to use Dediprog SF software? (1.) Preprepareation Connect the SF100 to the PC through a USB cable. Insert the flash card (face in when inserting) into the flash card header on the programmer. (2.) The Toolbar Function Chip Icon: It is used to detect the type of flash memory. File Icon: It is used to select the file that user want to program. The file can not be larger than the memory. Blank Icon: Check the flash memory is blank or not. Erase Icon: Erase the full content in a memory. After “Erase” the application memory shall be blank. Prog Icon: Program the selected image into the memory Verify Icon: Verify the checksum value of the selected image and the programmed image View Icon: When click on View, the programmer will read both the content of the selected image and the content in the application memory. Batch Icon: The programmer will perform a pre-configured set of operations such as (reload file+blank check+erase+program+verify) all together in one click. The configuration can be done by clicking on the “option” on the top of the screen menu. The configuration will not be changed until it is reconfigured.
  • 15. (3.) Flash Rom Operation Principle Program Flash programming always writes 0 into memory. Flash memory can not be programmed with 1. So we have to erase the flash memory before program it. Erase: The operation of erase is always writing 1 into flash memory. The basic unit erased is block.