PCI Configuration 下载本文

ret

;----------------------------------------------------------- -----------; ; STACK REQUIRED ; ; ; ; Input : (AL) Mask of PCI register bits to test. ; ; (optional) ; ; (AH) Index of PCI register to access. ; ; (DL) 7:3 PCI device # ; ; 2:0 PCI function # on device ; ; (DH) 7:0 PCI bus # of device ; ; ;

; Output: (AL) Value read from chip set register. ; ; (ZF) ZR Corresponding bits in chip set ; ; register to mask are all zero. ; ; NZ Corresponding bits in chip set ; ; register to mask has at least ; ; one bit set. ; ; ; ; Register destroyed : (AL) ; ; NOTE : ;

; * Do not invoke with \ Invoke with \; ; * Do not change IF status. ; ;----------------------------------------------------------------------- ;

read_pci PROC NEAR

push edx push eax pushf

xchg movzx shl bts mov and

ax,dx eax,ax eax,8 eax,31 al,dh al,0fch

; (eax) = device & func # ; (eax) = dev & func # in ; proper position.

; (al) = reg # to access. ; (eax) = proper config enb.

shl mov edx,16

dx,00cf8h

; (dx) = CONFIG_ADDRESS

cli out jcxz jcxz shr and or in jcxz jcxz mov popf pop

test

mov pop

ret

read_pci

dx,eax short $+2 short $+2 edx,24 dl,003h dx,00cfch al,dx short $+2 short $+2

dl,al

eax al,dl

al,dl edx

; (dl) = reg # to access.

; (dl) = byte to access of reg ; (dx) = CONFIG_DATA

; (al) = data read from reg ; For returning proper flag info.

ENDP

? Host/PCI Bridge:

通常被称为北桥(North Bridge),它连接主处理器总线与root PCI 总线. ? PCI-to-ISA Bridge:

通常被称为南桥(South Bridge),它连接root PCI总线与ISA(或EISA) 总线,南桥通常还整合中断控制器(Interrupt Controller),IDE控制器(IDE Controller),USB Host控制器(USB Controller)与DMA控制器(DMA Controller). ? PCI-to-PCI Bridge:

它连接root PCI总线与PCI总线