OpenBIC
OpenSource Bridge-IC
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
power_shell.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef POWER_SHELL_H
18#define POWER_SHELL_H
19
20#include <stdlib.h>
21#include <shell/shell.h>
22#include <plat_def.h>
23
24struct device_arr {
25 uint8_t enable;
26 char *name;
27};
28
33};
34
35#ifdef SHELL_PWR_SEQ
36
37#define MAX_PWR_ON_RECORD 10
38#define MAX_PWR_OFF_RECORD 10
39
40enum SHELL_POWER_ON_STAGE {
41 SHELL_BOARD_POWER_ON_STAGE0 = 0x00,
42 SHELL_BOARD_POWER_ON_STAGE1,
43 SHELL_BOARD_POWER_ON_STAGE2,
44 SHELL_RETIMER_POWER_ON_STAGE0,
45 SHELL_RETIMER_POWER_ON_STAGE1,
46 SHELL_RETIMER_POWER_ON_STAGE2,
47 SHELL_E1S_POWER_ON_STAGE0,
48 SHELL_E1S_POWER_ON_STAGE1,
49 SHELL_E1S_POWER_ON_STAGE2,
50 SHELL_E1S_POWER_ON_STAGE3,
51 SHELL_POWER_ON_NONE = 0xFF,
52};
53
54enum SHELL_POWER_OFF_STAGE {
55 SHELL_E1S_POWER_OFF_STAGE0 = 0x00,
56 SHELL_E1S_POWER_OFF_STAGE1,
57 SHELL_E1S_POWER_OFF_STAGE2,
58 SHELL_E1S_POWER_OFF_STAGE3,
59 SHELL_RETIMER_POWER_OFF_STAGE0,
60 SHELL_RETIMER_POWER_OFF_STAGE1,
61 SHELL_RETIMER_POWER_OFF_STAGE2,
62 SHELL_BOARD_POWER_OFF_STAGE0,
63 SHELL_BOARD_POWER_OFF_STAGE1,
64 SHELL_BOARD_POWER_OFF_STAGE2,
65 SHELL_POWER_OFF_NONE = 0xFF,
66};
67
68extern uint8_t power_on_stage[10];
69extern uint8_t power_off_stage[10];
70
71void cmd_power_sequence(const struct shell *shell, size_t argc, char **argv);
72void power_on_sequence_check(const struct shell *shell, uint8_t stage);
73void power_off_sequence_check(const struct shell *shell, uint8_t stage);
74
75#endif
76
77void cmd_power_status(const struct shell *shell, size_t argc, char **argv);
78void cmd_power_control(const struct shell *shell, size_t argc, char **argv);
79
81 SHELL_CMD(status, NULL, "List power status", cmd_power_status),
82 SHELL_CMD(control, NULL, "Power control", cmd_power_control),
83#ifdef SHELL_PWR_SEQ
84 SHELL_CMD(sequence, NULL, "Power Sequence status",
86#endif
87 SHELL_SUBCMD_SET_END);
88
89#endif
uint8_t status
Definition: mctp_ctrl.h:1
#define SHELL_PWR_SEQ
Definition: plat_def.h:21
uint8_t power_on_stage[MAX_PWR_ON_DATA]
Definition: plat_power_seq.c:45
uint8_t power_off_stage[MAX_PWR_OFF_DATA]
Definition: plat_power_seq.c:49
int cmd_power_sequence(const struct shell *shell, size_t argc, char **argv)
Definition: plat_power_sequence_shell.c:57
device_id
Definition: power_shell.h:29
@ DEVICE_BMC
Definition: power_shell.h:31
@ MAX_DEVICE_COUNT
Definition: power_shell.h:32
@ DEVICE_HOST
Definition: power_shell.h:30
SHELL_STATIC_SUBCMD_SET_CREATE(sub_power_cmds, SHELL_CMD(status, NULL, "List power status", cmd_power_status), SHELL_CMD(control, NULL, "Power control", cmd_power_control), SHELL_SUBCMD_SET_END)
void cmd_power_status(const struct shell *shell, size_t argc, char **argv)
Definition: power_shell.c:51
void cmd_power_control(const struct shell *shell, size_t argc, char **argv)
Definition: power_shell.c:86
Definition: power_shell.h:24
char * name
Definition: power_shell.h:26
uint8_t enable
Definition: power_shell.h:25