Example #1
0
static void ofd_bootargs(void)
{
    static const char *sepr[] = {" -- ", " || "};
    char *p;
    ofdn_t chosen;
    int sepr_index;
    int rc;

    if (builtin_cmdline[0] == '\0') {
        chosen = ofd_node_find((void *)oftree, "/chosen");
        rc = ofd_getprop((void *)oftree, chosen, "bootargs", builtin_cmdline,
                         CONFIG_CMDLINE_SIZE);
    }

    /* look for delimiter: "--" or "||" */
    for (sepr_index = 0; sepr_index < ARRAY_SIZE(sepr); sepr_index++){
        p = strstr(builtin_cmdline, sepr[sepr_index]);
        if (p != NULL) {
            /* Xen proper should never know about the dom0 args.  */
            *p = '\0';
            p += strlen(sepr[sepr_index]);
            dom0_cmdline = p;
            break;
        }
    }

    xen_cmdline = builtin_cmdline;
}
Example #2
0
sval
ofh_getprop(uval nargs, uval nrets, sval argp[], sval retp[], uval b)
{
	if (nargs == 4) {
		if (nrets == 1) {
			ofdn_t ph = argp[0];
			const char *name = (const char *)argp[1];
			void *buf = (void *)argp[2];
			uval buflen = argp[3];
			sval *size = &retp[0];
			void *mem = ofd_mem(b);

			*size = ofd_getprop(mem, ph, name, buf, buflen);
			if (*size > 0) {
				return OF_SUCCESS;
			}
		}
	}
	return OF_FAILURE;
}
Example #3
0
File: ofd.c Project: jiamacs/rhype
void
ofd_openpic_probe(void *m, uval little_endian)
{
	static const char name[] = "platform-open-pic";
	uval64 addr = ~0ULL;
	ofd_getprop(m, OFD_ROOT, name, &addr, sizeof(addr));
	if (addr == ~0ULL) return;

	sval rc;
	uval rets[5];

	rc = hcall_mem_define(rets, MMIO_ADDR, (uval)addr, 0x40000);

	hprintf("OpenPIC at: %lx %llx %lx\n", rc, addr, rets[0]);

	assert(rc == H_Success, "hcall failure: %lx\n", rc);

	if (rc == H_Success) {
		ofd_setprop(m, OFD_ROOT, name, rets, sizeof(rets));
	}

	rc = hcall_eic_config(rets, CONFIG, (uval)addr, little_endian, 0, 0);
	assert(rc == H_Success, "hcall failure: %lx\n", rc);
}
Example #4
0
File: ofd.c Project: jiamacs/rhype
static void
ofd_openpic_owner_props(void *m, uval lpid)
{
	static const char name[] = "platform-open-pic";
	uval64 addr = ~0ULL;
	ofd_getprop(m, OFD_ROOT, name, &addr, sizeof(addr));
	if (addr == ~0ULL) return;

	sval rc = H_Success;
	uval rets[5];

	if (lpid != H_SELF_LPID) {
		rc = hcall_resource_transfer(rets, MMIO_ADDR,
					     0, (uval)addr, 0x40000, lpid);
		assert(rc == H_Success, "hcall failure: %lx\n", rc);
		if (rc == H_Success) {
			ofd_setprop(m, OFD_ROOT, name, rets, sizeof(rets));
		}

	}

	rc = hcall_eic_config(rets, CTL_LPAR, lpid, 0, 0, 0);
	assert(rc == H_Success, "hcall failure: %lx\n", rc);
}