~ubuntu-branches/ubuntu/trusty/openipmi/trusty-updates

« back to all changes in this revision

Viewing changes to lib/normal_fru.c

  • Committer: Bazaar Package Importer
  • Author(s): Noèl Köthe
  • Date: 2009-07-28 10:17:23 UTC
  • mfrom: (1.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20090728101723-qxfi37j3g2l9dv6n
Tags: 2.0.16-1
* new upstream release from 2009-03-16
* debian/compat debian/control raised to debhelper 5
* debian/control removed URL in description new we
  have the Homepage: field
* debian/control updated Standards-Version: (no changes needed)
* debian/rules removed unused cdbd dependency

Show diffs side-by-side

added added

removed removed

Lines of Context:
4764
4764
        return EBADF;
4765
4765
 
4766
4766
    version = *data;
4767
 
    if (version != 1)
 
4767
    if ((version != 1) && (version != 2))
4768
4768
        /* Only support version 1 */
 
4769
        /* The IPMI 0.9 to IPMI 1.0 Change Summary and Porting Considerations
 
4770
         * from October 1, 1998 mention under FRU changes (Pg. 4)
 
4771
         * "The FRU format version has been updated to 02h from 01h"
 
4772
         * Unfortunately, some companies (such as Fujitsu Siemens Computers)
 
4773
         * used this information for production tools.
 
4774
         */
4769
4775
        return EBADF;
4770
4776
 
4771
4777
    for (i=0; i<IPMI_FRU_FTR_NUMBER; i++) {
4859
4865
 *
4860
4866
 ************************************************************************/
4861
4867
 
 
4868
static int fru_initialized;
 
4869
 
4862
4870
int
4863
4871
_ipmi_normal_fru_init(void)
4864
4872
{
4865
4873
    int rv;
4866
4874
 
 
4875
    if (fru_initialized)
 
4876
        return 0;
 
4877
 
4867
4878
    fru_multi_record_oem_handlers = locked_list_alloc
4868
4879
        (ipmi_get_global_os_handler());
4869
4880
    if (!fru_multi_record_oem_handlers)
4873
4884
                                                     0x00,
4874
4885
                                                     std_get_mr_root,
4875
4886
                                                     NULL);
4876
 
    if (rv)
 
4887
    if (rv) {
 
4888
        locked_list_destroy(fru_multi_record_oem_handlers);
 
4889
        fru_multi_record_oem_handlers = NULL;
4877
4890
        return rv;
 
4891
    }
 
4892
 
4878
4893
    rv = _ipmi_fru_register_multi_record_oem_handler(0,
4879
4894
                                                     0x01,
4880
4895
                                                     std_get_mr_root,
4881
4896
                                                     NULL);
4882
 
    if (rv)
 
4897
    if (rv) {
 
4898
        _ipmi_fru_deregister_multi_record_oem_handler(0, 0x00);
 
4899
        locked_list_destroy(fru_multi_record_oem_handlers);
 
4900
        fru_multi_record_oem_handlers = NULL;
4883
4901
        return rv;
 
4902
    }
 
4903
 
4884
4904
    rv = _ipmi_fru_register_multi_record_oem_handler(0,
4885
4905
                                                     0x02,
4886
4906
                                                     std_get_mr_root,
4887
4907
                                                     NULL);
4888
 
    if (rv)
 
4908
    if (rv) {
 
4909
        _ipmi_fru_deregister_multi_record_oem_handler(0, 0x01);
 
4910
        _ipmi_fru_deregister_multi_record_oem_handler(0, 0x00);
 
4911
        locked_list_destroy(fru_multi_record_oem_handlers);
 
4912
        fru_multi_record_oem_handlers = NULL;
4889
4913
        return rv;
 
4914
    }
4890
4915
 
4891
4916
    rv = _ipmi_fru_register_decoder(process_fru_info);
4892
 
    if (rv)
 
4917
    if (rv) {
 
4918
        _ipmi_fru_deregister_multi_record_oem_handler(0, 0x02);
 
4919
        _ipmi_fru_deregister_multi_record_oem_handler(0, 0x01);
 
4920
        _ipmi_fru_deregister_multi_record_oem_handler(0, 0x00);
 
4921
        locked_list_destroy(fru_multi_record_oem_handlers);
 
4922
        fru_multi_record_oem_handlers = NULL;
4893
4923
        return rv;
 
4924
    }
 
4925
 
 
4926
    fru_initialized = 1;
4894
4927
 
4895
4928
    return 0;
4896
4929
}
4898
4931
void
4899
4932
_ipmi_normal_fru_shutdown(void)
4900
4933
{
4901
 
    _ipmi_fru_deregister_decoder(process_fru_info);
4902
 
    if (fru_multi_record_oem_handlers) {
 
4934
    if (fru_initialized) {
 
4935
        _ipmi_fru_deregister_decoder(process_fru_info);
4903
4936
        _ipmi_fru_deregister_multi_record_oem_handler(0, 0x00);
4904
4937
        _ipmi_fru_deregister_multi_record_oem_handler(0, 0x01);
4905
4938
        _ipmi_fru_deregister_multi_record_oem_handler(0, 0x02);
4906
4939
        locked_list_destroy(fru_multi_record_oem_handlers);
4907
4940
        fru_multi_record_oem_handlers = NULL;
 
4941
        fru_initialized = 0;
4908
4942
    }
4909
4943
}
4910
4944