[PATCH 4/5] discover/platform-powerpc: add mailbox message structure

Geoff Levand geoff at infradead.org
Sat Jun 29 01:30:15 AEST 2019


Hi Maxim,

On 6/26/19 5:37 AM, Maxim Polyakov wrote:
> Use structure for the IPMI response mailbox message instead of raw byte
> array as its done in the ipmitool utility:
> https://github.com/ipmitool/ipmitool/commit/62a04390e10f8e62ce16b7bc95bf6ced419b80eb
> 
> Signed-off-by: Maxim Polyakov <m.polyakov at yadro.com>
> ---
>  discover/platform-powerpc.c | 83 ++++++++++++++++++++++++++++-----------------
>  1 file changed, 52 insertions(+), 31 deletions(-)
> 
> diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c
> index c874560..6500058 100644
> --- a/discover/platform-powerpc.c
> +++ b/discover/platform-powerpc.c
> @@ -22,6 +22,29 @@
>  #include "ipmi.h"
>  #include "dt.h"
>  
> +#define CHASSIS_BOOT_MBOX_IANA_SZ 3
> +#define CHASSIS_BOOT_MBOX_DATA_SZ 16
> +#define CHASSIS_BOOT_MBOX_BLOCK0_DATA_SZ \
> +	(CHASSIS_BOOT_MBOX_DATA_SZ - CHASSIS_BOOT_MBOX_IANA_SZ)
> +
> +typedef struct __attribute__((packed)) {
> +	uint8_t iana[CHASSIS_BOOT_MBOX_IANA_SZ];
> +	uint8_t data[CHASSIS_BOOT_MBOX_BLOCK0_DATA_SZ];
> +} mbox_block0_t;
> +
> +typedef union {
> +		uint8_t data[CHASSIS_BOOT_MBOX_DATA_SZ];
> +		mbox_block0_t b0;
> +} mbox_t;
> +
> +typedef struct __attribute__((packed)) {
> +	uint8_t cc;
> +	uint8_t param_version;
> +	uint8_t param_valid;
> +	uint8_t block_selector;
> +	mbox_t mbox;
> +} ipmi_mbox_response_t;
> +

It seems these definitions are not specific to powerpc.  Should
they go in discover/ipmi.h?

I think in general a lot of the ipmi code in platform-powerpc.c
can me moved out to ipmi.c or some other generic file.

-Geoff


More information about the Petitboot mailing list