diff options
author | Nan Li <bjlinan@cn.ibm.com> | 2016-03-31 11:16:08 +0800 |
---|---|---|
committer | Nan Li <bjlinan@cn.ibm.com> | 2016-04-20 11:14:55 +0800 |
commit | 36c0cb62c51206105e16aaa7131b42fcb860bd32 (patch) | |
tree | ab6746086c675e0ff9f396d514f6343deb2e5a6b /ipmid.C | |
parent | b7e01a16951e868b076f3d68ecb0688a5209aa5b (diff) | |
download | phosphor-host-ipmid-36c0cb62c51206105e16aaa7131b42fcb860bd32.tar.gz phosphor-host-ipmid-36c0cb62c51206105e16aaa7131b42fcb860bd32.zip |
Handle multiple attempts at ipmi reservation ids
1. Keep Reservation ID follow IPMI Spec.
2. Make Reservation ID increase sequentially.
3. Make Reservation ID available in shared librarys.
Signed-off-by: Nan Li <bjlinan@cn.ibm.com>
Diffstat (limited to 'ipmid.C')
-rw-r--r-- | ipmid.C | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -26,8 +26,6 @@ void print_usage(void) { fprintf(stderr, " mask : 0xFF - Print all trace\n"); } - - const char * DBUS_INTF = "org.openbmc.HostIpmi"; const char * FILTER = "type='signal',interface='org.openbmc.HostIpmi',member='ReceivedMessage'"; @@ -39,6 +37,13 @@ typedef std::pair<ipmid_callback_t, ipmi_context_t> ipmi_fn_context_t; // Global data structure that contains the IPMI command handler's registrations. std::map<ipmi_fn_cmd_t, ipmi_fn_context_t> g_ipmid_router_map; +// IPMI Spec, shared Reservation ID. +unsigned short g_sel_reserve = 0xFFFF; + +unsigned short get_sel_reserve_id(void) +{ + return g_sel_reserve; +} #ifndef HEXDUMP_COLS #define HEXDUMP_COLS 16 @@ -341,8 +346,8 @@ void ipmi_register_callback_handlers(const char* ipmi_lib_path) handler_fqdn += "/"; num_handlers = scandir(ipmi_lib_path, &handler_list, handler_select, alphasort); - if (num_handlers < 0) - return; + if (num_handlers < 0) + return; while(num_handlers--) { @@ -351,6 +356,7 @@ void ipmi_register_callback_handlers(const char* ipmi_lib_path) printf("Registering handler:[%s]\n",handler_fqdn.c_str()); lib_handler = dlopen(handler_fqdn.c_str(), RTLD_NOW); + if(lib_handler == NULL) { fprintf(stderr,"ERROR opening [%s]: %s\n", @@ -359,6 +365,7 @@ void ipmi_register_callback_handlers(const char* ipmi_lib_path) // Wipe the memory allocated for this particular entry. free(handler_list[num_handlers]); } + // Done with all registration. free(handler_list); } |