Implemented api.platform.config.switch.0.bootCfg.customMac.% MAC address
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
DataHoarder 2020-12-27 02:33:47 +01:00
parent 082ef5bdf3
commit 92ffa24779

View file

@ -138,19 +138,20 @@ patchImage(const std::string &originalImage, const std::string &settingsFile, co
// ==@0x1000 LOAD 9x2 api.platform.config.switch.0.bootCfg.pep.%.serialNumber @ 0x120053/0x120054 + 0x100028/0x100029 BSM_SCRATCH[0x141]-BSM_SCRATCH[0x142] PCIE_CFG_SPD_NUMBER_L SerialNumber and PCIE_SM_AREA.SerialNumber
//
// @0x1054 LOAD 8 entries api.platform.config.switch.0.bootCfg.customMac.0-4
// ==@0x1054 LOAD 8 entries api.platform.config.switch.0.bootCfg.customMac.0-3
//
// 0x1408 LOAD 1 = 0x0 ???? BSM_SCRATCH[0x150] IF 1: JUMP 0x0814c8 ELSE: INIT DATA? call SBUS_PCIE_REQUEST
//
// 0x8000 LOAD PEP0 device config Vital Product Data BSM_SCRATCH[0x1f4]
// 0x81c7 LOAD PEP1 device config Vital Product Data BSM_SCRATCH[0x226]
// 0x838e LOAD PEP2 device config Vital Product Data BSM_SCRATCH[0x258]
// 0x8555 LOAD PEP3 device config Vital Product Data BSM_SCRATCH[0x28a]
// 0x871c LOAD PEP4 device config Vital Product Data BSM_SCRATCH[0x2bc]
// 0x88e3 LOAD PEP5 device config Vital Product Data BSM_SCRATCH[0x2ee]
// 0x8aaa LOAD PEP6 device config Vital Product Data BSM_SCRATCH[0x320]
// 0x8c71 LOAD PEP7 device config Vital Product Data BSM_SCRATCH[0x352]
// 0x8e38 LOAD PEP8 device config Vital Product Data BSM_SCRATCH[0x384]
// these are written at ~000857d8
// 0x8000 LOAD PEP0 device config Vital Product Data PCIE_CFG_VPD_DATA BSM_SCRATCH[0x1f4]
// 0x81c7 LOAD PEP1 device config Vital Product Data PCIE_CFG_VPD_DATA BSM_SCRATCH[0x226]
// 0x838e LOAD PEP2 device config Vital Product Data PCIE_CFG_VPD_DATA BSM_SCRATCH[0x258]
// 0x8555 LOAD PEP3 device config Vital Product Data PCIE_CFG_VPD_DATA BSM_SCRATCH[0x28a]
// 0x871c LOAD PEP4 device config Vital Product Data PCIE_CFG_VPD_DATA BSM_SCRATCH[0x2bc]
// 0x88e3 LOAD PEP5 device config Vital Product Data PCIE_CFG_VPD_DATA BSM_SCRATCH[0x2ee]
// 0x8aaa LOAD PEP6 device config Vital Product Data PCIE_CFG_VPD_DATA BSM_SCRATCH[0x320]
// 0x8c71 LOAD PEP7 device config Vital Product Data PCIE_CFG_VPD_DATA BSM_SCRATCH[0x352]
// 0x8e38 LOAD PEP8 device config Vital Product Data PCIE_CFG_VPD_DATA BSM_SCRATCH[0x384]
//
// ==0x9000 LOAD 1 api.platform.config.switch.0.bootCfg.systimeClockSource
// ==0x9010 LOAD 1 api.platform.config.switch.0.bootCfg.pep.0.mode
@ -266,6 +267,32 @@ patchImage(const std::string &originalImage, const std::string &settingsFile, co
}
}
{
auto &instruction = imageObject.findInstructionByAddress(0x1054);
if (instruction != nullptr &&
instruction->getCommand() == Instruction::Instruction::CommandOp::LOAD) {
auto &load = reinterpret_cast<std::unique_ptr<Instruction::Load> &>(instruction);
if (load->address == (uint32_t) getScratchRegister(0x064) && load->data.size() == 4 * 2) {
for (uint32_t customMacOffset = 0; customMacOffset < 4; ++customMacOffset) {
std::stringstream key;
key << "api.platform.config.switch.0.bootCfg.customMac." << std::dec << customMacOffset;
auto entry = config.getEntry(key.str());
if (entry.type == Configuration::ConfigurationNode::Type::ValueText &&
!entry.value.empty()) {
auto value = entry.getEUI64ToInteger();
if(value.first == 0xFFFFFFFF && value.second == 0xFFFFFFFF){
value.first &= 0xFF000100 | customMacOffset;
value.second &= 0x000000FF;
}
load->data[customMacOffset * 2] = value.first;
load->data[customMacOffset * 2 + 1] = value.second;
}
}
}
}
}
{
for (auto baseOffset : baseOffsets) {
auto &instruction = imageObject.findInstructionByAddress(baseOffset + 0x9230);