Skip to content

Conversation

@pabloyangWW
Copy link
Contributor

[Task Description]
This patch implements two OEM IPMI commands (OEM_1S_GET_GPIO_CONFIG, OEM_1S_SET_GPIO_CONFIG) for GPIO configuration and control on the BIC. These commands are defined as weak functions in common code and overridden by platform-specific implementations in gc2.

[Motivation]
BMC needs to dynamically query and control BIC GPIO configurations for system management and debugging purposes. The bic_util tool on BMC requires IPMI interface to access BIC GPIOs without firmware modification. This implementation provides standardized OEM commands to fulfill two requirements by overriding the weak function stubs in common code with actual platform-specific implementations.

[Design]

  1. Implemented OEM_1S_GET_GPIO_CONFIG (NetFn: 0x38, CMD: 0x5):
  • Input: GPIO bitmap indicating which GPIOs to query
  • Output: Configuration bytes for each selected GPIO containing:
    • Direction (input/output)
    • Interrupt enable status * Trigger type (edge/level) * Trigger polarity (rising/falling/both or high/low)
  1. Implemented OEM_1S_SET_GPIO_CONFIG (NetFn: 0x38, CMD: 0x6):
    • Input: GPIO bitmap + configuration bytes for each selected GPIO
    • Configures GPIO direction and interrupt settings per configuration byte
    • byte format:
    • bit[0]: Direction (0: input, 1: output)
    • bit[1]: Interrupt enable (0: disable, 1: enable)
    • bit[2]: Trigger type (0: edge, 1: level)
    • bit[3]: Edge polarity (0: falling, 1: rising)
    • bit[4]: Both edge trigger (1: both edge)

[Test Log]

  • All implemented commands respond with correct IPMI completion codes and data formats as per specification.
  • Tested on GC2 platform using bic_util tool:
  1. Get GPIO configuration:
  • Successfully retrieved GPIO configuration for all GPIOs Output shows direction, interrupt enable, and trigger settings root@bmc-oob:~# bic_util slot1 --get_gpio_config gpio_config for pin#0 (FM_BMC_PCH_SCI_LPC_R_N): Direction: Input, Interrupt: Disabled, Trigger: Edge Trigger, Edge: Falling Edge gpio_config for pin#1 (FM_BIOS_POST_CMPLT_BMC_N): Direction: Input, Interrupt: Enabled, Trigger: Edge Trigger, Edge: Both Edges gpio_config for pin#2 (FM_SLPS3_PLD_N): Direction: Input, Interrupt: Enabled, Trigger: Edge Trigger, Edge: Both Edges ... gpio_config for pin#69 (SGPIO_BMC_CLK_R): Direction: Input, Interrupt: Disabled, Trigger: Edge Trigger, Edge: Falling Edge gpio_config for pin#70 (SGPIO_BMC_LD_R_N): Direction: Input, Interrupt: Disabled, Trigger: Edge Trigger, Edge: Falling Edge gpio_config for pin#71 (SGPIO_BMC_DOUT_R): Direction: Input, Interrupt: Enabled, Trigger: Edge Trigger, Edge: Falling Edge gpio_config for pin#72 (SGPIO_BMC_DIN): Direction: Input, Interrupt: Enabled, Trigger: Edge Trigger, Edge: Falling Edge
  1. Set GPIO configuration:
  • GPIO 52 set config with {Input, Enable Interrupt, Edge type, Both Edges} root@bmc-oob:~# bic-util server --get_gpio_config ... gpio_config for pin#52 (BMC_JTAG_SEL_R): Direction: Output, Interrupt: Disabled, Trigger: Edge Trigger, Edge: Falling Edge ... root@bmc-oob:~# bic-util server --set_gpio_config 52 0x12 Setting GPIO [52]BMC_JTAG_SEL_R config to 0x12 root@bmc-oob:~# bic-util server --get_gpio_config ... gpio_config for pin#52 (BMC_JTAG_SEL_R): Direction: Input, Interrupt: Enabled, Trigger: Edge Trigger, Edge: Both Edges ... ```

[Task Description]
This patch implements two OEM IPMI commands (OEM_1S_GET_GPIO_CONFIG,
OEM_1S_SET_GPIO_CONFIG) for GPIO configuration and
control on the BIC. These commands are defined as weak functions in common
code and overridden by platform-specific implementations in gc2.

[Motivation]
BMC needs to dynamically query and control BIC GPIO configurations for
system management and debugging purposes. The bic_util tool on BMC requires
IPMI interface to access BIC GPIOs without firmware modification. This
implementation provides standardized OEM commands to fulfill two
requirements by overriding the weak function stubs in common code with
actual platform-specific implementations.

[Design]
1.  Implemented OEM_1S_GET_GPIO_CONFIG (NetFn: 0x38, CMD: 0x5):
   - Input: GPIO bitmap indicating which GPIOs to query
   - Output: Configuration bytes for each selected GPIO containing:
     * Direction (input/output)
     * Interrupt enable status
     * Trigger type (edge/level)
     * Trigger polarity (rising/falling/both or high/low)

2. Implemented OEM_1S_SET_GPIO_CONFIG (NetFn: 0x38, CMD: 0x6):
   - Input: GPIO bitmap + configuration bytes for each selected GPIO
   - Configures GPIO direction and interrupt settings per configuration byte
   - byte format:
   - bit[0]: Direction (0: input, 1: output)
   - bit[1]: Interrupt enable (0: disable, 1: enable)
   - bit[2]: Trigger type (0: edge, 1: level)
   - bit[3]: Edge polarity (0: falling, 1: rising)
   - bit[4]: Both edge trigger (1: both edge)

[Test Log]
- All implemented commands respond with correct IPMI completion codes and
  data formats as per specification.
- Tested on GC2 platform using bic_util tool:
1. Get GPIO configuration:
  - Successfully retrieved GPIO configuration for all GPIOs
  Output shows direction, interrupt enable, and trigger settings
  ```
  root@bmc-oob:~# bic_util slot1 --get_gpio_config
  gpio_config for pin#0 (FM_BMC_PCH_SCI_LPC_R_N):
  Direction: Input,  Interrupt: Disabled, Trigger: Edge Trigger,  Edge: Falling Edge
  gpio_config for pin#1 (FM_BIOS_POST_CMPLT_BMC_N):
  Direction: Input,  Interrupt: Enabled,  Trigger: Edge Trigger,  Edge: Both Edges
  gpio_config for pin#2 (FM_SLPS3_PLD_N):
  Direction: Input,  Interrupt: Enabled,  Trigger: Edge Trigger,  Edge: Both Edges
  ...
  gpio_config for pin#69 (SGPIO_BMC_CLK_R):
  Direction: Input,  Interrupt: Disabled, Trigger: Edge Trigger,  Edge: Falling Edge
  gpio_config for pin#70 (SGPIO_BMC_LD_R_N):
  Direction: Input,  Interrupt: Disabled, Trigger: Edge Trigger,  Edge: Falling Edge
  gpio_config for pin#71 (SGPIO_BMC_DOUT_R):
  Direction: Input,  Interrupt: Enabled,  Trigger: Edge Trigger,  Edge: Falling Edge
  gpio_config for pin#72 (SGPIO_BMC_DIN):
  Direction: Input,  Interrupt: Enabled,  Trigger: Edge Trigger,  Edge: Falling Edge
  ```
2. Set GPIO configuration:
  - GPIO 52 set config with {Input, Enable Interrupt, Edge type, Both Edges}
  ```
  root@bmc-oob:~# bic-util server --get_gpio_config
  ...
  gpio_config for pin#52 (BMC_JTAG_SEL_R):
  Direction: Output, Interrupt: Disabled, Trigger: Edge Trigger,  Edge: Falling Edge
  ...
  root@bmc-oob:~# bic-util server --set_gpio_config 52 0x12
  Setting GPIO [52]BMC_JTAG_SEL_R config to 0x12
  root@bmc-oob:~# bic-util server --get_gpio_config
  ...
  gpio_config for pin#52 (BMC_JTAG_SEL_R):
  Direction: Input,  Interrupt: Enabled,  Trigger: Edge Trigger,  Edge: Both Edges
  ...
  ```
 ```
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 29, 2025
@meta-codesync
Copy link

meta-codesync bot commented Dec 29, 2025

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this in D89878933. (Because this pull request was imported automatically, there will not be any future comments.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant