Sven Schnelle | 332a7e9 | 2012-02-09 21:05:20 +0100 | [diff] [blame] | 1 | /* Save BIST result */ |
| 2 | |
| 3 | movl %eax, %ebp |
| 4 | |
Sven Schnelle | 1a7a7e6 | 2012-06-17 14:23:35 +0200 | [diff] [blame] | 5 | /* check if SPAD0 is cleared. If yes, it means this was a hard reset */ |
| 6 | movl $0x800080d0, %eax |
| 7 | movw $0xcf8, %dx |
| 8 | outl %eax, %dx |
| 9 | |
| 10 | addw $4, %dx |
| 11 | inl %dx, %eax |
| 12 | cmp $0, %eax |
| 13 | je no_reset |
| 14 | |
| 15 | /* perform hard reset */ |
| 16 | movw $0xcf9, %dx |
Sven Schnelle | 1454685 | 2012-06-20 16:59:15 +0200 | [diff] [blame] | 17 | movb $0x06, %al |
| 18 | outb %al, %dx |
Sven Schnelle | 1a7a7e6 | 2012-06-17 14:23:35 +0200 | [diff] [blame] | 19 | |
| 20 | loop0: hlt |
Sven Schnelle | 39b47d2 | 2012-06-20 15:36:53 +0200 | [diff] [blame] | 21 | jmp loop0 |
Sven Schnelle | 1a7a7e6 | 2012-06-17 14:23:35 +0200 | [diff] [blame] | 22 | |
| 23 | no_reset: |
| 24 | |
Sven Schnelle | 332a7e9 | 2012-02-09 21:05:20 +0100 | [diff] [blame] | 25 | /* Read the semaphore register of i5000 (BOFL0). |
| 26 | If it returns zero, it means there was already |
| 27 | another read by another CPU */ |
| 28 | |
| 29 | movl $0x800080c0, %eax |
| 30 | movw $0xcf8, %dx |
| 31 | outl %eax, %dx |
| 32 | |
| 33 | addw $4, %dx |
| 34 | inl %dx, %eax |
| 35 | cmp $0, %eax |
| 36 | jne 1f |
| 37 | |
| 38 | /* degrade BSP to AP */ |
| 39 | mov $0x1b, %ecx |
| 40 | rdmsr |
| 41 | andl $(~0x100), %eax |
| 42 | wrmsr |
| 43 | |
| 44 | cli |
| 45 | loop: hlt |
| 46 | jmp loop |
| 47 | |
Sven Schnelle | 1a7a7e6 | 2012-06-17 14:23:35 +0200 | [diff] [blame] | 48 | 1: /* set magic value for soft reset detection */ |
| 49 | movl $0x800080d0, %eax |
| 50 | movw $0xcf8, %dx |
| 51 | outl %eax, %dx |
| 52 | |
| 53 | addw $4, %dx |
| 54 | movl $0x12345678, %eax |
| 55 | outl %eax, %dx |
| 56 | |
| 57 | /* Restore BIST */ |
Sven Schnelle | 332a7e9 | 2012-02-09 21:05:20 +0100 | [diff] [blame] | 58 | mov %ebp, %eax |