⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mptable.asm

📁 本源码为BIOS研发技术剖析光盘原代码,是SIS530BIOS完整原代码.
💻 ASM
📖 第 1 页 / 共 2 页
字号:
	mov	eax,(CPUINFOSTRUC ptr ds:[si]).dResetID
	stosd				; CPU processor ID

	mov	eax,(CPUINFOSTRUC ptr ds:[si]).dFeature
	stosd				; CPU Feature Flags

	mov	cx,SIZEOF Processor_entry.reserved	; zero out reserved entries
	xor	al,al
@@:	stosb
	loop	@B	

	inc	word ptr es:[MP_Header.Entry_Count]	; increment number of entries

	pop	si			; get the pointer to next back
	mov	si,word ptr ds:[si]	; get next AP pointer
	pop	cx			; number of AP's
	loop	cape_00			; jump if more to add

cape_exit:
	pop	ds
	ret
create_app_proc_entries	endp

COMMENT~
*****************************************************************************************

       CREATE_BUS_ENTRIES


       Description:            This procedure will enumerate all buses.

                               PCI bus numbers will be assigned values as per the
                               actual PCI values.  Remaining values will go to ISA or EISA.



       Input:                  ES:DI = Pointer in MP table where entry needs to be made

       Output:                 ES:DI = Pointer in MP table after entry completion

       Stack:                  Available

       Registers destroyed:    EAX, BL, CX, SI


*****************************************************************************************
~

create_bus_entries	proc	near

	xor	bl,bl					; BX holds bus number to add

; Create PCI BUS entries
	call	get_max_pci_bus_number			; get max PCI bus (0-based) in CX
	inc	cx					; make it one based
@@:
	Declare_Bus	bl, PCI_BUS

	inc	bl					; increment bus number
	loop	@B	

	Declare_Bus	bl, ISA_BUS
	inc	bl

if MKF_INC_EISA
	Declare_Bus	bl, EISA_BUS
	inc	bl
endif
	ret
	
create_bus_entries	endp


COMMENT~
*****************************************************************************************

       CREATE_IO_APIC_ENTRIES


       Description:		This routine will create I/O APIC entries



       Input:                  ES:DI =	Pointer in MP table where entry needs to be made

       Output:                 ES:DI = Pointer in MP table after entry completion

       Stack:                  Available

       Registers destroyed:    EAX


*****************************************************************************************
~
create_io_apic_entries	proc	near

	Declare_IO_APIC DEFAULT_IO_APIC_BASE_ADDRESS, DEFAULT_IO_APIC_ID
	ret
	
create_io_apic_entries	endp

COMMENT~
*****************************************************************************************

       CREATE_LOCAL_INTERRUPT_ENTRIES


       Description:		This routine routes interrupts to CPU's local apic.



       Input:                  ES:DI =	Pointer in MP table where entry needs to be made

       Output:                 ES:DI = Pointer in MP table after entry completion

       Stack:                  Available

       Registers destroyed:    All general purpose


*****************************************************************************************
~
create_local_interrupt_entries	proc	near

; Route EXTINT to local APIC
	mov	ax,LOCAL_INTR_ENTRY_TYPE		; interrupt entry type
	stosb

	mov	ax,EXTINT_TYPE				; EXTINT type interrupt
	stosb	

	mov	ax,BUS_DEFAULT_TRIGGER OR BUS_DEFAULT_POLARITY
	stosw
	
	xor	ax,ax					; source bus number = N/A
	stosb						; write 0
	
	stosb						; source bus IRQ = N/A; write 0
	
	mov	ax,ALL_LOCAL_APICS			; destination APICs
	stosb				
	
	xor	ax,ax					; EXTINT -> LINTIN0
	stosb

	inc	word ptr es:[MP_Header.Entry_Count]	; increment number of entries
	
;
; Route NMI to local APIC
;
	mov	ax,LOCAL_INTR_ENTRY_TYPE		; interrupt entry type
	stosb

	mov	ax,NMI_TYPE				; NMI type interrupt
	stosb	

	mov	ax,BUS_DEFAULT_TRIGGER OR BUS_DEFAULT_POLARITY
	stosw
	
	xor	ax,ax					; source bus number = N/A
	stosb						; write 0
	
	stosb						; source bus IRQ = N/A; write 0
	
	mov	ax,ALL_LOCAL_APICS			; destination APICs
	stosb				
	
	mov	ax,1					; NMI -> LINTIN1
	stosb

	inc	word ptr es:[MP_Header.Entry_Count]	; increment number of entries
	
	ret
	
create_local_interrupt_entries	endp


COMMENT~
*****************************************************************************************

       CHECKSUM_MP_TABLE


       Description:            This routine checksums the MP table and stores its length
                               in the table header.



       Input:                  ES:DI = Pointer to end of MP table

       Output:                 CX = Length of MP table

       Stack:                  Available

       Registers destroyed:    AX, CX, SI, DI


*****************************************************************************************
~
checksum_mp_table	proc	near

	mov	word ptr es:[MP_Header.Table_Length],di	; store table length

	xor	ax,ax		; checksum
	mov	cx,di
	xor	si,si		
	
checksum_loop:
        lodsb	es:[si]
        add     ah,al
        loop    checksum_loop
        neg	ah

	mov	byte ptr es:[MP_Header.Checksum],ah	; store checksum
	mov	cx,di		; CX = length of MP table
	ret
	
checksum_mp_table	endp




COMMENT~
*****************************************************************************************

       GET_MAX_PCI_BUS_NUMBER


       Description:		This routine returns the maximum PCI bus number.



       Input:                  None

       Output:                 CX = 	Maximum PCI Bus number

       Stack:                  Available

       Registers destroyed:    CX


*****************************************************************************************
~
	public	get_max_pci_bus_number
get_max_pci_bus_number	proc	near

	push	ax
	push	bx
	push	edx
	
	xor	cx,cx
	mov	ax,0b101h
	int	1ah

	pop	edx
	pop	bx
	pop	ax
		
	ret
	
get_max_pci_bus_number	endp

COMMENT~
*****************************************************************************************

       READ_PCI_CFG_BYTE
       Description:	This routine reads a PCI config space byte

       Input:		BH =	Bus number
       			BL = 	(Device number SHL 3) or (Function number)
       			DI =	Register offset in device
       Output:		CL =	Config space byte
       Stack:		Available
       Registers destroyed:    CX
*****************************************************************************************
~
read_pci_cfg_byte	proc	near
	push	ax
	mov	ax,0b108h
	int	1ah
	pop	ax
	ret
read_pci_cfg_byte	endp


COMMENT~
*****************************************************************************************

       READ_PCI_CFG_WORD
       Description:		This routine reads a PCI config space word

       Input:		BH =	Bus number
       			BL = 	(Device number SHL 3) or (Function number)
       			DI =	Register offset in device
       Output:		CX =	Config space word
       Stack:		Available
       Registers destroyed:    CX
*****************************************************************************************
~
read_pci_cfg_word	proc	near
	push	ax
	mov	ax,0b109h
	int	1ah
	pop	ax
	ret
read_pci_cfg_word	endp
;-----------------------------------------------------------------------;
;			GET_PROCESSOR_INFO_FAR				;
;-----------------------------------------------------------------------;
get_processor_info_far:
	db	9ah			; GET_PROCESSOR_INFO at F000:EEC6
	dw	0eec6h
	dw	0f000h
	ret
;-----------------------------------------------------------------------;
;			GO_TO_FLAT_MODE_STACK_FAR			;
;-----------------------------------------------------------------------;
go_to_flat_mode_stack_far:
	db	9ah			; GO_TO_FLAT_MODE_STACK at F000:EEEA
	dw	0eeeah
	dw	0f000h
	ret
;-----------------------------------------------------------------------;
;		COMEBACK_FROM_FLAT_MODE_STACK_FAR			;
;-----------------------------------------------------------------------;
comeback_from_flat_mode_stack_far:
	db	9ah		; COMEBACK_FROM_FLAT_MODE_STACK at F000:EEED
	dw	0eeedh
	dw	0f000h
	ret
;-----------------------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;**                                                             **;
;**      (C)Copyright 1985-1996, American Megatrends, Inc.      **;
;**                                                             **;
;**                     All Rights Reserved.                    **;
;**                                                             **;
;**           6145-F Northbelt Pkwy, Norcross, GA 30071         **;
;**                                                             **;
;**                     Phone (770)-246-8600                    **;
;**                                                             **;
;*****************************************************************;
;*****************************************************************;
_text   ends
        end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -