xref: /openbmc/docs/designs/platform-init.md (revision 8190665f0f831e6199f07e0f2dcfe4ca77881b79)
1# Platform init
2
3Author: Ed Tanous (edtanous)
4
5Created: 7-21-25
6
7## Problem Description
8
9There are a number of platforms that require handling of state that requires
10interacting with hardware in a consolidated way. Some examples of this are:
11
121. Resetting an i2c driver that initially is without power.
132. Bringing up a power rail under the control of the BMC.
143. Initing a power rail dependent on the state of a plug detect pin.
15
16## Background and References
17
18And any number of other cases. Some concrete examples of this kind of init of
19these things exists here. [1]
20
21Very routinely, significant bash scripts are used to do some of this init. Those
22bash scripts suffer some minor performance penalty on startup, and are generally
23checked into meta layers, reducing the reuse between platforms.
24
25## Requirements
26
271. OpenBMC must be able to init a system with devices on power rails that it
28   controls.
292. During the control of aformentioned power rails, the OpenBMC must be able to
30   monitor GPIO signals.
313. OpenBMC must be able to reset i2c lines that might not be available.
324. (secondary) Must be able to init multiple platforms from a single binary
33   (dc-scm)
34
35## Proposed Design
36
37Initially, a new repository would be created to house the platform-init for
38gb200nvl platform, and get static analysis autobumps, and recipes reused between
39platforms.
40
41Platforms will be separated by folder to ensure that platform owners can review
42and create their platform configurations as required, and identical to the
43meta-layer process that exists today.
44
45Top level structure will be
46
47platform_init.cpp platform1/init.cpp platform2/init.cpp
48
49Initially a cli argument will be used to compile the appropriate paths for a
50given platform. At some point in the future, some level of detection _may_ be
51added that allows detecting platforms at runtime. Design for that is to be
52determined based on future requirements.
53
54Guard rails will need to evolve over time, but initially this repository will
55not interact with DBus or the OpenBMC model. As defined (at this time) it is
56purely for initial bringup of hardware.
57
58## Alternatives Considered
59
60Status quo, continue building init scripts in bash. This leads to a lack of code
61reuse, and while some layers have done an excellent job keeping the code clean,
62it's still very difficult to refactor/consolidate.
63
64## Impacts
65
661. Will require a new repository, recipe, and CI build.
672. A new service will be launched for platforms opting into platform-init.
68
69### Organizational
70
71- Does this proposal require a new repository? Yes Request for the repository is
72  available[2]
73- Who will be the initial maintainer(s) of this repository? Ed Tanous and
74  Patrick Williams
75- Which repositories are expected to be modified to execute this design?
76  openbmc/openbmc New repository
77
78## Testing
79
80Testing section omitted. Platform boot will be tested using individual
81platforms, with no change.
82
83[1]:
84  https://github.com/openbmc/openbmc/blob/master/meta-nvidia/meta-gb200nvl-obmc/recipes-nvidia/platform-init/files/platform_init.cpp
85[2]: https://github.com/openbmc/technical-oversight-forum/issues/51
86