Repository navigation
[patina::pi::hob] Adjust hob misc design - #1752
yangrongwei wants to merge 1 commit into
Conversation
⌛ QEMU Validation PendingQEMU validation is pending on successful CI completion.
This comment was automatically generated by the Patina QEMU PR Validation workflow. |
|
Original bug, #1748 |
| /// - MEMORY_POOL | ||
| /// - UNUSED | ||
| /// - LOAD_PEIM_UNUSED | ||
| Misc(&'a GenericHob), |
There was a problem hiding this comment.
There may have been conversation around this, so let me know if so, but If I'm understanding correctly, the Misc hob is incredibly close to the GuidHob. Due to this, I'm not a fan of the fact that we just give the user the header, and it is up to the caller to unsafe-ly extract any bytes after the header if the length exceeds the length of a header. I also don't think we should be using GenericHob. In my opinion it should just be a HobHeader.
I personally think it makes more sense for this enum variable to be below, where our code takes on the burden of extracting the bytes after the header:
Misc(&'a Hobheader, &'a [u8])| } | ||
| END_OF_HOB_LIST => return None, | ||
| hob_type => Hob::Misc(hob_type), | ||
| MEMORY_POOL | LOAD_PEIM_UNUSED | UNUSED => { |
There was a problem hiding this comment.
Here we would do something similar to GUID_EXTENSION and call the slice::from_raw_parts(data_ptr, data_len for the user.
| /// | ||
| #[repr(C)] | ||
| #[derive(Debug)] | ||
| pub struct GenericHob { |
There was a problem hiding this comment.
I don't see a need for GenericHob. It feels like we should just use the HobHeader directly - via the usage I described above.
5e18cfd to
ba08e3e
Compare
ba08e3e to
e8e79d5
Compare
Description
Refactor the
Hob::Miscdesign.Introduce
hob::GenericHobto hold the HOB generic header forHob::Misc.Per the PI spec, HOB is an open design, and all HOBs share a common header. Binding to a generic header is more intuitive than using a heterogeneous integer representation.
Bug Fix:
Introduce
hob::EndOfHobListfor unit tests, this is the correct struct for end-of-hob per PI Spec.Correct related unit tests to use
hob::EndOfHobListCode Enhancement:
Add
align(8)forhob::HobHeader. This is optional for consumers, but following PI Spec is not a bad choice.How This Was Tested
Pass
cargo make testIntegration Instructions
N/A