Skip to content

Info#328

Merged
kelvin-cao merged 6 commits intodevelfrom
info
Nov 15, 2022
Merged

Info#328
kelvin-cao merged 6 commits intodevelfrom
info

Conversation

@kelvin-cao
Copy link
Collaborator

@kelvin-cao kelvin-cao commented Nov 14, 2022

Generally two fixes in this PR.

  1. In BL2 boot phase, use MRPC instead of GAS access to retrieve device id, to make command info be capable to report them correctly.
  2. Make command info's output more reasonable in BL1 boot phase by showing the boot phase in all boot phases and 'N/A' for unavailable information in BL1.

The updated output looks like below.

# sudo ./switchtec info /dev/i2c-5:0x58
/dev/i2c-5:0x58 (BL1):
    Generation:  GEN4
    HW Revision: REVB
    Variant:     N/A
    Device ID:   N/A
    FW Version:  N/A

# sudo ./switchtec mfg boot-resume /dev/i2c-5:0x58
WARNING: if your system does not support hotplug,
your device might not be immediately accessible
after a normal boot process. In this case, be sure
to reboot your system after sending this command.

Do you want to continue? [y/N] y

# sudo ./switchtec info /dev/i2c-5:0x58
/dev/i2c-5:0x58 (BL2):
    Generation:  GEN4
    HW Revision: REVB
    Variant:     PSX
    Device ID:   0x4100
    FW Version:  3.90 B059

After the setup of dev->gen and dev->var, continue with the setup of
dev->boot_phase.
Introduce a new function to get device id in BL2, as GAS regions is not
populated in this boot phase.
The info command doesn't show variant and device ID properly in BL2,
as current code get device ID from GAS which is not available in BL2.
Fallback to MRPC if device ID is not returned.
F/W version is not available in BL1. Print 'N/A' for F/W version instead
of exiting with error.
Report 'N/A' instead of '0x0000' or 'Unknown' for Device Id and Variant
which are not available in BL1. Also show boot phase to make the
reporting of 'N/A' more reasonable.
@kelvin-cao kelvin-cao requested a review from lsgunth November 14, 2022 23:35
Copy link
Collaborator

@lsgunth lsgunth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor nit I noticed. Otherwise it looks good to me.

/**
* @brief Return the phase string for a phase id.
*/
static inline const char* phase_id_to_string(enum switchtec_boot_phase phase_id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a good idea to rename this with a switchtec_prefix, or some such.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, thanks for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants