| /* |
| * Copyright 2023 Google LLC |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| #include "soc-reset-me.hpp" |
| |
| #include <exception> |
| |
| namespace pldm_oem_google |
| { |
| namespace soc_reset_me |
| { |
| |
| std::optional<SocId> PeerSoCId::socId; |
| |
| // mapping pldmd command line --instance input to PeerSoCId |
| // siliently ignore invaild input and leave PeerSoCId unset |
| // current mapping policy: |
| // instance 0 => cn1, instance 1 => cn2 |
| bool PeerSoCId::setWithPldmdInstanceParam(const std::string& instance) |
| { |
| bool ret = false; |
| try |
| { |
| auto id = std::stoi(instance); |
| switch (id) |
| { |
| case 0: |
| { |
| ret = Set(SocId::cn1); |
| } |
| break; |
| case 1: |
| { |
| ret = Set(SocId::cn2); |
| } |
| break; |
| } |
| } |
| catch (const std::exception& e) |
| {} |
| return ret; |
| } |
| |
| } // namespace soc_reset_me |
| } // namespace pldm_oem_google |