1# Multi-Chassis Support for phosphor-psu-monitor 2 3## Current State 4 5Currently, **phosphor-psu-monitor** operates on a **single chassis**. 6 7- It gets the PSUs device access information (such as PSU I2CBus and I2CAddress) 8 and allowed PSU configurations using interfaces hosted by **entity manager** 9- The phosphor-psu-monitor uses a **fixed object path**, appended with the PSU 10 number, to access **inventory manager**. 11- Example of current PSU path: 12 13```text 14/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0 15``` 16 17## Goal: Support Multi-Chassis PSUs 18 19To support **multi-chassis**, the **phosphor-psu-monitor** requires the 20following changes: 21 22- Define Chassis class 23- Modify the **PSUManager** class to instantiate one **Chassis class** per 24 physical chassis. 25- Find all PSUs associated with each chassis. 26- Update the PSUs status on DBus with appropriate path i.e. 27 28```text 29/xyz/openbmc_project/inventory/system/chassis1/motherboard/powersupply1 30``` 31 32## Changes Required 33 34### 1. Define Chassis Class 35 36- Chassis class constructor take parameters D-Bus connection object, chassis 37 number, and object path 38- Vector of powerSupply instances 39- Functions to get and add PSUs 40- Function to get chassis status 41 42### 2. Modify PSUManager Class 43 44- Add method to retrieve a list of chassis objects from the **inventory 45 manager** and store them in a vector of chassis. Each chassis object listens 46 for D-BUS events to track chassis PGOOD Status. 47- Retrieve the PSU configurations from **entity manager** 48- Find all PSUs associated with chassis from **inventory manager** (using 49 **[getSubTree](https://github.com/openbmc/phosphor-power/blob/master/utility.hpp)**) 50 and add them to vector in the chassis object. **getSubTree** is a function 51 interacts with the D-Bus object mapper to retrieve all objects under a 52 specified path that implement interface to certain depth. 53 54### 3. Update Monitoring Logic 55 56- The PSUManager object loops over all **chassis** that are present and have 57 standby power. The **phosphor-psu-monitor** app monitors all PSUs associated 58 with the chassis to: 59 - Monitor Presence 60 - Create appropriate journal entries 61 - Create PELs for faults if the chassis is powered on 62 63### 4. DBus Updates 64 65- Update/publish **PSU sensors, presence and VPD information** on D-Bus. 66- Ensure properties **reflect multi-chassis** support. 67 68Note: The phosphor-psu-monitor logic should remain the same when adding support 69for multi chassis. 70 71### 5. PowerSystemInputs Interface 72 73- TBD 74 75### 6. Error Handling 76 77- Ensure any **error** references the **correct PSU inventory path**, e.g., 78 - `/xyz/openbmc_project/inventory/system/chassis0/powersupply0` 79 - `/xyz/openbmc_project/inventory/system/chassis1/powersupply3` 80 81### 7. Log Messages 82 83- Update journal messages to reflect **appropriate chassis**. 84 85--- 86 87## Summary 88 89**phosphor-psu-monitor** must be enhanced to dynamically: 90 91- Discover chassis, and maintain state of each chassis and react accordingly. 92- Monitor PSUs across all chassis 93- Update DBus and error logs accordingly. 94