1f0bfeaa8Sopenharmony_ci/* 2f0bfeaa8Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 3f0bfeaa8Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4f0bfeaa8Sopenharmony_ci * you may not use this file except in compliance with the License. 5f0bfeaa8Sopenharmony_ci * You may obtain a copy of the License at 6f0bfeaa8Sopenharmony_ci * 7f0bfeaa8Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8f0bfeaa8Sopenharmony_ci * 9f0bfeaa8Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10f0bfeaa8Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11f0bfeaa8Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12f0bfeaa8Sopenharmony_ci * See the License for the specific language governing permissions and 13f0bfeaa8Sopenharmony_ci * limitations under the License. 14f0bfeaa8Sopenharmony_ci */ 15f0bfeaa8Sopenharmony_ci 16f0bfeaa8Sopenharmony_ci#include "pm_state_c.h" 17f0bfeaa8Sopenharmony_ci 18f0bfeaa8Sopenharmony_ci#undef LOG_TAG 19f0bfeaa8Sopenharmony_ci#define LOG_TAG "PurgeableMemC: state" 20f0bfeaa8Sopenharmony_ci 21f0bfeaa8Sopenharmony_cistatic const char * const PMStateNames[PM_ERR_TYPES] = { 22f0bfeaa8Sopenharmony_ci "OK", 23f0bfeaa8Sopenharmony_ci "BuilderPtrNULL", 24f0bfeaa8Sopenharmony_ci "MmapPurgMemFail", 25f0bfeaa8Sopenharmony_ci "MmapUxptFail", 26f0bfeaa8Sopenharmony_ci "UnmapPurgMemSucc", 27f0bfeaa8Sopenharmony_ci "UnmapPurgMemFail", 28f0bfeaa8Sopenharmony_ci "UnmapUxptFail", 29f0bfeaa8Sopenharmony_ci "UxpteOutOfRange", 30f0bfeaa8Sopenharmony_ci "UxptePresentDataPurged", 31f0bfeaa8Sopenharmony_ci "UxpteNoPresent", 32f0bfeaa8Sopenharmony_ci "LockInitFail", 33f0bfeaa8Sopenharmony_ci "ReadLockSucc", 34f0bfeaa8Sopenharmony_ci "ReadLockFail", 35f0bfeaa8Sopenharmony_ci "WriteLockFail", 36f0bfeaa8Sopenharmony_ci "ReadUnlockFail", 37f0bfeaa8Sopenharmony_ci "WriteUnlockFail", 38f0bfeaa8Sopenharmony_ci "DataPurged", 39f0bfeaa8Sopenharmony_ci "DataNoPurged", 40f0bfeaa8Sopenharmony_ci "BuilderBuildAllSucc", 41f0bfeaa8Sopenharmony_ci "BuilderBuildAllFail", 42f0bfeaa8Sopenharmony_ci "BuilderDestoryFailed", 43f0bfeaa8Sopenharmony_ci}; 44f0bfeaa8Sopenharmony_ci 45f0bfeaa8Sopenharmony_ciconst char *GetPMStateName(PMState state) 46f0bfeaa8Sopenharmony_ci{ 47f0bfeaa8Sopenharmony_ci if (state < 0 || state >= PM_ERR_TYPES) { 48f0bfeaa8Sopenharmony_ci return "NONE"; 49f0bfeaa8Sopenharmony_ci } 50f0bfeaa8Sopenharmony_ci return PMStateNames[state]; 51f0bfeaa8Sopenharmony_ci} 52