Example #1
0
void
boot( void )
{
        uint16_t boot_device = fw_cfg_read_i16(FW_CFG_BOOT_DEVICE);

	fword("update-chosen");
	if (boot_device == 'm') {
	        check_preloaded_kernel();
	}

	if (is_apple()) {
		update_nvram();
	}
}
Example #2
0
void vga_vbe_init(const char *path, unsigned long fb, uint32_t fb_size,
                  unsigned long rom, uint32_t rom_size)
{
	phandle_t ph, chosen, aliases, options;
	char buf[6];
	int width = VGA_DEFAULT_WIDTH;
	int height = VGA_DEFAULT_HEIGHT;
	int depth = VGA_DEFAULT_DEPTH;
	int linebytes = VGA_DEFAULT_LINEBYTES;

#if defined(CONFIG_QEMU) && (defined(CONFIG_PPC) || defined(CONFIG_SPARC64))
	int w, h, d;
        w = fw_cfg_read_i16(FW_CFG_ARCH_WIDTH);
        h = fw_cfg_read_i16(FW_CFG_ARCH_HEIGHT);
        d = fw_cfg_read_i16(FW_CFG_ARCH_DEPTH);
	if (w && h && d) {
		width = w;
		height = h;
		depth = d;
		linebytes = (width * ((depth + 7) / 8));
	}
#ifdef CONFIG_SPARC64
#define VGA_VADDR  0xfe000000
        ofmem_claim_phys(fb, fb_size, 0);
        ofmem_claim_virt(VGA_VADDR, fb_size, 0);
        ofmem_map(fb, VGA_VADDR, fb_size, 0x76);
        fb = VGA_VADDR;
#endif
#endif

	vga_vbe_set_mode(width, height, depth);

#if 0
    ph = find_dev(path);
#else
    ph = get_cur_dev();
#endif

	set_int_property(ph, "width", width);
	set_int_property(ph, "height", height);
	set_int_property(ph, "depth", depth);
	set_int_property(ph, "linebytes", linebytes);
	set_int_property(ph, "address", (u32)(fb & ~0x0000000F));

	chosen = find_dev("/chosen");
	push_str(path);
	fword("open-dev");
	set_int_property(chosen, "display", POP());

	aliases = find_dev("/aliases");
	set_property(aliases, "screen", path, strlen(path) + 1);

	options = find_dev("/options");
	snprintf(buf, sizeof(buf), "%d", width / FONT_WIDTH);
	set_property(options, "screen-#columns", buf, strlen(buf) + 1);
	snprintf(buf, sizeof(buf), "%d", height / FONT_HEIGHT);
	set_property(options, "screen-#rows", buf, strlen(buf) + 1);

	if (rom_size >= 8) {
                const char *p;
		int size;

                p = (const char *)rom;
		if (p[0] == 'N' && p[1] == 'D' && p[2] == 'R' && p[3] == 'V') {
			size = *(uint32_t*)(p + 4);
			set_property(ph, "driver,AAPL,MacOS,PowerPC",
				     p + 8, size);
		}
	}

	init_video(fb, width, height, depth, linebytes);
}