1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
|
From bde7f728d5a87522674bcd5515baaa02bf7b9373 Mon Sep 17 00:00:00 2001
From: Kuiying Wang <kuiying.wang@intel.com>
Date: Fri, 4 Sep 2020 19:24:25 +0800
Subject: [PATCH] Define Redfish interface "/Registries/Bios" and enable
Attributes property
1. Define Redfish interface "/Registries/Bios" for BIOS Attribute Registry
RBC Daemon provide method to get BIOS attribute registry.
2. Eanble Attributes property for BIOS resource
3. Define Redfish interface "/Systems/system/Bios/Settings" for BIOS
settings
4. RBC daemon is at
https://gerrit.openbmc-project.xyz/#/c/openbmc/bios-settings-mgr/+/35563/
5. IPMI command implementation is at
https://gerrit.openbmc-project.xyz/#/c/openbmc/intel-ipmi-oem/+/30827/
6. Property design is at
https://github.com/openbmc/phosphor-dbus-interfaces/tree/master/xyz/openbmc_project/BIOSConfig
7. Design doc is at
https://github.com/openbmc/docs/blob/master/designs/remote-bios-configuration.md
8. There will be 95 test cases for this feature in the validation team.
Tested:
1. Use postman (Redfish tool) could get all the attributes in bios
resouce, get bios settings, get bios attribute
registry.
https://IP_ADDR/redfish/v1/Systems/system/Bios
{
"@Redfish.Settings": {
"@odata.type": "#Settings.v1_3_0.Settings",
"SettingsObject": {
"@odata.id": "/redfish/v1/Systems/system/Bios/Settings"
}
},
"@odata.id": "/redfish/v1/Systems/system/Bios",
"@odata.type": "#Bios.v1_1_0.Bios",
"Actions": {
"#Bios.ChangePassword": {
"target": "/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword"
},
"#Bios.ResetBios": {
"target": "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios"
}
},
"AttributeRegistry": "BiosAttributeRegistry",
"Attributes": {
"attr0": "current value"
},
"Description": "BIOS Configuration Service",
"Id": "BIOS",
"Links": {
"ActiveSoftwareImage": {
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/bios_active"
},
"SoftwareImages": [
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/bios_active"
}
],
"SoftwareImages@odata.count": 1
},
"Name": "BIOS Configuration"
}
Redfish interface: https://BMCIP/redfish/v1/Registries/BiosAttributeRegistry
{
"@odata.id": "/redfish/v1/Registries/BiosAttributeRegistry",
"@odata.type": "#MessageRegistryFile.v1_1_0.MessageRegistryFile",
"Description": "BiosAttributeRegistry Message Registry File Location",
"Id": "BiosAttributeRegistry",
"Languages": [
"en"
],
"Languages@odata.count": 1,
"Location": [
{
"Language": "en",
"Uri": "/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry"
}
],
"Location@odata.count": 1,
"Name": "BiosAttributeRegistry Message Registry File",
"Registry": "BiosAttributeRegistry.1.0.0"
}
Redfish interface: https://BMCIP/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry
{
"@odata.id": "/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry",
"@odata.type": "#AttributeRegistry.v1_3_2.AttributeRegistry",
"Id": "BiosAttributeRegistry",
"Language": "en",
"Name": "Bios Attribute Registry",
"OwningEntity": "OpenBMC",
"RegistryEntries": {
"Attributes": [
{
"AttributeName": "attr0",
"CurrentValue": "current value",
"DefaultValue": "default value",
"DisplayName": "display name for attr0",
"HelpText": "description for attr0",
"MenuPath": "./menu/path/for/attr0",
"ReadOnly": false,
"Type": "String",
"Value": []
}
]
},
"RegistryVersion": "1.0.0"
}
https://BMC_IPADDR/redfish/v1/Systems/system/Bios/Settings
{
"@odata.id": "/redfish/v1/Systems/system/Bios/Settings",
"@odata.type": "#Bios.v1_1_0.Bios",
"AttributeRegistry": "BiosAttributeRegistry",
"Attributes": {
"QuietBoot": "0x0"
},
"Id": "BiosSettingsV1",
"Name": "Bios Settings Version 1"
}
2. Passed Validator check for bios resource and bios attribute registry
*** /redfish/v1/Systems/system/Bios
INFO - Type (#Bios.v1_1_0.Bios), GET SUCCESS (time: 1.57377)
INFO - PASS
*** /redfish/v1/Registries/BiosAttributeRegistry
INFO - Type (#MessageRegistryFile.v1_1_0.MessageRegistryFile), GET SUCCESS (time: 0.075438)
INFO - PASS
INFO -
*** /redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry
INFO - Type (#AttributeRegistry.v1_3_2.AttributeRegistry), GET SUCCESS (time: 0.075751)
INFO - PASS
@odata.id /redfish/v1/Systems/system/Bios odata Exists PASS
@odata.type #Settings.v1_3_0.Settings odata Exists PASS
Links [JSON Object] Bios.v1_1_0.Links Yes complex
Links.ActiveSoftwareImage Link: /redfish/v1/UpdateService/FirmwareInventory/bios_active link to: SoftwareInventory Yes PASS
Links.SoftwareImages Array (size: 1) array of: SoftwareInventory Yes ...
Links.SoftwareImages[0] Link: /redfish/v1/UpdateService/FirmwareInventory/bios_active SoftwareInventory Yes PASS
Links.Oem - Resource.Oem No Optional
SoftwareImages@odata.count 1 odata Exists PASS
AttributeRegistry BiosAttributeRegistry string Yes PASS
Actions [JSON Object] Bios.v1_0_0.Actions Yes complex
Actions.#Bios.ResetBios Action - Yes PASS
Actions.#Bios.ChangePassword Action - Yes PASS
Attributes [JSON Object] Bios.v1_0_0.Attributes Yes complex
Attributes.attr0 current value primitive Yes PASS
Id BIOS string Yes PASS
Description BIOS Configuration Service string Yes PASS
Name BIOS Configuration string Yes PASS
Oem - Resource.Oem No Optional
@Redfish.Settings [JSON Object] Settings.Settings Yes complex
@Redfish.Settings.MaintenanceWindowResource - link to: ItemOrCollection No Optional
@Redfish.Settings.SupportedApplyTimes - string (enum) No Optional
@Redfish.Settings.Time - date No Optional
@Redfish.Settings.ETag - string No Optional
@Redfish.Settings.SettingsObject Link: /redfish/v1/Systems/system/Bios/Settings link to: Item Yes PASS
@Redfish.Settings.Messages - Message No Optional
@odata.id /redfish/v1/Registries/BiosAttributeRegistry odata Exists PASS
@odata.type #MessageRegistryFile.v1_1_0.MessageRegistryFile odata Exists PASS
Languages@odata.count 1 odata Exists PASS
Location@odata.count 1 odata Exists PASS
Actions - MessageRegistryFile.v1_1_0.Actions No Optional
Languages Array (size: 1) string Yes ...
Languages[0] en string Yes PASS
Registry BiosAttributeRegistry.1.0.0 string Yes PASS
Location Array (size: 1) array of: Location Yes ...
Location[0] [JSON Object] Location Yes complex
Location[0].Language en string Yes PASS
Location[0].Uri /redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry string Yes PASS
Location[0].ArchiveUri - string No Optional
Location[0].PublicationUri - string No Optional
Location[0].ArchiveFile - string No Optional
Id BiosAttributeRegistry string Yes PASS
Description BiosAttributeRegistry Message Registry File Location string Yes PASS
Name BiosAttributeRegistry Message Registry File string Yes PASS
Oem - Resource.Oem No Optional
@odata.id /redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry odata Exists PASS
@odata.type #AttributeRegistry.v1_3_2.AttributeRegistry odata Exists PASS
Actions - AttributeRegistry.v1_1_0.Actions No Optional
Language en string Yes PASS
RegistryVersion 1.0.0 string Yes PASS
OwningEntity OpenBMC string Yes PASS
SupportedSystems - SupportedSystems No Optional
RegistryEntries [JSON Object] AttributeRegistry.v1_0_0.RegistryEntries Yes complex
RegistryEntries.Attributes Array (size: 1) array of: Attributes Yes ...
RegistryEntries.Attributes[0] [JSON Object] Attributes Yes complex
RegistryEntries.Attributes[0].Oem - Resource.Oem No Optional
RegistryEntries.Attributes[0].ResetRequired - boolean No Optional
RegistryEntries.Attributes[0].UefiDevicePath - string No Optional
RegistryEntries.Attributes[0].UefiKeywordName - string No Optional
RegistryEntries.Attributes[0].UefiNamespaceId - string No Optional
RegistryEntries.Attributes[0].AttributeName attr0 string Yes PASS
RegistryEntries.Attributes[0].Type String string (enum) Yes PASS
RegistryEntries.Attributes[0].Value Array (size: 0) array of: AttributeValue Yes ...
RegistryEntries.Attributes[0].DisplayName display name for attr0 string Yes PASS
RegistryEntries.Attributes[0].HelpText description for attr0 string Yes PASS
RegistryEntries.Attributes[0].WarningText - string No Optional
RegistryEntries.Attributes[0].CurrentValue current value primitive Yes PASS
RegistryEntries.Attributes[0].DefaultValue default value primitive Yes PASS
RegistryEntries.Attributes[0].DisplayOrder - number No Optional
RegistryEntries.Attributes[0].MenuPath ./menu/path/for/attr0 string Yes PASS
RegistryEntries.Attributes[0].ReadOnly False boolean Yes PASS
RegistryEntries.Attributes[0].WriteOnly - boolean No Optional
RegistryEntries.Attributes[0].GrayOut - boolean No Optional
RegistryEntries.Attributes[0].Hidden - boolean No Optional
RegistryEntries.Attributes[0].Immutable - boolean No Optional
RegistryEntries.Attributes[0].IsSystemUniqueProperty - boolean No Optional
RegistryEntries.Attributes[0].MaxLength - number No Optional
RegistryEntries.Attributes[0].MinLength - number No Optional
RegistryEntries.Attributes[0].ScalarIncrement - number No Optional
RegistryEntries.Attributes[0].UpperBound - number No Optional
RegistryEntries.Attributes[0].LowerBound - number No Optional
RegistryEntries.Attributes[0].ValueExpression - string No Optional
RegistryEntries.Menus - Menus No Optional
RegistryEntries.Dependencies - Dependencies No Optional
Id BiosAttributeRegistry string Yes PASS
Description - string No Optional
Name Bios Attribute Registry string Yes PASS
Oem - Resource.Oem No Optional
Change-Id: Iecc61018c350f0b8c89df59b2864b941508b1916
Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
Signed-off-by: Snehalatha Venkatesh <snehalathax.v@intel.com>
---
redfish-core/include/redfish.hpp | 3 +
.../include/registries/bios_registry.hpp | 41 ++
redfish-core/lib/bios.hpp | 511 ++++++++++++++++++
redfish-core/lib/message_registries.hpp | 11 +-
4 files changed, 565 insertions(+), 1 deletion(-)
create mode 100644 redfish-core/include/registries/bios_registry.hpp
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
index 0a97150..07a9417 100644
--- a/redfish-core/include/redfish.hpp
+++ b/redfish-core/include/redfish.hpp
@@ -148,7 +148,10 @@ class RedfishService
requestRoutesSystemActionsReset(app);
requestRoutesSystemResetActionInfo(app);
requestRoutesBiosService(app);
+ requestRoutesBiosSettings(app);
+ requestRoutesBiosAttributeRegistry(app);
requestRoutesBiosReset(app);
+ requestRoutesBiosChangePassword(app);
#ifdef BMCWEB_ENABLE_VM_NBDPROXY
requestNBDVirtualMediaRoutes(app);
diff --git a/redfish-core/include/registries/bios_registry.hpp b/redfish-core/include/registries/bios_registry.hpp
new file mode 100644
index 0000000..c80937a
--- /dev/null
+++ b/redfish-core/include/registries/bios_registry.hpp
@@ -0,0 +1,41 @@
+/*
+// Copyright (c) 2020 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+*/
+#pragma once
+#include <registries.hpp>
+
+namespace redfish::message_registries::bios
+{
+const Header header = {
+ "Copyright 2020 OpenBMC. All rights reserved.",
+ "#MessageRegistry.v1_4_0.MessageRegistry",
+ "BiosAttributeRegistry.1.0.0",
+ "Bios Attribute Registry",
+ "en",
+ "This registry defines the messages for bios attribute registry.",
+ "BiosAttributeRegistry",
+ "1.0.0",
+ "OpenBMC",
+};
+// BiosAttributeRegistry registry is not defined in DMTF, We should use
+// OEM defined registries for this purpose.
+// Below link is wrong - We need to define OEM registries and use
+// appropriate data here.
+constexpr const char* url =
+ "https://redfish.dmtf.org/registries/BiosAttributeRegistry.1.0.0.json";
+
+constexpr std::array<MessageEntry, 0> registry = {
+};
+} // namespace redfish::message_registries::bios
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
index c2fb284..87536d6 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
@@ -3,8 +3,140 @@
#include <app.hpp>
#include <registries/privilege_registry.hpp>
#include <utils/fw_utils.hpp>
+
namespace redfish
{
+
+/*baseBIOSTable
+map{attributeName,struct{attributeType,readonlyStatus,displayname,
+ description,menuPath,current,default,
+ array{struct{optionstring,optionvalue}}}}
+*/
+using BiosBaseTableType = std::vector<std::pair<
+ std::string,
+ std::tuple<
+ std::string, bool, std::string, std::string, std::string,
+ std::variant<int64_t, std::string>, std::variant<int64_t, std::string>,
+ std::vector<
+ std::tuple<std::string, std::variant<int64_t, std::string>>>>>>;
+using BiosBaseTableItemType = std::pair<
+ std::string,
+ std::tuple<
+ std::string, bool, std::string, std::string, std::string,
+ std::variant<int64_t, std::string>, std::variant<int64_t, std::string>,
+ std::vector<
+ std::tuple<std::string, std::variant<int64_t, std::string>>>>>;
+using OptionsItemType =
+ std::tuple<std::string, std::variant<int64_t, std::string>>;
+
+enum BiosBaseTableIndex
+{
+ biosBaseAttrType = 0,
+ biosBaseReadonlyStatus,
+ biosBaseDisplayName,
+ biosBaseDescription,
+ biosBaseMenuPath,
+ biosBaseCurrValue,
+ biosBaseDefaultValue,
+ biosBaseOptions
+};
+enum OptionsItemIndex
+{
+ optItemType = 0,
+ optItemValue
+};
+/*
+ The Pending attribute name and new value.
+ ex- { {"QuietBoot",Type.Integer, 0x1},
+ { "DdrFreqLimit",Type.String,"2933"}
+ }
+*/
+using PendingAttributesType = std::vector<std::pair<
+ std::string, std::tuple<std::string, std::variant<int64_t, std::string>>>>;
+using PendingAttributesItemType =
+ std::pair<std::string,
+ std::tuple<std::string, std::variant<int64_t, std::string>>>;
+enum PendingAttributesIndex
+{
+ pendingAttrType = 0,
+ pendingAttrValue
+};
+static std::string mapAttrTypeToRedfish(const std::string_view typeDbus)
+{
+ std::string ret;
+ if (typeDbus == "xyz.openbmc_project.BIOSConfig.Manager."
+ "AttributeType.Enumeration")
+ {
+ ret = "Enumeration";
+ }
+ else if (typeDbus == "xyz.openbmc_project.BIOSConfig."
+ "Manager.AttributeType.String")
+ {
+ ret = "String";
+ }
+ else if (typeDbus == "xyz.openbmc_project.BIOSConfig."
+ "Manager.AttributeType.Password")
+ {
+ ret = "Password";
+ }
+ else if (typeDbus == "xyz.openbmc_project.BIOSConfig."
+ "Manager.AttributeType.Integer")
+ {
+ ret = "Integer";
+ }
+ else if (typeDbus == "xyz.openbmc_project.BIOSConfig."
+ "Manager.AttributeType.Boolean")
+ {
+ ret = "Boolean";
+ }
+ else
+ {
+ ret = "UNKNOWN";
+ }
+
+ return ret;
+}
+static std::string mapBoundTypeToRedfish(const std::string_view typeDbus)
+{
+ std::string ret;
+ if (typeDbus ==
+ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.ScalarIncrement")
+ {
+ ret = "ScalarIncrement";
+ }
+ else if (typeDbus ==
+ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.LowerBound")
+ {
+ ret = "LowerBound";
+ }
+ else if (typeDbus ==
+ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.UpperBound")
+ {
+ ret = "UpperBound";
+ }
+ else if (typeDbus ==
+ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.MinStringLength")
+ {
+ ret = "MinStringLength";
+ }
+ else if (typeDbus ==
+ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.MaxStringLength")
+ {
+ ret = "MaxStringLength";
+ }
+ else if (typeDbus ==
+ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.OneOf")
+ {
+ ret = "OneOf";
+ }
+ else
+ {
+ ret = "UNKNOWN";
+ }
+
+ return ret;
+}
+
/**
* BiosService class supports handle get method for bios.
*/
@@ -23,6 +155,85 @@ inline void
// Get the ActiveSoftwareImage and SoftwareImages
fw_util::populateFirmwareInformation(asyncResp, fw_util::biosPurpose, "",
true);
+
+ asyncResp->res.jsonValue["@Redfish.Settings"] = {
+ {"@odata.type", "#Settings.v1_3_0.Settings"},
+ {"SettingsObject",
+ {{"@odata.id", "/redfish/v1/Systems/system/Bios/Settings"}}}};
+ asyncResp->res.jsonValue["AttributeRegistry"] = "BiosAttributeRegistry";
+ asyncResp->res.jsonValue["Attributes"] = {};
+
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code ec,
+ const GetObjectType& getObjectType) {
+ if (ec)
+ {
+ BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: "
+ << ec;
+ messages::internalError(asyncResp->res);
+
+ return;
+ }
+ const std::string& service = getObjectType.begin()->first;
+
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](
+ const boost::system::error_code ec,
+ const std::variant<BiosBaseTableType>& retBiosTable) {
+ if (ec)
+ {
+ BMCWEB_LOG_ERROR << "getBiosAttributes DBUS error: "
+ << ec;
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ const BiosBaseTableType* baseBiosTable =
+ std::get_if<BiosBaseTableType>(&retBiosTable);
+ nlohmann::json& attributesJson =
+ asyncResp->res.jsonValue["Attributes"];
+ if (baseBiosTable == nullptr)
+ {
+ BMCWEB_LOG_ERROR << "baseBiosTable == nullptr ";
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ for (const BiosBaseTableItemType& item : *baseBiosTable)
+ {
+ const std::string& key = item.first;
+ const std::string& itemType =
+ std::get<biosBaseAttrType>(item.second);
+ std::string attrType = mapAttrTypeToRedfish(itemType);
+ if (attrType == "String")
+ {
+ const std::string* currValue =
+ std::get_if<std::string>(
+ &std::get<biosBaseCurrValue>(item.second));
+ attributesJson.emplace(
+ key, currValue != nullptr ? *currValue : "");
+ }
+ else if (attrType == "Integer")
+ {
+ const int64_t* currValue = std::get_if<int64_t>(
+ &std::get<biosBaseCurrValue>(item.second));
+ attributesJson.emplace(
+ key, currValue != nullptr ? *currValue : 0);
+ }
+ else
+ {
+ BMCWEB_LOG_ERROR << "Unsupported attribute type.";
+ messages::internalError(asyncResp->res);
+ }
+ }
+ },
+ service, "/xyz/openbmc_project/bios_config/manager",
+ "org.freedesktop.DBus.Properties", "Get",
+ "xyz.openbmc_project.BIOSConfig.Manager", "BaseBIOSTable");
+ },
+ "xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper", "GetObject",
+ "/xyz/openbmc_project/bios_config/manager",
+ std::array<const char*, 0>());
}
inline void requestRoutesBiosService(App& app)
{
@@ -31,6 +242,306 @@ inline void requestRoutesBiosService(App& app)
.methods(boost::beast::http::verb::get)(handleBiosServiceGet);
}
+/**
+ * BiosSettings class supports handle GET/PATCH method for
+ * BIOS configuration pending settings.
+ */
+inline void requestRoutesBiosSettings(App& app)
+{
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Bios/Settings")
+ .privileges(redfish::privileges::getBios)
+ .methods(boost::beast::http::verb::get)(
+ [](const crow::Request&,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ asyncResp->res.jsonValue["@odata.id"] =
+ asyncResp->res.jsonValue["@odata.id"] =
+ "/redfish/v1/Systems/system/Bios/Settings";
+ asyncResp->res.jsonValue["@odata.type"] = "#Bios.v1_1_0.Bios";
+ asyncResp->res.jsonValue["Name"] = "Bios Settings Version 1";
+ asyncResp->res.jsonValue["Id"] = "BiosSettingsV1";
+ asyncResp->res.jsonValue["AttributeRegistry"] =
+ "BiosAttributeRegistry";
+ asyncResp->res.jsonValue["Attributes"] = {};
+
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code ec,
+ const GetObjectType& getObjectType) {
+ if (ec)
+ {
+ BMCWEB_LOG_ERROR
+ << "ObjectMapper::GetObject call failed: "
+ << ec;
+ messages::internalError(asyncResp->res);
+
+ return;
+ }
+ std::string service = getObjectType.begin()->first;
+
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](
+ const boost::system::error_code ec,
+ const std::variant<PendingAttributesType>&
+ retPendingAttributes) {
+ if (ec)
+ {
+ BMCWEB_LOG_ERROR
+ << "getBiosSettings DBUS error: " << ec;
+ messages::resourceNotFound(
+ asyncResp->res, "Systems/system/Bios",
+ "Settings");
+ return;
+ }
+ const PendingAttributesType* pendingAttributes =
+ std::get_if<PendingAttributesType>(
+ &retPendingAttributes);
+ nlohmann::json& attributesJson =
+ asyncResp->res.jsonValue["Attributes"];
+ if (pendingAttributes == nullptr)
+ {
+ BMCWEB_LOG_ERROR
+ << "pendingAttributes == nullptr ";
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ for (const PendingAttributesItemType& item :
+ *pendingAttributes)
+ {
+ const std::string& key = item.first;
+ const std::string& itemType =
+ std::get<pendingAttrType>(item.second);
+ std::string attrType =
+ mapAttrTypeToRedfish(itemType);
+ if (attrType == "String")
+ {
+ const std::string* currValue =
+ std::get_if<std::string>(
+ &std::get<pendingAttrValue>(
+ item.second));
+ attributesJson.emplace(
+ key, currValue != nullptr
+ ? *currValue
+ : "");
+ }
+ else if (attrType == "Integer")
+ {
+ const int64_t* currValue =
+ std::get_if<int64_t>(
+ &std::get<pendingAttrValue>(
+ item.second));
+ attributesJson.emplace(
+ key, currValue != nullptr
+ ? *currValue
+ : 0);
+ }
+ else
+ {
+ BMCWEB_LOG_ERROR
+ << "Unsupported attribute type.";
+ messages::internalError(asyncResp->res);
+ }
+ }
+ },
+ service, "/xyz/openbmc_project/bios_config/manager",
+ "org.freedesktop.DBus.Properties", "Get",
+ "xyz.openbmc_project.BIOSConfig.Manager",
+ "PendingAttributes");
+ },
+ "xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper", "GetObject",
+ "/xyz/openbmc_project/bios_config/manager",
+ std::array<const char*, 0>());
+ });
+}
+/**
+ * BiosAttributeRegistry class supports handle get method for BIOS attribute
+ * registry.
+ */
+inline void requestRoutesBiosAttributeRegistry(App& app)
+{
+ BMCWEB_ROUTE(
+ app,
+ "/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry/")
+ .privileges(redfish::privileges::getBios)
+ .methods(
+ boost::beast::http::verb::
+ get)([](const crow::Request&,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ asyncResp->res.jsonValue["@odata.id"] =
+ "/redfish/v1/Registries/BiosAttributeRegistry/"
+ "BiosAttributeRegistry";
+ asyncResp->res.jsonValue["@odata.type"] =
+ "#AttributeRegistry.v1_3_2.AttributeRegistry";
+ asyncResp->res.jsonValue["Name"] = "Bios Attribute Registry";
+ asyncResp->res.jsonValue["Id"] = "BiosAttributeRegistry";
+ asyncResp->res.jsonValue["RegistryVersion"] = "1.0.0";
+ asyncResp->res.jsonValue["Language"] = "en";
+ asyncResp->res.jsonValue["OwningEntity"] = "OpenBMC";
+ asyncResp->res.jsonValue["RegistryEntries"]["Attributes"] =
+ nlohmann::json::array();
+
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code ec,
+ const GetObjectType& getObjectType) {
+ if (ec)
+ {
+ BMCWEB_LOG_ERROR
+ << "ObjectMapper::GetObject call failed: " << ec;
+ messages::internalError(asyncResp->res);
+
+ return;
+ }
+ std::string service = getObjectType.begin()->first;
+
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code ec,
+ const std::variant<BiosBaseTableType>&
+ retBiosTable) {
+ if (ec)
+ {
+ BMCWEB_LOG_ERROR
+ << "getBiosAttributeRegistry DBUS error: "
+ << ec;
+ messages::resourceNotFound(
+ asyncResp->res, "Registries/Bios", "Bios");
+ return;
+ }
+ const BiosBaseTableType* baseBiosTable =
+ std::get_if<BiosBaseTableType>(&retBiosTable);
+ nlohmann::json& attributeArray =
+ asyncResp->res
+ .jsonValue["RegistryEntries"]["Attributes"];
+ nlohmann::json optionsArray =
+ nlohmann::json::array();
+ if (baseBiosTable == nullptr)
+ {
+ BMCWEB_LOG_ERROR << "baseBiosTable == nullptr ";
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ for (const BiosBaseTableItemType& item :
+ *baseBiosTable)
+ {
+ const std::string& itemType =
+ std::get<biosBaseAttrType>(item.second);
+ std::string attrType =
+ mapAttrTypeToRedfish(itemType);
+ if (attrType == "UNKNOWN")
+ {
+ BMCWEB_LOG_ERROR << "attrType == UNKNOWN";
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ nlohmann::json attributeItem;
+ attributeItem["AttributeName"] = item.first;
+ attributeItem["Type"] = attrType;
+ attributeItem["ReadOnly"] =
+ std::get<biosBaseReadonlyStatus>(
+ item.second);
+ attributeItem["DisplayName"] =
+ std::get<biosBaseDisplayName>(item.second);
+ attributeItem["HelpText"] =
+ std::get<biosBaseDescription>(item.second);
+ attributeItem["MenuPath"] =
+ std::get<biosBaseMenuPath>(item.second);
+
+ if (attrType == "String")
+ {
+ const std::string* currValue =
+ std::get_if<std::string>(
+ &std::get<biosBaseCurrValue>(
+ item.second));
+ const std::string* defValue =
+ std::get_if<std::string>(
+ &std::get<biosBaseDefaultValue>(
+ item.second));
+ attributeItem["CurrentValue"] =
+ currValue != nullptr ? *currValue : "";
+ attributeItem["DefaultValue"] =
+ defValue != nullptr ? *defValue : "";
+ }
+ else if (attrType == "Integer")
+ {
+ const int64_t* currValue =
+ std::get_if<int64_t>(
+ &std::get<biosBaseCurrValue>(
+ item.second));
+ const int64_t* defValue =
+ std::get_if<int64_t>(
+ &std::get<biosBaseDefaultValue>(
+ item.second));
+ attributeItem["CurrentValue"] =
+ currValue != nullptr ? *currValue : 0;
+ attributeItem["DefaultValue"] =
+ defValue != nullptr ? *defValue : 0;
+ }
+ else
+ {
+ BMCWEB_LOG_ERROR
+ << "Unsupported attribute type.";
+ messages::internalError(asyncResp->res);
+ return;
+ }
+
+ const std::vector<OptionsItemType>&
+ optionsVector =
+ std::get<biosBaseOptions>(item.second);
+ for (const OptionsItemType& optItem :
+ optionsVector)
+ {
+ nlohmann::json optItemJson;
+ const std::string& strOptItemType =
+ std::get<optItemType>(optItem);
+ std::string optItemTypeRedfish =
+ mapBoundTypeToRedfish(strOptItemType);
+ if (optItemTypeRedfish == "UNKNOWN")
+ {
+ BMCWEB_LOG_ERROR
+ << "optItemTypeRedfish == UNKNOWN";
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ if (optItemTypeRedfish == "OneOf")
+ {
+ const std::string* currValue =
+ std::get_if<std::string>(
+ &std::get<optItemValue>(
+ optItem));
+ optItemJson[optItemTypeRedfish] =
+ currValue != nullptr ? *currValue
+ : "";
+ }
+ else
+ {
+ const int64_t* currValue =
+ std::get_if<int64_t>(
+ &std::get<optItemValue>(
+ optItem));
+ optItemJson[optItemTypeRedfish] =
+ currValue != nullptr ? *currValue
+ : 0;
+ }
+
+ optionsArray.push_back(optItemJson);
+ }
+
+ attributeItem["Value"] = optionsArray;
+ attributeArray.push_back(attributeItem);
+ }
+ },
+ service, "/xyz/openbmc_project/bios_config/manager",
+ "org.freedesktop.DBus.Properties", "Get",
+ "xyz.openbmc_project.BIOSConfig.Manager",
+ "BaseBIOSTable");
+ },
+ "xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper", "GetObject",
+ "/xyz/openbmc_project/bios_config/manager",
+ std::array<const char*, 0>());
+ });
+}
+
/**
* BiosReset class supports handle POST method for Reset bios.
* The class retrieves and sends data directly to D-Bus.
diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp
index 43359e3..b2fb43c 100644
--- a/redfish-core/lib/message_registries.hpp
+++ b/redfish-core/lib/message_registries.hpp
@@ -17,6 +17,7 @@
#include "registries.hpp"
#include "registries/base_message_registry.hpp"
+#include "registries/bios_registry.hpp"
#include "registries/openbmc_message_registry.hpp"
#include "registries/resource_event_message_registry.hpp"
#include "registries/task_event_message_registry.hpp"
@@ -125,7 +126,6 @@ inline void requestRoutesMessageRegistryFile(App& app)
inline void handleMessageRegistryGet(
const crow::Request&, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& registry, const std::string& registryMatch)
-
{
const message_registries::Header* header;
std::vector<const message_registries::MessageEntry*> registryEntries;
@@ -165,6 +165,15 @@ inline void handleMessageRegistryGet(
registryEntries.emplace_back(&entry);
}
}
+ else if (registry == "BiosAttributeRegistry")
+ {
+ header = &message_registries::bios::header;
+ for (const message_registries::MessageEntry& entry :
+ message_registries::bios::registry)
+ {
+ registryEntries.emplace_back(&entry);
+ }
+ }
else
{
messages::resourceNotFound(
--
2.17.1
|