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