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

📄 mpccl.asm

📁 X86 GX1 BOOTLOAD代码 ,支持WINCE操作系统!
💻 ASM
📖 第 1 页 / 共 2 页
字号:

	;check sleep state - if restoring from ram, do not do Id_CPU or chipsetInitNvram
	mov	dx, GEODE_ACPI_BASE+ACPI_PM1A_CNT
	in	ax, dx
	and	ax, SLP_TYPx_MASK
	cmp	ax, SLP_TYP3		; SL3
	je	chipsetInitDone

	;skip this procedure if chipsetInit is getting called during suspend
	;to ram
	call	Id_CPU

chipsetInitDone:
IF (SCx1xx_PROCESSOR)
	mov	eax, CX55x0_ID OR (FUNC0 shl 8) OR GEODE_REG44	; Disable Vendor ID write enable
	mov	dx, 0CF8h
	out	dx, eax			; Point to register
	mov	dx, 0CFCh
	in	eax, dx
	and	eax, 0F7FFFFFEh	; Mask bit 27 (F0 Index 47 bit 3) only 
	out	dx, eax			; Write EDX to register specified
ENDIF
	ror	ebx, 16
	jmp	bx

chipsetInit ENDP


;**************************************************************************
;*
;*	ConfigBaseAddr
;*
;*
;*	Entry:
;*	  None
;*
;*	Exit:
;*	  None
;*
;*	Modified:
;*	  None
;*
;**************************************************************************
ConfigBaseAddr	PROC NEAR
	mov	edi, ebx

	mov	edx, 5555h				; write out 5555xxxxh
	mov	eax, CX55x0_ID OR (FUNC5 shl 8) OR GEODE_REG64
	NOSTACK bx, Cy55x0RegWrite32
	mov	eax, CX55x0_ID OR (FUNC5 shl 8) OR GEODE_REG64
	NOSTACK bx, Cy55x0RegRead32
	cmp	dx, 5555h				; see if it stuck
	jne	F5_64h_not_valid
	mov	dx, 0AAAAh				; write out AAAAxxxxh
	mov	eax, CX55x0_ID OR (FUNC5 shl 8) OR GEODE_REG64
	NOSTACK bx, Cy55x0RegWrite32
	mov	eax, CX55x0_ID OR (FUNC5 shl 8) OR GEODE_REG64
	NOSTACK bx, Cy55x0RegRead32
	cmp	dx, 0AAAAh				; see if it stuck
	jne	F5_64h_not_valid
	xor	edx, edx				; clear upper edx
	mov	dx, GEODE_CONFIG_BASE
	mov	eax, CX55x0_ID OR (FUNC5 shl 8) OR GEODE_REG64
	NOSTACK bx, Cy55x0RegWrite32
	jmp	ConfigBaseAddrDone

F5_64h_not_valid:
	mov	ax, GEODE_CONFIG_BASE
	cmp	ax, 9000h		; base address must be kept at 9000h
					; if Func5 reg64 is not valid
	je	ConfigBaseAddrDone
	PORT80	POST_ConfigBaseAddrBad
F5_64h_halted:
	hlt				;otherwise, we halt
	jmp	F5_64h_halted

ConfigBaseAddrDone:
	mov	ebx, edi
	jmp	bx

ConfigBaseAddr	ENDP




;**************************************************************************
;*
;*	Id_CPU
;*	find the cpu type and program it into f5 index 60h
;*
;*	Entry:
;*	  None
;*
;*	Exit:
;*	  None
;*
;*	Modified:
;*	  None
;*
;**************************************************************************
PUBLIC scx2xxIDTable		;also used by int15BE
scx2xxIDTable::
; XX=Version built into the configurator
; YY=Version reported by GNT0# and GNT1#
; VVVV=version programmed into F5 index 60h
;		0XXYYh,	0VVVVh
	dw	00400h,	01200h
	dw	00402h,	01200h	;we don't currently support a 1210 in the configurator
	dw	00501h,	02200h
	dw	00603h,	03200h
	dw	0ffffh,	0ffffh	;end of table


Id_CPU proc near
	pushad
	mov	dx,GEODE_CONFIG_BASE+GEODE_PID	; Check whether it's 1201, x200 or Tavor
	in 	al,dx			; read PID

Check1100:
	cmp	al, GEODE_SC1100_PID
	jne	SCx2xx			; Jump if not 1100
	mov	edx, 01100h		; Tavor chip ID
	jmp	WriteCpu

SCx2xx:
	call	GetHRTimerSpeed
	push	ax			;save the xtal speed

	mov	dx,GEODE_CONFIG_BASE+GEODE_REV
	in 	al,dx			; read rev

	cmp	al, SCX2XX_REV_C
	jb	RevBorA

RevC:
	pop	ax
	cmp	ax, 27			; rev c only runs at 27 mhz
	jne	Id_CPUBad


Check1201:
	mov	dx,GEODE_CONFIG_BASE+GEODE_PID	; Check whether it's 1201 or x200
	in 	al,dx			; read PID
	cmp	al, GEODE_SC1201_PID
	jne	ReadStraps						; Jump if not 1201
	mov	edx, 01201h		; chip ID
	jmp	WriteCpu

ReadStraps:
; read GNT0# and GNT1# into cl
	mov	dx,GEODE_CONFIG_BASE+GEODE_MCR
	in	eax, dx
	mov	cl, 0

	rcl	eax, 3		;move bit 29 into carry, then into cl
	rcl	cl, 1
	rcr	eax, 2		;move bit 31 into carry, then into cl
	rcl	cl, 1

	mov	si, scx2xxIDTable

GetCPUType:
	mov	bx, word ptr cs:[si]
	add	si, 2			;move to id
	cmp	bl, cl
	je	WriteCPUType
	cmp	bx, 0ffffh
	je	WriteCPUType
	add	si, 2			;move to next value
	jmp	GetCPUType

WriteCPUType:
	xor	edx, edx		; clear upper edx
	mov	dx, word ptr cs:[si]
WriteCpu:
	mov	eax, CX55x0_ID
	mov	ah, FUNC5		; get function
	mov	al, GEODE_REG60		; get reg
	NOSTACK bx, Cy55x0RegWrite32
	jmp	Id_CPUDone


RevBorA:
	pop	ax
	cmp	ax, 27			; if 27 mhz, make sure the mcr
	je	Id_CPUDone		; is set correctly and exit

	cmp	ax, 25
	jne	Id_CPUBad		; if not 25 mhz, there are problems

	;check to see if pci clock is set to usb clock
	call	GetPCISpeed
	cmp	ax, 43
	jb	setup25mhz
	cmp	ax, 53
	ja	setup25mhz
	jmp	Id_CPUBad		; if pci speed is ~48mhz, we need to halt

setup25mhz:
	; Set PLL3 for 25Mhz
	mov		dx, GEODE_CONFIG_BASE + GEODE_PLL3C
	in		eax, dx
	and		eax, 00F800C0H		;Preserve reserved bits, zero rest
	or		eax, 7601D004H		;Set our bits
	out		dx, eax

	; set MCR for 25 mhz
	mov	ebx, (1 SHL 13) ;set bit13 if using 25mhz clock
	mov	dx, GEODE_CONFIG_BASE + GEODE_MCR
	in	eax, dx
	or	eax, ebx
	out	dx, eax

Id_CPUDone:
	popad
	ret

Id_CPUBad:
	PORT80 POST_XTAL_FREQ_BAD

finished:
	hlt
	jmp	finished

Id_CPU endp

;**************************************************************************
;*
;*	LPCBusInit
;*
;*	LPC bridge initialization
;*
;*	Entry:
;*	  None
;*
;*	Exit:
;*	  None
;*
;*	Modified:
;*	  AX, DX, SI, CX, EDI
;*
;**************************************************************************
LPCBusInit PROC NEAR PUBLIC
	mov	edi, ebx
	mov	ax, LPC
	cmp	ax, 0
	jz	noLPCBus		; neither installed, get out.

	PORT80	P80_CHIPSET_INIT+08h	; Chipset init: LPC bridge

	mov	cx, LPC_INIT_COUNT
	lea	si, LPC_INIT_TABLE
	mov	dx, GEODE_LPC_BASE

LPCbusloop:
	mov	dl, cs:[si]		; Get offset
	inc	si
	mov	bl, cs:[si]		; Get and mask
	inc	si
	mov	bh, cs:[si]		; Get or mask
	inc	si
	in	al, dx
	and	al, bl			; Mask register
	or	al, bh			; Enable desired bits
	out	dx, al			; Write the value to register
	loop LPCbusloop

noLPCBus:
	mov ebx, edi
	jmp bx
LPCBusInit ENDP

;**************************************************************************
;*
;*	GPIOInit
;*
;*	GPIOs initialization
;*
;*	Entry:
;*	  None
;*
;*	Exit:
;*	  None
;*
;*	Modified:
;*	  AX, DX, SI, CX
;*
;**************************************************************************
GPIOInit PROC NEAR PUBLIC
	PORT80	P80_CHIPSET_INIT+0Ah	; Chipset init: GPIO bridge

	mov	cx, GPIO_INIT_COUNT
	lea	si, GPIO_INIT_TABLE
	mov	dx, GEODE_GPIO_BASE

GpioInitloop:
	mov	dl, cs:[si]		; Get offset
	inc	si
	mov	al, cs:[si]		; Get value
	out	dx, al			; Write the value to register
	inc	si
	loop	GpioInitloop

	jmp	bx
GPIOInit ENDP

;**************************************************************************
;*
;*	VIPInit
;*
;*	Video Encoder initialization
;*
;*	Entry:
;*	  None
;*
;*	Exit:
;*	  None
;*
;*	Modified:
;*	  AX, DX, SI, CX
;*
;**************************************************************************
VIPInit PROC NEAR PUBLIC

	mov	cx, VIP_INIT_COUNT
	lea	si, VIP_INIT_TABLE
	xor	dx, dx

VipInitLoop:
	mov	edi, GEODE_VIP_BASE
	add	edi, GX_BASE
	mov	dl, byte ptr cs:[si]		; Get offset
	add	di, dx

	inc	si
	mov	al, byte ptr cs:[si]		; Get value
	mov	byte ptr es:[edi], al		; Write the value to register
	inc	si
	loop	VipInitLoop

	jmp	bx
VIPInit ENDP



_TEXT ENDS

END

⌨️ 快捷键说明

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