oemcommands.cpp (63c99be4ac026a326d6953d608376edb0e60007a) | oemcommands.cpp (f2246ce844b9f7bf3ba6192d423214c2a5f3d2ee) |
---|---|
1/* 2 * Copyright (c) 2018 Intel Corporation. 3 * Copyright (c) 2018-present Facebook. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * --- 43 unchanged lines hidden (view full) --- 52ipmi_ret_t plat_udbg_get_frame_data(uint8_t, uint8_t, uint8_t*, uint8_t*, 53 uint8_t*); 54ipmi_ret_t plat_udbg_control_panel(uint8_t, uint8_t, uint8_t, uint8_t*, 55 uint8_t*); 56int sendMeCmd(uint8_t, uint8_t, std::vector<uint8_t>&, std::vector<uint8_t>&); 57 58nlohmann::json oemData __attribute__((init_priority(101))); 59 | 1/* 2 * Copyright (c) 2018 Intel Corporation. 3 * Copyright (c) 2018-present Facebook. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * --- 43 unchanged lines hidden (view full) --- 52ipmi_ret_t plat_udbg_get_frame_data(uint8_t, uint8_t, uint8_t*, uint8_t*, 53 uint8_t*); 54ipmi_ret_t plat_udbg_control_panel(uint8_t, uint8_t, uint8_t, uint8_t*, 55 uint8_t*); 56int sendMeCmd(uint8_t, uint8_t, std::vector<uint8_t>&, std::vector<uint8_t>&); 57 58nlohmann::json oemData __attribute__((init_priority(101))); 59 |
60static constexpr size_t GUID_SIZE = 16; 61// TODO Make offset and location runtime configurable to ensure we 62// can make each define their own locations. 63static constexpr off_t OFFSET_SYS_GUID = 0x17F0; 64static constexpr const char* FRU_EEPROM = "/sys/bus/i2c/devices/6-0054/eeprom"; 65 |
|
60enum class LanParam : uint8_t 61{ 62 INPROGRESS = 0, 63 AUTHSUPPORT = 1, 64 AUTHENABLES = 2, 65 IP = 3, 66 IPSRC = 4, 67 MAC = 5, --- 732 unchanged lines hidden (view full) --- 800 ipmi_data_len_t data_len, 801 ipmi_context_t context) 802{ 803 /* Do nothing, return success */ 804 *data_len = 0; 805 return IPMI_CC_OK; 806} 807 | 66enum class LanParam : uint8_t 67{ 68 INPROGRESS = 0, 69 AUTHSUPPORT = 1, 70 AUTHENABLES = 2, 71 IP = 3, 72 IPSRC = 4, 73 MAC = 5, --- 732 unchanged lines hidden (view full) --- 806 ipmi_data_len_t data_len, 807 ipmi_context_t context) 808{ 809 /* Do nothing, return success */ 810 *data_len = 0; 811 return IPMI_CC_OK; 812} 813 |
814// Helper function to set guid at offset in EEPROM 815static int setGUID(off_t offset, uint8_t* guid) 816{ 817 int fd = -1; 818 ssize_t len; 819 int ret = 0; 820 821 errno = 0; 822 823 // Check if file is present 824 if (access(FRU_EEPROM, F_OK) == -1) 825 { 826 std::cerr << "Unable to access: " << FRU_EEPROM << std::endl; 827 return errno; 828 } 829 830 // Open the file 831 fd = open(FRU_EEPROM, O_WRONLY); 832 if (fd == -1) 833 { 834 std::cerr << "Unable to open: " << FRU_EEPROM << std::endl; 835 return errno; 836 } 837 838 // seek to the offset 839 lseek(fd, offset, SEEK_SET); 840 841 // Write bytes to location 842 len = write(fd, guid, GUID_SIZE); 843 if (len != GUID_SIZE) 844 { 845 phosphor::logging::log<phosphor::logging::level::ERR>( 846 "GUID write data to EEPROM failed"); 847 ret = errno; 848 } 849 850 close(fd); 851 return ret; 852} 853 |
|
808//---------------------------------------------------------------------- | 854//---------------------------------------------------------------------- |
855// Set System GUID (CMD_OEM_SET_SYSTEM_GUID) 856//---------------------------------------------------------------------- 857ipmi_ret_t ipmiOemSetSystemGuid(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 858 ipmi_request_t request, 859 ipmi_response_t response, 860 ipmi_data_len_t data_len, 861 ipmi_context_t context) 862{ 863 uint8_t* req = reinterpret_cast<uint8_t*>(request); 864 865 if (*data_len != GUID_SIZE) // 16bytes 866 { 867 *data_len = 0; 868 return IPMI_CC_REQ_DATA_LEN_INVALID; 869 } 870 871 *data_len = 0; 872 873 if (setGUID(OFFSET_SYS_GUID, req)) 874 { 875 return IPMI_CC_UNSPECIFIED_ERROR; 876 } 877 return IPMI_CC_OK; 878} 879 880//---------------------------------------------------------------------- |
|
809// Set Bios Flash Info (CMD_OEM_SET_BIOS_FLASH_INFO) 810//---------------------------------------------------------------------- 811ipmi_ret_t ipmiOemSetBiosFlashInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 812 ipmi_request_t request, 813 ipmi_response_t response, 814 ipmi_data_len_t data_len, 815 ipmi_context_t context) 816{ --- 767 unchanged lines hidden (view full) --- 1584 ipmiOemSetPostStart, 1585 PRIVILEGE_USER); // Set POST start 1586 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_POST_END, NULL, 1587 ipmiOemSetPostEnd, 1588 PRIVILEGE_USER); // Set POST End 1589 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_PPIN_INFO, NULL, 1590 ipmiOemSetPPINInfo, 1591 PRIVILEGE_USER); // Set PPIN Info | 881// Set Bios Flash Info (CMD_OEM_SET_BIOS_FLASH_INFO) 882//---------------------------------------------------------------------- 883ipmi_ret_t ipmiOemSetBiosFlashInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 884 ipmi_request_t request, 885 ipmi_response_t response, 886 ipmi_data_len_t data_len, 887 ipmi_context_t context) 888{ --- 767 unchanged lines hidden (view full) --- 1656 ipmiOemSetPostStart, 1657 PRIVILEGE_USER); // Set POST start 1658 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_POST_END, NULL, 1659 ipmiOemSetPostEnd, 1660 PRIVILEGE_USER); // Set POST End 1661 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_PPIN_INFO, NULL, 1662 ipmiOemSetPPINInfo, 1663 PRIVILEGE_USER); // Set PPIN Info |
1664 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_SYSTEM_GUID, NULL, 1665 ipmiOemSetSystemGuid, 1666 PRIVILEGE_USER); // Set System GUID |
|
1592 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_ADR_TRIGGER, NULL, 1593 ipmiOemSetAdrTrigger, 1594 PRIVILEGE_USER); // Set ADR Trigger 1595 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_BIOS_FLASH_INFO, NULL, 1596 ipmiOemSetBiosFlashInfo, 1597 PRIVILEGE_USER); // Set Bios Flash Info 1598 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_PPR, NULL, ipmiOemSetPpr, 1599 PRIVILEGE_USER); // Set PPR --- 47 unchanged lines hidden --- | 1667 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_ADR_TRIGGER, NULL, 1668 ipmiOemSetAdrTrigger, 1669 PRIVILEGE_USER); // Set ADR Trigger 1670 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_BIOS_FLASH_INFO, NULL, 1671 ipmiOemSetBiosFlashInfo, 1672 PRIVILEGE_USER); // Set Bios Flash Info 1673 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_PPR, NULL, ipmiOemSetPpr, 1674 PRIVILEGE_USER); // Set PPR --- 47 unchanged lines hidden --- |