Merge pull request #77 from mihaip/upstream-machineid

machinepdm: fix machine ID
This commit is contained in:
dingusdev 2024-01-03 07:44:38 -07:00 committed by GitHub
commit 79ee8543f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -27,6 +27,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <devices/ioctrl/macio.h>
#include <cinttypes>
#include <loguru.hpp>
#include <string>
/**
@ -58,7 +59,14 @@ public:
~NubusMacID() = default;
uint32_t read(uint32_t rgn_start, uint32_t offset, int size) {
return (offset < 4 ? this->id[offset] : 0);
if (size == 4 && offset == 0) {
return *(uint32_t*)this->id;
}
if (size == 1 && offset < 4) {
return this->id[offset];
}
ABORT_F("NubusMacID: invalid read size %d, offset %d!", size, offset);
return 0;
};
/* not writable */

View File

@ -50,7 +50,7 @@ int initialize_pdm(std::string& id)
HMC* hmc_obj = dynamic_cast<HMC*>(gMachineObj->get_comp_by_name("HMC"));
if (id == "pm6100") {
machine_id = 0x3010;
machine_id = 0x3011;
} else if (id == "pm7100") {
machine_id = 0x3012;
} else if (id == "pm8100") {