Deepak Kodihalli | c6e8fb5 | 2019-05-02 08:35:31 -0500 | [diff] [blame] | 1 | #include "pdr.hpp" |
| 2 | |
George Liu | a287072 | 2020-02-11 11:09:30 +0800 | [diff] [blame] | 3 | #include "pdr_state_effecter.hpp" |
Deepak Kodihalli | c682fe2 | 2020-03-04 00:42:54 -0600 | [diff] [blame] | 4 | |
Deepak Kodihalli | c6e8fb5 | 2019-05-02 08:35:31 -0500 | [diff] [blame] | 5 | namespace pldm |
| 6 | { |
| 7 | |
| 8 | namespace responder |
| 9 | { |
| 10 | |
| 11 | namespace pdr |
| 12 | { |
George Liu | e53193f | 2020-02-24 09:23:26 +0800 | [diff] [blame] | 13 | using namespace pldm::responder::pdr_utils; |
Deepak Kodihalli | c6e8fb5 | 2019-05-02 08:35:31 -0500 | [diff] [blame] | 14 | |
Deepak Kodihalli | c682fe2 | 2020-03-04 00:42:54 -0600 | [diff] [blame] | 15 | void getRepoByType(const Repo& inRepo, Repo& outRepo, Type pdrType) |
Deepak Kodihalli | c6e8fb5 | 2019-05-02 08:35:31 -0500 | [diff] [blame] | 16 | { |
George Liu | e53193f | 2020-02-24 09:23:26 +0800 | [diff] [blame] | 17 | uint8_t* pdrData = nullptr; |
| 18 | uint32_t pdrSize{}; |
Deepak Kodihalli | c682fe2 | 2020-03-04 00:42:54 -0600 | [diff] [blame] | 19 | auto record = pldm_pdr_find_record_by_type(inRepo.getPdr(), pdrType, NULL, |
George Liu | e53193f | 2020-02-24 09:23:26 +0800 | [diff] [blame] | 20 | &pdrData, &pdrSize); |
| 21 | while (record) |
| 22 | { |
| 23 | PdrEntry pdrEntry{}; |
| 24 | pdrEntry.data = pdrData; |
| 25 | pdrEntry.size = pdrSize; |
Deepak Kodihalli | c682fe2 | 2020-03-04 00:42:54 -0600 | [diff] [blame] | 26 | pdrEntry.handle.recordHandle = inRepo.getRecordHandle(record); |
| 27 | outRepo.addRecord(pdrEntry); |
George Liu | e53193f | 2020-02-24 09:23:26 +0800 | [diff] [blame] | 28 | |
| 29 | pdrData = nullptr; |
| 30 | pdrSize = 0; |
Deepak Kodihalli | c682fe2 | 2020-03-04 00:42:54 -0600 | [diff] [blame] | 31 | record = pldm_pdr_find_record_by_type(inRepo.getPdr(), pdrType, record, |
George Liu | e53193f | 2020-02-24 09:23:26 +0800 | [diff] [blame] | 32 | &pdrData, &pdrSize); |
| 33 | } |
George Liu | e53193f | 2020-02-24 09:23:26 +0800 | [diff] [blame] | 34 | } |
| 35 | |
Patrick Williams | 16c2a0a | 2024-08-16 15:20:59 -0400 | [diff] [blame] | 36 | const pldm_pdr_record* getRecordByHandle( |
| 37 | const RepoInterface& pdrRepo, RecordHandle recordHandle, PdrEntry& pdrEntry) |
George Liu | e53193f | 2020-02-24 09:23:26 +0800 | [diff] [blame] | 38 | { |
| 39 | uint8_t* pdrData = nullptr; |
Patrick Williams | 16c2a0a | 2024-08-16 15:20:59 -0400 | [diff] [blame] | 40 | auto record = |
| 41 | pldm_pdr_find_record(pdrRepo.getPdr(), recordHandle, &pdrData, |
| 42 | &pdrEntry.size, &pdrEntry.handle.nextRecordHandle); |
George Liu | e53193f | 2020-02-24 09:23:26 +0800 | [diff] [blame] | 43 | if (record) |
| 44 | { |
| 45 | pdrEntry.data = pdrData; |
| 46 | } |
| 47 | |
| 48 | return record; |
| 49 | } |
| 50 | |
Deepak Kodihalli | c6e8fb5 | 2019-05-02 08:35:31 -0500 | [diff] [blame] | 51 | } // namespace pdr |
| 52 | } // namespace responder |
| 53 | } // namespace pldm |