예제 #1
0
static ofdn_t ofd_cpus_props(void *m, struct domain *d)
{
    static const char path[] = "/cpus";
    static const char cpu[] = "cpu";
    u32 val = 1;
    ofdn_t n;
    ofdn_t c;
    static u32 ibm_pft_size[] = { 0x0, 0x0 };

    n = ofd_node_find(m, path);
    if (n == 0) {
        n = ofd_node_add(m, OFD_ROOT, path, sizeof (path));
        ofd_prop_add(m, n, "name",
                     &path[1], sizeof (path) - 1);
    }
    ofd_prop_add(m, n, "#address-cells", &val, sizeof(val));
    ofd_prop_add(m, n, "#size-cells", &val, sizeof(val));
    ofd_prop_add(m, n, "smp-enabled", NULL, 0);

#ifdef HV_EXPOSE_PERFORMANCE_MONITOR
    ofd_prop_add(m, n, "performance-monitor", NULL, 0);
#endif

    c = ofd_node_find_by_prop(m, n, "device_type", cpu, sizeof (cpu));
    if (ofd_boot_cpu == -1)
        ofd_boot_cpu = c;
    while (c > 0) {
        /* We do not use the OF tree to identify secondary processors
         * so we must prune them from the tree */
        if (c == ofd_boot_cpu) {
            ofdn_t p;

            ibm_pft_size[1] = d->arch.htab.log_num_ptes + LOG_PTE_SIZE;
            ofd_prop_add(m, c, "ibm,pft-size",
                         ibm_pft_size, sizeof (ibm_pft_size));

            /* get rid of non-standard properties */
            p = ofd_prop_find(m, c, "cpu#");
            if (p > 0) {
                ofd_prop_remove(m, c, p);
            }

            /* FIXME: Check the the "l2-cache" property who's
             * contents is an orphaned phandle? */
        } else
            ofd_node_prune(m, c);

        c = ofd_node_find_next(m, c);
    }

    return n;
}
예제 #2
0
파일: ofd.c 프로젝트: jiamacs/rhype
static ofdn_t
ofd_chosen_props(void *m)
{
	ofdn_t n;
	ofdn_t p;
	static const char path[] = "/chosen";
	static const char console[] = " console=hvc0 nosmp";
	char b[257];
	uval sz = 0;

//		" root=/dev/hda "
//		" rootfstype=ramfs "
//		"init=/bin/sh "
//		"root=/dev/nfsroot "
//		"nfsroot=9.2.208.21:/,rsize=1024,wsize=1024 "
//		"ether=0,0,eth0 "
//nfsaddrs=<wst-IP>  :<srv-IP>  :<gw-IP>  :<netm-IP>    :<hostname>
//"nfsaddrs=9.2.208.161:9.2.208.21:9.2.208.2:255.255.248.0:freakazoid "
//"nfsaddrs=9.2.208.161:9.2.208.21:9.2.208.2:255.255.248.0:freakazoid:eth0 "

	n = ofd_node_find(m, path);
	if (n == 0) {
		n = ofd_node_add(m, OFD_ROOT, path, sizeof (path));
		ofd_prop_add(m, n, "name",
				&path[1], sizeof (path) - 1);
	}

	sz = strlen(default_bootargs);
	memcpy(b, default_bootargs, sz);

	assert(sz + sizeof(console) <= 256,
	       "boot args not big enough\n");

	memcpy(b + sz, console, sizeof (console));
	sz += sizeof (console);

	ofd_prop_add(m, n, "bootargs", b, sz);

	ofd_prop_add(m, n, "bootpath", NULL, 0);

	hputs("Remove /chosen/mmu, stub will replace\n");
	p = ofd_prop_find(m, n, "mmu");
	if (p > 0) {
		ofd_prop_remove(m, n, p);
	}

	return n;
}
예제 #3
0
static ofdn_t ofd_chosen_props(void *m, const char *cmdline)
{
    ofdn_t n;
    ofdn_t p;
    static const char path[] = "/chosen";
    char bootargs[256] = { 0, };
    int bsz;
    int sz;
    int rm;

    n = ofd_node_find(m, path);
    if (n == 0) {
        n = ofd_node_add(m, OFD_ROOT, path, sizeof (path));
        ofd_prop_add(m, n, "name",
                     &path[1], sizeof (path) - 1);
    }

    if (cmdline)
        strlcpy(bootargs, cmdline, sizeof(bootargs));
    bsz = strlen(bootargs) + 1;
    rm = sizeof (bootargs) - bsz;

    if (default_bootargs != NULL) {
        sz = strlen(default_bootargs);
        if (sz > rm) {
            panic("default_bootargs is too big: 0x%x > 0x%x\n",
                  sz, rm);
        } else if (sz > 0) {
            memcpy(&bootargs[bsz - 1], default_bootargs, sz + 1);
            bsz += sz;
            rm -= sz;
        }
    }

    printk("DOM0 bootargs: %s\n", bootargs);
    ofd_prop_add(m, n, "bootargs", bootargs, bsz);

    ofd_prop_add(m, n, "bootpath", NULL, 0);

    printk("Remove /chosen/mmu, stub will replace\n");
    p = ofd_prop_find(m, n, "mmu");
    if (p > 0) {
        ofd_prop_remove(m, n, p);
    }

    return n;
}