コード例 #1
0
ファイル: prom_mem.c プロジェクト: andreiw/polaris
ihandle_t
prom_memory_ihandle(void)
{
	static ihandle_t imemory;

	if (imemory != (ihandle_t)0)
		return (imemory);

	if (prom_getproplen(prom_chosennode(), "memory") != sizeof (ihandle_t))
		return (imemory = (ihandle_t)-1);

	(void) prom_getprop(prom_chosennode(), "memory", (caddr_t)(&imemory));
	return (imemory);
}
コード例 #2
0
ファイル: promfs.c プロジェクト: apprisi/illumos-gate
static int
promfs_mountroot(char *str)
{

	(void) prom_getprop(prom_chosennode(), str, (caddr_t)&fsih);
	return (fsih == -1);
}
コード例 #3
0
ファイル: fillsysinfo.c プロジェクト: mikess/illumos-gate
void
map_wellknown_devices()
{
    struct wkdevice *wkp;
    phandle_t	ieeprom;
    pnode_t	root;
    uint_t	stick_freq;

    /*
     * if there is a chosen eeprom, note it (for have_eeprom())
     */
    if (GETPROPLEN(prom_chosennode(), CHOSEN_EEPROM) ==
            sizeof (phandle_t) &&
            GETPROP(prom_chosennode(), CHOSEN_EEPROM, (caddr_t)&ieeprom) != -1)
        chosen_eeprom = (pnode_t)prom_decode_int(ieeprom);

    root = prom_nextnode((pnode_t)0);
    /*
     * Get System clock frequency from root node if it exists.
     */
    if (GETPROP(root, "stick-frequency", (caddr_t)&stick_freq) != -1)
        system_clock_freq = stick_freq;

    map_wellknown(NEXT((pnode_t)0));

    /*
     * See if it worked
     */
    for (wkp = wkdevice; wkp->wk_namep; ++wkp) {
        if (wkp->wk_flags == V_MUSTHAVE) {
            cmn_err(CE_PANIC, "map_wellknown_devices: required "
                    "device %s not mapped", wkp->wk_namep);
        }
    }

    /*
     * all sun4u systems must have an IO bus, i.e. sbus or pcibus
     */
    if (niobus == 0)
        cmn_err(CE_PANIC, "map_wellknown_devices: no i/o bus node");

    check_cpus_ver();
    check_cpus_set();
}
コード例 #4
0
ファイル: util.c プロジェクト: apprisi/illumos-gate
/*
 * Mount root fs so we can read statefile, etc
 *
 * sets global
 *	cb_rih
 */
int
cb_mountroot()
{

	chosen = prom_chosennode();
	if (chosen == OBP_BADNODE) {
		prom_printf("Missing chosen node\n");
		return (ERR);
	}
	if (prom_getprop(chosen, "bootfs", (caddr_t)&cb_rih) == -1) {
		prom_printf("Missing bootfs ihandle\n");
		return (ERR);
	}
	return (0);
}
コード例 #5
0
ファイル: prom_boot.c プロジェクト: apprisi/illumos-gate
char *
prom_bootpath(void)
{
	static char bootpath[OBP_MAXPATHLEN];
	int length;
	pnode_t node;
	static char *name = "bootpath";

	if (bootpath[0] != (char)0)
		return (bootpath);

	node = prom_chosennode();
	if ((node == OBP_NONODE) || (node == OBP_BADNODE))
		node = prom_rootnode();
	length = prom_getproplen(node, name);
	if ((length == -1) || (length == 0))
		return (NULL);
	if (length > OBP_MAXPATHLEN)
		length = OBP_MAXPATHLEN - 1;	/* Null terminator */
	(void) prom_bounded_getprop(node, name, bootpath, length);
	return (bootpath);
}
コード例 #6
0
ファイル: sgsbbc.c プロジェクト: andreiw/polaris
/*
 * If we don't already have a master SBBC selected,
 * get the <sbbc> property from the /chosen node. If
 * the pathname matches, this is the master SBBC and
 * we set up the console/TOD SRAM mapping here.
 */
static void
sbbc_chosen_init(sbbc_softstate_t *softsp)
{
	char		master_sbbc[MAXNAMELEN];
	char		pn[MAXNAMELEN];
	int		nodeid, len;
	pnode_t		dnode;

	if (master_chosen != FALSE) {
		/*
		 * We've got one already
		 */
		return;
	}

	/*
	 * Get /chosen node info. prom interface will handle errors.
	 */
	dnode = prom_chosennode();

	/*
	 * Look for the "iosram" property on the chosen node with a prom
	 * interface as ddi_find_devinfo() couldn't be used (calls
	 * ddi_walk_devs() that creates one extra lock on the device tree).
	 */
	if (prom_getprop(dnode, IOSRAM_CHOSEN_PROP, (caddr_t)&nodeid) <= 0) {
		/*
		 * No I/O Board SBBC set up as console, what to do ?
		 */
		SBBC_ERR(CE_PANIC, "No SBBC found for Console/TOD \n");
	}

	if (prom_getprop(dnode, IOSRAM_TOC_PROP,
	    (caddr_t)&softsp->sram_toc) <= 0) {
		/*
		 * SRAM TOC Offset defaults to 0
		 */
		SBBC_ERR(CE_WARN, "No SBBC TOC Offset found\n");
		softsp->sram_toc = 0;
	}

	/*
	 * get the full OBP pathname of this node
	 */
	if (prom_phandle_to_path((phandle_t)nodeid, master_sbbc,
		sizeof (master_sbbc)) < 0) {

		SBBC_ERR1(CE_PANIC, "prom_phandle_to_path(%d) failed\n",
		    nodeid);
	}
	SGSBBC_DBG_ALL("chosen pathname : %s\n", master_sbbc);
	SGSBBC_DBG_ALL("device pathname : %s\n", ddi_pathname(softsp->dip, pn));
	if (strcmp(master_sbbc, ddi_pathname(softsp->dip, pn)) == 0) {

		/*
		 * map in the SBBC regs
		 */

		if (sbbc_map_regs(softsp) != DDI_SUCCESS) {
			SBBC_ERR(CE_PANIC, "Can't map the SBBC regs \n");
		}
		/*
		 * Only the 'chosen' node is used for iosram_read()/_write()
		 * Must initialise the tunnel before the console/tod
		 *
		 */
		if (iosram_tunnel_init(softsp) == DDI_FAILURE) {
			SBBC_ERR(CE_PANIC, "Can't create the SRAM <-> SC "
				"comm. tunnel \n");
		}

		master_chosen = TRUE;

		/*
		 * Verify that an 'interrupts' property
		 * exists for this device
		 */

		if (ddi_getproplen(DDI_DEV_T_ANY, softsp->dip,
			DDI_PROP_DONTPASS, "interrupts",
			&len) != DDI_PROP_SUCCESS) {

			SBBC_ERR(CE_PANIC, "No 'interrupts' property for the "
					"'chosen' SBBC \n");
		}

		/*
		 * add the interrupt handler
		 * NB
		 * should this be a high-level interrupt ?
		 * NB
		 */
		if (sbbc_add_intr(softsp) == DDI_FAILURE) {
			SBBC_ERR(CE_PANIC, "Can't add interrupt handler for "
					"'chosen' SBBC \n");
		}

		sbbc_enable_intr(softsp);

		/*
		 * Create the mailbox
		 */
		if (sbbc_mbox_create(softsp) != 0) {
			cmn_err(CE_WARN, "No IOSRAM MailBox created!\n");
		}

	}
}