openMMC
Open Source Modular MMC for AMCs
Loading...
Searching...
No Matches
hotswap.h
Go to the documentation of this file.
1/*
2 * openMMC -- Open Source modular IPM Controller firmware
3 *
4 * Copyright (C) 2015-2016 Henrique Silva <henrique.silva@lnls.br>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>
20 */
21
36#ifndef _HOTSWAP_H_
37#define _HOTSWAP_H_
38
39#include "sdr.h"
40#ifdef MODULE_RTM
41#include "rtm_user.h"
42#endif
43
44#define DEBOUNCE_TIME 250
45
46/* Module handle sensor status */
47#define HOTSWAP_STATE_HANDLE_CLOSED 0x00
48#define HOTSWAP_STATE_HANDLE_OPENED 0x01
49#define HOTSWAP_STATE_QUIESCED 0x02
50#define HOTSWAP_STATE_BP_FAIL 0x03
51#define HOTSWAP_STATE_BP_SDOWN 0x04
52#define HOTSWAP_STATE_URTM_PRSENT 0x05
53#define HOTSWAP_STATE_URTM_ABSENT 0x06
54#define HOTSWAP_STATE_URTM_COMPATIBLE 0x07
55#define HOTSWAP_STATE_URTM_INCOMPATIBLE 0x08
56
57#define HOTSWAP_MODULE_HANDLE_CLOSED_MASK 0x01
58#define HOTSWAP_MODULE_HANDLE_OPEN_MASK 0x02
59#define HOTSWAP_QUIESCED_MASK 0x04
60#define HOTSWAP_BACKEND_PWR_FAILURE_MASK 0x08
61#define HOTSWAP_BACKEND_PWR_SHUTDOWN_MASK 0x10
62#define HOTSWAP_URTM_PRESENT_MASK 0x20
63#define HOTSWAP_URTM_ABSENT_MASK 0x40
64#define HOTSWAP_URTM_COMPATIBLE_MASK 0x80
65
66enum {
69};
70
74extern TaskHandle_t vTaskHotSwap_Handle;
75
81void vTaskHotSwap( void *Parameters );
82
88void hotswap_init( void );
89
99ipmb_error hotswap_send_event( sensor_t *sensor, uint8_t evt );
100
109void hotswap_set_mask_bit( uint8_t fru, uint8_t mask );
110
119void hotswap_clear_mask_bit( uint8_t fru, uint8_t mask );
120
121#endif
fru_data_t fru[FRU_COUNT]
Definition board_fru.c:34
void hotswap_clear_mask_bit(uint8_t fru, uint8_t mask)
Clears the corresponding status bit in the Hotswap SDR readout value.
Definition hotswap.c:207
TaskHandle_t vTaskHotSwap_Handle
Hotswap Task handle.
Definition hotswap.c:50
void vTaskHotSwap(void *Parameters)
Periodically reads the Hotswap sensor state and checks if its state has changed.
Definition hotswap.c:109
@ HOTSWAP_AMC
Definition hotswap.h:67
@ HOTSWAP_RTM
Definition hotswap.h:68
ipmb_error hotswap_send_event(sensor_t *sensor, uint8_t evt)
Send a hotswap event via IPMB.
Definition hotswap.c:202
void hotswap_set_mask_bit(uint8_t fru, uint8_t mask)
Sets the corresponding status bit in the Hotswap SDR readout value.
Definition hotswap.c:216
void hotswap_init(void)
Initializes hotswap sensor informatiosn on SDR and creates vTaskHotSwap.
Definition hotswap.c:74
ipmb_error
IPMB errors enumeration.
Definition ipmb.h:181
Definition sdr.h:181