James -

There are two problems with this:

- The microcode status is exposed as part of a plugin, not as core
  libses functionality.  So there is no way to expose a function on top
  of that.  Any additional information should be presented in the
  nvlist, not as part of a separate callback.

- Such a table makes a lot of assumptions about the consumers, the main
  one being non-localized ASCII text as the canonical format of
   describing the result.

The correct way to do this would be to create new properties such as
LIBSES_UCODE_ERR_CONDITION that could be filled in by the plugin.  This
would also allow for vendor-specific modules to fill in information
about any vendor specific codes they may return.

In any case, such a change is entirely within the scope of a future RFE,
and doesn't affect the architecture of libses as it relates to this
case.

- Eric

On Tue, Mar 18, 2008 at 07:07:37AM +1000, James C. McPherson wrote:

> I was thinking that having something like the following as
> common code would be preferable to seeing consumers of libses
> rolling their own each time they needed some status mappings:
> 
> 
> ================
> 
> typedef struct ucode_statdesc {
>       uint64_t        us_value;
>       const char      *us_desc;
>       boolean_t       us_pending;
>       boolean_t       us_iserr;
> } ucode_statdesc_t;
> 
> static ucode_statdesc_t ucode_statdesc_table[] = {
>       { SES2_DLUCODE_S_NOP,           "none", B_FALSE, B_FALSE },
>       { SES2_DLUCODE_S_INPROGRESS,    "in progress", B_TRUE, B_FALSE },
>       { SES2_DLUCODE_S_SAVING,        "saved", B_TRUE, B_FALSE },
>       { SES2_DLUCODE_S_COMPLETE_NOW,  "completed (available)", B_FALSE,
>           B_FALSE },
>       { SES2_DLUCODE_S_COMPLETE_AT_RESET,
>           "completed (need reset or power on)", B_FALSE, B_FALSE },
>       { SES2_DLUCODE_S_COMPLETE_AT_POWERON,   "completed (need power on)",
>           B_FALSE, B_FALSE },
>       { SES2_DLUCODE_S_PAGE_ERR,      "page error (offset %d)",
>           B_FALSE, B_TRUE },
>       { SES2_DLUCODE_S_IMAGE_ERR,     "invalid image",
>           B_FALSE, B_TRUE },
>       { SES2_DLUCODE_S_TIMEOUT,       "download timeout",
>           B_FALSE, B_TRUE },
>       { SES2_DLUCODE_S_INTERNAL_NEEDIMAGE,
>           "internal error (NEED NEW IMAGE BEFORE RESET)",
>           B_FALSE, B_TRUE },
>       { SES2_DLUCODE_S_INTERNAL_SAFE,
>           "internal error (reset to revert to backup)",
>           B_FALSE, B_TRUE },
> };
> 
> #define       NUCODE_STATUS   \
>       (sizeof (ucode_statdesc_table) / sizeof (ucode_statdesc_table[0]))
> 
> typedef struct ucode_status {
>       uint64_t        us_status;
>       boolean_t       us_iserr;
>       boolean_t       us_pending;
>       char            us_desc[128];
> } ucode_status_t;
> 
> ================
> 
> 
> 
> cheers,
> James C. McPherson
> --
> Senior Kernel Software Engineer, Solaris
> Sun Microsystems
> http://blogs.sun.com/jmcp     http://www.jmcp.homeunix.com/blog

--
Eric Schrock, Fishworks                        http://blogs.sun.com/eschrock

Reply via email to