patch-2.2.4 linux/arch/sparc64/prom/misc.c
Next file: linux/arch/sparc64/solaris/fs.c
Previous file: linux/arch/sparc64/prom/memory.c
Back to the patch index
Back to the overall index
- Lines: 130
- Date:
Wed Mar 10 16:53:37 1999
- Orig file:
v2.2.3/linux/arch/sparc64/prom/misc.c
- Orig date:
Sun Nov 8 14:02:50 1998
diff -u --recursive --new-file v2.2.3/linux/arch/sparc64/prom/misc.c linux/arch/sparc64/prom/misc.c
@@ -1,4 +1,4 @@
-/* $Id: misc.c,v 1.13 1998/10/13 14:03:49 davem Exp $
+/* $Id: misc.c,v 1.14 1998/12/18 10:01:59 davem Exp $
* misc.c: Miscellaneous prom functions that don't belong
* anywhere else.
*
@@ -122,9 +122,123 @@
p1275_cmd("SUNW,set-trap-table", P1275_INOUT(1, 0), tba);
}
+/* This is only used internally below. */
+static int prom_get_mmu_ihandle(void)
+{
+ int node;
+ int ret;
+
+ node = prom_finddevice("/chosen");
+ ret = prom_getint(node, "mmu");
+ if(ret == -1 || ret == 0) {
+ prom_printf("PROMLIB: Fatal error, cannot get mmu ihandle.\n");
+ prom_halt();
+ }
+ return ret;
+}
+
+/* Load explicit I/D TLB entries. */
+long prom_itlb_load(unsigned long index,
+ unsigned long tte_data,
+ unsigned long vaddr)
+{
+ return p1275_cmd("call-method",
+ (P1275_ARG(0, P1275_ARG_IN_BUF) | P1275_INOUT(5, 1)),
+ "SUNW,itlb-load",
+ prom_get_mmu_ihandle(),
+ /* And then our actual args are pushed backwards. */
+ vaddr,
+ tte_data,
+ index);
+}
+
+long prom_dtlb_load(unsigned long index,
+ unsigned long tte_data,
+ unsigned long vaddr)
+{
+ return p1275_cmd("call-method",
+ (P1275_ARG(0, P1275_ARG_IN_BUF) | P1275_INOUT(5, 1)),
+ "SUNW,dtlb-load",
+ prom_get_mmu_ihandle(),
+ /* And then our actual args are pushed backwards. */
+ vaddr,
+ tte_data,
+ index);
+}
+
+/* Set aside physical memory which is not touched or modified
+ * across soft resets.
+ */
+unsigned long prom_retain(char *name,
+ unsigned long pa_low, unsigned long pa_high,
+ long size, long align)
+{
+ /* XXX I don't think we return multiple values correctly.
+ * XXX OBP supposedly returns pa_low/pa_high here, how does
+ * XXX it work?
+ */
+
+ /* If align is zero, the pa_low/pa_high args are passed,
+ * else they are not.
+ */
+ if(align == 0)
+ return p1275_cmd("SUNW,retain",
+ (P1275_ARG(0, P1275_ARG_IN_BUF) | P1275_INOUT(5, 2)),
+ name, pa_low, pa_high, size, align);
+ else
+ return p1275_cmd("SUNW,retain",
+ (P1275_ARG(0, P1275_ARG_IN_BUF) | P1275_INOUT(3, 2)),
+ name, size, align);
+}
+
+/* Get "Unumber" string for the SIMM at the given
+ * memory address. Usually this will be of the form
+ * "Uxxxx" where xxxx is a decimal number which is
+ * etched into the motherboard next to the SIMM slot
+ * in question.
+ */
+int prom_getunumber(unsigned long phys_lo, unsigned long phys_hi,
+ char *buf, int buflen)
+{
+ return p1275_cmd("SUNW,get-unumber",
+ (P1275_ARG(2, P1275_ARG_OUT_BUF) | P1275_INOUT(4, 1)),
+ phys_lo, phys_hi, buf, buflen);
+}
+
+/* Power management extensions. */
+void prom_sleepself(void)
+{
+ p1275_cmd("SUNW,sleep-self", P1275_INOUT(0, 0));
+}
+
+int prom_sleepsystem(void)
+{
+ return p1275_cmd("SUNW,sleep-system", P1275_INOUT(0, 1));
+}
+
+int prom_wakeupsystem(void)
+{
+ return p1275_cmd("SUNW,wakeup-system", P1275_INOUT(0, 1));
+}
+
#ifdef __SMP__
void prom_startcpu(int cpunode, unsigned long pc, unsigned long o0)
{
p1275_cmd("SUNW,start-cpu", P1275_INOUT(3, 0), cpunode, pc, o0);
+}
+
+void prom_stopself(void)
+{
+ p1275_cmd("SUNW,stop-self", P1275_INOUT(0, 0));
+}
+
+void prom_idleself(void)
+{
+ p1275_cmd("SUNW,idle-self", P1275_INOUT(0, 0));
+}
+
+void prom_resumecpu(int cpunode)
+{
+ p1275_cmd("SUNW,resume-cpu", P1275_INOUT(1, 0), cpunode);
}
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)