From 02ca34ff237b6c3f0c8cb4670f161c95c5184ac2 Mon Sep 17 00:00:00 2001 From: Gustavo de Souza dos Reis Date: Mon, 6 May 2024 13:42:52 -0300 Subject: [PATCH] base: add ipmiComm module. The patche solves an overflow bug and a problem when linking. Both can be found in pull requests in ipmiComm repo, and the patch can be removed when the PRs are accepted. --- CHANGES.md | 2 + base/.env | 1 + base/Dockerfile | 2 + base/docker-compose.yml | 1 + base/install_modules.sh | 8 ++ base/ipmicomm.patch | 157 +++++++++++++++++++++++++++++++++++ base/musl/Dockerfile | 2 + base/musl/docker-compose.yml | 1 + 8 files changed, 174 insertions(+) create mode 100644 base/ipmicomm.patch diff --git a/CHANGES.md b/CHANGES.md index 2f18f42..77ec6c4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,8 @@ A new container image, `ghcr.io/cnpem/opcua-epics-ioc`, is now available. https://github.com/cnpem/epics-in-docker/pull/61 * base: add IOCStats module. by @gustavosr8 in https://github.com/cnpem/epics-in-docker/pull/62 +* base: add IPMIComm module. by @gustavosr8 in + https://github.com/cnpem/epics-in-docker/pull/62 ## v0.7.0 diff --git a/base/.env b/base/.env index ab9e8a9..71b51f8 100644 --- a/base/.env +++ b/base/.env @@ -17,6 +17,7 @@ CAPUTLOG_VERSION=R4.0 RETOOLS_VERSION=b7abe82533cdbd7ddbc2dc845c95a2c51b7f2db9 ETHER_IP_VERSION=ether_ip-3-3 IOCSTATS_VERSION=3.2.0 +IPMICOMM_VERSION=R4.6.0 AREA_DETECTOR_VERSION=R3-12-1 NDSSCPIMEGA_VERSION=1.0.0 diff --git a/base/Dockerfile b/base/Dockerfile index 1939f90..18ee289 100644 --- a/base/Dockerfile +++ b/base/Dockerfile @@ -53,7 +53,9 @@ ARG CAPUTLOG_VERSION ARG RETOOLS_VERSION ARG ETHER_IP_VERSION ARG IOCSTATS_VERSION +ARG IPMICOMM_VERSION +COPY ipmicomm.patch . COPY caputlog-waveform-fix.patch . COPY install_modules.sh . RUN ./install_modules.sh diff --git a/base/docker-compose.yml b/base/docker-compose.yml index 3066828..871e262 100644 --- a/base/docker-compose.yml +++ b/base/docker-compose.yml @@ -26,6 +26,7 @@ services: RETOOLS_VERSION: ${RETOOLS_VERSION} ETHER_IP_VERSION: ${ETHER_IP_VERSION} IOCSTATS_VERSION: ${IOCSTATS_VERSION} + IPMICOMM_VERSION: ${IPMICOMM_VERSION} AREA_DETECTOR_VERSION: ${AREA_DETECTOR_VERSION} NDSSCPIMEGA_VERSION: ${NDSSCPIMEGA_VERSION} LIBSSCPIMEGA_VERSION: ${LIBSSCPIMEGA_VERSION} diff --git a/base/install_modules.sh b/base/install_modules.sh index 48bd3ee..888e20a 100755 --- a/base/install_modules.sh +++ b/base/install_modules.sh @@ -69,3 +69,11 @@ EPICS_BASE install_from_github epics-modules iocStats DEVIOCSTATS $IOCSTATS_VERSION " EPICS_BASE " + +download_from_github slac-epics-modules ipmiComm $IPMICOMM_VERSION +patch -d ipmiComm -Np1 < ipmicomm.patch +install_module ipmiComm IPMICOMM " +EPICS_BASE +ASYN +DEVIOCSTATS +" diff --git a/base/ipmicomm.patch b/base/ipmicomm.patch new file mode 100644 index 0000000..26cf349 --- /dev/null +++ b/base/ipmicomm.patch @@ -0,0 +1,157 @@ +From: https://github.com/slac-epics-modules/ipmiComm/pull/26/ +From: https://github.com/slac-epics-modules/ipmiComm/pull/28/ +diff --git a/iocs/ipmicomm-test-IOC/configure/RELEASE b/iocs/ipmicomm-test-IOC/configure/RELEASE +index 2822ab1..0ab1707 100644 +--- a/iocs/ipmicomm-test-IOC/configure/RELEASE ++++ b/iocs/ipmicomm-test-IOC/configure/RELEASE +@@ -16,13 +16,6 @@ + # Build variables that are NOT used in paths should be set in + # the CONFIG_SITE file. + +-# These lines allow developers to override these RELEASE settings +-# without having to modify this file directly. +--include $(TOP)/../RELEASE.local +--include $(TOP)/../RELEASE.$(EPICS_HOST_ARCH).local +--include $(TOP)/configure/RELEASE.local +--include $(TOP)/../../RELEASE_SITE +- + # modules this app depends upon. this builds a search path for libraries, header files, db files. + # ========================================================== + # Define the version strings for all needed modules +@@ -47,3 +40,10 @@ IPMICOMM=$(TOP)/../.. + # Set EPICS_BASE last so it appears last in the DB, DBD, INCLUDE, and LIB search paths + # ==================================================================== + EPICS_BASE=$(BASE_SITE_TOP)/$(BASE_MODULE_VERSION) ++ ++# These lines allow developers to override these RELEASE settings ++# without having to modify this file directly. ++-include $(TOP)/../RELEASE.local ++-include $(TOP)/../RELEASE.$(EPICS_HOST_ARCH).local ++-include $(TOP)/configure/RELEASE.local ++-include $(TOP)/../../RELEASE_SITE +diff --git a/src/devMch.c b/src/devMch.c +index ee1e6b0..20346d0 100644 +--- a/src/devMch.c ++++ b/src/devMch.c +@@ -206,6 +206,10 @@ extern uint32_t mchStat[MAX_MCH]; + */ + uint8_t SENSOR_SCAN_PERIODS[5] = { 5, 10, 20, 30, 60 }; + ++IOSCANPVT drvMchStatScan; ++IOSCANPVT drvMchInitScan; ++IOSCANPVT drvMchFruScan; ++ + #define MAX_STRING_LENGTH 39 + #define MAX_EGU_LENGTH 16 + +diff --git a/src/devMch.h b/src/devMch.h +index 81e74aa..6c82f49 100644 +--- a/src/devMch.h ++++ b/src/devMch.h +@@ -25,9 +25,9 @@ extern "C" { + #define MAX_NAME_LENGTH 50 + #define MAX_TASK_LENGTH 10 + +-IOSCANPVT drvMchStatScan; +-IOSCANPVT drvMchInitScan; +-IOSCANPVT drvMchFruScan; ++extern IOSCANPVT drvMchStatScan; ++extern IOSCANPVT drvMchInitScan; ++extern IOSCANPVT drvMchFruScan; + + /* Much of this stolen from devBusMapped */ + +diff --git a/src/drvMch.c b/src/drvMch.c +index 33e9b00..18e41cb 100644 +--- a/src/drvMch.c ++++ b/src/drvMch.c +@@ -71,6 +71,9 @@ static int postIocStart = 0; + epicsMutexId mchStatMtx[MAX_MCH]; + uint32_t mchStat[MAX_MCH] = { 0 }; + ++IOSCANPVT drvSensorScan[MAX_MCH]; ++struct MchCbRec_ *MchCb; ++ + static int mchSdrGetDataAll(MchData mchData); + static int mchFruGetDataAll(MchData mchData); + int mchGetFruIdFromIndex(MchData mchData, int index); +@@ -702,7 +705,7 @@ int rval = 0; + * Caller must perform locking. + */ + static void +-mchSensorGetFru(MchData mchData, uint8_t index) ++mchSensorGetFru(MchData mchData, int index) + { + MchSys mchSys = mchData->mchSys; + Sensor sens = &mchSys->sens[index]; +diff --git a/src/drvMch.h b/src/drvMch.h +index d231b94..bd371d6 100644 +--- a/src/drvMch.h ++++ b/src/drvMch.h +@@ -20,8 +20,6 @@ + #define MAX_MCH 255 + #define MAX_SENS_INST 32 /* Max instances of one sensor type on one FRU or Management Controller entity */ + +-extern const void *mchCbRegistryId; +- + extern uint32_t mchStat[MAX_MCH]; + + /* Sensor scan period [seconds] */ +@@ -30,7 +28,7 @@ extern volatile uint8_t mchSensorScanPeriod; + extern epicsMutexId mchStatMtx[MAX_MCH]; + + /* Used for sensor scanning; one list per MCH */ +-IOSCANPVT drvSensorScan[MAX_MCH]; ++extern IOSCANPVT drvSensorScan[MAX_MCH]; + + /* Vadatech typically sends 2 replies; NAT sends 1 */ + #define RPLY_TIMEOUT_SENDMSG_RPLY 0.50 +@@ -254,7 +252,7 @@ extern char mchDescString[MCH_TYPE_MAX][MCH_DESC_MAX_LENGTH]; /* Defined in drvM + #define VT_ENTITY_ID_RTM 0xC0 /* asked Vivek to verify */ + + extern const void *mchCbRegistryId; +-struct MchCbRec_ { ++extern struct MchCbRec_ { + void (*assign_sys_sizes) (MchData mchData); + void (*assign_site_info) (MchData mchData); + void (*assign_fru_lkup) (MchData mchData); +diff --git a/src/drvMchServerPc.c b/src/drvMchServerPc.c +index 9bf5314..08c9380 100644 +--- a/src/drvMchServerPc.c ++++ b/src/drvMchServerPc.c +@@ -97,23 +97,21 @@ Fru fru; + } + + MchCbRec drvMchSupermicroCb = { +- assign_sys_sizes: assign_sys_sizes_supermicro, +- assign_site_info: 0, +- assign_fru_lkup: assign_fru_lkup_supermicro, +- fru_data_suppl: 0, +- sensor_get_fru: sensor_get_fru_supermicro, +- get_chassis_status: mchMsgGetChassisStatus +- ++ .assign_sys_sizes = assign_sys_sizes_supermicro, ++ .assign_site_info = 0, ++ .assign_fru_lkup = assign_fru_lkup_supermicro, ++ .fru_data_suppl = 0, ++ .sensor_get_fru = sensor_get_fru_supermicro, ++ .get_chassis_status = mchMsgGetChassisStatus + }; + + MchCbRec drvMchAdvantechCb = { +- assign_sys_sizes: 0, +- assign_site_info: 0, +- assign_fru_lkup: assign_fru_lkup_advantech, +- fru_data_suppl: 0, +- sensor_get_fru: sensor_get_fru_advantech, +- get_chassis_status: mchMsgGetChassisStatus +- ++ .assign_sys_sizes = 0, ++ .assign_site_info = 0, ++ .assign_fru_lkup = assign_fru_lkup_advantech, ++ .fru_data_suppl = 0, ++ .sensor_get_fru = sensor_get_fru_advantech, ++ .get_chassis_status = mchMsgGetChassisStatus + }; + + static void diff --git a/base/musl/Dockerfile b/base/musl/Dockerfile index 683d2f6..6396fc1 100644 --- a/base/musl/Dockerfile +++ b/base/musl/Dockerfile @@ -53,8 +53,10 @@ ARG CAPUTLOG_VERSION ARG RETOOLS_VERSION ARG ETHER_IP_VERSION ARG IOCSTATS_VERSION +ARG IPMICOMM_VERSION WORKDIR ${EPICS_MODULES_PATH} +COPY ipmicomm.patch . COPY caputlog-waveform-fix.patch . COPY install_modules.sh . RUN NEEDS_TIRPC=YES ./install_modules.sh diff --git a/base/musl/docker-compose.yml b/base/musl/docker-compose.yml index 87a2d42..a802547 100644 --- a/base/musl/docker-compose.yml +++ b/base/musl/docker-compose.yml @@ -26,3 +26,4 @@ services: RETOOLS_VERSION: ${RETOOLS_VERSION} ETHER_IP_VERSION: ${ETHER_IP_VERSION} IOCSTATS_VERSION: ${IOCSTATS_VERSION} + IPMICOMM_VERSION: ${IPMICOMM_VERSION}