예제 #1
0
static void key_ofdump(unsigned char key)
{
    printk("ofdump:\n");
    /* make sure the OF devtree is good */
    ofd_walk((void *)oftree, "devtree", OFD_ROOT,
             ofd_dump_props, OFD_DUMP_ALL);
}
예제 #2
0
파일: ofd.c 프로젝트: jiamacs/rhype
uval
ofd_devtree_init(uval mem, uval *space)
{
	uval sz;
	uval mapped;

	/* map the first page, there may be more */
	mapped = map_pages(mem, mem, PGSIZE);

	sz = ofd_size(mem);

	*space = ofd_space(mem);

	if (sz > mapped) {
		/* map the rest */
		map_pages(mem + mapped, mem + mapped, sz - mapped);
	}

#ifdef OFD_DEBUG
	ofd_walk((void *)mem, OFD_ROOT, ofd_dump_props, OFD_DUMP_VALUES);
#endif
	/* scan the tree and identify resources */
	ofd_pci_addr(mem);
	ofd_proc_dev_probe((void *)mem);

	if (ofd_platform_probe)
		ofd_platform_probe((void *)mem);

	*space -= 8;
	return mem;
}
예제 #3
0
ulong ofd_dom0_fixup(struct domain *d, ulong mem, const char *cmdline,
                     ulong shared_info)
{
    const char compat[] = "Hypervisor,Maple";
    const char d0[] = "dom0";
    void *m;
    const ofdn_t n = OFD_ROOT;
    ofdn_t r;
    u32 did;

    m = (void *)mem;

#ifdef PAPR_VDEVICE
    printk("Add /vdevice\n");
    ofd_vdevice(m, d);

    printk("Add /aliases props\n");
    ofd_aliases_props(m);
#endif

    printk("Add /openprom props\n");
    ofd_openprom_props(m);

    printk("Add /options props\n");
    ofd_options_props(m);

    printk("Add /cpus props\n");
    ofd_cpus_props(m, d);

    printk("Add /chosen props\n");
    ofd_chosen_props(m, cmdline);

    printk("fix /memory props\n");
    ofd_memory_props(m, d);

    printk("fix /xen props\n");
    ofd_xen_props(m, d, shared_info);

    printk("Remove original /dart\n");
    ofd_prune_path(m, "/dart");

    printk("Remove original /rtas\n");
    ofd_prune_path(m, "/rtas");

    rtas_proxy_init(m);

#ifdef FIX_COMPAT 
    r = ofd_prop_add(m, n, "compatible", compat, sizeof (compat));
    ASSERT( r > 0 );
#else
    (void)compat;
#endif

    did = d->domain_id;
    r = ofd_prop_add(m, n, "ibm,partition-no", &did, sizeof(did));
    ASSERT( r > 0 );

    r = ofd_prop_add(m, n, "ibm,partition-name", d0, sizeof (d0));
    ASSERT( r > 0 );


#ifdef DEBUG
    ofd_walk(m, __func__, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL);
#endif
    return ofd_size(m);
}
예제 #4
0
파일: controller.c 프로젝트: jiamacs/rhype
static void
ask(uval deflist, uval ofd)
{
	int i;
	char inbuf[17];
	uval sz;
	uval chunks = 1;
	uval lpalgn = LOG_CHUNKSIZE;

	for (i = 0; i < 4; i++) {
		uval def;
		def = deflist & (0xffUL << (8 * i));
		def >>= 8 * i;
		if (def == 0 || def >= image_cnt) {
			continue;
		}

		if (image_names[def - 1] != NULL) {
			uval mem = get_pages_aligned(&logical_pa,
						     CHUNK_SIZE,
						     LOG_CHUNKSIZE);
			assert(mem != PAGE_ALLOC_ERROR,
			       "no memory for partition\n");

			launch_image(mem, CHUNK_SIZE,
				     image_names[def - 1], ofd);

			yield(1);
		}
	}

	for (;;) {
		const char *iostr;
		uval iolpid = iohost_lpid;
		i = 0;
		hputs("Choose one of the following images\n");
		while (image_names[i] != NULL) {
			hprintf("  %02d: %s\n", i + 1, image_names[i]);
			++i;
		}

		switch (iohost_lpid) {
		case 0:
			iostr = "Next";
			break;
		case 1:
			iostr = "Unavailable";
			break;
		case IOHOST_NONE:
			iostr = "None";
			iolpid = 0;
			break;
		default:
			i = find_partition(iohost_lpid);
			iostr = partitions[i].name;
			break;
		}

		hprintf("  i: IOHost Selection: 0x%lx: %s\n", iolpid, iostr);
#ifdef USE_OPENFIRMWARE
		hputs("  o: Dump OF master device tree (if available)\n");
#endif
		if (rags_state != NULL) {
			hputs("  R: Resource Allocation Management: ");
			if (rags_state()) {
				hputs("ON\n");
			} else {
				hputs("OFF\n");
			}
		}

		hputs("  d: destroy a partition\n");
		hputs("  b: trigger breakpoint\n");
		hputs("  B: trigger HV Core breakpoint\n");
		hputs("  H: set HV debug verbosity level\n");
		hprintf("  A: set default partition boot arguments\n\t%s\n",
			default_bootargs);
		hputs("  s: schedule partitions\n");
		hputs("  h: halt machine\n");
		hputs("  y: yield forever\n");
		hprintf("  M: partition size (%ld x CHUNK_SIZE) (1..9)\n",
			chunks);
		hputs("Choice [1]: ");

		sz = get_input(inbuf);
		inbuf[16] = '\0';

		if (sz == 0) {
			continue;
		}
		hprintf("Got command: %s %ld\n",inbuf,sz);
		uval val;
		switch (inbuf[0]) {
		case 'y':
			hcall_yield(NULL, 0);
			break;
		case 'b':
			breakpoint();
			break;
		case 'H':
			ask_debug_flags();
			break;
		case 'A':
			ask_boot_args();
			break;
		case 'B':
			hcall_debug(NULL, H_BREAKPOINT, 0, 0, 0, 0);
			break;
		case 'h':
			controller_halt();
			break;
		case 'd':
			ask_destroy_partition();
			break;
		case 's':
			ask_schedule_partition();
			break;
		case 'M':{
			uval x = 1;
			while (inbuf[x]) {
				if (inbuf[x]>='1' && inbuf[x]<='9') {
					chunks = inbuf[x] - '0';
					break;
				}
				++x;
			}
			break;
		}
		case 'i':
			switch (iohost_lpid) {
			case IOHOST_NONE:
				iohost_lpid = 0;
				break;
			case 0:
				iohost_lpid = IOHOST_NONE;
				break;
			case 1:
				break;
			default:
				i = find_partition(iohost_lpid);

				assert (i >= 0, "bad iohost_lpid?\n");
				hprintf("IO Host already selected: "
					"0x%lx: %s\n",
					partitions[i].lpid,
					partitions[i].name);
				break;
			}
			break;
#ifdef USE_OPENFIRMWARE
		case 'o':
			if (ofd > 0) {
				ofd_walk((void *)ofd, OFD_ROOT,
					 ofd_dump_props, OFD_DUMP_ALL);
			} else {
				hputs("sorry no Of tree available\n");
			}
			break;
#endif
		case 'R':
			if (rags_ask) {
				rags_ask();
			}
			break;
		case '0' ... '9':
			val = strtoul(inbuf, NULL, 0) - 1;
			if (val < image_cnt) {
				uval mem;

				mem = get_pages_aligned(&logical_pa,
							chunks * CHUNK_SIZE,
							lpalgn);


				if (mem == PAGE_ALLOC_ERROR) {
					/* So what do we do here? */
					assert(0,
					       "no memory for partition\n");
				}

				if (mem != PAGE_ALLOC_ERROR) {
					launch_image(mem, chunks * CHUNK_SIZE,
						     image_names[val], ofd);
				}
			}
			break;
		default:
			hprintf("invalid entry: %s\n", inbuf);
			break;
		}
	}
}