1From 104027fff5db49d60d2ff7256580b8efb6429a27 Mon Sep 17 00:00:00 2001
2From: Alexander Amelkin <a.amelkin@yadro.com>
3Date: Wed, 20 Mar 2019 19:33:00 +0300
4Subject: [PATCH] Add boot initiator mailbox interface
5
6Add the xyz.openbmc_project.Control.Boot.Mailbox interface to allow
7for provision of the boot initiator (such as Petitboot or UEFI) with
8its specific parameters. This is based on IPMI 2.0 Table 28-14 'Boot
9Option Parameters' parameter 7 'Boot initiator mailbox'.
10
11Partially resolves openbmc/openbmc#3391
12
13Change-Id: If2a7dce6fae812fc3f1f325cd07c77f31900cf42
14Signed-off-by: Alexander Amelkin <a.amelkin@yadro.com>
15---
16 .../Control/Boot/Mailbox/meson.build          | 14 +++++
17 .../openbmc_project/Control/Boot/meson.build  | 15 +++++
18 .../Control/Boot/Mailbox.interface.yaml       | 63 +++++++++++++++++++
19 3 files changed, 92 insertions(+)
20 create mode 100644 gen/xyz/openbmc_project/Control/Boot/Mailbox/meson.build
21 create mode 100644 xyz/openbmc_project/Control/Boot/Mailbox.interface.yaml
22
23diff --git a/gen/xyz/openbmc_project/Control/Boot/Mailbox/meson.build b/gen/xyz/openbmc_project/Control/Boot/Mailbox/meson.build
24new file mode 100644
25index 0000000..149e68a
26--- /dev/null
27+++ b/gen/xyz/openbmc_project/Control/Boot/Mailbox/meson.build
28@@ -0,0 +1,14 @@
29+# Generated file; do not modify.
30+generated_sources += custom_target(
31+    'xyz/openbmc_project/Control/Boot/Mailbox__cpp'.underscorify(),
32+    input: [ meson.source_root() / 'xyz/openbmc_project/Control/Boot/Mailbox.interface.yaml',  ],
33+    output: [ 'server.cpp', 'server.hpp', 'client.hpp',  ],
34+    command: [
35+        sdbuspp_gen_meson_prog, '--command', 'cpp',
36+        '--output', meson.current_build_dir(),
37+        '--tool', sdbusplusplus_prog,
38+        '--directory', meson.source_root(),
39+        'xyz/openbmc_project/Control/Boot/Mailbox',
40+    ],
41+)
42+
43diff --git a/gen/xyz/openbmc_project/Control/Boot/meson.build b/gen/xyz/openbmc_project/Control/Boot/meson.build
44index ba8a19f..6901fc0 100644
45--- a/gen/xyz/openbmc_project/Control/Boot/meson.build
46+++ b/gen/xyz/openbmc_project/Control/Boot/meson.build
47@@ -1,4 +1,19 @@
48 # Generated file; do not modify.
49+subdir('Mailbox')
50+generated_others += custom_target(
51+    'xyz/openbmc_project/Control/Boot/Mailbox__markdown'.underscorify(),
52+    input: [ meson.source_root() / 'xyz/openbmc_project/Control/Boot/Mailbox.interface.yaml',  ],
53+    output: [ 'Mailbox.md' ],
54+    command: [
55+        sdbuspp_gen_meson_prog, '--command', 'markdown',
56+        '--output', meson.current_build_dir(),
57+        '--tool', sdbusplusplus_prog,
58+        '--directory', meson.source_root(),
59+        'xyz/openbmc_project/Control/Boot/Mailbox',
60+    ],
61+    build_by_default: true,
62+)
63+
64 subdir('Mode')
65 generated_others += custom_target(
66     'xyz/openbmc_project/Control/Boot/Mode__markdown'.underscorify(),
67diff --git a/xyz/openbmc_project/Control/Boot/Mailbox.interface.yaml b/xyz/openbmc_project/Control/Boot/Mailbox.interface.yaml
68new file mode 100644
69index 0000000..839e8be
70--- /dev/null
71+++ b/xyz/openbmc_project/Control/Boot/Mailbox.interface.yaml
72@@ -0,0 +1,63 @@
73+description: >
74+    Implement to provide the boot initiator (such as Petitboot or UEFI)
75+    with its specific parameters. This is based on IPMI 2.0 Table 28-14
76+    'Boot Option Parameters' parameter 7 'Boot initiator mailbox'.
77+
78+properties:
79+    - name: Supported
80+      type: boolean
81+      flags:
82+        - const
83+      default: false
84+      description: >
85+          Specifies whether or not the mailbox is supported by the
86+          boot initiator on this machine.
87+
88+          The property is constant and is only set by the implementation
89+          on startup.
90+
91+    - name: IANAEnterpriseNumber
92+      type: uint32
93+      flags:
94+        - const
95+      default: 0
96+      description: >
97+          The 24-bit IANA Private Enterprise Number for the company or organization
98+          that has specified the boot initiator. This is a machine-specific
99+          constant. The implementing application is responsible for setting
100+          this to the proper machine-specific value (0x000000..0xFFFFFF)
101+          according to https://www.iana.org/assignments/enterprise-numbers/enterprise-numbers.
102+
103+          The property is constant and is only set by the implementation
104+          on startup.
105+
106+    - name: Data
107+      type: array[byte]
108+      description: >
109+          The array of data bytes for the boot initiator to treat
110+          in its specific way. This interface doesn't impose any
111+          limitiations on the format or make any assumptions regarding
112+          it. The boot initiator is responsible for parsing this array.
113+
114+          The size of the array is a constant depending on the requirements
115+          set by the boot initiator used for a particular architecture or
116+          a machine. The implementing application is responsible for setting
117+          the size of this array to the proper value.
118+
119+          For conformance to the IPMI 2.0 specification, the size of the array
120+          plus 3 (the size of IPMI 2.0 representation of IANA Enterprise Number)
121+          must be a multiple of 16 with the minimum allowed size being 77
122+          (5 x 16-byte blocks, minus 3) if mailbox is at all Supported.
123+
124+          For IPMI 2.0 this array is supposed to be split into 16-byte
125+          blocks by the implementing service (block 0 being made of IANA PEN
126+          plus first 13 bytes of this array). Please pay special attention
127+          that this array does NOT include the IANA PEN needed for IPMI 2.0.
128+          Only the actual PEN-specific data is stored here.
129+
130+          When partially written to, the remaining parts of this array
131+          must not be automatically cleared. This is per IPMI 2.0
132+          specification.
133+
134+          Other interfaces to the boot initiator (such as MCTP) may process
135+          this array differently.
136--
1372.26.2
138
139