summaryrefslogtreecommitdiffstats
path: root/arch/mips/sgi/prom/misc.c
blob: 53ee61cfe8080a0b40de2eef01a47841d28b12f8 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
 * misc.c: Miscellaneous ARCS PROM routines.
 *
 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
 */
#include <linux/config.h>
#include <linux/kernel.h>

#include <asm/sgialib.h>
#include <asm/bootinfo.h>
#include <asm/system.h>

extern unsigned long mips_cputype;
extern int initialize_kbd(void);
extern void *sgiwd93_host;
extern void reset_wd33c93(void *instance);

static inline void shutoff_r4600_cache(void)
{
	unsigned long tmp1, tmp2, tmp3;

	if(mips_cputype != CPU_R4600 &&
	   mips_cputype != CPU_R4640 &&
	   mips_cputype != CPU_R4700)
		return;
	printk("Disabling R4600 SCACHE\n");
	__asm__ __volatile__("
	.set noreorder
	.set mips3
	li	%0, 0x1
	dsll	%0, 31
	lui	%1, 0x9000
	dsll32	%1, 0
	or	%0, %1, %0
	mfc0	%2, $12
	nop; nop; nop; nop;
	li	%1, 0x80
	mtc0	%1, $12
	nop; nop; nop; nop;
	sh	$0, 0(%0)
	mtc0	$0, $12
	nop; nop; nop; nop;
	mtc0	%2, $12
	nop; nop; nop; nop;
	.set mips2
	.set reorder
        " : "=r" (tmp1), "=r" (tmp2), "=r" (tmp3));
}

void prom_halt(void)
{
	shutoff_r4600_cache();
	initialize_kbd();
#if CONFIG_SCSI_SGIWD93
	reset_wd33c93(sgiwd93_host);
#endif
	cli();
	romvec->halt();
}

void prom_powerdown(void)
{
	shutoff_r4600_cache();
	initialize_kbd();
#if CONFIG_SCSI_SGIWD93
	reset_wd33c93(sgiwd93_host);
#endif
	cli();
	romvec->pdown();
}

/* XXX is this a soft reset basically? XXX */
void prom_restart(void)
{
	shutoff_r4600_cache();
	initialize_kbd();
#if CONFIG_SCSI_SGIWD93
	reset_wd33c93(sgiwd93_host);
#endif
	cli();
	romvec->restart();
}

void prom_reboot(void)
{
	shutoff_r4600_cache();
	initialize_kbd();
#if CONFIG_SCSI_SGIWD93
	reset_wd33c93(sgiwd93_host);
#endif
	cli();
	romvec->reboot();
}

void prom_imode(void)
{
	shutoff_r4600_cache();
	initialize_kbd();
#if CONFIG_SCSI_SGIWD93
	reset_wd33c93(sgiwd93_host);
#endif
	cli();
	romvec->imode();
}

long prom_cfgsave(void)
{
	return romvec->cfg_save();
}

struct linux_sysid *prom_getsysid(void)
{
	return romvec->get_sysid();
}

void prom_cacheflush(void)
{
	romvec->cache_flush();
}