summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files')
-rwxr-xr-xmeta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_image.py22
-rw-r--r--meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_manifest.json16
2 files changed, 20 insertions, 18 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_image.py b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_image.py
index 5cda38b79..c2c18247d 100755
--- a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_image.py
+++ b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_image.py
@@ -1,4 +1,4 @@
-#/usr/bin/env python3
+#!/usr/bin/env python3
# coding: utf-8
# our image is contained as parts, including the hash
# then it gets zipped up and signed again
@@ -46,7 +46,7 @@ PFM_SPI = 0x1
PFM_I2C = 0x2
SHA256 = 0x1
SHA256_SIZE = 32
-PFM_DEF_SIZE = 16
+PFM_DEF_SIZE = 32 # 32 bytes of PFM header
PFM_SPI_SIZE_DEF = 16 # 16 bytes of SPI PFM
PFM_SPI_SIZE_HASH = 32 # 32 bytes of SPI region HASH
PFM_I2C_SIZE = 40 # 40 bytes of i2c rules region in PFM
@@ -102,7 +102,6 @@ class pfr_bmc_image(object):
for p in self.manifest['image-parts']:
# the json should have in the order- filename, index, offset, size and protection byte
self.image_parts.append((p['name'], p['index'], p['offset'], p['size'], p['prot_mask'], p['pfm'], p['hash'], p['compress']))
- print(self.image_parts)
self.act_dgst = hashlib.sha256()
@@ -124,7 +123,6 @@ class pfr_bmc_image(object):
for i in self.manifest['i2c-rules']:
# the json should have in the order- bus-id, rule-id, address, size and cmd-whitelist
self.i2c_rules.append((i['bus-id'], i['rule-id'], i['address'], i['cmd-whitelist']))
- print(self.i2c_rules)
# I2C rules PFM array
self.pfm_i2c_rules = []
@@ -205,7 +203,7 @@ class pfr_bmc_image(object):
if pfm_flag == 1:
self.pfm_bytes += PFM_SPI_SIZE_DEF
- hash = b'\x00' * 32
+ hash = bytearray(32)
hash_pres = 0
if hash_flag == 1:
@@ -232,7 +230,7 @@ class pfr_bmc_image(object):
whitelist_map[i] = 0xff
break
else:
- idx = int(c,16) / 8 # index in the 32 bytes of white list i2c cmds
+ idx = int(c,16) // 8 # index in the 32 bytes of white list i2c cmds
bit = int(c,16) % 8 # bit position to set
whitelist_map[idx] |= (1 << bit)
@@ -241,7 +239,6 @@ class pfr_bmc_image(object):
def build_i2c_rules(self):
for i in self.i2c_rules:
- print(i[0], i[1], i[2], i[3])
self.add_i2c_rules(i)
def hash_and_map(self):
@@ -327,10 +324,15 @@ class pfr_bmc_image(object):
}
# PFM should be 128bytes aligned, find the padding bytes
- padding_bytes = 128 - (self.pfm_bytes % 128)
+ padding_bytes = 0
+ if (self.pfm_bytes % 128) != 0:
+ padding_bytes = 128 - (self.pfm_bytes % 128)
+
+ print("padding={}".format(padding_bytes))
+ print("PFM size1={}".format(self.pfm_bytes))
self.pfm_bytes += padding_bytes
parts['pfm_len'] = struct.pack('<I', self.pfm_bytes)
- print("PFM size={}".format(self.pfm_bytes))
+ print("PFM size2={}".format(self.pfm_bytes))
with open("pfm.bin", "wb+") as f:
f.write(b''.join([parts[n] for n in names]))
@@ -343,7 +345,7 @@ class pfr_bmc_image(object):
f.write(struct.pack('<I', int(i.spi_end_addr)))
if i.spi_hash_pres == 1:
- f.write(i.spi_hash.decode('hex'))
+ f.write(bytearray.fromhex(i.spi_hash))
for r in self.pfm_i2c_rules:
f.write(struct.pack('<B', int(r.i2c_pfm)))
diff --git a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_manifest.json b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_manifest.json
index adea41eab..c9f7d0746 100644
--- a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_manifest.json
+++ b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/files/pfr_manifest.json
@@ -81,24 +81,24 @@
}
],
"i2c-rules": [{
- "bus-id": 5,
- "rule-id": 1,
+ "bus-id": 3,
+ "rule-id": 3,
"address": "0xD0",
"cmd-whitelist": ["0x00", "0x01", "0x02", "0x03", "0x04", "0x09", "0x0A", "0x0B", "0x0C", "0x0D", "0x0E", "0x0F",
"0x10", "0x13", "0x17", "0x1B", "0x1C", "0x1D", "0x02", "0x021", "0x22", "0x23", "0x25", "0x30",
"0x31", "0x32", "0x33", "0x035", "0x36", "0x37", "0x38", "0x39", "0x3A", "0x3B", "0x3C", "0x3D"]
},
{
- "bus-id": 5,
- "rule-id": 2,
- "address": "0xD6",
+ "bus-id": 3,
+ "rule-id": 4,
+ "address": "0xD8",
"cmd-whitelist": ["0x00", "0x01", "0x02", "0x03", "0x04", "0x09", "0x0A", "0x0B", "0x0C", "0x0D", "0x0E", "0x0F",
"0x10", "0x13", "0x17", "0x1B", "0x1C", "0x1D", "0x02", "0x021", "0x22", "0x23", "0x25", "0x30",
"0x31", "0x32", "0x33", "0x035", "0x36", "0x37", "0x38", "0x39", "0x3A", "0x3B", "0x3C", "0x3D"]
},
{
- "bus-id": 8,
- "rule-id": 3,
+ "bus-id": 1,
+ "rule-id": 6,
"address": "0xB0",
"cmd-whitelist": ["0x03", "0x05", "0x06", "0x19", "0x1A", "0x30", "0x3A", "0x3B", "0x3C", "0x3D", "0x3E", "0x3F",
"0x79", "0x7A", "0x7B", "0x7C", "0x7D", "0x7E", "0x7F", "0x81", "0x82", "0x86", "0x87", "0x88",
@@ -107,7 +107,7 @@
"0xD9", "0xDC", "0xDD", "0xDE", "0xDE"]
},
{
- "bus-id": 8,
+ "bus-id": 1,
"rule-id": 4,
"address": "0xB2",
"cmd-whitelist": ["0x03", "0x05", "0x06", "0x19", "0x1A", "0x30", "0x3A", "0x3B", "0x3C", "0x3D", "0x3E", "0x3F",