arch/sparc/prom/misc_64.c

Source file repositories/reference/linux-study-clean/arch/sparc/prom/misc_64.c

File Facts

System
Linux kernel
Corpus path
arch/sparc/prom/misc_64.c
Extension
.c
Size
9028 bytes
Lines
448
Domain
Architecture Layer
Bucket
arch/sparc
Inferred role
Architecture Layer: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0
/*
 * misc.c:  Miscellaneous prom functions that don't belong
 *          anywhere else.
 *
 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
 * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
 */

#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/module.h>

#include <asm/openprom.h>
#include <asm/oplib.h>
#include <asm/ldc.h>

static int prom_service_exists(const char *service_name)
{
	unsigned long args[5];

	args[0] = (unsigned long) "test";
	args[1] = 1;
	args[2] = 1;
	args[3] = (unsigned long) service_name;
	args[4] = (unsigned long) -1;

	p1275_cmd_direct(args);

	if (args[4])
		return 0;
	return 1;
}

void prom_sun4v_guest_soft_state(void)
{
	const char *svc = "SUNW,soft-state-supported";
	unsigned long args[3];

	if (!prom_service_exists(svc))
		return;
	args[0] = (unsigned long) svc;
	args[1] = 0;
	args[2] = 0;
	p1275_cmd_direct(args);
}

/* Reset and reboot the machine with the command 'bcommand'. */
void prom_reboot(const char *bcommand)
{
	unsigned long args[4];

#ifdef CONFIG_SUN_LDOMS
	if (ldom_domaining_enabled)
		ldom_reboot(bcommand);
#endif
	args[0] = (unsigned long) "boot";
	args[1] = 1;
	args[2] = 0;
	args[3] = (unsigned long) bcommand;

	p1275_cmd_direct(args);
}

/* Forth evaluate the expression contained in 'fstring'. */
void prom_feval(const char *fstring)
{
	unsigned long args[5];

	if (!fstring || fstring[0] == 0)
		return;
	args[0] = (unsigned long) "interpret";
	args[1] = 1;
	args[2] = 1;
	args[3] = (unsigned long) fstring;
	args[4] = (unsigned long) -1;

	p1275_cmd_direct(args);
}
EXPORT_SYMBOL(prom_feval);

/* Drop into the prom, with the chance to continue with the 'go'
 * prom command.
 */
void prom_cmdline(void)
{
	unsigned long args[3];

Annotation

Implementation Notes