<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          PIC 、APIC(IOAPIC LAPIC)

          作者: 時(shí)間:2016-12-15 來源:網(wǎng)絡(luò) 收藏
          1. Overview

          本文引用地址:http://www.ex-cimer.com/article/201612/330451.htm

          PIC全稱Programmable Interrupt Controller,通常是指Intel 8259A雙片級(jí)聯(lián)構(gòu)成的最多支持15個(gè)interrupts的中斷控制系統(tǒng)。APIC全稱Advanced Programmable Interrupt Controller,APIC是為了多核平臺(tái)而設(shè)計(jì)的。它由兩個(gè)部分組成IOAPICLAPIC,其中IOAPIC通常位于南橋中用于處理橋上的設(shè)備所產(chǎn)生的各種中斷,LAPIC則是每個(gè)CPU都會(huì)有一個(gè)。IOAPIC通過APICBUS(現(xiàn)在都是通過FSB/QPI)將中斷信息分派給每顆CPU的LAPIC,CPU上的LAPIC能夠智能的決定是否接受系統(tǒng)總線上傳遞過來的中斷信息,而且它還可以處理Local端中斷的pending、nesting、masking,以及IOAPIC于Local CPU的交互處理。

          2. PIC

          基于Intel 80x86的PC使用兩片8259A級(jí)聯(lián)的方式組成了可以管理15級(jí)中斷向量的一個(gè)中斷系統(tǒng),下圖是它的一個(gè)連接示意圖。兩片8259A,一片為Master,另一片為Slaver。其中Slaver的INT接到Master的IRQ2上。8259A有兩種工作模式分別為編程和操作模式。BIOS初始化的時(shí)候會(huì)先通過IO port對(duì)8259A進(jìn)行編程配置,在此之后8259A就可以響應(yīng)來自外部設(shè)備的中斷請(qǐng)求了。Master的IO address是0x20 0x21; Slaver的IO address是0xA0 0xA1。

          為了能夠正常的使用PIC來管理系統(tǒng)中斷,就需要對(duì)它進(jìn)行初始化。8259A支持兩種類型的命令字,一類是初始化命令字ICW1~4,另一類是操作命令字OCW1~3,其中每一個(gè)命令字的各個(gè)bit都有其代表的特定意義。下述是一個(gè)初始化Master的一個(gè)sample code:

          MOVAL,00010001b;級(jí)聯(lián),邊沿觸發(fā),需要寫ICW4

          OUT20H,AL;寫ICW1

          MOVAL,01000000B ;中斷類型號(hào)40H

          OUT21H,AL;寫ICW2

          MOVAL,00000100B;主片的IR2引腳從片

          OUT21H,AL;寫ICW3

          MOVAL,00010001B;特殊完全嵌套,非緩沖,自動(dòng)結(jié)束

          OUT21H,AL;寫ICW4

          3. APIC

          Intel APIC由一組中斷輸入信號(hào),一個(gè)24*64bit的Programmable Redirection Table(PRT),一組register和用于從APIC BUS(FSB/QPI)上傳送APIC MSG的部件組成,當(dāng)南橋的IO device通過IOAPIC的interrupt lines產(chǎn)生interrupt,IOAPIC將根據(jù)內(nèi)部的PRT table格式化成中斷請(qǐng)求信息,并將該信息發(fā)送給目標(biāo)CPU的LAPIC,再由LAPIC通知CPU進(jìn)行處理。下圖是一個(gè)基于Intel APIC的連接示意圖,如下圖所示IOAPIC上有24個(gè)interrupt pin,每一個(gè)pin都對(duì)應(yīng)一個(gè)RTE,所以針對(duì)每一個(gè)interrupt pin都可以單獨(dú)設(shè)定它的mask,觸發(fā)方式(level,edge trigger),中斷管腳的極性,傳送方式,傳送狀態(tài),目的地,中斷向量等。

          Programmable Redirection Table詳細(xì)格式如下所示:

          Bit Description:

          [63:56] Destination Field—R/W.If the Destination Mode of this entry is Physical Mode (bit 11=0), bits

          [59:56] contain an APIC ID. If Logical Mode is selected (bit 11=1), the Destination Field

          potentially defines a set of processors. Bits [63:56] of the Destination Field specify the logical

          destination address.

          Destination Mode IOREDTBLx[11] Logical Destination Address

          0, Physical Mode IOREDTBLx[59:56] = APIC ID

          1, Logical Mode IOREDTBLx[63:56] = Set of processors

          [55:17] Reserved.82093AA (IOAPIC)

          [16]Interrupt Mask—R/W.When this bit is 1, the interrupt signal is masked. Edge-sensitive

          interrupts signaled on a masked interrupt pin are ignored (i.e., not delivered or held pending).

          Level-asserts or negates occurring on a masked level-sensitive pin are also ignored and have no

          side effects. Changing the mask bit from unmasked to masked after the interrupt is accepted by

          a local APIC has no effect on that interrupt. This behavior is identical to the case where the

          device withdraws the interrupt before that interrupt is posted to the processor. It is softwares

          responsibility to handle the case where the mask bit is set after the interrupt message has been

          accepted by a local APIC unit but before the interrupt is dispensed to the processor. When this

          bit is 0, the interrupt is not masked. An edge or level on an interrupt pin that is not masked

          results in the delivery of the interrupt to the destination.

          [15] Trigger Mode—R/W.The trigger mode field indicates the type of signal on the interrupt pin that triggers an interrupt. 1=Level sensitive, 0=Edge sensitive.

          [14] Remote IRR—RO.This bit is used for level triggered interrupts. Its meaning is undefined for edge triggered interrupts. For level triggered interrupts, this bit is set to 1 when local APIC(s) accept the level interrupt sent by the IOAPIC. The Remote IRR bit is set to 0 when an EOI message with a matching interrupt vector is received from a local APIC.

          [13] Interrupt Input Pin Polarity (INTPOL)—R/W.This bit specifies the polarity of the interrupt

          signal. 0=High active, 1=Low active.

          [12]Delivery Status (DELIVS)—RO.The Delivery Status bit contains the current status of the

          delivery of this interrupt. Delivery Status is read-only and writes to this bit (as part of a 32 bit

          word) do not effect this bit. 0=IDLE (there is currently no activity for this interrupt). 1=Send

          Pending (the interrupt has been injected but its delivery is temporarily held up due to the APIC

          bus being busy or the inability of the receiving APIC unit to accept that interrupt at that time).

          [11] Destination Mode (DESTMOD)—R/W.This field determines the interpretation of the

          Destination field. When DESTMOD=0 (physical mode), a destination APIC is identified by its ID.

          Bits 56 through 59 of the Destination field specify the 4 bit APIC ID. When DESTMOD=1 (logical mode), destinations are identified by matching on the logical destination under the control of theDestination Format Register and Logical Destination Register in each Local APIC.

          Destination Mode IOREDTBLx[11] Logical Destination Address 0, Physical Mode IOREDTBLx[59:56] = APIC ID1, Logical Mode IOREDTBLx[63:56] = Set of processorsE 82093AA (IOAPIC)

          [10:8]Delivery Mode (DELMOD)—R/W.The Delivery Mode is a 3 bit field that specifies how the APICs listed in the destination field should act upon reception of this signal. Note that certain

          Delivery Modes only operate as intended when used in conjunction with a specific trigger Mode.

          These restrictions are indicated in the following table for each Delivery Mode.

          Mode Description

          000Fixed Deliver the signal on the INTR signal of all processor cores listed in the

          destination. Trigger Mode for "fixed" Delivery Mode can be edge or level.

          001Lowest

          Priority Deliver the signal on the INTR signal of the processor core that is

          executing at the lowest priority among all the processors listed in the

          specified destination. Trigger Mode for "lowest priority". Delivery Mode

          can be edge or level.

          010SMI System Management Interrupt. A delivery mode equal to SMI requires an

          edge trigger mode. The vector information is ignored but must be

          programmed to all zeroes for future compatibility.

          011Reserved

          100NMI Deliver the signal on the NMI signal of all processor cores listed in the

          destination. Vector information is ignored. NMI is treated as an edge

          triggered interrupt, even if it is programmed as a level triggered interrupt.

          For proper operation, this redirection table entry must be programmed to

          “edge” triggered interrupt.

          101INIT Deliver the signal to all processor cores listed in the destination by

          asserting the INIT signal. All addressed local APICs will assume their

          INIT state. INIT is always treated as an edge triggered interrupt, even if

          programmed otherwise. For proper operation, this redirection table entry

          must be programmed to “edge” triggered interrupt.

          110Reserved

          111ExtINT Deliver the signal to the INTR signal of all processor cores listed in the

          destination as an interrupt that originated in an externally connected

          (8259A-compatible) interrupt controller. The INTA cycle that corresponds

          to this ExtINT delivery is routed to the external controller that is expected

          to supply the vector. A Delivery Mode of "ExtINT"requires an edge

          trigger mode.

          [7:0] Interrupt Vector (INTVEC)—R/W:The vector field is an 8 bit field containing the interrupt

          vector for this interrupt. Vector values range from 10h to FEh.

          REFF:

          1.《82093AA I/O ADVANCED PROGRAMMABLE INTERRUPT CONTROLLER (IOAPIC)》

          2.《8259A PROGRAMMABLE INTERRUPT CONTROLLER(8259A/8259A-2)》

          3.《Undocumented PC》

          4.8259A初始化編程

          That’s all!



          關(guān)鍵詞: PICAPICIOAPICLAPI

          評(píng)論


          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();