arch/powerpc/boot/treeboot-akebono.c

Source file repositories/reference/linux-study-clean/arch/powerpc/boot/treeboot-akebono.c

File Facts

System
Linux kernel
Corpus path
arch/powerpc/boot/treeboot-akebono.c
Extension
.c
Size
3905 bytes
Lines
160
Domain
Architecture Layer
Bucket
arch/powerpc
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

if (strncmp(&userdata[i], "local-mac-addr=", 15) == 0) {
			if (i > 0 && userdata[i - 1] != ' ') {
				/* We've only found a substring ending
				 * with local-mac-addr so this isn't
				 * our mac address. */
				continue;
			}

			mac_addr = strtoull(&userdata[i + 15], &end, 16);

			/* Remove the "local-mac-addr=<...>" from the kernel
			 * command line, including the tailing space if
			 * present. */
			if (*end == ' ')
				end++;

			len = ((int) end) - ((int) &userdata[i]);
			memmove(&userdata[i], end,
				userdata_len - (len + i) + 1);
			break;
		}
	}

	loader_info.cmdline = userdata;
	loader_info.cmdline_len = 256;

	ibm_akebono_memsize = ibm_akebono_detect_memsize();
	if (ibm_akebono_memsize >> 32)
		end_of_ram = ~0UL;
	else
		end_of_ram = ibm_akebono_memsize;
	avail_ram = end_of_ram - (unsigned long)_end;

	simple_alloc_init(_end, avail_ram, 128, 64);
	platform_ops.fixups = ibm_akebono_fixups;
	platform_ops.exit = ibm44x_dbcr_reset;
	pir_reg = mfspr(SPRN_PIR);

	/* Make sure FDT blob is sane */
	if (fdt_check_header(_dtb_start) != 0)
		fatal("Invalid device tree blob\n");

	node = fdt_node_offset_by_prop_value(_dtb_start, -1, "device_type",
					     "cpu", sizeof("cpu"));
	if (!node)
		fatal("Cannot find cpu node\n");
	timebase = fdt_getprop(_dtb_start, node, "timebase-frequency", &size);
	if (timebase && (size == 4))
		timebase_period_ns = 1000000000 / *timebase;

	fdt_set_boot_cpuid_phys(_dtb_start, pir_reg);
	fdt_init(_dtb_start);

	serial_console_init();
}

Annotation

Implementation Notes