[PATCH phosphor-host-ipmid 3/3] Patch set-3 for IPMI function router

Patrick Williams patrick at stwcx.xyz
Thu Oct 8 11:43:42 AEDT 2015


On Wed, Oct 07, 2015 at 07:04:29PM -0500, OpenBMC Patches wrote:
> From: vishwabmc <vishwanath at in.ibm.com>
> ---
>  apphandler.H  |  32 ++++++++++++++++++
>  apphandler.h  |  11 ++++++

Why did we end up with a .h and a .H now?

> diff --git a/Makefile b/Makefile
>  
> +INC_FLAG += $(shell pkg-config --cflags glib-2.0 gio-unix-2.0) -I. -O2 --std=gnu++11 -D__IPMI_DEBUG__

Want to remove -D__IPMI_DEBUG__ now?

> +IPMID_PATH = -DHOST_IPMI_LIB_PATH=\"/usr/lib/host-ipmid/\" 

IPMID_PATH ?=, to allow an override by recipe.

> diff --git a/apphandler.H b/apphandler.H
> new file mode 100644
> index 0000000..fdcd66f
> --- /dev/null
> +++ b/apphandler.H
> @@ -0,0 +1,32 @@
> +#ifndef  __HOST_IPMI_APP_HANDLER_H__
> +#define __HOST_IPMI_APP_HANDLER_H__
> +
> +// These are the command network functions, the response
> +// network functions are the function + 1. So to determine
> +// the proper network function which issued the command
> +// associated with a response, subtract 1.
> +// Note: these are also shifted left to make room for the LUN.
> +enum ipmi_net_fns
> +{
> +    NETFUN_CHASSIS  =   (0x00 << 2),
> +    NETFUN_BRIDGE   =   (0x02 << 2),
> +    NETFUN_SENSOR   =   (0x04 << 2),
> +    NETFUN_APP      =   (0x06 << 2),
> +    NETFUN_FIRMWARE =   (0x08 << 2),
> +    NETFUN_STORAGE  =   (0x0a << 2),
> +    NETFUN_TRANPORT =   (0x0c << 2),
> +    NETFUN_GRPEXT   =   (0x2c << 2),
> +    NETFUN_NONE     =   (0x30 << 2)
> +};
> +
> +// TODO :: As and when we write plugin's these will go into apporpriate
> +// provider space.
> +
> +// IPMI commands for net functions.
> +enum ipmi_netfn_app_cmds
> +{
> +    // Get capability bits
> +    IPMI_CMD_GET_CAP_BIT    = 0x36,
> +};
> +
> +#endif

I think you intended to delete this file. 'git rm apphandler.H'.

> diff --git a/ipmid.C b/ipmid.C
> @@ -8,55 +8,56 @@
>      // Extract Handler and context from Map.
> -    ipmi_fn_context_t handler_and_context;
> +    //ipmi_fn_context_t handler_and_context;

Remove dead code.

> +    // Creating a pointer type casted to char* to make sure we advance 1 byte
> +    // when we advance pointer to next's address. advancing void * would not
> +    // make sense.
> +    char *resp = (char *)response;
>  
> -    rc = (handler_and_context.first) (netfn, cmd, request, response,
> +    // Response message from the plugin goes into a byte post the base response
> +    rc = (handler_and_context.first) (netfn, cmd, request, resp + IPMI_CC_LEN,
>                                        data_len, handler_and_context.second);

Would prefer the following instead of the '+ IPMI_CC_LEN' in the
function parameter:
    char *respo = &((char *)response)[IPMI_CC_LEN];


> diff --git a/ipmidcommon.H b/ipmidcommon.H
> new file mode 100755
> index 0000000..9fa2284
> --- /dev/null
> +++ b/ipmidcommon.H
> @@ -0,0 +1,63 @@
> +#ifndef __HOST_IPMID_IPMI_COMMON_H__
> +#define __HOST_IPMID_IPMI_COMMON_H__
> +
> +// IPMI Net Function number as specified by IPMI V2.0 spec.
> +// Example : 
> +// NETFUN_APP      =   (0x06 << 2),
> +typedef unsigned char   ipmi_netfn_t;
> +
> +// IPMI Command for a Net Function number as specified by IPMI V2.0 spec.
> +typedef unsigned char   ipmi_cmd_t;
> +
> +// Buffer containing data from sender of netfn and command as part of request
> +typedef void*           ipmi_request_t;
> +
> +// This is the response buffer that the provider of [netfn,cmd] will send back
> +// to the caller. Provider will allocate the memory inside the handler and then
> +// will do a memcpy to this response buffer and also will set the data size
> +// parameter to the size of the buffer.
> +// EXAMPLE :
> +// unsigned char str[] = {0x00, 0x01, 0xFE, 0xFF, 0x0A, 0x01};
> +// *data_len = 6;
> +// memcpy(response, &str, *data_len);
> +typedef void*           ipmi_response_t;
> +
> +// This buffer contains any *user specific* data that is of interest only to the
> +// plugin. For a ipmi function router, this data is opaque. At the time of
> +// registering the plugin handlers, plugin may optionally allocate a memory and
> +// fill in whatever needed that will be of help during the actual handling of
> +// command. IPMID will just pass the netfn, cmd and also this data to plugins
> +// during the command handler invocation.
> +typedef void*           ipmi_context_t;
> +
> +// Length of request / response buffer depending on whether the data is a
> +// request or a response from a plugin handler.
> +typedef unsigned int*   ipmi_data_len_t;
> +
> +// This is the callback handler that the plugin registers with IPMID. IPMI
> +// function router will then make a call to this callback handler with the
> +// necessary arguments of netfn, cmd, request, response, size and context.
> +typedef int (*ipmid_callback_t)(ipmi_netfn_t, ipmi_cmd_t, ipmi_request_t,
> +                                ipmi_response_t, ipmi_data_len_t, ipmi_context_t);
> +
> +// This is the constructor function that is called into by each plugin handlers.
> +// When ipmi sets up the callback handlers, a call is made to this with
> +// information of netfn, cmd, callback handler pointer and context data.
> +void ipmi_register_callback(ipmi_netfn_t, ipmi_cmd_t, ipmi_context_t, ipmid_callback_t);
> +
> +// IPMI commands for net functions. Since this is to be used both by the ipmi
> +// function router and also the callback handler registration function, its put
> +// in this .H file.
> +enum ipmi_netfn_wild_card_cmd
> +{
> +    IPMI_CMD_WILDCARD       = 0xFF,
> +};
> +
> +// Return codes from a IPMI operation as needed by IPMI V2.0 spec.
> +enum ipmi_return_codes
> +{
> +    CC_OK = 0x00,
> +    CC_INVALID = 0xC1
> +};
> +
> +#endif

Intended to delete this file too?

-- 
Patrick Williams
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20151007/3f79896c/attachment.sig>


More information about the openbmc mailing list