Example #1
0
/*ARGSUSED*/
int
check_status(int id, char *buf, dev_info_t *parent)
{
    char status_buf[64];
    extern int status_okay(int, char *, int);

    /*
     * is the status okay?
     */
    if (status_okay(id, status_buf, sizeof (status_buf)))
        return (DDI_SUCCESS);

    return (DDI_FAILURE);
}
Example #2
0
/*ARGSUSED*/
int
check_status(int id, char *buf, dev_info_t *parent)
{
	char status_buf[64];
	char devtype_buf[OBP_MAXPROPNAME];
	char board_buf[32];
	char path[OBP_MAXPATHLEN];
	int boardnum;
	int retval = DDI_FAILURE;
	extern int status_okay(int, char *, int);

	/*
	 * is the status okay?
	 */
	if (status_okay(id, status_buf, sizeof (status_buf)))
		return (DDI_SUCCESS);

	/*
	 * a status property indicating bad memory will be associated
	 * with a node which has a "device_type" property with a value of
	 * "memory-controller". in this situation, return DDI_SUCCESS
	 */
	if (getlongprop_buf(id, OBP_DEVICETYPE, devtype_buf,
	    sizeof (devtype_buf)) > 0) {
		if (strcmp(devtype_buf, "memory-controller") == 0)
			retval = DDI_SUCCESS;
	}

	/*
	 * get the full OBP pathname of this node
	 */
	if (prom_phandle_to_path((phandle_t)id, path, sizeof (path)) < 0)
		cmn_err(CE_WARN, "prom_phandle_to_path(%d) failed", id);

	/*
	 * get the board number, if one exists
	 */
	if ((boardnum = get_boardnum(id, parent)) >= 0)
		(void) sprintf(board_buf, " on board %d", boardnum);
	else
		board_buf[0] = '\0';

	/*
	 * print the status property information
	 */
	cmn_err(CE_WARN, "status '%s' for '%s'%s",
	    status_buf, path, board_buf);
	return (retval);
}
Example #3
0
/*
 * map_wellknown - map known devices & registers
 */
static void
map_wellknown(pnode_t curnode)
{
    extern int status_okay(int, char *, int);
    char tmp_name[MAXSYSNAME];
    int sok;

#ifdef VPRINTF
    VPRINTF("map_wellknown(%x)\n", curnode);
#endif /* VPRINTF */

    for (curnode = CHILD(curnode); curnode; curnode = NEXT(curnode)) {
        /*
         * prune subtree if status property indicating not okay
         */
        sok = status_okay((int)curnode, (char *)NULL, 0);
        if (!sok) {
            char devtype_buf[OBP_MAXPROPNAME];
            int size;

#ifdef VPRINTF
            VPRINTF("map_wellknown: !okay status property\n");
#endif /* VPRINTF */
            /*
             * a status property indicating bad memory will be
             * associated with a node which has a "device_type"
             * property with a value of "memory-controller"
             */
            if ((size = GETPROPLEN(curnode,
                                   OBP_DEVICETYPE)) == -1)
                continue;
            if (size > OBP_MAXPROPNAME) {
                cmn_err(CE_CONT, "node %x '%s' prop too "
                        "big\n", curnode, OBP_DEVICETYPE);
                continue;
            }
            if (GETPROP(curnode, OBP_DEVICETYPE,
                        devtype_buf) == -1) {
                cmn_err(CE_CONT, "node %x '%s' get failed\n",
                        curnode, OBP_DEVICETYPE);
                continue;
            }
            if (strcmp(devtype_buf, "memory-controller") != 0)
                continue;
            /*
             * ...else fall thru and process the node...
             */
        }
        bzero(tmp_name, MAXSYSNAME);
        if (GETPROP(curnode, OBP_NAME, (caddr_t)tmp_name) != -1)
            fill_address(curnode, tmp_name);
        if (GETPROP(curnode, OBP_DEVICETYPE, tmp_name) != -1 &&
                strcmp(tmp_name, "cpu") == 0) {
            fill_cpu(curnode);
        }
        if (strcmp(tmp_name, "tod") == 0)
            have_tod(curnode);
        if (sok && (strcmp(tmp_name, "memory-controller") == 0) &&
                (&plat_fill_mc != NULL))
            plat_fill_mc(curnode);
        map_wellknown(curnode);
    }
}