当前位置: 首页 > 工具软件 > OpenBMC > 使用案例 >

openbmc开发29:开关机管理

南门祯
2023-12-01

在ob中开关可以划分为x86、openpower和自定义三类,x86主要是intel、amd的x86架构的CPU开关机控制,openpower是IBM的powerPC的开关机控制,自定义一般是自己设计主板上带有CPLD或者FPGA,通过AST的gpio信号通知逻辑对HOST的开关机、复位控制。
按控制对象划分可以分为chassis控制和host控制,在非标服务器设计中,可能没有chassis这一部分,只有对host的控制,host控制由obmc-op-control-host软件包实现。在chassis控制中又分为chassis和power两部分,由obmc-control-chassis,obmc-op-control-power两个软件包实现。
另外还有对BMC自己的控制,主要是冷重启和热重启,有obmc-control-bmc软件实现。

以上的软件包都在https://github.com/openbmc/skeleton下,该软件包下还包含了fan、flash、led等控制或服务等,详细内容可以自行研究源码。

x86

x86架构CPU控制源码请参考git://github.com/openbmc/x86-power-control.git,主要配置文件是power-config-host0.json,也就是对host0的配置,该文件内容如下:

{
  "gpio_configs":{
      "IdButton": "ID_BUTTON",
      "NMIButton": "NMI_BUTTON",
      "NMIOut": "NMI_OUT",
      "PostComplete": "POST_COMPLETE",
      "PwrButton": "POWER_BUTTON",
      "PwrOK": "PS_PWROK",
      "PwrOut": "POWER_OUT",
      "RstButton": "RESET_BUTTON",
      "RstOut": "RESET_OUT",
      "SIOOnCtl": "SIO_ONCONTROL",
      "SIOPwrGd": "SIO_POWER_GOOD",
      "SIOS5": "SIO_S5"
    },
  "timing_configs":{
      "PowerPulseMs": 200,
      "ForceOffPulseMs": 15000,
      "ResetPulseMs": 500,
      "PowerCycleMs": 5000,
      "SioPowerGoodWatchdogMs": 1000,
      "PsPowerOKWatchdogMs": 8000,
      "GracefulPowerOffS": 300,
      "WarmResetCheckMs": 500,
      "PowerOffSaveMs": 7000
    }
}

一般需要可能修改时间配置中各种信号的有效时间以及GPIO标识,如"IdButton": “ID_BUTTON"修改为"IdButton”: "IDBUTTON"等,这里的"ID_BUTTON"是在BMC系统下gpio管脚的一个标识名称,可以在dts中配置。

gpio-keys {
		compatible = "gpio-keys";
		id_button {
			label = "ID_BUTTON";
			gpios = <&gpio ASPEED_GPIO(Q, 5) GPIO_ACTIVE_LOW>;
			linux,code = <ASPEED_GPIO(Q, 5)>;
		};

	};
&gpio {
	gpio-line-names =
	/*A0-A7*/	"","","","S0_BMC_SPECIAL_BOOT","","","","",
	/*B0-B7*/	"BMC_SELECT_EEPROM","","","",
			"POWER_BUTTON","","","",
	/*C0-C7*/	"","","","","","","","",
	/*D0-D7*/	"","","","","","","","",
	/*E0-E7*/	"","","","","","","","",
	/*F0-F7*/	"","","BMC_SYS_PSON_L","S0_DDR_SAVE","PGOOD",
			"S1_DDR_SAVE","","",
	/*G0-G7*/	"S0_FW_BOOT_OK","SHD_REQ_L","","S0_OVERTEMP_L","","",
			"","",
	/*H0-H7*/	"","","","","","","","",
	/*I0-I7*/	"","","S1_BMC_SPECIAL_BOOT","","","","","",
	/*J0-J7*/	"S0_HIGHTEMP_L","S0_FAULT_L","S0_SCP_AUTH_FAIL_L","",
			"","","","",
	/*K0-K7*/	"","","","","","","","",
	/*L0-L7*/       "","","","BMC_SYSRESET_L","SPI_AUTH_FAIL_L","","","",
	/*M0-M7*/	"","","","","","","","",
	/*N0-N7*/	"","","","","","","","",
	/*O0-O7*/	"","","","","","","","",
	/*P0-P7*/	"","","","","","","","",
	/*Q0-Q7*/	"","","","","","UID_BUTTON","","",
	/*R0-R7*/	"","","BMC_EXT_HIGHTEMP_L","","","RESET_BUTTON","","",
	/*S0-S7*/	"","","","","","","","",
	/*T0-T7*/	"","","","","","","","",
	/*U0-U7*/	"","","","","","","","",
	/*V0-V7*/	"","","","","","","","",
	/*W0-W7*/	"","","","","","","","",
	/*X0-X7*/	"","","","","","","","",
	/*Y0-Y7*/	"","","","","","","","",
	/*Z0-Z7*/	"S0_BMC_PLIMIT","S1_FAULT_L","S1_FW_BOOT_OK","","",
			"S1_SCP_AUTH_FAIL_L","S1_OVERTEMP_L","",
	/*AA0-AA7*/	"","","","","","","","",
	/*AB0-AB7*/	"S1_HIGHTEMP_L","S1_BMC_PLIMIT","S0_BMC_DDR_ADDR",
			"S1_BMC_DDR_ADR","","","","",
	/*AC0-AC7*/	"SYS_PWR_GD","","","","","BMC_READY","SLAVE_PRESENT_L",
			"BMC_OCP_PG";
};

这里只是参考例子,需要按照实际设计自行修改。其中chassis的复位控制需要自己添加执行命令完成控制。
x86电源控制一般bblayers.conf.sample(bblayers.conf)中不包含meta-openpower路径。

openpower

git://github.com/openbmc/openpower-proc-control

自定义

 类似资料: