Search code examples
cpu-registersuefi

efi shell command and register R/W


I got a basic question of efi mm command. I need to control a controller (MAC) inside a SOC, and let it generate MDIO traffic to external PHY chip, to read its ID. The instruction told me to do the following under efi shell

Shell> mm xxxxxxx yyyyyyy -w 4 -MEM -n

Shell> mm xxxxxxx -w 4 -MEM -n

I'm wondering what's the mm command do? Looks like it write to xxxxxx register the yyyyyy data, and then "mm" this register again? Not sure why.

Can anyone help me on this?


Solution

  • The mm command is explained in the UEFI Shell Specification:

    mm address [value] [-w 1|2|4|8] [-MEM | -PMEM | -MMIO | -IO | -PCI | -PCIE] [- n]

    The description states "If value is specified, which should be typed in hex format, this command will write this value to specified address. Otherwise when this command is executed, the current contents of address are displayed.".

    So your first command writes the 32-bit value yyyyyyy to address xxxxxxx, and the second command reads a 32-bit value from address xxxxxxx - presumably to verify that the write took effect.