arch/sparc/kernel/prom_64.c

Source file repositories/reference/linux-study-clean/arch/sparc/kernel/prom_64.c

File Facts

System
Linux kernel
Corpus path
arch/sparc/kernel/prom_64.c
Extension
.c
Size
15094 bytes
Lines
638
Domain
Architecture Layer
Bucket
arch/sparc
Inferred role
Architecture Layer: implementation source
Status
source 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

of_node_is_type(parent, "pciex")) {
			pci_path_component(dp, tmp_buf);
			return;
		}
		if (of_node_is_type(parent, "sbus")) {
			sbus_path_component(dp, tmp_buf);
			return;
		}
		if (of_node_is_type(parent, "upa")) {
			upa_path_component(dp, tmp_buf);
			return;
		}
		if (of_node_is_type(parent, "ebus")) {
			ebus_path_component(dp, tmp_buf);
			return;
		}
		if (of_node_name_eq(parent, "usb") ||
		    of_node_name_eq(parent, "hub")) {
			usb_path_component(dp, tmp_buf);
			return;
		}
		if (of_node_is_type(parent, "i2c")) {
			i2c_path_component(dp, tmp_buf);
			return;
		}
		if (of_node_is_type(parent, "firewire")) {
			ieee1394_path_component(dp, tmp_buf);
			return;
		}
		if (of_node_is_type(parent, "virtual-devices")) {
			vdev_path_component(dp, tmp_buf);
			return;
		}
		/* "isa" is handled with platform naming */
	}

	/* Use platform naming convention.  */
	if (tlb_type == hypervisor) {
		sun4v_path_component(dp, tmp_buf);
		return;
	} else {
		sun4u_path_component(dp, tmp_buf);
	}
}

char * __init build_path_component(struct device_node *dp)
{
	const char *name = of_get_property(dp, "name", NULL);
	char tmp_buf[64], *n;
	size_t n_sz;

	tmp_buf[0] = '\0';
	__build_path_component(dp, tmp_buf);
	if (tmp_buf[0] == '\0')
		strscpy(tmp_buf, name);

	n_sz = strlen(tmp_buf) + 1;
	n = prom_early_alloc(n_sz);
	strscpy(n, tmp_buf, n_sz);

	return n;
}

static const char *get_mid_prop(void)
{
	return (tlb_type == spitfire ? "upa-portid" : "portid");
}

bool arch_find_n_match_cpu_physical_id(struct device_node *cpun,
				       int cpu, unsigned int *thread)
{
	const char *mid_prop = get_mid_prop();
	int this_cpu_id;

	/* On hypervisor based platforms we interrogate the 'reg'
	 * property.  On everything else we look for a 'upa-portid',
	 * 'portid', or 'cpuid' property.
	 */

	if (tlb_type == hypervisor) {
		struct property *prop = of_find_property(cpun, "reg", NULL);
		u32 *regs;

		if (!prop) {
			pr_warn("CPU node missing reg property\n");
			return false;
		}
		regs = prop->value;
		this_cpu_id = regs[0] & 0x0fffffff;
	} else {

Annotation

Implementation Notes