fiano icon indicating copy to clipboard operation
fiano copied to clipboard

pkg/amd/firmware: Wrap PSP and BIOS directories in arrays

Open orangecms opened this issue 3 years ago • 6 comments

This allows for returning multiple directories. Up until now, only the first directories would be returned, while many firmware images contain multiple directories for various SoC families and models, e.g., for desktop boards where SoCs can be swapped.

Signed-off-by: Daniel Maslowski [email protected]

orangecms avatar Mar 02 '22 20:03 orangecms

Codecov Report

Merging #367 (f581bcd) into master (64c18ae) will decrease coverage by 0.02%. The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #367      +/-   ##
==========================================
- Coverage   41.74%   41.72%   -0.03%     
==========================================
  Files         110      110              
  Lines        7649     7653       +4     
==========================================
  Hits         3193     3193              
- Misses       3877     3881       +4     
  Partials      579      579              
Impacted Files Coverage Δ
pkg/amd/manifest/firmware.go 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 64c18ae...f581bcd. Read the comment docs.

codecov-commenter avatar Mar 02 '22 20:03 codecov-commenter

A slice doesn't provide information about the origin of the element. It is unclear what element should I use, if I end up having multiple.

rihter007 avatar Mar 04 '22 17:03 rihter007

A slice doesn't provide information about the origin of the element. It is unclear what element should I use, if I end up having multiple.

Yea, that is also currently the problem: I don't know what I got, I only got a single directory, and I am missing the other directories. From the code I could understand that I got the first directory that is found. And it could be either from the EmbeddedFirmwareStruct or it could have been found by scanning. When the latter is the case, how would we know the processor family/model range?

To expost that information when we have it, I would suggest adding metadata to the respective directory, such as processor family / model range based on the offset. However, that is a different concern; this PR here is to enable multiple directories for a start. WDYT?

orangecms avatar Mar 04 '22 17:03 orangecms

A slice doesn't provide information about the origin of the element. It is unclear what element should I use, if I end up having multiple.

Yea, that is also currently the problem: I don't know what I got, I only got a single directory, and I am missing the other directories. From the code I could understand that I got the first directory that is found. And it could be either from the EmbeddedFirmwareStruct or it could have been found by scanning. When the latter is the case, how would we know the processor family/model range?

To expost that information when we have it, I would suggest adding metadata to the respective directory, such as processor family / model range based on the offset. However, that is a different concern; this PR here is to enable multiple directories for a start. WDYT?

Sorry, for a very long delay. There is a documentation problem, each "directory" has its own purpose. The future code should clearly specify the purpose of each directory. (which we currently can't do)

I agree that the current code assumes, that there could be no more than a single directory in firmware, which could be incorrect.

I propose to leave everything as is, but move "scanning" into a separate function

rihter007 avatar Mar 18 '22 19:03 rihter007

Okay I will create another implementation then. We discussed this in the Fiano sync call, and the proposal is to rework the directory structs, so that they

  • contain the range; it's currently side by side, though belongs to the dir
  • get a source field; can be "scan", "efs". "xxxdir", depending on whether it resulted from seeking or from following references via EFS or possibly a level 1 directory (called pointers here in the code; "xxxdir" would need be more precise of course such as "fam-17h_model-00h-0fh_biosdir" or something)

orangecms avatar Mar 21 '22 08:03 orangecms