/* Set aside physical memory which is not touched or modified
 * across soft resets.
 */
int prom_retain(const char *name, unsigned long size,
		unsigned long align, unsigned long *paddr)
{
	unsigned long args[11];

	args[0] = (unsigned long) prom_callmethod_name;
	args[1] = 5;
	args[2] = 3;
	args[3] = (unsigned long) "SUNW,retain";
	args[4] = (unsigned int) prom_get_memory_ihandle();
	args[5] = align;
	args[6] = size;
	args[7] = (unsigned long) name;
	args[8] = (unsigned long) -1;
	args[9] = (unsigned long) -1;
	args[10] = (unsigned long) -1;

	p1275_cmd_direct(args);

	if (args[8])
		return (int) args[8];

	/* Next we get "phys_high" then "phys_low".  On 64-bit
	 * the phys_high cell is don't care since the phys_low
	 * cell has the full value.
	 */
	*paddr = args[10];

	return 0;
}
Ejemplo n.º 2
0
/* 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(int syndrome_code,
		    unsigned long phys_addr,
		    char *buf, int buflen)
{
	return p1275_cmd(prom_callmethod_name,
			 (P1275_ARG(0, P1275_ARG_IN_STRING)	|
			  P1275_ARG(3, P1275_ARG_OUT_BUF)	|
			  P1275_ARG(6, P1275_ARG_IN_64B)	|
			  P1275_INOUT(8, 2)),
			 "SUNW,get-unumber", prom_get_memory_ihandle(),
			 buflen, buf, P1275_SIZE(buflen),
			 0, phys_addr, syndrome_code);
}
/* 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(int syndrome_code,
		    unsigned long phys_addr,
		    char *buf, int buflen)
{
	unsigned long args[12];

	args[0] = (unsigned long) prom_callmethod_name;
	args[1] = 7;
	args[2] = 2;
	args[3] = (unsigned long) "SUNW,get-unumber";
	args[4] = (unsigned int) prom_get_memory_ihandle();
	args[5] = buflen;
	args[6] = (unsigned long) buf;
	args[7] = 0;
	args[8] = phys_addr;
	args[9] = (unsigned int) syndrome_code;
	args[10] = (unsigned long) -1;
	args[11] = (unsigned long) -1;

	p1275_cmd_direct(args);

	return (int) args[10];
}