示例#1
0
文件: esp.c 项目: xHypervisor/WinQEMU
static void
ob_esp_initialize(ATTRIBUTE_UNUSED esp_private_t **esp)
{
    phandle_t ph = get_cur_dev();

    set_int_property(ph, "#address-cells", 2);
    set_int_property(ph, "#size-cells", 0);

    /* set device type */
    push_str("scsi");
    fword("device-type");

    /* QEMU's ESP emulation does not support mixing DMA and FIFO messages. By
       setting this attribute, we prevent the Solaris ESP kernel driver from
       trying to use this feature when booting a disk image (and failing) */
    PUSH(0x58);
    fword("encode-int");
    push_str("scsi-options");
    fword("property");

    PUSH(0x24);
    fword("encode-int");
    PUSH(0);
    fword("encode-int");
    fword("encode+");
    push_str("intr");
    fword("property");
}
示例#2
0
TEST_F(test_stream, test_class_property) {
  auto obj = test_service.create_test_object("jeb");
  obj.set_int_property(42);
  auto x = obj.int_property_stream();
  for (int i = 0; i < 5; i++) {
    ASSERT_EQ(42, x());
    wait();
  }
}
示例#3
0
static void
ob_cuda_initialize (int *idx)
{
	phandle_t ph=get_cur_dev();
	int props[2];

	push_str("via-cuda");
	fword("device-type");

	set_int_property(ph, "#address-cells", 1);
        set_int_property(ph, "#size-cells", 0);

	set_property(ph, "compatible", "cuda", 5);

	props[0] = __cpu_to_be32(IO_CUDA_OFFSET);
	props[1] = __cpu_to_be32(IO_CUDA_SIZE);

	set_property(ph, "reg", (char *)&props, sizeof(props));

	/* on newworld machines the cuda is on interrupt 0x19 */

	props[0] = 0x19;
	props[1] = 0;
	NEWWORLD(set_property(ph, "interrupts", (char *)props, sizeof(props)));
	NEWWORLD(set_int_property(ph, "#interrupt-cells", 2));

	/* we emulate an oldworld hardware, so we must use
	 * non-standard oldworld property (needed by linux 2.6.18)
	 */

	OLDWORLD(set_int_property(ph, "AAPL,interrupts", 0x12));

        bind_func("ppc32-reset-all", ppc32_reset_all);
        push_str("' ppc32-reset-all to reset-all");
        fword("eval");
}
示例#4
0
void
ob_pc_serial_init(const char *path, const char *dev_name, uint64_t base,
                  uint64_t offset, int intr)
{
    phandle_t aliases;
    char nodebuff[128];

    snprintf(nodebuff, sizeof(nodebuff), "%s/%s", path, dev_name);
    REGISTER_NAMED_NODE(pc_serial, nodebuff);

    push_str(nodebuff);
    fword("find-device");

    PUSH(offset);
    PUSH(find_package_method("init", get_cur_dev()));
    fword("execute");

    push_str("serial");
    fword("device-type");

    PUSH((base + offset) >> 32);
    fword("encode-int");
    PUSH((base + offset) & 0xffffffff);
    fword("encode-int");
    fword("encode+");
    PUSH(SER_SIZE);
    fword("encode-int");
    fword("encode+");
    push_str("reg");
    fword("property");
    
#if !defined(CONFIG_SPARC64)
    PUSH(offset);
    fword("encode-int");
    push_str("address");
    fword("property");
#endif
    
#if defined(CONFIG_SPARC64)
    set_int_property(get_cur_dev(), "interrupts", 1);
#endif

    aliases = find_dev("/aliases");
    set_property(aliases, "ttya", nodebuff, strlen(nodebuff) + 1);
}
示例#5
0
bool InventoryItem_SetProperty(ScriptInvItem *scii, const char *property, int value)
{
    return set_int_property(play.invProps[scii->id], property, value);
}
示例#6
0
文件: vga_vbe.c 项目: 3a9LL/panda
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);
}