コード例 #1
0
ファイル: vbe.c プロジェクト: XVilka/coreboot
void vbe_set_graphics(void)
{
	u8 rval;

	vbe_info_t info;
	rval = vbe_info(&info);
	if (rval != 0)
		return;

	DEBUG_PRINTF_VBE("VbeSignature: %s\n", info.signature);
	DEBUG_PRINTF_VBE("VbeVersion: 0x%04x\n", info.version);
	DEBUG_PRINTF_VBE("OemString: %s\n", info.oem_string_ptr);
	DEBUG_PRINTF_VBE("Capabilities:\n");
	DEBUG_PRINTF_VBE("\tDAC: %s\n",
			 (info.capabilities & 0x1) ==
			 0 ? "fixed 6bit" : "switchable 6/8bit");
	DEBUG_PRINTF_VBE("\tVGA: %s\n",
			 (info.capabilities & 0x2) ==
			 0 ? "compatible" : "not compatible");
	DEBUG_PRINTF_VBE("\tRAMDAC: %s\n",
			 (info.capabilities & 0x4) ==
			 0 ? "normal" : "use blank bit in Function 09h");

	mode_info.video_mode = (1 << 14) | CONFIG_FRAMEBUFFER_VESA_MODE;
	vbe_get_mode_info(&mode_info);
	vbe_set_mode(&mode_info);

#if CONFIG_BOOTSPLASH
	unsigned char *framebuffer =
		(unsigned char *) le32_to_cpu(mode_info.vesa.phys_base_ptr);
	DEBUG_PRINTF_VBE("FRAMEBUFFER: 0x%p\n", framebuffer);

	struct jpeg_decdata *decdata;
	decdata = malloc(sizeof(*decdata));

	/* Switching Intel IGD to 1MB video memory will break this. Who
	 * cares. */
	// int imagesize = 1024*768*2;

	unsigned char *jpeg = cbfs_find_file("bootsplash.jpg", CBFS_TYPE_BOOTSPLASH);
	if (!jpeg) {
		DEBUG_PRINTF_VBE("Could not find bootsplash.jpg\n");
		return;
	}
	DEBUG_PRINTF_VBE("Splash at %p ...\n", jpeg);
	dump(jpeg, 64);

	int ret = 0;
	DEBUG_PRINTF_VBE("Decompressing boot splash screen...\n");
	ret = jpeg_decode(jpeg, framebuffer, 1024, 768, 16, decdata);
	DEBUG_PRINTF_VBE("returns %x\n", ret);
#endif
}
コード例 #2
0
ファイル: romstage.c プロジェクト: XVilka/coreboot
static inline void check_cmos( void ) {

	char *cmos_default = NULL;
	int i;
#if DUMP_CMOS_RAM
	u8 c = 0;
#endif
	if (cmos_error() || !cmos_chksum_valid()) {
		cmos_default = cbfs_find_file("cmos.default", 0xaa);
		if (cmos_default) {
#if DUMP_CMOS_RAM
			__DEBUG__("Write cmos default ...\n");
#endif
			outb(0x0a,0x72);
			i = inb(0x73);
			i &= ~(1 << 4);
			outb(i,0x73);

			for (i = 14; i < 128; i++) {
#if DUMP_CMOS_RAM
				if( c%16 == 0 ) __DEBUG__("%02x:", i);
				__DEBUG__(" %02x", (u8)cmos_default[i]);
				if( c%16 == 15 ) __DEBUG__("\n");
				c++;
#endif
				outb(i,0x72);
				outb(cmos_default[i],0x73);
			}

#if DUMP_CMOS_RAM
			__DEBUG__("\n");
#endif
			if( !cmos_chksum_valid() )
				__DEBUG__("CMOS CHECKSUM ERROR\n");
			/* Now reboot to run with default cmos. */
			outb(0x06, 0xcf9);
			for (;;) asm("hlt"); /* Wait for reset! */
		}
	}

	// update altcentury
	outb(0x32, 0x72);
	i = inb(0x73);
	if ( i != 0x20 ) {
		outb(0x20,0x73);
		set_chksum(LB_CKS_RANGE_START, LB_CKS_RANGE_END, LB_CKS_LOC);
	}

}
コード例 #3
0
ファイル: layout-bin.c プロジェクト: RafaelRMachado/Coreboot
void get_layout_from_cbfs_file(void)
{
	uint32_t len;
	cmos_table = cbfs_find_file("cmos_layout.bin", CBFS_COMPONENT_CMOS_LAYOUT, &len);
	process_layout();
}
コード例 #4
0
ファイル: nvramtool.c プロジェクト: killbug2004/coreboot
/****************************************************************************
 * main
 ****************************************************************************/
int main(int argc, char *argv[])
{
	void *cmos_default = NULL;
	cmos_layout_get_fn_t fn = get_layout_from_cmos_table;

	parse_nvramtool_args(argc, argv);

	/* If we should operate on a CBFS file default to reading the layout
	 * and CMOS contents from it. */
	if (nvramtool_op_modifiers[NVRAMTOOL_MOD_USE_CBFS_FILE].found) {
		open_cbfs(nvramtool_op_modifiers[NVRAMTOOL_MOD_USE_CBFS_FILE].param);
		if (!nvramtool_op_modifiers[NVRAMTOOL_MOD_USE_CMOS_FILE].found) {
			cmos_default = cbfs_find_file("cmos.default", CBFS_COMPONENT_CMOS_DEFAULT, NULL);
			if (cmos_default == NULL) {
				fprintf(stderr, "Need a cmos.default in the CBFS image or separate cmos file (-D).\n");
				exit(1);
			}
		}
		fn = get_layout_from_cbfs_file;
	}

	/* If the user wants to use a specific layout file or explicitly use
	 * the coreboot option table allow him to override previous settings. */
	if (nvramtool_op_modifiers[NVRAMTOOL_MOD_USE_CMOS_LAYOUT_FILE].found) {
		set_layout_filename(nvramtool_op_modifiers[NVRAMTOOL_MOD_USE_CMOS_LAYOUT_FILE].param);
		fn = get_layout_from_file;
	} else if (nvramtool_op_modifiers[NVRAMTOOL_MOD_USE_CMOS_OPT_TABLE].found) {
		fn = get_layout_from_cmos_table;
	}

	/* Allow the user to use a file for the CMOS contents, possibly
	 * overriding a previously opened "cmos.default" file from the CBFS. */
	if (nvramtool_op_modifiers[NVRAMTOOL_MOD_USE_CMOS_FILE].found) {
		struct stat fd_stat;
		int fd;

		if ((fd = open(nvramtool_op_modifiers[NVRAMTOOL_MOD_USE_CMOS_FILE].param, O_RDWR | O_CREAT, 0666)) < 0) {
			fprintf(stderr, "Couldn't open '%s'\n", nvramtool_op_modifiers[NVRAMTOOL_MOD_USE_CMOS_FILE].param);
			exit(1);
		}

		if (fstat(fd, &fd_stat) == -1) {
			fprintf(stderr, "Couldn't stat '%s'\n", nvramtool_op_modifiers[NVRAMTOOL_MOD_USE_CMOS_FILE].param);
			exit(1);
		}

		if (fd_stat.st_size < CMOS_SIZE) {
			if ((lseek(fd, CMOS_SIZE - 1, SEEK_SET) == -1) ||
			    (write(fd, "\0", 1) != 1)) {
				fprintf(stderr, "Unable to extended '%s' to its full size.\n",
						nvramtool_op_modifiers[NVRAMTOOL_MOD_USE_CMOS_FILE].param);
				exit(1);
			}
#ifndef __MINGW32__
			fsync(fd);
#else
			FlushFileBuffers ((HANDLE) _get_osfhandle (fd));
#endif
		}

		cmos_default = mmap(NULL, CMOS_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
		if (cmos_default == MAP_FAILED) {
			fprintf(stderr, "Couldn't map '%s'\n", nvramtool_op_modifiers[NVRAMTOOL_MOD_USE_CMOS_FILE].param);
			exit(1);
		}
	}

	/* Switch to memory based CMOS access. */
	if (cmos_default) {
		select_hal(HAL_MEMORY, cmos_default);
	}

	register_cmos_layout_get_fn(fn);
	op_fns[nvramtool_op.op]();

	return 0;
}