/*ARGSUSED*/
static int
cpu_cmd(fmd_hdl_t *hdl, nvlist_t *fmri, int cmd)
{
	int rc = 0;
	char *scheme;

	/*
	 * We're using topo retire if the fmri is in "hc" scheme.
	 */
	if (nvlist_lookup_string(fmri, FM_FMRI_SCHEME, &scheme) == 0 &&
	    strcmp(scheme, FM_FMRI_SCHEME_HC) == 0) {
		if (cmd != P_STATUS) {
			errno = EINVAL;
			return (-1);
		}
		rc = fmd_nvl_fmri_service_state(hdl, fmri);
		switch (rc) {
		case FMD_SERVICE_STATE_UNUSABLE:
			return (P_FAULTED);
		case -1:
			return (-1);
		default:
			return (P_ONLINE);
		}
	}

	switch (cmd & ~P_FORCED) {
	case P_STATUS:
		rc = ldom_fmri_status(cma_lhp, fmri);
		break;
	case P_FAULTED:
		rc = ldom_fmri_retire(cma_lhp, fmri);
		break;
	case P_ONLINE:
		rc = ldom_fmri_unretire(cma_lhp, fmri);
		break;
	default:
		errno = EINVAL;
		return (-1);
	}

	if (rc != P_OFFLINE && rc != P_ONLINE && rc != P_FAULTED) {
		errno = rc;
		return (-1);
	}

	return (rc);
}
Exemple #2
0
/*ARGSUSED*/
int
cpu_cmd(fmd_hdl_t *hdl, nvlist_t *fmri, int cmd)
{
	int rc = 0;

	if (cmd & P_STATUS) {
		rc = ldom_fmri_status(cma_lhp, fmri);
	} else if (cmd & P_FAULTED) {
		rc = ldom_fmri_retire(cma_lhp, fmri);
	} else {
		errno = EINVAL;
		return (-1);
	}

	if (rc != P_OFFLINE && rc != P_ONLINE && rc != P_FAULTED) {
		errno = rc;
		return (-1);
	}

	return (rc);
}
Exemple #3
0
static int
dimm_page_unusable(topo_mod_t *mod, tnode_t *node, topo_version_t version,
    nvlist_t *in, nvlist_t **out)
{
	uint32_t rc = 0;
	nvlist_t *asru;
	int err;

	if (version > TOPO_METH_UNUSABLE_VERSION)
		return (topo_mod_seterrno(mod, EMOD_VER_NEW));

	if (pi_lhp != NULL && is_page_fmri(in) &&
	    topo_node_asru(node, &asru, in, &err) == 0) {
		err = ldom_fmri_status(pi_lhp, asru);

		if (err == 0 || err == EINVAL)
			rc = 1;
		nvlist_free(asru);
	}

	return (set_retnvl(mod, out, TOPO_METH_UNUSABLE_RET, rc));
}
Exemple #4
0
static int
dimm_page_service_state(topo_mod_t *mod, tnode_t *node, topo_version_t version,
    nvlist_t *in, nvlist_t **out)
{
	uint32_t rc = FMD_SERVICE_STATE_OK;
	nvlist_t *asru;
	int err;

	if (version > TOPO_METH_SERVICE_STATE_VERSION)
		return (topo_mod_seterrno(mod, EMOD_VER_NEW));

	if (pi_lhp != NULL && is_page_fmri(in) &&
	    topo_node_asru(node, &asru, in, &err) == 0) {
		err = ldom_fmri_status(pi_lhp, asru);

		if (err == 0 || err == EINVAL)
			rc = FMD_SERVICE_STATE_UNUSABLE;
		else if (err == EAGAIN)
			rc = FMD_SERVICE_STATE_ISOLATE_PENDING;
		nvlist_free(asru);
	}

	return (set_retnvl(mod, out, TOPO_METH_SERVICE_STATE_RET, rc));
}