/* * * Intel Management Engine Interface (Intel MEI) Linux driver * Copyright (c) 2003-2012, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * */#include<linux/export.h>#include<linux/sched.h>#include<linux/wait.h>#include<linux/pm_runtime.h>#include<linux/slab.h>#include<linux/mei.h>#include"mei_dev.h"#include"hbm.h"#include"client.h"staticconstchar*mei_hbm_status_str(enummei_hbm_statusstatus){#define MEI_HBM_STATUS(status) case MEI_HBMS_##status: return #statusswitch(status){MEI_HBM_STATUS(SUCCESS);MEI_HBM_STATUS(CLIENT_NOT_FOUND);MEI_HBM_STATUS(ALREADY_EXISTS);MEI_HBM_STATUS(REJECTED);MEI_HBM_STATUS(INVALID_PARAMETER);MEI_HBM_STATUS(NOT_ALLOWED);MEI_HBM_STATUS(ALREADY_STARTED);MEI_HBM_STATUS(NOT_STARTED);default:return"unknown";}#undef MEI_HBM_STATUS};staticconstchar*mei_cl_conn_status_str(enummei_cl_connect_statusstatus){#define MEI_CL_CS(status) case MEI_CL_CONN_##status: return #statusswitch(status){MEI_CL_CS(SUCCESS);MEI_CL_CS(NOT_FOUND);MEI_CL_CS(ALREADY_STARTED);MEI_CL_CS(OUT_OF_RESOURCES);MEI_CL_CS(MESSAGE_SMALL);MEI_CL_CS(NOT_ALLOWED);default:return"unknown";}#undef MEI_CL_CCS}constchar*mei_hbm_state_str(enummei_hbm_statestate){#define MEI_HBM_STATE(state) case MEI_HBM_##state: return #stateswitch(state){MEI_HBM_STATE(IDLE);MEI_HBM_STATE(STARTING);MEI_HBM_STATE(STARTED);MEI_HBM_STATE(DR_SETUP);MEI_HBM_STATE(ENUM_CLIENTS);MEI_HBM_STATE(CLIENT_PROPERTIES);MEI_HBM_STATE(STOPPED);default:return"unknown";}#undef MEI_HBM_STATE}/** * mei_cl_conn_status_to_errno - convert client connect response * status to error code * * @status: client connect response status * * Return: corresponding error code */staticintmei_cl_conn_status_to_errno(enummei_cl_connect_statusstatus){switch(status){caseMEI_CL_CONN_SUCCESS:return0;caseMEI_CL_CONN_NOT_FOUND:return-ENOTTY;