summaryrefslogtreecommitdiffstats
path: root/src/northbridge/intel/i5000/halt_second_bsp.S
blob: 041807ecc71a3f07654df2a08d93d0596ed71e44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
	/* Save BIST result */

	movl	%eax, %ebp

	/* check if SPAD0 is cleared. If yes, it means this was a hard reset */
	movl	$0x800080d0, %eax
	movw	$0xcf8, %dx
	outl	%eax, %dx

	addw	$4, %dx
	inl	%dx, %eax
	cmp	$0, %eax
	je	no_reset

	/* perform hard reset */
	movw	$0xcf9, %dx
	movb	$0x06, %al
	outb	%al, %dx

loop0:	hlt
	jmp	loop0

no_reset:

	/* Read the semaphore register of i5000 (BOFL0).
	   If it returns zero, it means there was already
	   another read by another CPU */

	movl	$0x800080c0, %eax
	movw	$0xcf8, %dx
	outl	%eax, %dx

	addw	$4, %dx
	inl	%dx, %eax
	cmp	$0, %eax
	jne	1f

	/* degrade BSP to AP */
	mov	$0x1b, %ecx
	rdmsr
	andl $(~0x100), %eax
	wrmsr

	cli
loop:	hlt
	jmp	loop

1:	/* set magic value for soft reset detection */
	movl    $0x800080d0, %eax
	movw    $0xcf8, %dx
	outl    %eax, %dx

	addw    $4, %dx
	movl	$0x12345678, %eax
	outl	%eax, %dx

	/* Restore BIST */
	mov	%ebp, %eax
OpenPOWER on IntegriCloud