├── OWNERS ├── meson_options.txt ├── subprojects ├── gtest.wrap ├── libcper.wrap ├── sdbusplus.wrap ├── phosphor-logging.wrap ├── boost.wrap └── nlohmann_json.wrap ├── xyz.openbmc_project.CPERLogger.service ├── .gitignore ├── README.md ├── cper-logger_git.bb ├── schema-gen ├── README.md ├── schemagen.py └── NvidiaCPER_v1.xml ├── MAINTAINERS ├── src ├── cper_logger_main.cpp ├── cper.hpp └── cper.cpp ├── test ├── pcie │ └── good_cper.h ├── nvidia │ └── ccplex │ │ ├── bad_cper.h │ │ ├── good_cper.h │ │ ├── multiseverity_cper.h │ │ └── nullsection_cper.h └── cper_logger_test.cpp ├── .clang-format ├── meson.build ├── .clang-tidy └── LICENSE /OWNERS: -------------------------------------------------------------------------------- 1 | owners: 2 | - ed@tanous.net 3 | -------------------------------------------------------------------------------- /meson_options.txt: -------------------------------------------------------------------------------- 1 | option('tests', type: 'feature', value: 'enabled', description: 'Build tests.') 2 | -------------------------------------------------------------------------------- /subprojects/gtest.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | url = https://github.com/google/googletest 3 | revision = HEAD 4 | -------------------------------------------------------------------------------- /subprojects/libcper.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | url = https://github.com/openbmc/libcper.git 3 | revision = HEAD 4 | 5 | [provide] 6 | libcper = libcper_parse_dep 7 | -------------------------------------------------------------------------------- /subprojects/sdbusplus.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | url = https://github.com/openbmc/sdbusplus.git 3 | revision = HEAD 4 | 5 | [provide] 6 | sdbusplus = sdbusplus_dep 7 | -------------------------------------------------------------------------------- /subprojects/phosphor-logging.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | url = https://github.com/openbmc/phosphor-logging.git 3 | revision = HEAD 4 | 5 | [provide] 6 | phosphor-logging = phosphor_logging_dep 7 | -------------------------------------------------------------------------------- /subprojects/boost.wrap: -------------------------------------------------------------------------------- 1 | [wrap-file] 2 | directory = boost-1.84.0 3 | 4 | source_url = https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.gz 5 | source_hash = 4d27e9efed0f6f152dc28db6430b9d3dfb40c0345da7342eaa5a987dde57bd95 6 | source_filename = 1_84_0.tar.gz 7 | 8 | [provide] 9 | boost = boost_dep 10 | -------------------------------------------------------------------------------- /xyz.openbmc_project.CPERLogger.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=CPER logger 3 | StopWhenUnneeded=false 4 | 5 | [Service] 6 | Restart=always 7 | RestartSec=5 8 | 9 | # Old versions of cper logger wrote files to disk. 10 | # Clean them up. Can be removed for non gb200 platforms. 11 | ExecStartPre=rm -rf /var/cper 12 | 13 | ExecStart=@INSTALL_PREFIX@/bin/cper-logger 14 | SyslogIdentifier=cper-logger 15 | Type=dbus 16 | BusName=xyz.openbmc_project.CPERLogger 17 | 18 | [Install] 19 | WantedBy=multi-user.target 20 | -------------------------------------------------------------------------------- /subprojects/nlohmann_json.wrap: -------------------------------------------------------------------------------- 1 | [wrap-file] 2 | directory = nlohmann_json-3.11.3 3 | lead_directory_missing = true 4 | source_url = https://github.com/nlohmann/json/releases/download/v3.11.3/include.zip 5 | source_filename = nlohmann_json-3.11.3.zip 6 | source_hash = a22461d13119ac5c78f205d3df1db13403e58ce1bb1794edc9313677313f4a9d 7 | source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/nlohmann_json_3.11.3-1/nlohmann_json-3.11.3.zip 8 | wrapdb_version = 3.11.3-1 9 | 10 | [provide] 11 | nlohmann_json = nlohmann_json_dep 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.toptal.com/developers/gitignore/api/meson 3 | # Edit at https://www.toptal.com/developers/gitignore?templates=meson 4 | 5 | ### Meson ### 6 | # subproject directories 7 | /subprojects/* 8 | !/subprojects/*.wrap 9 | 10 | # Meson Directories 11 | meson-logs 12 | meson-private 13 | 14 | # Meson Files 15 | meson_benchmark_setup.dat 16 | meson_test_setup.dat 17 | sanitycheckcpp.cc # C++ specific 18 | sanitycheckcpp.exe # C++ specific 19 | 20 | # Ninja 21 | build.ninja 22 | .ninja_deps 23 | .ninja_logs 24 | 25 | # Misc 26 | compile_commands.json 27 | 28 | # End of https://www.toptal.com/developers/gitignore/api/meson 29 | 30 | build/* -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OpenBMC Template Application 2 | 3 | The purpose of this application is to provide a template for writing new openbmc 4 | applications. When using this template, the author should fill this section with 5 | some small details about what the app is for, how it should be used, and how one 6 | configures it into the build. 7 | 8 | This template application supports: Meson builds Unit tests using gtest Opening 9 | a basic application on DBus Static analysis with openbmc-build-scripts 10 | 11 | ## Usage 12 | 13 | To use this application, take template-app_git.bb, and put it into an 14 | appropriate meta layer (generally meta-machine_name), and rename to your 15 | application name in the form of 16 | 17 | my-app-name_git.bb 18 | 19 | Update the SRC_URI in the bb file to the latest commit from this repo. 20 | 21 | Open $BBPATH/conf/local.conf and add 22 | 23 | ```bash 24 | IMAGE_INSTALL:append = "my-app-name" 25 | ``` 26 | 27 | Then run bitbake, and your application will be included. 28 | -------------------------------------------------------------------------------- /cper-logger_git.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "Logger for CPERs" 2 | DESCRIPTION = "The CPER logger decodes CPERs received & logs them to the EventLog" 3 | 4 | LICENSE = "Apache-2.0" 5 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" 6 | 7 | DEPENDS = " \ 8 | sdbusplus \ 9 | ${@bb.utils.contains('PTEST_ENABLED', '1', 'gtest', '', d)} \ 10 | ${@bb.utils.contains('PTEST_ENABLED', '1', 'gmock', '', d)} \ 11 | " 12 | 13 | SRC_URI = "file:///home/krajagopalan/cper_logger;branch=main" 14 | SRCREV = "efe9f17637ed27457f2effa52ec215aa093267d9" 15 | 16 | PV = "1.0+git${SRCPV}" 17 | 18 | SYSTEMD_SERVICE:${PN}:append = "xyz.openbmc_project.CPERLogger.service" 19 | 20 | S = "${WORKDIR}/git" 21 | 22 | inherit meson systemd pkgconfig 23 | 24 | PACKAGECONFIG ??= "" 25 | 26 | EXTRA_OEMESON = " \ 27 | -Dtests=${@bb.utils.contains('PTEST_ENABLED', '1', 'enabled', 'disabled', d)} \ 28 | " 29 | 30 | do_install_ptest() { 31 | install -d ${D}${PTEST_PATH}/test 32 | cp -rf ${B}/*_test ${D}${PTEST_PATH}/test/ 33 | } 34 | -------------------------------------------------------------------------------- /schema-gen/README.md: -------------------------------------------------------------------------------- 1 | # Schema-gen 2 | 3 | ## Usage 4 | 5 | ### Step 1 6 | 7 | Clone libcper to your local system: `https://github.com/openbmc/libcper.git` 8 | 9 | ### Step 2 10 | 11 | Run the cmdline tool to convert JSON refs to XML schema suitable for redfish: 12 | `python3 schemagen.py convert -s cper-json.json -d ../libcper/specification/json/ -a sections` 13 | 14 | ### Optional 15 | 16 | #### Creating a master json schema from all $refs and converting the master json to XML 17 | 18 | #### can be done in separate steps 19 | 20 | Generate master-schema.json, which consolidates all .json files in the libcper 21 | repo 22 | `python3 schemagen.py json_master -s cper-json.json -d ../libcper/specification/json/` 23 | 24 | Convert the master json schema to an XML schema compatible with redfish 25 | `python3 schemagen.py json_to_xml -s master-schema.json -a sections` 26 | 27 | ### Help 28 | 29 | `python3 schemagen.py -h` `python3 schemagen.py json_to_xml -h` 30 | `python3 schemagen.py json_master -h` 31 | 32 | ## Examples 33 | 34 | ### Example to aggregate multiple JSON schemas which reference each other with $ref 35 | 36 | `python3 schemagen.py json_master -s json_schema.json -d examples` 37 | 38 | ### Example to convert a clean json schema (with no refs) into XML 39 | 40 | 1. `python3 schemagen.py json_to_xml -s final_out.json -a sections` 41 | 2. `python3 schemagen.py json_to_xml -s final_out.json -x "XML header" \ -f "XML footer" -p "XmlBaseType" -a sections` 42 | -------------------------------------------------------------------------------- /MAINTAINERS: -------------------------------------------------------------------------------- 1 | How to use this list: 2 | Find the most specific section entry (described below) that matches where 3 | your change lives and add the reviewers (R) and maintainers (M) as 4 | reviewers. You can use the same method to track down who knows a particular 5 | code base best. 6 | 7 | Your change/query may span multiple entries; that is okay. 8 | 9 | If you do not find an entry that describes your request at all, someone 10 | forgot to update this list; please at least file an issue or send an email 11 | to a maintainer, but preferably you should just update this document. 12 | 13 | Description of section entries: 14 | 15 | Section entries are structured according to the following scheme: 16 | 17 | X: NAME 18 | X: ... 19 | . 20 | . 21 | . 22 | 23 | Where REPO_NAME is the name of the repository within the OpenBMC GitHub 24 | organization; FILE_PATH is a file path within the repository, possibly with 25 | wildcards; X is a tag of one of the following types: 26 | 27 | M: Denotes maintainer; has fields NAME ; 28 | if omitted from an entry, assume one of the maintainers from the 29 | MAINTAINERS entry. 30 | R: Denotes reviewer; has fields NAME ; 31 | these people are to be added as reviewers for a change matching the repo 32 | path. 33 | F: Denotes forked from an external repository; has fields URL. 34 | 35 | Line comments are to be denoted "# SOME COMMENT" (typical shell style 36 | comment); it is important to follow the correct syntax and semantics as we 37 | may want to use automated tools with this file in the future. 38 | 39 | A change cannot be added to an OpenBMC repository without a MAINTAINER's 40 | approval; thus, a MAINTAINER should always be listed as a reviewer. 41 | 42 | START OF MAINTAINERS LIST 43 | ------------------------- 44 | M: Ed Tanous 45 | -------------------------------------------------------------------------------- /src/cper_logger_main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & 3 | * AFFILIATES. All rights reserved. SPDX-License-Identifier: Apache-2.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "cper.hpp" 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | #include 26 | 27 | std::shared_ptr conn = nullptr; 28 | 29 | // CPER.Logging.CreateLog "s" 30 | void cperCreateLog(const std::vector& cper) 31 | { 32 | properties prop; 33 | CPER cp(std::span(cper.data(), cper.size())); 34 | 35 | cp.prepareToLog(prop); 36 | if (prop.empty()) 37 | { 38 | lg2::error("Error creating log"); 39 | return; 40 | } 41 | lg2::debug("{1} sections found", "1", prop.size()); 42 | 43 | for (const auto& section : prop) 44 | { 45 | // Handle multiple cper sections 46 | cp.log(section, *conn.get()); 47 | } 48 | } 49 | 50 | int main(void) 51 | { 52 | boost::asio::io_context io; 53 | conn = std::make_shared(io); 54 | 55 | conn->request_name("xyz.openbmc_project.CPERLogger"); 56 | 57 | auto server = sdbusplus::asio::object_server(conn); 58 | 59 | std::shared_ptr iface = 60 | server.add_interface("/xyz/openbmc_project/cperlogger", 61 | "xyz.openbmc_project.CPER"); 62 | 63 | iface->register_method("CreateLog", cperCreateLog); 64 | 65 | iface->initialize(); 66 | io.run(); 67 | } 68 | -------------------------------------------------------------------------------- /src/cper.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & 3 | * AFFILIATES. All rights reserved. SPDX-License-Identifier: Apache-2.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | using namespace nlohmann::literals; 28 | 29 | using properties = std::vector>; 30 | 31 | class CPER 32 | { 33 | 34 | public: 35 | // Constructor to create json from file 36 | CPER(const std::span data); 37 | 38 | // Populate properties from json for logging 39 | void prepareToLog(properties& dumpData) const; 40 | void addDumpDefaults(std::map& log) const; 41 | 42 | // Log 43 | void log(const std::map&, 44 | sdbusplus::asio::connection&) const; 45 | 46 | // Get 47 | bool isValid() const 48 | { 49 | return jsonData.is_object(); 50 | } 51 | const nlohmann::json& getJson() const 52 | { 53 | return jsonData; 54 | } 55 | 56 | private: 57 | #ifdef CPER_LOGGER_DEBUG_TRACE 58 | // Load from libcper json 59 | void readJsonFile(const std::string& filename); 60 | #endif 61 | 62 | // Load from pldmd data 63 | void readPldmData(std::span data); 64 | 65 | // helpers 66 | std::string toDbusSeverity(const std::string& severity) const; 67 | std::string toBase64String(const std::vector& data) const; 68 | 69 | // input file (needed to fwd the notification) 70 | std::string cperPath; 71 | 72 | // raw cper 73 | std::vector cperData; 74 | 75 | // cper json 76 | nlohmann::json jsonData; 77 | 78 | }; // class 79 | -------------------------------------------------------------------------------- /test/pcie/good_cper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & 3 | * AFFILIATES. All rights reserved. SPDX-License-Identifier: Apache-2.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | unsigned char pcieGoodCper[] = { 19 | 0x01, 0x00, 0x98, 0x01, 0x43, 0x50, 0x45, 0x52, 0x01, 0x01, 0xff, 0xff, 20 | 0xff, 0xff, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 21 | 0x98, 0x01, 0x00, 0x00, 0x06, 0x02, 0x03, 0x00, 0x11, 0x07, 0x24, 0x20, 22 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 23 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 24 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xe4, 0x01, 0xa9, 25 | 0x73, 0x11, 0xef, 0x11, 0x96, 0xa8, 0x5f, 0xa6, 0xbe, 0xf5, 0xee, 0xa4, 26 | 0xac, 0xd5, 0xa9, 0x09, 0x04, 0x52, 0x14, 0x42, 0x96, 0xe5, 0x94, 0x99, 27 | 0x2e, 0x75, 0x2b, 0xcd, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 28 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 29 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 30 | 0xc8, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 31 | 0x00, 0x00, 0x00, 0x00, 0x54, 0xe9, 0x95, 0xd9, 0xc1, 0xbb, 0x0f, 0x43, 32 | 0xad, 0x91, 0xb4, 0x4d, 0xcb, 0x3c, 0x6f, 0x35, 0x4a, 0x33, 0x4f, 0xcc, 33 | 0x63, 0xc5, 0xeb, 0x11, 0x8f, 0x88, 0x9f, 0x7a, 0xc7, 0x6c, 0x6f, 0x0c, 34 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 35 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 36 | 0xed, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 37 | 0x00, 0x00, 0x00, 0x00, 0x07, 0x05, 0x11, 0x80, 0x00, 0x00, 0x00, 0x00, 38 | 0xde, 0x10, 0xb9, 0x22, 0x00, 0x04, 0x06, 0x00, 0x00, 0x18, 0x00, 0x00, 39 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 40 | 0x00, 0x20, 0x02, 0x00, 0x10, 0x84, 0x42, 0x01, 0x21, 0x80, 0x01, 0x00, 41 | 0x1f, 0x29, 0x01, 0x00, 0x24, 0xf8, 0x7a, 0x00, 0x48, 0x00, 0x12, 0x70, 42 | 0x40, 0x00, 0xc4, 0x00, 0x28, 0x10, 0x00, 0x00, 0x17, 0x00, 0x01, 0x00, 43 | 0x00, 0x00, 0x00, 0x00, 0xb1, 0x1b, 0x71, 0x80, 0x00, 0x04, 0x00, 0x00, 44 | 0x1e, 0x00, 0x80, 0x81, 0x04, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 45 | 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xc2, 0x23, 0x00, 0x00, 0x00, 0x00, 46 | 0x00, 0x00, 0x40, 0x04, 0x30, 0x20, 0x46, 0x00, 0x01, 0x00, 0x00, 0x00, 47 | 0x00, 0xc0, 0x00, 0x00, 0xa0, 0x10, 0x00, 0x00, 0x01, 0x00, 0x80, 0x04, 48 | 0x0f, 0x33, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 49 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 50 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 51 | 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x41, 0x24, 0x1f, 0x01, 0x1d, 0x00, 52 | 0x21, 0x00, 0x41, 0x25, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 53 | 0x00, 0x00, 0x00, 0x00}; 54 | unsigned int pcieGoodCperLen = 412; 55 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | Language: Cpp 3 | # BasedOnStyle: LLVM 4 | AccessModifierOffset: -2 5 | AlignAfterOpenBracket: Align 6 | AlignConsecutiveAssignments: false 7 | AlignConsecutiveDeclarations: false 8 | AlignEscapedNewlines: Right 9 | AlignOperands: true 10 | AlignTrailingComments: true 11 | AllowAllParametersOfDeclarationOnNextLine: true 12 | AllowShortBlocksOnASingleLine: false 13 | AllowShortCaseLabelsOnASingleLine: false 14 | AllowShortFunctionsOnASingleLine: None 15 | AllowShortIfStatementsOnASingleLine: false 16 | AllowShortLoopsOnASingleLine: false 17 | AlwaysBreakAfterReturnType: None 18 | AlwaysBreakBeforeMultilineStrings: false 19 | AlwaysBreakTemplateDeclarations: Yes 20 | BinPackArguments: true 21 | BinPackParameters: true 22 | BraceWrapping: 23 | AfterCaseLabel: true 24 | AfterClass: true 25 | AfterControlStatement: true 26 | AfterEnum: true 27 | AfterFunction: true 28 | AfterNamespace: true 29 | AfterObjCDeclaration: true 30 | AfterStruct: true 31 | AfterUnion: true 32 | AfterExternBlock: true 33 | BeforeCatch: true 34 | BeforeElse: true 35 | IndentBraces: false 36 | SplitEmptyFunction: false 37 | SplitEmptyRecord: false 38 | SplitEmptyNamespace: false 39 | BreakBeforeBinaryOperators: None 40 | BreakBeforeBraces: Custom 41 | BreakBeforeTernaryOperators: true 42 | BreakConstructorInitializers: AfterColon 43 | BreakInheritanceList: AfterColon 44 | BreakStringLiterals: true 45 | ColumnLimit: 80 46 | CommentPragmas: '^ IWYU pragma:' 47 | CompactNamespaces: false 48 | ConstructorInitializerAllOnOneLineOrOnePerLine: false 49 | ConstructorInitializerIndentWidth: 4 50 | ContinuationIndentWidth: 4 51 | Cpp11BracedListStyle: true 52 | DerivePointerAlignment: false 53 | PointerAlignment: Left 54 | DisableFormat: false 55 | ExperimentalAutoDetectBinPacking: false 56 | FixNamespaceComments: true 57 | ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] 58 | IncludeBlocks: Regroup 59 | IncludeCategories: 60 | - Regex: '^[<"](gtest|gmock)' 61 | Priority: 7 62 | - Regex: '^"config.h"' 63 | Priority: -1 64 | - Regex: '^".*\.h"' 65 | Priority: 1 66 | - Regex: '^".*\.hpp"' 67 | Priority: 2 68 | - Regex: '^<.*\.h>' 69 | Priority: 3 70 | - Regex: '^<.*\.hpp>' 71 | Priority: 4 72 | - Regex: '^<.*' 73 | Priority: 5 74 | - Regex: '.*' 75 | Priority: 6 76 | IndentCaseLabels: true 77 | IndentWidth: 4 78 | IndentWrappedFunctionNames: true 79 | KeepEmptyLinesAtTheStartOfBlocks: true 80 | MacroBlockBegin: '' 81 | MacroBlockEnd: '' 82 | MaxEmptyLinesToKeep: 1 83 | NamespaceIndentation: None 84 | ObjCBlockIndentWidth: 2 85 | ObjCSpaceAfterProperty: false 86 | ObjCSpaceBeforeProtocolList: true 87 | PenaltyBreakBeforeFirstCallParameter: 19 88 | PenaltyBreakComment: 300 89 | PenaltyBreakFirstLessLess: 120 90 | PenaltyBreakString: 1000 91 | PenaltyExcessCharacter: 1000000 92 | PenaltyReturnTypeOnItsOwnLine: 60 93 | ReflowComments: true 94 | SortIncludes: true 95 | SortUsingDeclarations: true 96 | SpaceAfterCStyleCast: false 97 | SpaceAfterTemplateKeyword: true 98 | SpaceBeforeAssignmentOperators: true 99 | SpaceBeforeCpp11BracedList: false 100 | SpaceBeforeCtorInitializerColon: true 101 | SpaceBeforeInheritanceColon: true 102 | SpaceBeforeParens: ControlStatements 103 | SpaceBeforeRangeBasedForLoopColon: true 104 | SpaceInEmptyParentheses: false 105 | SpacesBeforeTrailingComments: 1 106 | SpacesInAngles: false 107 | SpacesInContainerLiterals: true 108 | SpacesInCStyleCastParentheses: false 109 | SpacesInParentheses: false 110 | SpacesInSquareBrackets: false 111 | Standard: Latest 112 | TabWidth: 4 113 | UseTab: Never 114 | ... 115 | 116 | -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | project( 2 | 'cper-logger', 3 | 'cpp', 4 | meson_version: '>=1.3.0', 5 | default_options: [ 6 | 'warning_level=3', 7 | 'werror=true', 8 | 'cpp_std=c++23', 9 | # note: This is allowed in certain contexts, but provides binary size 10 | # improvements for loggerlications that don't require rtti 11 | 'cpp_rtti=false', 12 | 'b_lto=true', 13 | ], 14 | license: 'Apache-2.0', 15 | version: '0.1', 16 | ) 17 | 18 | # Validate the c++ Standard 19 | if get_option('cpp_std') != 'c++23' 20 | error('This project requires c++23 support') 21 | endif 22 | 23 | boost = dependency( 24 | 'boost', 25 | version: '>=1.84.0', 26 | required: false, 27 | include_type: 'system', 28 | ) 29 | if not boost.found() 30 | cmake = import('cmake') 31 | opt = cmake.subproject_options() 32 | opt.add_cmake_defines( 33 | { 34 | 'BOOST_INCLUDE_LIBRARIES': 'asio;beast;callable_traits;container;headers', 35 | 'BUILD_SHARED_LIBS': 'OFF', 36 | }, 37 | ) 38 | 39 | boost = cmake.subproject('boost', required: true, options: opt) 40 | boost_asio = boost.dependency('boost_asio').as_system() 41 | boost_beast = boost.dependency('boost_beast').as_system() 42 | boost_callable_traits = boost.dependency('boost_callable_traits').as_system() 43 | boost_container = boost.dependency('boost_container').as_system() 44 | boost_headers = boost.dependency('boost_headers').as_system() 45 | boost = [ 46 | boost_asio, 47 | boost_callable_traits, 48 | boost_container, 49 | boost_headers, 50 | boost_beast, 51 | ] 52 | endif 53 | add_project_arguments( 54 | '-DBOOST_ASIO_DISABLE_THREADS', 55 | '-DBOOST_NO_RTTI', 56 | '-DBOOST_NO_TYPEID', 57 | language: 'cpp', 58 | ) 59 | 60 | systemd = dependency('systemd') 61 | sdbusplus = dependency('sdbusplus', required: false, include_type: 'system') 62 | if not sdbusplus.found() 63 | sdbusplus_proj = subproject('sdbusplus', required: true) 64 | sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep') 65 | sdbusplus = sdbusplus.as_system('system') 66 | endif 67 | add_project_arguments('-DSDBUSPLUS_DISABLE_BOOST_COROUTINES', language: 'cpp') 68 | 69 | phosphor_logging = dependency('phosphor-logging') 70 | nlohmann_json_dep = dependency( 71 | 'nlohmann_json', 72 | required: false, 73 | version: '>=3.11.2', 74 | include_type: 'system', 75 | ) 76 | if not nlohmann_json_dep.found() 77 | nlohmann_proj = subproject('nlohmann_json', required: true) 78 | nlohmann_json_dep = nlohmann_proj.get_variable('nlohmann_json_dep') 79 | endif 80 | 81 | cxx = meson.get_compiler('cpp') 82 | 83 | systemd_system_unit_dir = systemd.get_variable(pkgconfig: 'systemdsystemunitdir') 84 | 85 | system_conf_dir = systemd.get_variable(pkgconfig: 'sysconfdir') 86 | 87 | systemd_unit_configuration = configuration_data() 88 | systemd_unit_configuration.set('INSTALL_PREFIX', get_option('prefix')) 89 | 90 | configure_file( 91 | input: 'xyz.openbmc_project.CPERLogger.service', 92 | output: 'xyz.openbmc_project.CPERLogger.service', 93 | configuration: systemd_unit_configuration, 94 | install_dir: systemd_system_unit_dir, 95 | install: true, 96 | ) 97 | inc = [include_directories('src')] 98 | libcper_parse_dep = dependency('libcper', required: false) 99 | if not libcper_parse_dep.found() 100 | libcper = subproject('libcper') 101 | libcper_parse_dep = libcper.get_variable('libcper_parse_dep') 102 | # TODO, this really shouldn't be neccesary, but the install dir and the 103 | # subproject dir are different on libcper. Needs fixed in libcper itself. 104 | inc += [include_directories('subprojects')] 105 | endif 106 | 107 | cper_logger_a = static_library( 108 | 'cper_logger_a', 109 | 'src/cper.cpp', 110 | dependencies: [ 111 | boost, 112 | libcper_parse_dep, 113 | nlohmann_json_dep, 114 | phosphor_logging, 115 | sdbusplus, 116 | ], 117 | include_directories: inc, 118 | ) 119 | 120 | executable( 121 | 'cper-logger', 122 | 'src/cper_logger_main.cpp', 123 | dependencies: [boost, sdbusplus, phosphor_logging], 124 | include_directories: inc, 125 | install: true, 126 | link_with: [cper_logger_a], 127 | ) 128 | 129 | if get_option('tests').enabled() 130 | gtest_dep = dependency( 131 | 'gtest', 132 | disabler: true, 133 | required: false, 134 | include_type: 'system', 135 | ) 136 | gmock_dep = dependency( 137 | 'gmock', 138 | disabler: true, 139 | required: false, 140 | include_type: 'system', 141 | ) 142 | if not gtest_dep.found() or not gmock_dep.found() 143 | gtest_proj = import('cmake').subproject('gtest', required: false) 144 | if gtest_proj.found() 145 | gtest_dep = declare_dependency( 146 | dependencies: [ 147 | dependency('threads'), 148 | gtest_proj.dependency('gtest'), 149 | ], 150 | ) 151 | gmock_dep = gtest_proj.dependency('gmock') 152 | else 153 | assert( 154 | not get_option('tests').enabled(), 155 | 'Googletest is required if tests are enabled', 156 | ) 157 | endif 158 | endif 159 | cper_logger_test = executable( 160 | 'cper-logger-test', 161 | 'test/cper_logger_test.cpp', 162 | dependencies: [ 163 | boost, 164 | gmock_dep, 165 | gtest_dep, 166 | nlohmann_json_dep, 167 | sdbusplus, 168 | phosphor_logging, 169 | ], 170 | include_directories: inc + [include_directories('test')], 171 | link_with: [cper_logger_a], 172 | ) 173 | 174 | test('test_cper_logger', cper_logger_test) 175 | endif 176 | -------------------------------------------------------------------------------- /test/nvidia/ccplex/bad_cper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & 3 | * AFFILIATES. All rights reserved. SPDX-License-Identifier: Apache-2.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | unsigned char nvidiaCcplexBadCper[] = { 19 | 0x01, 0x00, 0xe0, 0x03, 0x43, 0x50, 0x45, 0x52, 0x01, 0x01, 0xff, 0xff, 20 | 0xff, 0xff, 0x06, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 21 | 0x58, 0x01, 0x00, 0x00, 0x29, 0x20, 0x22, 0x00, 0x10, 0x07, 0x24, 0x20, 22 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 23 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 24 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xe4, 0x01, 0xa9, 25 | 0x73, 0x11, 0xef, 0x11, 0x96, 0xa8, 0x5f, 0xa6, 0xbe, 0xf5, 0xee, 0xa4, 26 | 0xac, 0xd5, 0xa9, 0x09, 0x04, 0x52, 0x14, 0x42, 0x96, 0xe5, 0x94, 0x99, 27 | 0x2e, 0x75, 0x2b, 0xcd, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 28 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 29 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 30 | 0x30, 0x02, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 31 | 0x00, 0x00, 0x00, 0x00, 0xf2, 0x44, 0x52, 0x6d, 0x12, 0x27, 0xec, 0x11, 32 | 0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86, 0x4a, 0x33, 0x4f, 0xcc, 33 | 0x63, 0xc5, 0xeb, 0x11, 0x8f, 0x88, 0x9f, 0x7a, 0xc7, 0x6c, 0x6f, 0x0c, 34 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 35 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 36 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 37 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 38 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 39 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 40 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 41 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 42 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 43 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 44 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 45 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 46 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 47 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 48 | 0xe0, 0x03, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 49 | 0x00, 0x00, 0x00, 0x00, 0xf2, 0x44, 0x52, 0x6d, 0x12, 0x27, 0xec, 0x11, 50 | 0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86, 0x4a, 0x33, 0x4f, 0xcc, 51 | 0x63, 0xc5, 0xeb, 0x11, 0x8f, 0x88, 0x9f, 0x7a, 0xc7, 0x6c, 0x6f, 0x0c, 52 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 53 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 54 | 0x70, 0x04, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 55 | 0x00, 0x00, 0x00, 0x00, 0xf2, 0x44, 0x52, 0x6d, 0x12, 0x27, 0xec, 0x11, 56 | 0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86, 0x4a, 0x33, 0x4f, 0xcc, 57 | 0x63, 0xc5, 0xeb, 0x11, 0x8f, 0x88, 0x9f, 0x7a, 0xc7, 0x6c, 0x6f, 0x0c, 58 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 59 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 60 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 61 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 62 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 63 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 64 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 65 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 66 | 0x43, 0x43, 0x50, 0x4c, 0x45, 0x58, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 67 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 68 | 0x00, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x20, 0x18, 69 | 0x00, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x00, 70 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 71 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 72 | 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x28, 0x00, 0x20, 0x18, 73 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 74 | 0x30, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 75 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 76 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 77 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 78 | 0x43, 0x43, 0x50, 0x4c, 0x45, 0x58, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 79 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 80 | 0x00, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x18, 81 | 0x00, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x00, 82 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 83 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 84 | 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x28, 0x00, 0x30, 0x18, 85 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 86 | 0x30, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 87 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 88 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 89 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 90 | 0x43, 0x43, 0x50, 0x4c, 0x45, 0x58, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 91 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 92 | 0x00, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x20, 0x18, 93 | 0x00, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x00, 94 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 95 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 96 | 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x28, 0x10, 0x20, 0x18, 97 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 98 | 0x30, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 99 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 100 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 101 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 102 | unsigned int nvidiaCcplexBadCperLen = 996; 103 | -------------------------------------------------------------------------------- /test/cper_logger_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & 3 | * AFFILIATES. All rights reserved. SPDX-License-Identifier: Apache-2.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "nvidia/ccplex/bad_cper.h" 19 | #include "nvidia/ccplex/good_cper.h" 20 | #include "nvidia/ccplex/multiseverity_cper.h" 21 | #include "nvidia/ccplex/nullsection_cper.h" 22 | #include "pcie/good_cper.h" 23 | 24 | #include "cper.hpp" 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | std::string writeTempfile(const unsigned char* data, unsigned int size, 32 | const std::string& basename) 33 | { 34 | std::string fileName = "/tmp/" + basename + "-cper-XXXXXX"; 35 | auto fd = mkstemp(fileName.data()); 36 | if (fd < 0) 37 | { 38 | std::cout << "Failed creating file" << std::endl; 39 | return {}; 40 | } 41 | close(fd); 42 | 43 | std::ofstream ofs; 44 | ofs.exceptions(std::ofstream::failbit | std::ofstream::badbit | 45 | std::ofstream::eofbit); 46 | try 47 | { 48 | ofs.open(fileName); 49 | ofs.write(reinterpret_cast(data), size); 50 | } 51 | catch (const std::exception& e) 52 | { 53 | std::cout << "Failed writing to file" << std::endl; 54 | return {}; 55 | } 56 | return fileName; 57 | } 58 | 59 | struct Keypair 60 | { 61 | std::string_view from; 62 | std::string_view to; 63 | bool json = false; 64 | }; 65 | 66 | void parseOut(const std::map& m, 67 | const std::span& array, nlohmann::json::object_t& jFlat) 68 | { 69 | for (const auto& element : array) 70 | { 71 | const auto& f = m.find(std::string(element.from)); 72 | if (m.end() == f) 73 | { 74 | continue; 75 | } 76 | 77 | bool cj = element.json; 78 | if (cj == false) 79 | { 80 | jFlat[std::string(element.to)] = f->second; 81 | continue; 82 | } 83 | 84 | std::string prefix(element.to); 85 | prefix.erase(std::remove(prefix.begin(), prefix.end(), '\"'), 86 | prefix.end()); 87 | 88 | auto jj = nlohmann::ordered_json::parse(f->second); 89 | for (auto& [key, value] : jj.items()) 90 | { 91 | jFlat[prefix + key] = value; 92 | } 93 | } 94 | } 95 | 96 | std::vector redfishOutput(const properties& m) 97 | { 98 | std::array redfishConfig = { 99 | {{"REDFISH_MESSAGE_ID", "/MessageId"}, 100 | {"diagnosticData", "/DiagnosticData"}, 101 | {"diagnosticDataType", "/DiagnosticDataType"}, 102 | {"notificationType", "/CPER/NotificationType"}, 103 | {"sectionType", "/CPER/SectionType"}, 104 | {"jsonDiagnosticData", "/CPER/Oem/Nvidia", true}}}; 105 | 106 | std::vector jOut; 107 | for (const auto& it : m) 108 | { 109 | parseOut(it, redfishConfig, jOut.emplace_back()); 110 | } 111 | return jOut; 112 | } 113 | 114 | TEST(CPERTests, GoodParseCCPLEX) 115 | { 116 | properties prop; 117 | 118 | CPER cp(nvidiaCcplexGoodCper); 119 | cp.prepareToLog(prop); 120 | ASSERT_TRUE(cp.isValid()); 121 | 122 | EXPECT_EQ(prop[0]["diagnosticDataType"], "CPER"); 123 | EXPECT_EQ(prop[0]["cperSeverity"], "Corrected"); 124 | std::vector rf = redfishOutput(prop); 125 | 126 | // std::cout << nlohmann::json(rf[2]).dump(4, ' ') << '\n'; 127 | 128 | // TODO NEED TO ASSERT index 1-3 129 | ASSERT_EQ(prop.size(), 5); 130 | 131 | // TODO BUG 132 | EXPECT_EQ( 133 | rf[0]["/CPER/Oem/NvidiasectionDescriptors"][0]["sectionType"]["type"], 134 | "NVIDIA"); 135 | EXPECT_EQ(rf[0]["/CPER/Oem/Nvidiasections"][0]["Nvidia"]["signature"], 136 | "CCPLEXSCF"); 137 | EXPECT_EQ(rf[0]["/CPER/NotificationType"], 138 | "09a9d5ac-5204-4214-96e5-94992e752bcd"); 139 | } 140 | 141 | TEST(CPERTests, GoodParsePCIe) 142 | { 143 | properties prop; 144 | CPER cp(pcieGoodCper); 145 | cp.prepareToLog(prop); 146 | ASSERT_TRUE(cp.isValid()); 147 | 148 | EXPECT_EQ(prop[0]["diagnosticDataType"], "CPER"); 149 | EXPECT_EQ(prop[0]["cperSeverity"], "Corrected"); 150 | std::vector rf = redfishOutput(prop); 151 | ASSERT_EQ(prop.size(), 1); 152 | EXPECT_EQ( 153 | rf[0]["/CPER/Oem/NvidiasectionDescriptors"][0]["sectionType"]["type"], 154 | "PCIe"); 155 | EXPECT_EQ(rf[0]["/CPER/NotificationType"], 156 | "09a9d5ac-5204-4214-96e5-94992e752bcd"); 157 | } 158 | 159 | TEST(CPERTests, FailParse) 160 | { 161 | properties prop; 162 | CPER cp(nvidiaCcplexBadCper); 163 | cp.prepareToLog(prop); 164 | ASSERT_FALSE(cp.isValid()); 165 | ASSERT_EQ(prop.size(), 0); 166 | } 167 | 168 | TEST(CPERTests, MultiSeverity) 169 | { 170 | properties prop; 171 | CPER cp(nvidiaCcplexMultiseverityCper); 172 | cp.prepareToLog(prop); 173 | ASSERT_TRUE(cp.isValid()); 174 | 175 | // TODO NEED TO ASSERT index 1-4 176 | ASSERT_EQ(prop.size(), 5); 177 | 178 | EXPECT_EQ(prop[0]["diagnosticDataType"], "CPER"); 179 | EXPECT_EQ(prop[0]["cperSeverity"], "Corrected"); 180 | std::vector rf = redfishOutput(prop); 181 | EXPECT_EQ( 182 | rf[0]["/CPER/Oem/NvidiasectionDescriptors"][0]["sectionType"]["type"], 183 | "NVIDIA"); 184 | EXPECT_EQ(rf[0]["/CPER/Oem/Nvidiasections"][0]["Nvidia"]["signature"], 185 | "CCPLEXSCF"); 186 | EXPECT_EQ(rf[0]["/CPER/NotificationType"], 187 | "09a9d5ac-5204-4214-96e5-94992e752bcd"); 188 | // std::cout << nlohmann::json(rf[1]).dump(4, ' ') << '\n'; 189 | } 190 | 191 | TEST(CPERTests, NullSection) 192 | { 193 | properties prop; 194 | CPER cp(nvidiaCcplexNullsectionCper); 195 | cp.prepareToLog(prop); 196 | ASSERT_TRUE(cp.isValid()); 197 | 198 | EXPECT_EQ(prop[0]["diagnosticDataType"], "CPER"); 199 | // This is a BUG with this CPER 200 | EXPECT_EQ(prop[0]["cperSeverity"], "Corrected"); 201 | std::vector rf = redfishOutput(prop); 202 | 203 | // TODO NEED TO ASSERT index 1-3 204 | ASSERT_EQ(prop.size(), 4); 205 | EXPECT_EQ( 206 | rf[0]["/CPER/Oem/NvidiasectionDescriptors"][0]["sectionType"]["type"], 207 | "NVIDIA"); 208 | EXPECT_EQ(rf[0]["/CPER/Oem/Nvidiasections"][0]["Nvidia"]["signature"], 209 | "CCPLEXSCF"); 210 | EXPECT_EQ(rf[0]["/CPER/NotificationType"], 211 | "09a9d5ac-5204-4214-96e5-94992e752bcd"); 212 | } 213 | 214 | int main(int argc, char** argv) 215 | { 216 | // cper_set_log_stdio(); 217 | testing::InitGoogleTest(&argc, argv); 218 | return RUN_ALL_TESTS(); 219 | } 220 | -------------------------------------------------------------------------------- /test/nvidia/ccplex/good_cper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & 3 | * AFFILIATES. All rights reserved. SPDX-License-Identifier: Apache-2.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | unsigned char nvidiaCcplexGoodCper[] = { 19 | 0x01, 0x00, 0xb8, 0x04, 0x43, 0x50, 0x45, 0x52, 0x01, 0x01, 0xff, 0xff, 20 | 0xff, 0xff, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 21 | 0xb8, 0x04, 0x00, 0x00, 0x22, 0x28, 0x22, 0x00, 0x02, 0x07, 0x24, 0x20, 22 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 23 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 24 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xe4, 0x01, 0xa9, 25 | 0x73, 0x11, 0xef, 0x11, 0x96, 0xa8, 0x5f, 0xa6, 0xbe, 0xf5, 0xee, 0xa4, 26 | 0xac, 0xd5, 0xa9, 0x09, 0x04, 0x52, 0x14, 0x42, 0x96, 0xe5, 0x94, 0x99, 27 | 0x2e, 0x75, 0x2b, 0xcd, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 28 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 29 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 30 | 0xe8, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 31 | 0x00, 0x00, 0x00, 0x00, 0xf2, 0x44, 0x52, 0x6d, 0x12, 0x27, 0xec, 0x11, 32 | 0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86, 0x4a, 0x33, 0x4f, 0xcc, 33 | 0x63, 0xc5, 0xeb, 0x11, 0x8f, 0x88, 0x9f, 0x7a, 0xc7, 0x6c, 0x6f, 0x0c, 34 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 35 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 36 | 0x78, 0x02, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 37 | 0x00, 0x00, 0x00, 0x00, 0xf2, 0x44, 0x52, 0x6d, 0x12, 0x27, 0xec, 0x11, 38 | 0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86, 0x4a, 0x33, 0x4f, 0xcc, 39 | 0x63, 0xc5, 0xeb, 0x11, 0x8f, 0x88, 0x9f, 0x7a, 0xc7, 0x6c, 0x6f, 0x0c, 40 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 41 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 42 | 0x08, 0x03, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 43 | 0x00, 0x00, 0x00, 0x00, 0xf2, 0x44, 0x52, 0x6d, 0x12, 0x27, 0xec, 0x11, 44 | 0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86, 0x4a, 0x33, 0x4f, 0xcc, 45 | 0x63, 0xc5, 0xeb, 0x11, 0x8f, 0x88, 0x9f, 0x7a, 0xc7, 0x6c, 0x6f, 0x0c, 46 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 47 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 48 | 0x98, 0x03, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 49 | 0x00, 0x00, 0x00, 0x00, 0xf2, 0x44, 0x52, 0x6d, 0x12, 0x27, 0xec, 0x11, 50 | 0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86, 0x4a, 0x33, 0x4f, 0xcc, 51 | 0x63, 0xc5, 0xeb, 0x11, 0x8f, 0x88, 0x9f, 0x7a, 0xc7, 0x6c, 0x6f, 0x0c, 52 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 53 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 54 | 0x28, 0x04, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 55 | 0x00, 0x00, 0x00, 0x00, 0xf2, 0x44, 0x52, 0x6d, 0x12, 0x27, 0xec, 0x11, 56 | 0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86, 0x4a, 0x33, 0x4f, 0xcc, 57 | 0x63, 0xc5, 0xeb, 0x11, 0x8f, 0x88, 0x9f, 0x7a, 0xc7, 0x6c, 0x6f, 0x0c, 58 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 59 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 60 | 0x43, 0x43, 0x50, 0x4c, 0x45, 0x58, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 61 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 62 | 0x00, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x20, 0x18, 63 | 0x00, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x00, 64 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 65 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 66 | 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x28, 0x00, 0x20, 0x18, 67 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 68 | 0x30, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 69 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 70 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 71 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 72 | 0x43, 0x43, 0x50, 0x4c, 0x45, 0x58, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 73 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 74 | 0x00, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x18, 75 | 0x00, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x00, 76 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 77 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 78 | 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x28, 0x00, 0x30, 0x18, 79 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 80 | 0x30, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 81 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 82 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 83 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 84 | 0x43, 0x43, 0x50, 0x4c, 0x45, 0x58, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 85 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 86 | 0x00, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x20, 0x18, 87 | 0x00, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x00, 88 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 89 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 90 | 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x28, 0x10, 0x20, 0x18, 91 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 92 | 0x30, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 93 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 94 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 95 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 96 | 0x43, 0x43, 0x50, 0x4c, 0x45, 0x58, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 97 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 98 | 0x00, 0x10, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x30, 0x18, 99 | 0x00, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x00, 100 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 101 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 102 | 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x28, 0x10, 0x30, 0x18, 103 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 104 | 0x30, 0x10, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 105 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x10, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 106 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 107 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 108 | 0x43, 0x43, 0x50, 0x4c, 0x45, 0x58, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 109 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 110 | 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x19, 111 | 0x00, 0x00, 0x00, 0x00, 0x0d, 0x02, 0x80, 0xdc, 0x00, 0x00, 0x00, 0x00, 112 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 113 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 114 | 0x89, 0x14, 0xe0, 0x08, 0x00, 0x00, 0x9a, 0x05, 0x28, 0x00, 0x00, 0x19, 115 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 116 | 0x30, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 117 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 118 | 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 119 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 120 | unsigned int nvidiaCcplexGoodCperLen = 1212; 121 | -------------------------------------------------------------------------------- /test/nvidia/ccplex/multiseverity_cper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & 3 | * AFFILIATES. All rights reserved. SPDX-License-Identifier: Apache-2.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | unsigned char nvidiaCcplexMultiseverityCper[] = { 19 | 0x01, 0x00, 0xb8, 0x04, 0x43, 0x50, 0x45, 0x52, 0x01, 0x01, 0xff, 0xff, 20 | 0xff, 0xff, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 21 | 0xb8, 0x04, 0x00, 0x00, 0x21, 0x23, 0x22, 0x00, 0x16, 0x07, 0x24, 0x20, 22 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 23 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 24 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xe4, 0x01, 0xa9, 25 | 0x73, 0x11, 0xef, 0x11, 0x96, 0xa8, 0x5f, 0xa6, 0xbe, 0xf5, 0xee, 0xa4, 26 | 0xac, 0xd5, 0xa9, 0x09, 0x04, 0x52, 0x14, 0x42, 0x96, 0xe5, 0x94, 0x99, 27 | 0x2e, 0x75, 0x2b, 0xcd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 28 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 29 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 30 | 0xe8, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 31 | 0x00, 0x00, 0x00, 0x00, 0xf2, 0x44, 0x52, 0x6d, 0x12, 0x27, 0xec, 0x11, 32 | 0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86, 0x4a, 0x33, 0x4f, 0xcc, 33 | 0x63, 0xc5, 0xeb, 0x11, 0x8f, 0x88, 0x9f, 0x7a, 0xc7, 0x6c, 0x6f, 0x0c, 34 | 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 35 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 36 | 0x78, 0x02, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 37 | 0x00, 0x00, 0x00, 0x00, 0xf2, 0x44, 0x52, 0x6d, 0x12, 0x27, 0xec, 0x11, 38 | 0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86, 0x4a, 0x33, 0x4f, 0xcc, 39 | 0x63, 0xc5, 0xeb, 0x11, 0x8f, 0x88, 0x9f, 0x7a, 0xc7, 0x6c, 0x6f, 0x0c, 40 | 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 41 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 42 | 0x08, 0x03, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 43 | 0x00, 0x00, 0x00, 0x00, 0xf2, 0x44, 0x52, 0x6d, 0x12, 0x27, 0xec, 0x11, 44 | 0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86, 0x4a, 0x33, 0x4f, 0xcc, 45 | 0x63, 0xc5, 0xeb, 0x11, 0x8f, 0x88, 0x9f, 0x7a, 0xc7, 0x6c, 0x6f, 0x0c, 46 | 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 47 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 48 | 0x98, 0x03, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 49 | 0x00, 0x00, 0x00, 0x00, 0xf2, 0x44, 0x52, 0x6d, 0x12, 0x27, 0xec, 0x11, 50 | 0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86, 0x4a, 0x33, 0x4f, 0xcc, 51 | 0x63, 0xc5, 0xeb, 0x11, 0x8f, 0x88, 0x9f, 0x7a, 0xc7, 0x6c, 0x6f, 0x0c, 52 | 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 53 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 54 | 0x28, 0x04, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 55 | 0x00, 0x00, 0x00, 0x00, 0xf2, 0x44, 0x52, 0x6d, 0x12, 0x27, 0xec, 0x11, 56 | 0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86, 0x4a, 0x33, 0x4f, 0xcc, 57 | 0x63, 0xc5, 0xeb, 0x11, 0x8f, 0x88, 0x9f, 0x7a, 0xc7, 0x6c, 0x6f, 0x0c, 58 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 59 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 60 | 0x43, 0x43, 0x50, 0x4c, 0x45, 0x58, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 61 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 62 | 0x00, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x20, 0x18, 63 | 0x00, 0x00, 0x00, 0x00, 0x07, 0x0c, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 64 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 65 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 66 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x20, 0x18, 67 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 68 | 0x30, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 69 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 70 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 71 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 72 | 0x43, 0x43, 0x50, 0x4c, 0x45, 0x58, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 73 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 74 | 0x00, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x18, 75 | 0x00, 0x00, 0x00, 0x00, 0x07, 0x0c, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 76 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 77 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 78 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x30, 0x18, 79 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 80 | 0x30, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 81 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 82 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 83 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 84 | 0x43, 0x43, 0x50, 0x4c, 0x45, 0x58, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 85 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 86 | 0x00, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x20, 0x18, 87 | 0x00, 0x00, 0x00, 0x00, 0x07, 0x0c, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 88 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 89 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 90 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x10, 0x20, 0x18, 91 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 92 | 0x30, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 93 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 94 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 95 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 96 | 0x43, 0x43, 0x50, 0x4c, 0x45, 0x58, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 97 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 98 | 0x00, 0x10, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x30, 0x18, 99 | 0x00, 0x00, 0x00, 0x00, 0x07, 0x0c, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 100 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 101 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 102 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x10, 0x30, 0x18, 103 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 104 | 0x30, 0x10, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 105 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x10, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 106 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 107 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 108 | 0x43, 0x43, 0x50, 0x4c, 0x45, 0x58, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 109 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 110 | 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x19, 111 | 0x00, 0x00, 0x00, 0x00, 0x0d, 0x02, 0x80, 0xdc, 0x00, 0x00, 0x00, 0x00, 112 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 113 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 114 | 0x89, 0x14, 0xe0, 0x08, 0x00, 0x00, 0x9a, 0x05, 0x28, 0x00, 0x00, 0x19, 115 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 116 | 0x30, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 117 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 118 | 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 119 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 120 | unsigned int nvidiaCcplexMultiseverityCperLen = 1212; 121 | -------------------------------------------------------------------------------- /test/nvidia/ccplex/nullsection_cper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & 3 | * AFFILIATES. All rights reserved. SPDX-License-Identifier: Apache-2.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | unsigned char nvidiaCcplexNullsectionCper[] = { 19 | 0x01, 0x00, 0x00, 0x05, 0x43, 0x50, 0x45, 0x52, 0x01, 0x01, 0xff, 0xff, 20 | 0xff, 0xff, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 21 | 0x00, 0x05, 0x00, 0x00, 0x42, 0x52, 0x04, 0x00, 0x18, 0x07, 0x24, 0x20, 22 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 23 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 24 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xe4, 0x01, 0xa9, 25 | 0x73, 0x11, 0xef, 0x11, 0x96, 0xa8, 0x5f, 0xa6, 0xbe, 0xf5, 0xee, 0xa4, 26 | 0xac, 0xd5, 0xa9, 0x09, 0x04, 0x52, 0x14, 0x42, 0x96, 0xe5, 0x94, 0x99, 27 | 0x2e, 0x75, 0x2b, 0xcd, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 28 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 29 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 30 | 0x30, 0x02, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 31 | 0x00, 0x00, 0x00, 0x00, 0xf2, 0x44, 0x52, 0x6d, 0x12, 0x27, 0xec, 0x11, 32 | 0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86, 0x4a, 0x33, 0x4f, 0xcc, 33 | 0x63, 0xc5, 0xeb, 0x11, 0x8f, 0x88, 0x9f, 0x7a, 0xc7, 0x6c, 0x6f, 0x0c, 34 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 35 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 36 | 0xc0, 0x02, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 37 | 0x00, 0x00, 0x00, 0x00, 0xf2, 0x44, 0x52, 0x6d, 0x12, 0x27, 0xec, 0x11, 38 | 0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86, 0x4a, 0x33, 0x4f, 0xcc, 39 | 0x63, 0xc5, 0xeb, 0x11, 0x8f, 0x88, 0x9f, 0x7a, 0xc7, 0x6c, 0x6f, 0x0c, 40 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 41 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 42 | 0x50, 0x03, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 43 | 0x00, 0x00, 0x00, 0x00, 0xf2, 0x44, 0x52, 0x6d, 0x12, 0x27, 0xec, 0x11, 44 | 0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86, 0x4a, 0x33, 0x4f, 0xcc, 45 | 0x63, 0xc5, 0xeb, 0x11, 0x8f, 0x88, 0x9f, 0x7a, 0xc7, 0x6c, 0x6f, 0x0c, 46 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 47 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 48 | 0xe0, 0x03, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 49 | 0x00, 0x00, 0x00, 0x00, 0xf2, 0x44, 0x52, 0x6d, 0x12, 0x27, 0xec, 0x11, 50 | 0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86, 0x4a, 0x33, 0x4f, 0xcc, 51 | 0x63, 0xc5, 0xeb, 0x11, 0x8f, 0x88, 0x9f, 0x7a, 0xc7, 0x6c, 0x6f, 0x0c, 52 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 53 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 54 | 0x70, 0x04, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 55 | 0x00, 0x00, 0x00, 0x00, 0xf2, 0x44, 0x52, 0x6d, 0x12, 0x27, 0xec, 0x11, 56 | 0xbe, 0xa7, 0xcb, 0x3f, 0xdb, 0x95, 0xc7, 0x86, 0x4a, 0x33, 0x4f, 0xcc, 57 | 0x63, 0xc5, 0xeb, 0x11, 0x8f, 0x88, 0x9f, 0x7a, 0xc7, 0x6c, 0x6f, 0x0c, 58 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 59 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 60 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 61 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 62 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 63 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 64 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 65 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 66 | 0x43, 0x43, 0x50, 0x4c, 0x45, 0x58, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 67 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 68 | 0x00, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x20, 0x18, 69 | 0x00, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x00, 70 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 71 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 72 | 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x28, 0x00, 0x20, 0x18, 73 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 74 | 0x30, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 75 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 76 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 77 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 78 | 0x43, 0x43, 0x50, 0x4c, 0x45, 0x58, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 79 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 80 | 0x00, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x18, 81 | 0x00, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x00, 82 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 83 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 84 | 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x28, 0x00, 0x30, 0x18, 85 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 86 | 0x30, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 87 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 88 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 89 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 90 | 0x43, 0x43, 0x50, 0x4c, 0x45, 0x58, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 91 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 92 | 0x00, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x20, 0x18, 93 | 0x00, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x00, 94 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 95 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 96 | 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x28, 0x10, 0x20, 0x18, 97 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 98 | 0x30, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 99 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 100 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 101 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 102 | 0x43, 0x43, 0x50, 0x4c, 0x45, 0x58, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 103 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 104 | 0x00, 0x10, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x30, 0x18, 105 | 0x00, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x00, 106 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 107 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 108 | 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x28, 0x10, 0x30, 0x18, 109 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 110 | 0x30, 0x10, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 111 | 0x00, 0x00, 0x00, 0x00, 0x38, 0x10, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 112 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 113 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 114 | 0x43, 0x43, 0x50, 0x4c, 0x45, 0x58, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 115 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 116 | 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x19, 117 | 0x00, 0x00, 0x00, 0x00, 0x0d, 0x02, 0x80, 0xdc, 0x00, 0x00, 0x00, 0x00, 118 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 119 | 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 120 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 121 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 122 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 123 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 124 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 125 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 126 | unsigned int nvidiaCcplexNullsectionCperLen = 1284; 127 | -------------------------------------------------------------------------------- /.clang-tidy: -------------------------------------------------------------------------------- 1 | Checks: '-*, 2 | bugprone-argument-comment, 3 | bugprone-assert-side-effect, 4 | bugprone-bad-signal-to-kill-thread, 5 | bugprone-bool-pointer-implicit-conversion, 6 | bugprone-branch-clone, 7 | bugprone-copy-constructor-init, 8 | bugprone-dangling-handle, 9 | bugprone-dynamic-static-initializers, 10 | bugprone-fold-init-type, 11 | bugprone-forward-declaration-namespace, 12 | bugprone-forwarding-reference-overload, 13 | bugprone-inaccurate-erase, 14 | bugprone-incorrect-roundings, 15 | bugprone-infinite-loop, 16 | bugprone-integer-division, 17 | bugprone-lambda-function-name, 18 | bugprone-macro-parentheses, 19 | bugprone-macro-repeated-side-effects, 20 | bugprone-misplaced-operator-in-strlen-in-alloc, 21 | bugprone-misplaced-pointer-arithmetic-in-alloc, 22 | bugprone-misplaced-widening-cast, 23 | bugprone-multiple-statement-macro, 24 | bugprone-narrowing-conversions, 25 | bugprone-no-escape, 26 | bugprone-not-null-terminated-result, 27 | bugprone-parent-virtual-call, 28 | bugprone-posix-return, 29 | bugprone-reserved-identifier, 30 | bugprone-signed-char-misuse, 31 | bugprone-sizeof-container, 32 | bugprone-sizeof-expression, 33 | bugprone-spuriously-wake-up-functions, 34 | bugprone-string-constructor, 35 | bugprone-string-integer-assignment, 36 | bugprone-string-literal-with-embedded-nul, 37 | bugprone-suspicious-enum-usage, 38 | bugprone-suspicious-include, 39 | bugprone-suspicious-memset-usage, 40 | bugprone-suspicious-missing-comma, 41 | bugprone-suspicious-semicolon, 42 | bugprone-suspicious-string-compare, 43 | bugprone-swapped-arguments, 44 | bugprone-terminating-continue, 45 | bugprone-throw-keyword-missing, 46 | bugprone-too-small-loop-variable, 47 | bugprone-undefined-memory-manipulation, 48 | bugprone-undelegated-constructor, 49 | bugprone-unhandled-self-assignment, 50 | bugprone-unused-raii, 51 | bugprone-unused-return-value, 52 | bugprone-use-after-move, 53 | bugprone-virtual-near-miss, 54 | cert-con36-c, 55 | cert-con54-cpp, 56 | cert-dcl03-c, 57 | cert-dcl16-c, 58 | cert-dcl21-cpp, 59 | cert-dcl37-c, 60 | cert-dcl50-cpp, 61 | cert-dcl51-cpp, 62 | cert-dcl54-cpp, 63 | cert-dcl58-cpp, 64 | cert-dcl59-cpp, 65 | cert-env33-c, 66 | cert-err09-cpp, 67 | cert-err34-c, 68 | cert-err52-cpp, 69 | cert-err60-cpp, 70 | cert-err61-cpp, 71 | cert-fio38-c, 72 | cert-flp30-c, 73 | cert-mem57-cpp, 74 | cert-msc30-c, 75 | cert-msc32-c, 76 | cert-msc50-cpp, 77 | cert-msc51-cpp, 78 | cert-oop11-cpp, 79 | cert-oop54-cpp, 80 | cert-oop57-cpp, 81 | clang-analyzer-apiModeling.StdCLibraryFunctions, 82 | clang-analyzer-apiModeling.TrustNonnull, 83 | clang-analyzer-apiModeling.google.GTest, 84 | clang-analyzer-apiModeling.llvm.CastValue, 85 | clang-analyzer-apiModeling.llvm.ReturnValue, 86 | clang-analyzer-core.CallAndMessageModeling, 87 | clang-analyzer-core.DivideZero, 88 | clang-analyzer-core.DynamicTypePropagation, 89 | clang-analyzer-core.NonNullParamChecker, 90 | clang-analyzer-core.NonnilStringConstants, 91 | clang-analyzer-core.NullDereference, 92 | clang-analyzer-core.StackAddrEscapeBase, 93 | clang-analyzer-core.StackAddressEscape, 94 | clang-analyzer-core.UndefinedBinaryOperatorResult, 95 | clang-analyzer-core.VLASize, 96 | clang-analyzer-core.builtin.BuiltinFunctions, 97 | clang-analyzer-core.builtin.NoReturnFunctions, 98 | clang-analyzer-core.uninitialized.ArraySubscript, 99 | clang-analyzer-core.uninitialized.Assign, 100 | clang-analyzer-core.uninitialized.Branch, 101 | clang-analyzer-core.uninitialized.CapturedBlockVariable, 102 | clang-analyzer-core.uninitialized.UndefReturn, 103 | clang-analyzer-cplusplus.InnerPointer, 104 | clang-analyzer-cplusplus.Move, 105 | clang-analyzer-cplusplus.NewDelete, 106 | clang-analyzer-cplusplus.NewDeleteLeaks, 107 | clang-analyzer-cplusplus.PlacementNew, 108 | clang-analyzer-cplusplus.PureVirtualCall, 109 | clang-analyzer-cplusplus.SelfAssignment, 110 | clang-analyzer-cplusplus.SmartPtrModeling, 111 | clang-analyzer-cplusplus.VirtualCallModeling, 112 | clang-analyzer-deadcode.DeadStores, 113 | clang-analyzer-fuchsia.HandleChecker, 114 | clang-analyzer-nullability.NullPassedToNonnull, 115 | clang-analyzer-nullability.NullReturnedFromNonnull, 116 | clang-analyzer-nullability.NullabilityBase, 117 | clang-analyzer-nullability.NullableDereferenced, 118 | clang-analyzer-nullability.NullablePassedToNonnull, 119 | clang-analyzer-nullability.NullableReturnedFromNonnull, 120 | clang-analyzer-optin.cplusplus.UninitializedObject, 121 | clang-analyzer-optin.cplusplus.VirtualCall, 122 | clang-analyzer-optin.mpi.MPI-Checker, 123 | clang-analyzer-optin.osx.OSObjectCStyleCast, 124 | clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker, 125 | clang-analyzer-optin.osx.cocoa.localizability.NonLocalizedStringChecker, 126 | clang-analyzer-optin.performance.GCDAntipattern, 127 | clang-analyzer-optin.performance.Padding, 128 | clang-analyzer-optin.portability.UnixAPI, 129 | clang-analyzer-osx.API, 130 | clang-analyzer-osx.MIG, 131 | clang-analyzer-osx.NSOrCFErrorDerefChecker, 132 | clang-analyzer-osx.NumberObjectConversion, 133 | clang-analyzer-osx.OSObjectRetainCount, 134 | clang-analyzer-osx.ObjCProperty, 135 | clang-analyzer-osx.SecKeychainAPI, 136 | clang-analyzer-osx.cocoa.AtSync, 137 | clang-analyzer-osx.cocoa.AutoreleaseWrite, 138 | clang-analyzer-osx.cocoa.ClassRelease, 139 | clang-analyzer-osx.cocoa.Dealloc, 140 | clang-analyzer-osx.cocoa.IncompatibleMethodTypes, 141 | clang-analyzer-osx.cocoa.Loops, 142 | clang-analyzer-osx.cocoa.MissingSuperCall, 143 | clang-analyzer-osx.cocoa.NSAutoreleasePool, 144 | clang-analyzer-osx.cocoa.NSError, 145 | clang-analyzer-osx.cocoa.NilArg, 146 | clang-analyzer-osx.cocoa.NonNilReturnValue, 147 | clang-analyzer-osx.cocoa.ObjCGenerics, 148 | clang-analyzer-osx.cocoa.RetainCount, 149 | clang-analyzer-osx.cocoa.RetainCountBase, 150 | clang-analyzer-osx.cocoa.RunLoopAutoreleaseLeak, 151 | clang-analyzer-osx.cocoa.SelfInit, 152 | clang-analyzer-osx.cocoa.SuperDealloc, 153 | clang-analyzer-osx.cocoa.UnusedIvars, 154 | clang-analyzer-osx.cocoa.VariadicMethodTypes, 155 | clang-analyzer-osx.coreFoundation.CFError, 156 | clang-analyzer-osx.coreFoundation.CFNumber, 157 | clang-analyzer-osx.coreFoundation.CFRetainRelease, 158 | clang-analyzer-osx.coreFoundation.containers.OutOfBounds, 159 | clang-analyzer-osx.coreFoundation.containers.PointerSizedValues, 160 | clang-analyzer-security.FloatLoopCounter, 161 | clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling, 162 | clang-analyzer-security.insecureAPI.SecuritySyntaxChecker, 163 | clang-analyzer-security.insecureAPI.UncheckedReturn, 164 | clang-analyzer-security.insecureAPI.bcmp, 165 | clang-analyzer-security.insecureAPI.bcopy, 166 | clang-analyzer-security.insecureAPI.bzero, 167 | clang-analyzer-security.insecureAPI.decodeValueOfObjCType, 168 | clang-analyzer-security.insecureAPI.getpw, 169 | clang-analyzer-security.insecureAPI.gets, 170 | clang-analyzer-security.insecureAPI.mkstemp, 171 | clang-analyzer-security.insecureAPI.mktemp, 172 | clang-analyzer-security.insecureAPI.rand, 173 | clang-analyzer-security.insecureAPI.strcpy, 174 | clang-analyzer-security.insecureAPI.vfork, 175 | clang-analyzer-unix.API, 176 | clang-analyzer-unix.DynamicMemoryModeling, 177 | clang-analyzer-unix.Malloc, 178 | clang-analyzer-unix.MallocSizeof, 179 | clang-analyzer-unix.MismatchedDeallocator, 180 | clang-analyzer-unix.Vfork, 181 | clang-analyzer-unix.cstring.BadSizeArg, 182 | clang-analyzer-unix.cstring.CStringModeling, 183 | clang-analyzer-unix.cstring.NullArg, 184 | clang-analyzer-valist.CopyToSelf, 185 | clang-analyzer-valist.Uninitialized, 186 | clang-analyzer-valist.Unterminated, 187 | clang-analyzer-valist.ValistBase, 188 | clang-analyzer-webkit.NoUncountedMemberChecker, 189 | clang-analyzer-webkit.RefCntblBaseVirtualDtor, 190 | misc-misplaced-const, 191 | misc-no-recursion, 192 | misc-redundant-expression, 193 | misc-static-assert, 194 | misc-throw-by-value-catch-by-reference, 195 | misc-unconventional-assign-operator, 196 | misc-uniqueptr-reset-release, 197 | misc-unused-using-decls, 198 | modernize-avoid-bind, 199 | modernize-deprecated-headers, 200 | modernize-deprecated-ios-base-aliases, 201 | modernize-loop-convert, 202 | modernize-make-shared, 203 | modernize-make-unique, 204 | modernize-raw-string-literal, 205 | modernize-replace-auto-ptr, 206 | modernize-replace-random-shuffle, 207 | modernize-return-braced-init-list, 208 | modernize-shrink-to-fit, 209 | modernize-unary-static-assert, 210 | modernize-use-bool-literals, 211 | modernize-use-default-member-init, 212 | modernize-use-emplace, 213 | modernize-use-equals-default, 214 | modernize-use-equals-delete, 215 | modernize-use-noexcept, 216 | modernize-use-nullptr, 217 | modernize-use-override, 218 | modernize-use-transparent-functors, 219 | modernize-use-uncaught-exceptions, 220 | modernize-use-using, 221 | performance-faster-string-find, 222 | performance-for-range-copy, 223 | performance-implicit-conversion-in-loop, 224 | performance-inefficient-algorithm, 225 | performance-inefficient-string-concatenation, 226 | performance-inefficient-vector-operation, 227 | performance-move-const-arg, 228 | performance-move-constructor-init, 229 | performance-no-automatic-move, 230 | performance-noexcept-move-constructor, 231 | performance-trivially-destructible, 232 | performance-type-promotion-in-math-fn, 233 | performance-unnecessary-copy-initialization, 234 | performance-unnecessary-value-param, 235 | readability-braces-around-statements, 236 | readability-const-return-type, 237 | readability-delete-null-pointer, 238 | readability-deleted-default, 239 | readability-else-after-return, 240 | readability-identifier-naming 241 | ' 242 | 243 | CheckOptions: 244 | - key: readability-identifier-naming.ClassCase 245 | value: CamelCase 246 | - key: readability-identifier-naming.FunctionCase 247 | value: camelBack 248 | - key: readability-identifier-naming.NamespaceCase 249 | value: lower_case 250 | - key: readability-identifier-naming.ParameterCase 251 | value: camelBack 252 | - key: readability-identifier-naming.StructCase 253 | value: CamelCase 254 | - key: readability-identifier-naming.VariableCase 255 | value: camelBack 256 | 257 | HeaderFilterRegex: ^((?!linux).)*$ 258 | 259 | WarningsAsErrors: '*' 260 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /src/cper.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & 3 | * AFFILIATES. All rights reserved. SPDX-License-Identifier: Apache-2.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "cper.hpp" 19 | 20 | #include 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | extern "C" 36 | { 37 | #include 38 | } 39 | 40 | // Public functions 41 | int constructDiagnosticData(nlohmann::json& out, const nlohmann::json& secdIt, 42 | const nlohmann::json& secIt) 43 | { 44 | nlohmann::json::array_t arr; 45 | arr.push_back(secdIt); 46 | out["sectionDescriptors"] = std::move(arr); 47 | 48 | nlohmann::json::array_t secarr; 49 | secarr.push_back(secIt); 50 | out["sections"] = std::move(secarr); 51 | 52 | return 0; 53 | } 54 | 55 | CPER::CPER(std::span data) 56 | { 57 | readPldmData(data); 58 | 59 | #ifdef CPER_LOGGER_DEBUG_TRACE 60 | if (this->jsonData.empty() || this->jsonData.is_discarded()) 61 | { 62 | // Debug-mode - Try the incoming file as json 63 | readJsonFile(filename); 64 | } 65 | #endif 66 | } 67 | 68 | void CPER::addDumpDefaults(std::map& log) const 69 | { 70 | log["diagnosticData"] = toBase64String(this->cperData); 71 | log["REDFISH_MESSAGE_ID"] = "Platform.1.0.PlatformError"; 72 | 73 | // override these defaults 74 | log["diagnosticDataType"] = "CPER"; 75 | log["cperSeverity"] = "Unknown"; 76 | } 77 | 78 | void readIntKey(const std::string& match, const std::string& key, 79 | const nlohmann::json& obj, int64_t& valueOut) 80 | { 81 | if (match != key) 82 | { 83 | return; 84 | } 85 | const int64_t* name = obj.get_ptr(); 86 | if (name != nullptr) 87 | { 88 | valueOut = *name; 89 | } 90 | } 91 | 92 | void readStrKey(const std::string& match, const std::string& key, 93 | const nlohmann::json& obj, std::string& valueOut) 94 | { 95 | if (match != key) 96 | { 97 | return; 98 | } 99 | const std::string* name = obj.get_ptr(); 100 | if (name != nullptr) 101 | { 102 | valueOut = *name; 103 | } 104 | } 105 | 106 | struct Header 107 | { 108 | std::string severity; 109 | int64_t code = std::numeric_limits::max(); 110 | std::string notificationType; 111 | std::string timestamp; 112 | std::string time; 113 | }; 114 | 115 | static Header readHeader(const nlohmann::json& headerJson) 116 | { 117 | Header ret; 118 | const nlohmann::json::object_t* headerObj = 119 | headerJson.get_ptr(); 120 | for (const auto& [key, value] : *headerObj) 121 | { 122 | const nlohmann::json::object_t* obj = 123 | value.get_ptr(); 124 | if (key == "severity") 125 | { 126 | if (obj != nullptr) 127 | { 128 | for (const auto& [key, value] : *obj) 129 | { 130 | readStrKey("name", key, value, ret.severity); 131 | readIntKey("code", key, value, ret.code); 132 | } 133 | } 134 | } 135 | else if (key == "notificationType") 136 | { 137 | if (obj != nullptr) 138 | { 139 | for (const auto& [key, value] : *obj) 140 | { 141 | readStrKey("guid", key, value, ret.notificationType); 142 | } 143 | } 144 | } 145 | else if (key == "timestamp") 146 | { 147 | readStrKey("timestamp", key, value, ret.time); 148 | } 149 | } 150 | return ret; 151 | } 152 | 153 | /* 154 | * Parses libcper output to generate dbus-formatted message 155 | * Arguments: 156 | * 1. dumpMap: Map containing CPER sections to dump on dbus 157 | * Return: 158 | * Number of sections parsed, CPER_PARSE_ERROR on error, CPER_PARSE_EMPTY on 0 159 | */ 160 | void CPER::prepareToLog(properties& dumpMap) const 161 | { 162 | if (!isValid()) 163 | { 164 | lg2::error("CPER is invalid"); 165 | return; 166 | } 167 | 168 | auto sectionDescriptors = jsonData.find("sectionDescriptors"); 169 | if (sectionDescriptors == jsonData.end()) 170 | { 171 | lg2::error("Section Descriptor property not found in CPER log"); 172 | return; 173 | } 174 | 175 | const nlohmann::json::array_t* sectionDs = 176 | sectionDescriptors->get_ptr(); 177 | if (sectionDs == nullptr) 178 | { 179 | lg2::error("Section Descriptor property is not an array"); 180 | return; 181 | } 182 | auto sectionD = sectionDs->begin(); 183 | 184 | auto sections = jsonData.find("sections"); 185 | if (sections == jsonData.end()) 186 | { 187 | lg2::error("Sections property not found in CPER log"); 188 | return; 189 | } 190 | const nlohmann::json::array_t* sectionArrs = 191 | sections->get_ptr(); 192 | if (sectionArrs == nullptr) 193 | { 194 | lg2::error("Sections property is not an array"); 195 | return; 196 | } 197 | auto sectionArr = sectionArrs->begin(); 198 | 199 | // Ensure sections and sectionDescriptors are same sized arrays 200 | if (sectionArrs->size() != sectionDs->size()) 201 | { 202 | lg2::error("Invalid CPER: Number of Sections and Section Descriptors " 203 | "do not match"); 204 | return; 205 | } 206 | 207 | Header header; 208 | const auto headerJson = jsonData.find("header"); 209 | std::map commonProps; 210 | 211 | if (headerJson == jsonData.end()) 212 | { 213 | lg2::error("Absent header field, proceeding as a section log"); 214 | // single-section CPER 215 | commonProps["diagnosticDataType"] = "CPERSection"; 216 | } 217 | else 218 | { 219 | // full CPER 220 | commonProps["diagnosticDataType"] = "CPER"; 221 | header = readHeader(*headerJson); 222 | commonProps["cperSeverity"] = header.severity; 223 | commonProps["cperSeverityCode"] = std::to_string(header.code); 224 | commonProps["notificationType"] = header.notificationType; 225 | if (!header.time.empty()) 226 | { 227 | commonProps["timestamp"] = header.time; 228 | } 229 | } 230 | 231 | // Iterate over sections 232 | for (size_t logCountInd = 0; logCountInd < sectionDs->size(); logCountInd++) 233 | { 234 | nlohmann::json out; 235 | 236 | auto& entry = dumpMap.emplace_back(); 237 | for (const auto& [key, value] : commonProps) 238 | { 239 | entry[key] = value; 240 | } 241 | 242 | entry["diagnosticData"] = toBase64String(this->cperData); 243 | entry["REDFISH_MESSAGE_ID"] = "Platform.1.0.PlatformError"; 244 | 245 | if (constructDiagnosticData(out, *sectionD, *sectionArr)) 246 | { 247 | lg2::error("Could not construct CPER data for section."); 248 | } 249 | entry["jsonDiagnosticData"] = out.dump(4, ' '); 250 | 251 | // sectionDescriptor has the CPER's severity & sectionType 252 | 253 | std::string stype = 254 | sectionD->value("/sectionType/data"_json_pointer, ""); 255 | if (stype.empty()) 256 | { 257 | lg2::error("sectionType property not found"); 258 | } 259 | else 260 | { 261 | entry["sectionType"] = stype; 262 | } 263 | 264 | sectionD++; 265 | sectionArr++; 266 | } 267 | } 268 | 269 | // Callback function 270 | static void asioCallback(const boost::system::error_code& ec, 271 | sdbusplus::message::message& msg) 272 | { 273 | if (ec) 274 | { 275 | lg2::error("Error in callback {1}", "1", msg.get_errno()); 276 | } 277 | } 278 | 279 | // Log to sdbus 280 | void CPER::log(const std::map& props, 281 | sdbusplus::asio::connection& conn) const 282 | { 283 | std::map> dumpData; 284 | std::string cperSeverity; 285 | 286 | for (const auto& pair : props) 287 | { 288 | lg2::debug("{1}: {2}", "1", pair.first, "2", pair.second); 289 | if ("diagnosticDataType" == pair.first) 290 | { 291 | dumpData["CPER_PATH"] = this->cperPath; 292 | dumpData["CPER_TYPE"] = pair.second; 293 | } 294 | if ("cperSeverity" == pair.first) 295 | { 296 | cperSeverity = pair.second; 297 | } 298 | } 299 | 300 | // Send to phosphor-logging 301 | conn.async_method_call( 302 | // callback 303 | asioCallback, 304 | // dbus method: service, object, interface, method 305 | "xyz.openbmc_project.Logging", "/xyz/openbmc_project/logging", 306 | "xyz.openbmc_project.Logging.Create", "Create", 307 | // parameters: ssa{ss} 308 | "A CPER was logged", toDbusSeverity(cperSeverity), props); 309 | } 310 | 311 | // Private funtions 312 | 313 | // Load json from file 314 | #ifdef CPER_LOGGER_DEBUG_TRACE 315 | void CPER::readJsonFile(const std::string& filename) 316 | { 317 | std::ifstream jsonFile(filename.c_str()); 318 | 319 | if (!jsonFile.is_open()) 320 | { 321 | lg2::error("Failed reading {1} as json", "1", filename); 322 | return; 323 | } 324 | 325 | this->jsonData = nlohmann::json::parse(jsonFile, nullptr, false); 326 | } 327 | #endif 328 | 329 | void CPER::readPldmData(std::span pldmData) 330 | { 331 | const size_t pldmHeaderSize = 4; 332 | const size_t sectionDescriptorSize = sizeof(EFI_ERROR_SECTION_DESCRIPTOR); 333 | 334 | // 1st 4 bytes are a PLDM header, and there needs to be at least 1 335 | // section-descriptor 336 | if (pldmData.size() < pldmHeaderSize + sectionDescriptorSize) 337 | { 338 | lg2::error("Invalid CPER: Got {1} bytes", "1", pldmData.size()); 339 | return; 340 | } 341 | 342 | // 0:Full CPER (header & sections), 1:Single section (no header) 343 | uint8_t type = pldmData[1]; 344 | if (type > 1) 345 | { 346 | lg2::error("Invalid CPER: Got format-type {1}", "1", type); 347 | return; 348 | } 349 | 350 | // copy the CPER binary for encoding later 351 | cperData.assign(pldmData.begin() + pldmHeaderSize, pldmData.end()); 352 | std::cout << "cperData " << std::to_string(cperData.size()) << "\n"; 353 | // parse to json as char* from libcper 354 | char* raw = nullptr; 355 | if (type) 356 | { 357 | raw = 358 | cperbuf_single_section_to_str_ir(cperData.data(), cperData.size()); 359 | } 360 | else 361 | { 362 | raw = cperbuf_to_str_ir(cperData.data(), cperData.size()); 363 | } 364 | if (raw == nullptr) 365 | { 366 | lg2::error("Failed parsing cper data"); 367 | return; 368 | } 369 | std::unique_ptr jstr(raw, free); 370 | this->jsonData = nlohmann::json::parse(jstr.get(), nullptr, false); 371 | } 372 | 373 | // conversion 374 | // ... to dbus-sevrity 375 | std::string CPER::toDbusSeverity(const std::string& severity) const 376 | { 377 | if ("Recoverable" == severity) 378 | { 379 | return "xyz.openbmc_project.Logging.Entry.Level.Warning"; 380 | } 381 | if ("Fatal" == severity) 382 | { 383 | return "xyz.openbmc_project.Logging.Entry.Level.Critical"; 384 | } 385 | if ("Corrected" == severity || "Informational" == severity) 386 | { 387 | return "xyz.openbmc_project.Logging.Entry.Level.Informational"; 388 | } 389 | return "xyz.openbmc_project.Logging.Entry.Level.Warning"; 390 | } 391 | 392 | // ... to base64 393 | std::string CPER::toBase64String(const std::vector& data) const 394 | { 395 | // encoded_size() doesn't include \0 396 | size_t len = boost::beast::detail::base64::encoded_size(data.size()) + 1; 397 | std::string encoded(len, '\0'); 398 | 399 | size_t written = boost::beast::detail::base64::encode( 400 | encoded.data(), data.data(), data.size()); 401 | encoded.resize(written); 402 | 403 | return encoded; 404 | } 405 | -------------------------------------------------------------------------------- /schema-gen/schemagen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # coding: utf-8 3 | """ 4 | Allows conversion of multiple json schemas into a single 5 | master schema by replacing $ref(s) with the expanded file contents 6 | 7 | Modify certain keys of a schema by applying a transformation 8 | 9 | Generate an XML schema from a json schema defined for CPERs 10 | 11 | @author: Aushim Nagarkatti 12 | """ 13 | 14 | import argparse 15 | 16 | # imports 17 | import json 18 | import os 19 | 20 | version = "v0_8_0" 21 | 22 | HEADER = f""" 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | """ 34 | 35 | FOOTER = """ 36 | 37 | 38 | """ 39 | 40 | 41 | class SchemaGenerator: 42 | """ 43 | Class for creating a single json schema by combining refs 44 | and allowing modification of property keys. 45 | """ 46 | 47 | def __init__(self, rootpath, base_schema): 48 | """ 49 | Args: 50 | rootpath (string): Path to directory containing all json schema files 51 | base_schema (string): Path to root json schema file 52 | """ 53 | self.ref_paths = {} 54 | self.rootpath = rootpath 55 | self.base_schema = json.load(open(os.path.join(rootpath, base_schema))) 56 | self.map_schemas(rootpath) 57 | 58 | def map_schemas(self, schema_dir): 59 | """ 60 | Create a map of all the json files in the directories below root dir 61 | Args: 62 | schema_dir (string): Path to root directory containing all json schema files 63 | """ 64 | for root, _, files in os.walk(schema_dir): 65 | for filename in files: 66 | if filename.endswith(".json"): 67 | schema_path = os.path.join(root, filename) 68 | self.ref_paths[filename] = schema_path 69 | 70 | def refresolve(self, ref): 71 | if ref not in self.ref_paths: 72 | print("Error no ref path named: ", ref) 73 | return 74 | with open(self.ref_paths[ref], "r") as schema_file: 75 | return json.load(schema_file) 76 | 77 | def replace_refs(self, schema): 78 | """ 79 | Replace all references of $ref with actual json file contents 80 | Args: 81 | schema (string): Original json schema file as a string 82 | Returns: 83 | result (string): transformed json schema file 84 | """ 85 | if isinstance(schema, dict): 86 | if "$ref" in schema: 87 | ref = os.path.basename(schema["$ref"]) 88 | resolved_schema = self.refresolve(ref) 89 | replaced_ref = self.replace_refs(resolved_schema) 90 | replaced_ref.pop("$schema", None) 91 | return replaced_ref 92 | else: 93 | for key, value in schema.items(): 94 | schema[key] = self.replace_refs(value) 95 | elif isinstance(schema, list): 96 | schema = [self.replace_refs(item) for item in schema] 97 | 98 | return schema 99 | 100 | # Modify named properties in a json schema 101 | def modify_schema(self, schema, keytomod): 102 | """ 103 | Replace all references of $ref with actual json file contents 104 | Args: 105 | schema (string): Original json schema file as a string 106 | keytomod (string): A particular json property that needs modification 107 | Returns: 108 | result (string): json schema file with modified property 109 | """ 110 | if isinstance(schema, dict): 111 | for key, value in schema.items(): 112 | if key == keytomod: 113 | propname = schema[key] 114 | # Define your own transform in place of capitalize() 115 | schema[key] = self.capitalize(propname) 116 | else: 117 | schema[key] = self.modify_schema(value) 118 | 119 | return schema 120 | 121 | elif isinstance(schema, list): 122 | schema = [self.modify_schema(item) for item in schema] 123 | 124 | return schema 125 | 126 | def capitalize(self, propname): 127 | return propname[0].upper() + propname[1:] 128 | 129 | 130 | class JsontoXml: 131 | """ 132 | Class for creating an XML version of a JSON schema. 133 | Created specifically to transform CPER json schemas into xml. 134 | Note: Refer to examples/json_schema.json for details 135 | on json schema fields expected by this script. 136 | """ 137 | 138 | def __init__( 139 | self, 140 | debug=False, 141 | parent_basetype=None, 142 | required=False, 143 | start_property="sections", 144 | ): 145 | """ 146 | Args: 147 | debug (bool): Enables verbose printing of schema and properties in each iteration. Default is False. 148 | parent_basetype (string): Base type of XML schema, which is referred to by all child properties 149 | required (bool): Populate only "required" properties of the json schema in the XML. Default is False. 150 | start_property (string): Change root element of the json schema, so XML will only be a subset. This should 151 | be defined in the "properties" field 152 | """ 153 | self.typemap = { 154 | "integer": "Edm.Int64", 155 | "uint64": "Edm.Int64", 156 | "string": "Edm.String", 157 | "boolean": "Edm.Boolean", 158 | } 159 | self.debug = debug 160 | # add a parent_basetype to instruct code to always 161 | # use this as the inferred base data type. Else, 162 | # the base data type for each property will be its immediate parent 163 | self.parent_basetype = parent_basetype 164 | self.required = required 165 | self.start_property = start_property 166 | self.error_status_present = False 167 | # Resolves $id and property duplications 168 | self.skip_idprop = [ 169 | "GenericProcessor", 170 | "Ia32X64Processor", 171 | "ArmProcessor", 172 | "Memory", 173 | "Memory2", 174 | "Pcie", 175 | "PciBus", 176 | "PciComponent", 177 | "Firmware", 178 | "GenericDmar", 179 | "VtdDmar", 180 | "IommuDmar", 181 | "CcixPer", 182 | "CxlProtocol", 183 | "CxlComponent", 184 | "Nvidia", 185 | "Ampere", 186 | "Unknown", 187 | "CacheError", 188 | "TlbError", 189 | "BusError", 190 | ] 191 | # Skips properties from being added to XML 192 | self.skip_props = [] 193 | 194 | def jsonschema_to_xml(self, schema, basetype, baseid, prevproperty=""): 195 | """ 196 | Replace all references of $ref with actual json file contents 197 | Args: 198 | schema (string): Original json schema file as a string 199 | basetype (string): Parent data type of property. Use same as parent_basetype if the entire json schema is being used. 200 | baseid (string): Reference to closest ancestor $id property. This is used to provide unique namespaces to repeatable properties. 201 | Returns: 202 | result (string): XML schema for CPER output 203 | """ 204 | if self.debug: 205 | print("\n\n\n\n") 206 | print(json.dumps(schema, indent=1)) 207 | if isinstance(schema, dict): 208 | req = schema.get("required") 209 | if req is not None: 210 | assert isinstance(req, list), "request field is not a list" 211 | if (baseid + basetype).lower() == "errorstatuserrortype": 212 | if not self.error_status_present: 213 | self.error_status_present = True 214 | else: 215 | return ("", "") 216 | 217 | props = schema.get("properties") 218 | 219 | if not props: 220 | print( 221 | "'Required' field was found. 'Properties' field not found for: \n", 222 | schema, 223 | ) 224 | return 1 225 | 226 | id = schema.get("$id") 227 | if id and ("namevaluepair" not in id): 228 | basetype = self.format_propname(id) 229 | if basetype in self.skip_idprop: 230 | k = list(schema["properties"].keys())[0] 231 | return ( 232 | self.jsonschema_to_xml( 233 | schema["properties"][k], 234 | basetype, 235 | baseid, 236 | prevproperty, 237 | )[0], 238 | basetype, 239 | ) 240 | 241 | start, end = self.encode_xml(baseid, basetype, "base") 242 | property_xml = start 243 | 244 | # We need a way to return baseid to the parent property when the baseids 245 | # are encapsulated in a list, like in oneOf[] 246 | ret_id = None 247 | if id: 248 | baseid = self.format_propname(id) 249 | ret_id = baseid 250 | self.id = id 251 | 252 | if "validationbits" in basetype.lower(): 253 | baseid += prevproperty 254 | 255 | xml_ret = "" 256 | if basetype in self.skip_idprop: 257 | baseid += basetype 258 | for prop, propval in props.items(): 259 | if self.required and (prop not in req): 260 | continue 261 | if self.debug: 262 | print(prop) 263 | # Get each property 264 | if prop.lower() == "validationbits": 265 | baseid += basetype 266 | subschema = propval 267 | if (baseid + prop).lower() in self.skip_props: 268 | property_xml += self.handle_errorinfo(baseid, basetype) 269 | else: 270 | property_xml += self.encode_xml( 271 | baseid, 272 | prop, 273 | "property", 274 | type=subschema["type"], 275 | basetype=basetype, 276 | ) 277 | xml_ret += self.jsonschema_to_xml( 278 | propval, prop, baseid, prevproperty=basetype 279 | )[0] 280 | 281 | property_xml += end 282 | xml_ret += property_xml 283 | if self.debug: 284 | print(xml_ret) 285 | 286 | return (xml_ret, ret_id) 287 | 288 | else: 289 | if schema.get("oneOf"): 290 | return self.jsonschema_to_xml( 291 | schema["oneOf"], basetype, baseid, prevproperty 292 | ) 293 | elif schema.get("items"): 294 | return self.jsonschema_to_xml( 295 | schema["items"], basetype, baseid, prevproperty 296 | ) 297 | else: 298 | return ("", None) 299 | 300 | elif isinstance(schema, list): 301 | property_xml = "" 302 | properties_oneof = [] 303 | for i, item in enumerate(schema): 304 | xml, ret_id = self.jsonschema_to_xml( 305 | item, basetype, baseid, "" 306 | ) 307 | property_xml += xml 308 | if ret_id: 309 | properties_oneof.append(ret_id) 310 | else: 311 | idstr = ( 312 | "cper-json-" 313 | + baseid.lower() 314 | + "-" 315 | + basetype.lower() 316 | + str(i) 317 | ) 318 | print('"$id": "' + idstr + '",') 319 | 320 | # This works only if $id is defined for every oneof[] 321 | if len(properties_oneof): 322 | xml, end = self.encode_xml(baseid, basetype, "base") 323 | for prop in properties_oneof: 324 | xml += self.encode_xml( 325 | baseid, 326 | prop, 327 | "property", 328 | "object", 329 | basetype=basetype, 330 | ) 331 | 332 | xml += end 333 | return (property_xml + xml, None) 334 | 335 | def schema_parser(self, schema, basetype="NvidiaCPER", baseid=""): 336 | """ 337 | Wrapper around jsonschema_to_xml 338 | Args: 339 | header (string): XML header to be appended to output 340 | footer (string): XML footer to be appended to output 341 | schema (string): Original json schema file as a string 342 | basetype (string): Parent data type of property. Use same as parent_basetype if the entire json schema is being used. 343 | baseid (string): Reference to closest ancestor $id property. This is used to provide unique namespaces to repeatable properties. 344 | User should leave this empty. 345 | Returns: 346 | result (string): XML schema for CPER output 347 | """ 348 | xml_out = HEADER 349 | start_property = self.start_property 350 | while not schema.get(start_property): 351 | if schema.get("oneOf"): 352 | schema = schema["oneOf"][0] 353 | continue 354 | elif schema.get("required"): 355 | if start_property in schema["required"]: 356 | schema = schema["properties"] 357 | continue 358 | else: 359 | print("ERROR could not find ", start_property) 360 | return 361 | schema = schema[start_property] 362 | base_schema = schema 363 | xml_out += self.jsonschema_to_xml( 364 | base_schema, basetype=basetype, baseid=baseid 365 | )[0] 366 | xml_out += FOOTER 367 | 368 | return xml_out 369 | 370 | def get_schema_file(self, filename): 371 | with open(filename, "r") as schema_file: 372 | schema = json.load(schema_file) 373 | return schema 374 | 375 | def format_propname(self, name): 376 | """ 377 | Change how property names are displayed 378 | Args: 379 | name (string): Property name 380 | Returns: 381 | result (string): Formatted name 382 | """ 383 | names_l = name.split("-") 384 | # For CPER schemas, name is of the format 385 | # cper-json-error-status or cper-json-firmware-section 386 | ret = "" 387 | for n in names_l[2:]: 388 | if n == "section": 389 | continue 390 | ret += n.title() 391 | 392 | # These need to be handled differently 393 | # to match output spec 394 | if ret == "Cacheerror": 395 | return "CacheError" 396 | if ret == "Tlberror": 397 | return "TlbError" 398 | if ret == "Buserror": 399 | return "BusError" 400 | return ret 401 | 402 | def handle_errorinfo(self, baseid, basetype): 403 | xml = "" 404 | xml += self.encode_xml( 405 | baseid, 406 | "CacheError", 407 | "property", 408 | "object", 409 | basetype=basetype, 410 | ) 411 | xml += self.encode_xml( 412 | baseid, "TlbError", "property", "object", basetype=basetype 413 | ) 414 | return xml 415 | 416 | def encode_xml(self, baseid, val, ele, type=None, basetype=None): 417 | """ 418 | Format XML output 419 | Args: 420 | baseid (string): Reference to closest ancestor $id property. This is used to provide unique namespaces to repeatable properties. 421 | User should leave this empty. 422 | val (string): Property or Entity name 423 | ele (string): 'base' for Entity, 'property' for Property 424 | type (string): Used for converting json type to XML type 425 | basetype (string): Parent data type of property. 426 | 427 | Returns: 428 | result (string): XML schema for CPER output 429 | """ 430 | # val = self.format_propname(val) 431 | entity_name = baseid + val[0].upper() + val[1:] 432 | prop_name = val[0].upper() + val[1:] 433 | prop_type = baseid + val[0].upper() + val[1:] 434 | if ele == "base": 435 | return ( 436 | '\n \n', 437 | " \n", 438 | ) 439 | elif ele == "property": 440 | if self.parent_basetype: 441 | basetype = self.parent_basetype 442 | else: 443 | basetype = basetype[0].upper() + basetype[1:] 444 | if type == "object" or type == "array": 445 | if type == "array": 446 | return ( 447 | ' \n' 454 | ) 455 | return ( 456 | ' \n' 463 | ) 464 | else: 465 | return ( 466 | ' \n' 471 | ) 472 | else: 473 | print("wrong value for XML element: ", ele) 474 | 475 | def append_to_xml(self, xml, arg): 476 | return xml + arg 477 | 478 | def validate_xml(self, xmlf): 479 | print("Validating XML") 480 | entity_names = [] 481 | with open(xmlf, "r") as f: 482 | for line in f: 483 | if "ComplexType Name" in line: 484 | name = line.strip().split("=")[1] 485 | if name in entity_names: 486 | print("Duplicate: ", name) 487 | else: 488 | entity_names.append(name) 489 | 490 | 491 | def main(): 492 | parser = argparse.ArgumentParser( 493 | prog="JsonSchemaToXML", 494 | description="Create a master json schema by replacing refs, modify json properties, and convert it to XML.", 495 | epilog="Refer to examples/json_schema.json for json schema parameters expected by this program.", 496 | ) 497 | 498 | subparsers = parser.add_subparsers(dest="subparser_name", required=True) 499 | 500 | parser_a = subparsers.add_parser( 501 | "json_master", 502 | help="Select this option to convert an assortment of json schemas into a single schema by using the $ref variable.", 503 | ) 504 | parser_b = subparsers.add_parser( 505 | "json_to_xml", 506 | help="Create an XML schema out of a json schema (containing no $ref)", 507 | ) 508 | 509 | parser_c = subparsers.add_parser( 510 | "convert", 511 | help="Create an XML schema out of a json schema (might contain $ref)", 512 | ) 513 | 514 | parser_a.add_argument("-v", "--verbose", action="store_true") 515 | parser_a.add_argument( 516 | "-s", 517 | "--schema", 518 | nargs=1, 519 | help="Input json schema", 520 | required=True, 521 | ) 522 | 523 | parser_c.add_argument("-v", "--verbose", action="store_true") 524 | parser_c.add_argument( 525 | "-s", 526 | "--schema", 527 | nargs=1, 528 | help="Input json schema", 529 | required=True, 530 | ) 531 | 532 | parser_a.add_argument( 533 | "-d", 534 | "--schemadir", 535 | nargs=1, 536 | help="Root location of json schema directory", 537 | required=True, 538 | ) 539 | 540 | parser_c.add_argument( 541 | "-d", 542 | "--schemadir", 543 | nargs=1, 544 | help="Root location of json schema directory", 545 | required=True, 546 | ) 547 | 548 | parser_b.add_argument("-v", "--verbose", action="store_true") 549 | parser_b.add_argument( 550 | "-s", 551 | "--schema", 552 | nargs=1, 553 | help="Input json schema", 554 | required=True, 555 | ) 556 | parser_b.add_argument( 557 | "-p", 558 | "--parent-basetype", 559 | nargs=1, 560 | help="Basetype for all elements to inherit", 561 | ) 562 | 563 | parser_b.add_argument( 564 | "-a", 565 | "--argstart", 566 | nargs=1, 567 | help="Property of json schema to start parsing from", 568 | ) 569 | 570 | parser_c.add_argument( 571 | "-a", 572 | "--argstart", 573 | nargs=1, 574 | help="Property of json schema to start parsing from", 575 | ) 576 | 577 | parser_c.add_argument( 578 | "-p", 579 | "--parent-basetype", 580 | nargs=1, 581 | help="Basetype for all elements to inherit", 582 | ) 583 | 584 | parser_b.add_argument("-x", "--header", nargs=1, help="XML header") 585 | parser_b.add_argument("-f", "--footer", nargs=1, help="XML footer") 586 | parser_b.add_argument( 587 | "-r", 588 | "--required", 589 | help="Only consider required fields", 590 | action="store_true", 591 | ) 592 | parser_b.add_argument( 593 | "-z", "--validate", help="Validate XML", action="store_true" 594 | ) 595 | parser_c.add_argument( 596 | "-z", "--validate", help="Validate XML", action="store_true" 597 | ) 598 | parser_c.add_argument( 599 | "-r", 600 | "--required", 601 | help="Only consider required fields", 602 | action="store_true", 603 | ) 604 | 605 | args = parser.parse_args() 606 | 607 | if args.subparser_name == "json_master": 608 | print("Creating master json") 609 | # Master JSON Schema creation 610 | schema_directory = args.schemadir[0] 611 | 612 | schema = SchemaGenerator(schema_directory, args.schema[0]) 613 | 614 | base = schema.base_schema 615 | master_schema = schema.replace_refs(base) 616 | 617 | output = "master-schema.json" 618 | print("Output filename: ", output) 619 | with open(output, "w") as f: 620 | print(json.dumps(master_schema, indent=1), file=f) 621 | # json.dump(master_schema, f) 622 | 623 | elif args.subparser_name == "json_to_xml": 624 | print("Creating json-schema -> xml") 625 | 626 | if args.header: 627 | header = args.header[0] 628 | else: 629 | header = "" 630 | 631 | if args.footer: 632 | footer = args.footer[0] 633 | else: 634 | footer = "" 635 | 636 | if args.parent_basetype: 637 | parent_basetype = args.parent_basetype[0] 638 | else: 639 | parent_basetype = "NvidiaCPER." + version 640 | 641 | if args.argstart: 642 | argstart = args.argstart[0] 643 | else: 644 | argstart = "sections" 645 | 646 | print("header is: ", header) 647 | print("footer is: ", footer) 648 | print("parent_basetype is: ", parent_basetype) 649 | print("required is: ", args.required) 650 | 651 | # #JSON to XML conversion 652 | xml_obj = JsontoXml( 653 | debug=args.verbose, 654 | parent_basetype=parent_basetype, 655 | required=args.required, 656 | start_property=argstart, 657 | ) 658 | 659 | # logfile='cper-json-full-log.json' 660 | # masterfile = 'master-schema.json' 661 | if args.validate: 662 | xml_obj.validate_xml(args.schema[0]) 663 | exit(0) 664 | 665 | schema = xml_obj.get_schema_file(args.schema[0]) 666 | output = xml_obj.schema_parser(schema) 667 | 668 | out_file = "master-schema.xml" 669 | print("Output filename: ", out_file) 670 | with open(out_file, "w") as f: 671 | print(output, file=f) 672 | 673 | elif args.subparser_name == "convert": 674 | print("Creating master json") 675 | # Master JSON Schema creation 676 | json_schema_directory = args.schemadir[0] 677 | 678 | schema = SchemaGenerator(json_schema_directory, args.schema[0]) 679 | 680 | base = schema.base_schema 681 | master_schema = schema.replace_refs(base) 682 | 683 | print("Creating json-schema -> xml") 684 | 685 | if args.parent_basetype: 686 | parent_basetype = args.parent_basetype[0] 687 | else: 688 | parent_basetype = "NvidiaCPER." + version 689 | 690 | if args.argstart: 691 | argstart = args.argstart[0] 692 | else: 693 | argstart = "sections" 694 | 695 | print("parent_basetype is: ", parent_basetype) 696 | print("required is: ", args.required) 697 | 698 | # #JSON to XML conversion 699 | xml_obj = JsontoXml( 700 | debug=args.verbose, 701 | parent_basetype=parent_basetype, 702 | required=args.required, 703 | start_property=argstart, 704 | ) 705 | 706 | output = xml_obj.schema_parser(master_schema) 707 | 708 | out_file = "NvidiaCPER_v1.xml" 709 | print("Saving output to NvidiaCPER_v1.xml") 710 | print("Output filename: ", out_file) 711 | with open(out_file, "w") as f: 712 | print(output, file=f) 713 | 714 | if args.validate: 715 | xml_obj.validate_xml(out_file) 716 | exit(0) 717 | 718 | else: 719 | exit(1) 720 | 721 | 722 | if __name__ == "__main__": 723 | main() 724 | -------------------------------------------------------------------------------- /schema-gen/NvidiaCPER_v1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | 951 | 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | 1027 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | 1034 | 1035 | 1036 | 1037 | 1038 | 1039 | 1040 | 1041 | 1042 | 1043 | 1044 | 1045 | 1046 | 1047 | 1048 | 1049 | 1050 | 1051 | 1052 | 1053 | 1054 | 1055 | 1056 | 1057 | 1058 | 1059 | 1060 | 1061 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1089 | 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1099 | 1100 | 1101 | 1102 | 1103 | 1104 | 1105 | 1106 | 1107 | 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | 1127 | 1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | 1146 | 1147 | 1148 | 1149 | 1150 | 1151 | 1152 | 1153 | 1154 | 1155 | 1156 | 1157 | 1158 | 1159 | 1160 | 1161 | 1162 | 1163 | 1164 | 1165 | 1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | 1174 | 1175 | 1176 | 1177 | 1178 | 1179 | 1180 | 1181 | 1182 | 1183 | 1184 | 1185 | 1186 | 1187 | 1188 | 1189 | 1190 | 1191 | 1192 | 1193 | 1194 | 1195 | 1196 | 1197 | 1198 | 1199 | 1200 | 1201 | 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 | 1209 | 1210 | 1211 | 1212 | 1213 | 1214 | 1215 | 1216 | 1217 | 1218 | 1219 | 1220 | 1221 | 1222 | 1223 | 1224 | 1225 | 1226 | 1227 | 1228 | 1229 | 1230 | 1231 | 1232 | 1233 | 1234 | 1235 | 1236 | 1237 | 1238 | 1239 | 1240 | 1241 | 1242 | 1243 | 1244 | 1245 | 1246 | 1247 | 1248 | 1249 | 1250 | 1251 | 1252 | 1253 | 1254 | 1255 | 1256 | 1257 | 1258 | 1259 | 1260 | 1261 | 1262 | 1263 | 1264 | 1265 | 1266 | 1267 | 1268 | 1269 | 1270 | 1271 | 1272 | 1273 | 1274 | 1275 | 1276 | 1277 | 1278 | 1279 | 1280 | 1281 | 1282 | 1283 | 1284 | 1285 | 1286 | 1287 | 1288 | 1289 | 1290 | 1291 | 1292 | 1293 | 1294 | 1295 | 1296 | 1297 | 1298 | 1299 | 1300 | 1301 | 1302 | 1303 | 1304 | 1305 | 1306 | 1307 | 1308 | 1309 | 1310 | 1311 | 1312 | 1313 | 1314 | 1315 | 1316 | 1317 | 1318 | 1319 | 1320 | 1321 | 1322 | 1323 | 1324 | 1325 | 1326 | 1327 | 1328 | 1329 | 1330 | 1331 | 1332 | 1333 | 1334 | 1335 | 1336 | 1337 | 1338 | 1339 | 1340 | 1341 | 1342 | 1343 | 1344 | 1345 | 1346 | 1347 | 1348 | 1349 | 1350 | 1351 | 1352 | 1353 | 1354 | 1355 | 1356 | 1357 | 1358 | 1359 | 1360 | 1361 | 1362 | 1363 | 1364 | 1365 | 1366 | 1367 | 1368 | --------------------------------------------------------------------------------