summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0065--Refactor-DCMI-IPMI-commands.patch
blob: bf222cf54c721f4532c8c0f60c9673b24c071615 (plain)
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
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
From 2cced6aac7e35f8f3c1d9c5f56a8c8873556bd7d Mon Sep 17 00:00:00 2001
From: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Date: Mon, 28 Aug 2023 18:18:43 +0000
Subject: [PATCH] Refactor DCMI IPMI commands

This PR ported from below upstream commit ID's
82cffccd642142b7dd48c9a874718e69e83b2ef3
f4eb35d069bb338506dcac80905c0bc9e929ac89
d4222fd3b66e4fd69b42ea7b91ad2af11fd77cce
dca4720fe3d0af8c433614a6199f0a6b41ade6a4
efb5ae550fe5033742c74b611c5c3f1791261414
f038dc095f8d9089d92d89740177b19a5d2b5f5b
cce9ffd9efea31ea6c42692a6d3ba50a3fccaacf
056fab1a60e1b23de2526f6d7a06b419e8ac8008
53d0cf1d4aacbea483d0fe99e1bb9b57da70fc2f
6475b5c9d7efc23a48d0c522d1eb7fecde09bd55

Tested:
Testing is in progress

Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
---
 dcmihandler.cpp | 1802 +++++++++++++++++++++--------------------------
 dcmihandler.hpp |  536 +-------------
 ipmid-new.cpp   |    5 +-
 3 files changed, 788 insertions(+), 1555 deletions(-)

diff --git a/dcmihandler.cpp b/dcmihandler.cpp
index 2ab02f3..e2addb5 100644
--- a/dcmihandler.cpp
+++ b/dcmihandler.cpp
@@ -15,745 +15,703 @@
 #include <sdbusplus/bus.hpp>
 #include <variant>
 #include <xyz/openbmc_project/Common/error.hpp>
+#include <xyz/openbmc_project/Network/EthernetInterface/server.hpp>
 
 using namespace phosphor::logging;
+using sdbusplus::xyz::openbmc_project::Network::server::EthernetInterface;
 using InternalFailure =
     sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
 
 void register_netfn_dcmi_functions() __attribute__((constructor));
 
-constexpr auto PCAP_PATH = "/xyz/openbmc_project/control/host0/power_cap";
-constexpr auto PCAP_INTERFACE = "xyz.openbmc_project.Control.Power.Cap";
-
-constexpr auto POWER_CAP_PROP = "PowerCap";
-constexpr auto POWER_CAP_ENABLE_PROP = "PowerCapEnable";
-
-constexpr auto DCMI_PARAMETER_REVISION = 2;
-constexpr auto DCMI_SPEC_MAJOR_VERSION = 1;
-constexpr auto DCMI_SPEC_MINOR_VERSION = 5;
-constexpr auto DCMI_CONFIG_PARAMETER_REVISION = 1;
-constexpr auto DCMI_RAND_BACK_OFF_MASK = 0x80;
-constexpr auto DCMI_OPTION_60_43_MASK = 0x02;
-constexpr auto DCMI_OPTION_12_MASK = 0x01;
-constexpr auto DCMI_ACTIVATE_DHCP_MASK = 0x01;
-constexpr auto DCMI_ACTIVATE_DHCP_REPLY = 0x00;
-constexpr auto DCMI_SET_CONF_PARAM_REQ_PACKET_MAX_SIZE = 0x04;
-constexpr auto DCMI_SET_CONF_PARAM_REQ_PACKET_MIN_SIZE = 0x03;
-constexpr auto DHCP_TIMING1 = 0x04;       // 4 sec
-constexpr auto DHCP_TIMING2_UPPER = 0x00; // 2 min
-constexpr auto DHCP_TIMING2_LOWER = 0x78;
-constexpr auto DHCP_TIMING3_UPPER = 0x00; // 64 sec
-constexpr auto DHCP_TIMING3_LOWER = 0x40;
-// When DHCP Option 12 is enabled the string "SendHostName=true" will be
-// added into n/w configuration file and the parameter
-// SendHostNameEnabled will set to true.
-constexpr auto DHCP_OPT12_ENABLED = "SendHostNameEnabled";
+constexpr auto pcapPath = "/xyz/openbmc_project/control/host0/power_cap";
+constexpr auto pcapInterface = "xyz.openbmc_project.Control.Power.Cap";
 
-constexpr auto SENSOR_VALUE_INTF = "xyz.openbmc_project.Sensor.Value";
-constexpr auto SENSOR_VALUE_PROP = "Value";
-constexpr auto SENSOR_SCALE_PROP = "Scale";
+constexpr auto powerCapProp = "PowerCap";
+constexpr auto powerCapEnableProp = "PowerCapEnable";
 
 using namespace phosphor::logging;
 
 namespace dcmi
 {
+constexpr auto assetTagMaxOffset = 62;
+constexpr auto assetTagMaxSize = 63;
+constexpr auto maxBytes = 16;
+constexpr size_t maxCtrlIdStrLen = 63;
+
+constexpr uint8_t parameterRevision = 2;
+constexpr uint8_t specMajorVersion = 1;
+constexpr uint8_t specMinorVersion = 5;
+constexpr auto sensorValueIntf = "xyz.openbmc_project.Sensor.Value";
+constexpr auto sensorValueProp = "Value";
+constexpr uint8_t configParameterRevision = 1;
+constexpr auto option12Mask = 0x01;
+constexpr auto activateDhcpReply = 0x00;
+constexpr uint8_t dhcpTiming1 = 0x04;  // 4 sec
+constexpr uint16_t dhcpTiming2 = 0x78; // 120 sec
+constexpr uint16_t dhcpTiming3 = 0x40; // 60 sec
+// When DHCP Option 12 is enabled the string "SendHostName=true" will be
+// added into n/w configuration file and the parameter
+// SendHostNameEnabled will set to true.
+constexpr auto dhcpOpt12Enabled = "SendHostNameEnabled";
+
+enum class DCMIConfigParameters : uint8_t
+{
+    ActivateDHCP = 1,
+    DiscoveryConfig,
+    DHCPTiming1,
+    DHCPTiming2,
+    DHCPTiming3,
+};
 
 // Refer Table 6-14, DCMI Entity ID Extension, DCMI v1.5 spec
 static const std::map<uint8_t, std::string> entityIdToName{
     {0x40, "inlet"}, {0x37, "inlet"},     {0x41, "cpu"},
     {0x03, "cpu"},   {0x42, "baseboard"}, {0x07, "baseboard"}};
 
-bool isDCMIPowerMgmtSupported()
+nlohmann::json parseJSONConfig(const std::string& configFile)
 {
-    auto data = parseJSONConfig(gDCMICapabilitiesConfig);
-
-    return (gDCMIPowerMgmtSupported == data.value(gDCMIPowerMgmtCapability, 0));
-}
-
-uint32_t getPcap(sdbusplus::bus::bus& bus)
-{
-    auto settingService = ipmi::getService(bus, PCAP_INTERFACE, PCAP_PATH);
-
-    auto method = bus.new_method_call(settingService.c_str(), PCAP_PATH,
-                                      "org.freedesktop.DBus.Properties", "Get");
-
-    method.append(PCAP_INTERFACE, POWER_CAP_PROP);
-    auto reply = bus.call(method);
+    std::ifstream jsonFile(configFile);
+    if (!jsonFile.is_open())
+    {
+        log<level::ERR>("Temperature readings JSON file not found");
+        elog<InternalFailure>();
+    }
 
-    if (reply.is_method_error())
+    auto data = nlohmann::json::parse(jsonFile, nullptr, false);
+    if (data.is_discarded())
     {
-        log<level::ERR>("Error in getPcap prop");
+        log<level::ERR>("Temperature readings JSON parser failure");
         elog<InternalFailure>();
     }
-    std::variant<uint32_t> pcap;
-    reply.read(pcap);
 
-    return std::get<uint32_t>(pcap);
+    return data;
 }
 
-bool getPcapEnabled(sdbusplus::bus::bus& bus)
+bool isDCMIPowerMgmtSupported()
 {
-    auto settingService = ipmi::getService(bus, PCAP_INTERFACE, PCAP_PATH);
-
-    auto method = bus.new_method_call(settingService.c_str(), PCAP_PATH,
-                                      "org.freedesktop.DBus.Properties", "Get");
+    static bool parsed = false;
+    static bool supported = false;
+    if (!parsed)
+    {
+        auto data = parseJSONConfig(gDCMICapabilitiesConfig);
 
-    method.append(PCAP_INTERFACE, POWER_CAP_ENABLE_PROP);
-    auto reply = bus.call(method);
+        supported = (gDCMIPowerMgmtSupported ==
+                     data.value(gDCMIPowerMgmtCapability, 0));
+    }
+    return supported;
+}
 
-    if (reply.is_method_error())
+std::optional<uint32_t> getPcap(ipmi::Context::ptr& ctx)
+{
+    std::string service{};
+    boost::system::error_code ec = ipmi::getService(ctx, pcapInterface,
+                                                    pcapPath, service);
+    if (ec.value())
     {
-        log<level::ERR>("Error in getPcapEnabled prop");
+        return std::nullopt;
+    }
+    uint32_t pcap{};
+    ec = ipmi::getDbusProperty(ctx, service, pcapPath, pcapInterface,
+                               powerCapProp, pcap);
+    if (ec.value())
+    {
+        log<level::ERR>("Error in getPcap prop",
+                        entry("ERROR=%s", ec.message().c_str()));
         elog<InternalFailure>();
+        return std::nullopt;
     }
-    std::variant<bool> pcapEnabled;
-    reply.read(pcapEnabled);
-
-    return std::get<bool>(pcapEnabled);
+    return pcap;
 }
 
-void setPcap(sdbusplus::bus::bus& bus, const uint32_t powerCap)
+std::optional<bool> getPcapEnabled(ipmi::Context::ptr& ctx)
 {
-    auto service = ipmi::getService(bus, PCAP_INTERFACE, PCAP_PATH);
-
-    auto method = bus.new_method_call(service.c_str(), PCAP_PATH,
-                                      "org.freedesktop.DBus.Properties", "Set");
-
-    method.append(PCAP_INTERFACE, POWER_CAP_PROP);
-    method.append(std::variant<uint32_t>(powerCap));
-
-    auto reply = bus.call(method);
-
-    if (reply.is_method_error())
+    std::string service{};
+    boost::system::error_code ec = ipmi::getService(ctx, pcapInterface,
+                                                    pcapPath, service);
+    if (ec.value())
     {
-        log<level::ERR>("Error in setPcap property");
+        return std::nullopt;
+    }
+    bool pcapEnabled{};
+    ec = ipmi::getDbusProperty(ctx, service, pcapPath, pcapInterface,
+                               powerCapEnableProp, pcapEnabled);
+    if (ec.value())
+    {
+        log<level::ERR>("Error in getPcap prop");
         elog<InternalFailure>();
+        return std::nullopt;
     }
+    return pcapEnabled;
 }
 
-void setPcapEnable(sdbusplus::bus::bus& bus, bool enabled)
+bool setPcap(ipmi::Context::ptr& ctx, const uint32_t powerCap)
 {
-    auto service = ipmi::getService(bus, PCAP_INTERFACE, PCAP_PATH);
-
-    auto method = bus.new_method_call(service.c_str(), PCAP_PATH,
-                                      "org.freedesktop.DBus.Properties", "Set");
-
-    method.append(PCAP_INTERFACE, POWER_CAP_ENABLE_PROP);
-    method.append(std::variant<bool>(enabled));
-
-    auto reply = bus.call(method);
+    std::string service{};
+    boost::system::error_code ec = ipmi::getService(ctx, pcapInterface,
+                                                    pcapPath, service);
+    if (ec.value())
+    {
+        return false;
+    }
 
-    if (reply.is_method_error())
+    ec = ipmi::setDbusProperty(ctx, service, pcapPath, pcapInterface,
+                               powerCapProp, powerCap);
+    if (ec.value())
     {
-        log<level::ERR>("Error in setPcapEnabled property");
+        log<level::ERR>("Error in setPcap property",
+                        entry("ERROR=%s", ec.message().c_str()));
         elog<InternalFailure>();
+        return false;
     }
+    return true;
 }
 
-void readAssetTagObjectTree(dcmi::assettag::ObjectTree& objectTree)
+bool setPcapEnable(ipmi::Context::ptr& ctx, bool enabled)
 {
-    static constexpr auto mapperBusName = "xyz.openbmc_project.ObjectMapper";
-    static constexpr auto mapperObjPath = "/xyz/openbmc_project/object_mapper";
-    static constexpr auto mapperIface = "xyz.openbmc_project.ObjectMapper";
-    static constexpr auto inventoryRoot = "/xyz/openbmc_project/inventory/";
-
-    sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
-    auto depth = 0;
-
-    auto mapperCall = bus.new_method_call(mapperBusName, mapperObjPath,
-                                          mapperIface, "GetSubTree");
-
-    mapperCall.append(inventoryRoot);
-    mapperCall.append(depth);
-    mapperCall.append(std::vector<std::string>({dcmi::assetTagIntf}));
-
-    auto mapperReply = bus.call(mapperCall);
-    if (mapperReply.is_method_error())
+    std::string service{};
+    boost::system::error_code ec = ipmi::getService(ctx, pcapInterface,
+                                                    pcapPath, service);
+    if (ec.value())
     {
-        log<level::ERR>("Error in mapper call");
-        elog<InternalFailure>();
+        return false;
     }
 
-    mapperReply.read(objectTree);
-
-    if (objectTree.empty())
+    ec = ipmi::setDbusProperty(ctx, service, pcapPath, pcapInterface,
+                               powerCapEnableProp, enabled);
+    if (ec.value())
     {
-        log<level::ERR>("AssetTag property is not populated");
+        log<level::ERR>("Error in setPcapEnabled property",
+                        entry("ERROR=%s", ec.message().c_str()));
         elog<InternalFailure>();
+        return false;
     }
+    return true;
 }
 
-std::string readAssetTag()
+std::optional<std::string> readAssetTag(ipmi::Context::ptr& ctx)
 {
-    sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
-    dcmi::assettag::ObjectTree objectTree;
-
     // Read the object tree with the inventory root to figure out the object
     // that has implemented the Asset tag interface.
-    readAssetTagObjectTree(objectTree);
-
-    auto method = bus.new_method_call(
-        (objectTree.begin()->second.begin()->first).c_str(),
-        (objectTree.begin()->first).c_str(), dcmi::propIntf, "Get");
-    method.append(dcmi::assetTagIntf);
-    method.append(dcmi::assetTagProp);
+    ipmi::DbusObjectInfo objectInfo;
+    boost::system::error_code ec = getDbusObject(
+        ctx, dcmi::assetTagIntf, ipmi::sensor::inventoryRoot, "", objectInfo);
+    if (ec.value())
+    {
+        return std::nullopt;
+    }
 
-    auto reply = bus.call(method);
-    if (reply.is_method_error())
+    std::string assetTag{};
+    ec = ipmi::getDbusProperty(ctx, objectInfo.second, objectInfo.first,
+                               dcmi::assetTagIntf, dcmi::assetTagProp,
+                               assetTag);
+    if (ec.value())
     {
-        log<level::ERR>("Error in reading asset tag");
+        log<level::ERR>("Error in reading asset tag",
+                        entry("ERROR=%s", ec.message().c_str()));
         elog<InternalFailure>();
+        return std::nullopt;
     }
 
-    std::variant<std::string> assetTag;
-    reply.read(assetTag);
-
-    return std::get<std::string>(assetTag);
+    return assetTag;
 }
 
-void writeAssetTag(const std::string& assetTag)
+bool writeAssetTag(ipmi::Context::ptr& ctx, const std::string& assetTag)
 {
-    sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
-    dcmi::assettag::ObjectTree objectTree;
-
     // Read the object tree with the inventory root to figure out the object
     // that has implemented the Asset tag interface.
-    readAssetTagObjectTree(objectTree);
-
-    auto method = bus.new_method_call(
-        (objectTree.begin()->second.begin()->first).c_str(),
-        (objectTree.begin()->first).c_str(), dcmi::propIntf, "Set");
-    method.append(dcmi::assetTagIntf);
-    method.append(dcmi::assetTagProp);
-    method.append(std::variant<std::string>(assetTag));
+    ipmi::DbusObjectInfo objectInfo;
+    boost::system::error_code ec = getDbusObject(
+        ctx, dcmi::assetTagIntf, ipmi::sensor::inventoryRoot, "", objectInfo);
+    if (ec.value())
+    {
+        return false;
+    }
 
-    auto reply = bus.call(method);
-    if (reply.is_method_error())
+    ec = ipmi::setDbusProperty(ctx, objectInfo.second, objectInfo.first,
+                               dcmi::assetTagIntf, dcmi::assetTagProp,
+                               assetTag);
+    if (ec.value())
     {
-        log<level::ERR>("Error in writing asset tag");
+        log<level::ERR>("Error in writing asset tag",
+                        entry("ERROR=%s", ec.message().c_str()));
         elog<InternalFailure>();
+        return false;
     }
+    return true;
 }
 
-std::string getHostName(void)
+std::optional<std::string> getHostName(ipmi::Context::ptr& ctx)
 {
-    sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
-
-    auto service = ipmi::getService(bus, networkConfigIntf, networkConfigObj);
-    auto value = ipmi::getDbusProperty(bus, service, networkConfigObj,
-                                       networkConfigIntf, hostNameProp);
-
-    return std::get<std::string>(value);
+    std::string service{};
+    boost::system::error_code ec = ipmi::getService(ctx, networkConfigIntf,
+                                                    networkConfigObj, service);
+    if (ec.value())
+    {
+        return std::nullopt;
+    }
+    std::string hostname{};
+    ec = ipmi::getDbusProperty(ctx, service, networkConfigObj,
+                               networkConfigIntf, hostNameProp, hostname);
+    if (ec.value())
+    {
+        log<level::ERR>("Error fetching hostname");
+        elog<InternalFailure>();
+        return std::nullopt;
+    }
+    return hostname;
 }
 
-bool getDHCPEnabled()
+std::optional<EthernetInterface::DHCPConf>
+    getDHCPEnabled(ipmi::Context::ptr& ctx)
 {
-    sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
-
     auto ethdevice = ipmi::getChannelName(ethernetDefaultChannelNum);
-    auto ethernetObj =
-        ipmi::getDbusObject(bus, ethernetIntf, networkRoot, ethdevice);
-    auto service = ipmi::getService(bus, ethernetIntf, ethernetObj.first);
-    auto value = ipmi::getDbusProperty(bus, service, ethernetObj.first,
-                                       ethernetIntf, "DHCPEnabled");
-
-    return std::get<bool>(value);
-}
-
-bool getDHCPOption(std::string prop)
-{
-    sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
-
-    auto service = ipmi::getService(bus, dhcpIntf, dhcpObj);
-    auto value = ipmi::getDbusProperty(bus, service, dhcpObj, dhcpIntf, prop);
+    ipmi::DbusObjectInfo ethernetObj{};
+    boost::system::error_code ec = ipmi::getDbusObject(
+        ctx, ethernetIntf, networkRoot, ethdevice, ethernetObj);
+    if (ec.value())
+    {
+        return std::nullopt;
+    }
+    std::string service{};
+    ec = ipmi::getService(ctx, ethernetIntf, ethernetObj.first, service);
+    if (ec.value())
+    {
+        return std::nullopt;
+    }
+    std::string dhcpVal{};
+    ec = ipmi::getDbusProperty(ctx, service, ethernetObj.first, ethernetIntf,
+                               "DHCPEnabled", dhcpVal);
+    if (ec.value())
+    {
+        return std::nullopt;
+    }
 
-    return std::get<bool>(value);
+    return EthernetInterface::convertDHCPConfFromString(dhcpVal);
 }
 
-void setDHCPOption(std::string prop, bool value)
+std::optional<bool> getDHCPOption(ipmi::Context::ptr& ctx,
+                                  const std::string& prop)
 {
-    sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
+    std::string service;
+    boost::system::error_code ec = ipmi::getService(ctx, dhcpIntf, dhcpObj,
+                                                    service);
+    if (ec.value())
+    {
+        return std::nullopt;
+    }
+    bool value{};
+    ec = ipmi::getDbusProperty(ctx, service, dhcpObj, dhcpIntf, prop, value);
+    if (ec.value())
+    {
+        return std::nullopt;
+    }
 
-    auto service = ipmi::getService(bus, dhcpIntf, dhcpObj);
-    ipmi::setDbusProperty(bus, service, dhcpObj, dhcpIntf, prop, value);
+    return value;
 }
 
-Json parseJSONConfig(const std::string& configFile)
+bool setDHCPOption(ipmi::Context::ptr& ctx, std::string prop, bool value)
 {
-    std::ifstream jsonFile(configFile);
-    if (!jsonFile.is_open())
+    std::string service;
+    boost::system::error_code ec = ipmi::getService(ctx, dhcpIntf, dhcpObj,
+                                                    service);
+    if (!ec.value())
     {
-        log<level::ERR>("Temperature readings JSON file not found");
-        elog<InternalFailure>();
+        ec = ipmi::setDbusProperty(ctx, service, dhcpObj, dhcpIntf, prop,
+                                   value);
     }
-
-    auto data = Json::parse(jsonFile, nullptr, false);
-    if (data.is_discarded())
-    {
-        log<level::ERR>("Temperature readings JSON parser failure");
-        elog<InternalFailure>();
-    }
-
-    return data;
+    return (!ec.value());
 }
 
 } // namespace dcmi
 
-ipmi_ret_t getPowerLimit(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                         ipmi_request_t request, ipmi_response_t response,
-                         ipmi_data_len_t data_len, ipmi_context_t context)
+constexpr uint8_t exceptionPowerOff = 0x01;
+ipmi::RspType<uint16_t, // reserved
+              uint8_t,  // exception actions
+              uint16_t, // power limit requested in watts
+              uint32_t, // correction time in milliseconds
+              uint16_t, // reserved
+              uint16_t  // statistics sampling period in seconds
+              >
+    getPowerLimit(ipmi::Context::ptr ctx, uint16_t reserved)
 {
     if (!dcmi::isDCMIPowerMgmtSupported())
     {
-        *data_len = 0;
-        log<level::ERR>("DCMI Power management is unsupported!");
-        return IPMI_CC_INVALID;
+        return ipmi::responseInvalidCommand();
     }
-
-    std::vector<uint8_t> outPayload(sizeof(dcmi::GetPowerLimitResponse));
-    auto responseData =
-        reinterpret_cast<dcmi::GetPowerLimitResponse*>(outPayload.data());
-
-    sdbusplus::bus::bus sdbus{ipmid_get_sd_bus_connection()};
-    uint32_t pcapValue = 0;
-    bool pcapEnable = false;
-
-    try
+    if (reserved)
     {
-        pcapValue = dcmi::getPcap(sdbus);
-        pcapEnable = dcmi::getPcapEnabled(sdbus);
+        return ipmi::responseInvalidFieldRequest();
     }
-    catch (const InternalFailure& e)
+
+    std::optional<uint16_t> pcapValue = dcmi::getPcap(ctx);
+    std::optional<bool> pcapEnable = dcmi::getPcapEnabled(ctx);
+    if (!pcapValue || !pcapEnable)
     {
-        *data_len = 0;
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ipmi::responseUnspecifiedError();
     }
 
+    constexpr uint16_t reserved1{};
+    constexpr uint16_t reserved2{};
     /*
      * Exception action if power limit is exceeded and cannot be controlled
      * with the correction time limit is hardcoded to Hard Power Off system
      * and log event to SEL.
      */
-    constexpr auto exception = 0x01;
-    responseData->exceptionAction = exception;
-
-    responseData->powerLimit = static_cast<uint16_t>(pcapValue);
-
+    constexpr uint8_t exception = exceptionPowerOff;
     /*
      * Correction time limit and Statistics sampling period is currently not
      * populated.
      */
-
-    *data_len = outPayload.size();
-    memcpy(response, outPayload.data(), *data_len);
-
-    if (pcapEnable)
+    constexpr uint32_t correctionTime{};
+    constexpr uint16_t statsPeriod{};
+    if (!pcapEnable)
     {
-        return IPMI_CC_OK;
-    }
-    else
-    {
-        return IPMI_DCMI_CC_NO_ACTIVE_POWER_LIMIT;
+        constexpr ipmi::Cc responseNoPowerLimitSet = 0x80;
+        constexpr uint16_t noPcap{};
+        return ipmi::response(responseNoPowerLimitSet, reserved1, exception,
+                              noPcap, correctionTime, reserved2, statsPeriod);
     }
+    return ipmi::responseSuccess(reserved1, exception, *pcapValue,
+                                 correctionTime, reserved2, statsPeriod);
 }
 
-ipmi_ret_t setPowerLimit(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                         ipmi_request_t request, ipmi_response_t response,
-                         ipmi_data_len_t data_len, ipmi_context_t context)
+ipmi::RspType<> setPowerLimit(ipmi::Context::ptr& ctx, uint16_t reserved1,
+                              uint8_t exceptionAction, uint16_t powerLimit,
+                              uint32_t correctionTime, uint16_t reserved2,
+                              uint16_t statsPeriod)
 {
     if (!dcmi::isDCMIPowerMgmtSupported())
     {
-        *data_len = 0;
         log<level::ERR>("DCMI Power management is unsupported!");
-        return IPMI_CC_INVALID;
+        return ipmi::responseInvalidCommand();
     }
 
-    auto requestData =
-        reinterpret_cast<const dcmi::SetPowerLimitRequest*>(request);
-
-    sdbusplus::bus::bus sdbus{ipmid_get_sd_bus_connection()};
-
-    // Only process the power limit requested in watts.
-    try
+    // Only process the power limit requested in watts. Return errors
+    // for other fields that are set
+    if (reserved1 || reserved2 || correctionTime || statsPeriod ||
+        exceptionAction != exceptionPowerOff)
     {
-        dcmi::setPcap(sdbus, requestData->powerLimit);
+        return ipmi::responseInvalidFieldRequest();
     }
-    catch (const InternalFailure& e)
+
+    if (!dcmi::setPcap(ctx, powerLimit))
     {
-        *data_len = 0;
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ipmi::responseUnspecifiedError();
     }
 
-    log<level::INFO>("Set Power Cap",
-                     entry("POWERCAP=%u", requestData->powerLimit));
+    log<level::INFO>("Set Power Cap", entry("POWERCAP=%u", powerLimit));
 
-    *data_len = 0;
-    return IPMI_CC_OK;
+    return ipmi::responseSuccess();
 }
 
-ipmi_ret_t applyPowerLimit(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                           ipmi_request_t request, ipmi_response_t response,
-                           ipmi_data_len_t data_len, ipmi_context_t context)
+ipmi::RspType<> applyPowerLimit(ipmi::Context::ptr& ctx, bool enabled,
+                                uint7_t reserved1, uint16_t reserved2)
 {
     if (!dcmi::isDCMIPowerMgmtSupported())
     {
-        *data_len = 0;
         log<level::ERR>("DCMI Power management is unsupported!");
-        return IPMI_CC_INVALID;
+        return ipmi::responseInvalidCommand();
     }
-
-    auto requestData =
-        reinterpret_cast<const dcmi::ApplyPowerLimitRequest*>(request);
-
-    sdbusplus::bus::bus sdbus{ipmid_get_sd_bus_connection()};
-
-    try
+    if (reserved1 || reserved2)
     {
-        dcmi::setPcapEnable(sdbus,
-                            static_cast<bool>(requestData->powerLimitAction));
+        return ipmi::responseInvalidFieldRequest();
     }
-    catch (const InternalFailure& e)
+
+    if (!dcmi::setPcapEnable(ctx, enabled))
     {
-        *data_len = 0;
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ipmi::responseUnspecifiedError();
     }
 
     log<level::INFO>("Set Power Cap Enable",
-                     entry("POWERCAPENABLE=%u", requestData->powerLimitAction));
+                     entry("POWERCAPENABLE=%u", static_cast<uint8_t>(enabled)));
 
-    *data_len = 0;
-    return IPMI_CC_OK;
+    return ipmi::responseSuccess();
 }
 
-ipmi_ret_t getAssetTag(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                       ipmi_request_t request, ipmi_response_t response,
-                       ipmi_data_len_t data_len, ipmi_context_t context)
+ipmi::RspType<uint8_t,          // total tag length
+              std::vector<char> // tag data
+              >
+    getAssetTag(ipmi::Context::ptr& ctx, uint8_t offset, uint8_t count)
 {
-    auto requestData =
-        reinterpret_cast<const dcmi::GetAssetTagRequest*>(request);
-    std::vector<uint8_t> outPayload(sizeof(dcmi::GetAssetTagResponse));
-    auto responseData =
-        reinterpret_cast<dcmi::GetAssetTagResponse*>(outPayload.data());
-
-    // Verify offset to read and number of bytes to read are not exceeding the
-    // range.
-    if ((requestData->offset > dcmi::assetTagMaxOffset) ||
-        (requestData->bytes > dcmi::maxBytes) ||
-        ((requestData->offset + requestData->bytes) > dcmi::assetTagMaxSize))
-    {
-        *data_len = 0;
-        return IPMI_CC_PARM_OUT_OF_RANGE;
-    }
-
-    std::string assetTag;
-
-    try
-    {
-        assetTag = dcmi::readAssetTag();
-    }
-    catch (const InternalFailure& e)
+    // Verify offset to read and number of bytes to read are not exceeding
+    // the range.
+    if ((offset > dcmi::assetTagMaxOffset) || (count > dcmi::maxBytes) ||
+        ((offset + count) > dcmi::assetTagMaxSize))
     {
-        *data_len = 0;
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ipmi::responseParmOutOfRange();
     }
 
-    // Return if the asset tag is not populated.
-    if (!assetTag.size())
+    std::optional<std::string> assetTagResp = dcmi::readAssetTag(ctx);
+    if (!assetTagResp)
     {
-        responseData->tagLength = 0;
-        memcpy(response, outPayload.data(), outPayload.size());
-        *data_len = outPayload.size();
-        return IPMI_CC_OK;
+        return ipmi::responseUnspecifiedError();
     }
 
-    // If the asset tag is longer than 63 bytes, restrict it to 63 bytes to suit
-    // Get Asset Tag command.
+    std::string& assetTag = assetTagResp.value();
+    // If the asset tag is longer than 63 bytes, restrict it to 63 bytes to
+    // suit Get Asset Tag command.
     if (assetTag.size() > dcmi::assetTagMaxSize)
     {
         assetTag.resize(dcmi::assetTagMaxSize);
     }
 
-    // If the requested offset is beyond the asset tag size.
-    if (requestData->offset >= assetTag.size())
+    if (offset >= assetTag.size())
     {
-        *data_len = 0;
-        return IPMI_CC_PARM_OUT_OF_RANGE;
+        return ipmi::responseParmOutOfRange();
     }
 
-    auto returnData = assetTag.substr(requestData->offset, requestData->bytes);
-
-    responseData->tagLength = assetTag.size();
+    // silently truncate reads beyond the end of assetTag
+    if ((offset + count) >= assetTag.size())
+    {
+        count = assetTag.size() - offset;
+    }
 
-    memcpy(response, outPayload.data(), outPayload.size());
-    memcpy(static_cast<uint8_t*>(response) + outPayload.size(),
-           returnData.data(), returnData.size());
-    *data_len = outPayload.size() + returnData.size();
+    auto totalTagSize = static_cast<uint8_t>(assetTag.size());
+    std::vector<char> data{assetTag.begin() + offset,
+                           assetTag.begin() + offset + count};
 
-    return IPMI_CC_OK;
+    return ipmi::responseSuccess(totalTagSize, data);
 }
 
-ipmi_ret_t setAssetTag(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                       ipmi_request_t request, ipmi_response_t response,
-                       ipmi_data_len_t data_len, ipmi_context_t context)
+ipmi::RspType<uint8_t // new asset tag length
+              >
+    setAssetTag(ipmi::Context::ptr& ctx, uint8_t offset, uint8_t count,
+                const std::vector<char>& data)
 {
-    auto requestData =
-        reinterpret_cast<const dcmi::SetAssetTagRequest*>(request);
-    std::vector<uint8_t> outPayload(sizeof(dcmi::SetAssetTagResponse));
-    auto responseData =
-        reinterpret_cast<dcmi::SetAssetTagResponse*>(outPayload.data());
-
-    // Verify offset to read and number of bytes to read are not exceeding the
-    // range.
-    if ((requestData->offset > dcmi::assetTagMaxOffset) ||
-        (requestData->bytes > dcmi::maxBytes) ||
-        ((requestData->offset + requestData->bytes) > dcmi::assetTagMaxSize))
+    // Verify offset to read and number of bytes to read are not exceeding
+    // the range.
+    if ((offset > dcmi::assetTagMaxOffset) || (count > dcmi::maxBytes) ||
+        ((offset + count) > dcmi::assetTagMaxSize))
     {
-        *data_len = 0;
-        return IPMI_CC_PARM_OUT_OF_RANGE;
+        return ipmi::responseParmOutOfRange();
     }
-
-    std::string assetTag;
-
-    try
+    if (data.size() != count)
     {
-        assetTag = dcmi::readAssetTag();
+        return ipmi::responseReqDataLenInvalid();
+    }
 
-        if (requestData->offset > assetTag.size())
-        {
-            *data_len = 0;
-            return IPMI_CC_PARM_OUT_OF_RANGE;
-        }
+    std::optional<std::string> assetTagResp = dcmi::readAssetTag(ctx);
+    if (!assetTagResp)
+    {
+        return ipmi::responseUnspecifiedError();
+    }
 
-        assetTag.replace(requestData->offset,
-                         assetTag.size() - requestData->offset,
-                         static_cast<const char*>(request) +
-                             sizeof(dcmi::SetAssetTagRequest),
-                         requestData->bytes);
+    std::string& assetTag = assetTagResp.value();
 
-        dcmi::writeAssetTag(assetTag);
+    if (offset > assetTag.size())
+    {
+        return ipmi::responseParmOutOfRange();
+    }
 
-        responseData->tagLength = assetTag.size();
-        memcpy(response, outPayload.data(), outPayload.size());
-        *data_len = outPayload.size();
+    // operation is to truncate at offset and append new data
+    assetTag.resize(offset);
+    assetTag.append(data.begin(), data.end());
 
-        return IPMI_CC_OK;
-    }
-    catch (const InternalFailure& e)
+    if (!dcmi::writeAssetTag(ctx, assetTag))
     {
-        *data_len = 0;
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ipmi::responseUnspecifiedError();
     }
+
+    auto totalTagSize = static_cast<uint8_t>(assetTag.size());
+    return ipmi::responseSuccess(totalTagSize);
 }
 
-ipmi_ret_t getMgmntCtrlIdStr(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                             ipmi_request_t request, ipmi_response_t response,
-                             ipmi_data_len_t data_len, ipmi_context_t context)
+ipmi::RspType<uint8_t,          // length
+              std::vector<char> // data
+              >
+    getMgmntCtrlIdStr(ipmi::Context::ptr& ctx, uint8_t offset, uint8_t count)
 {
-    auto requestData =
-        reinterpret_cast<const dcmi::GetMgmntCtrlIdStrRequest*>(request);
-    auto responseData =
-        reinterpret_cast<dcmi::GetMgmntCtrlIdStrResponse*>(response);
-    std::string hostName;
-
-    *data_len = 0;
+    if (count > dcmi::maxBytes || offset + count > dcmi::maxCtrlIdStrLen)
+    {
+        return ipmi::responseParmOutOfRange();
+    }
 
-    if (requestData->bytes > dcmi::maxBytes ||
-        requestData->offset + requestData->bytes > dcmi::maxCtrlIdStrLen)
+    std::optional<std::string> hostnameResp = dcmi::getHostName(ctx);
+    if (!hostnameResp)
     {
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ipmi::responseUnspecifiedError();
     }
 
-    try
+    std::string& hostname = hostnameResp.value();
+    // If the id string is longer than 63 bytes, restrict it to 63 bytes to
+    // suit set management ctrl str  command.
+    if (hostname.size() > dcmi::maxCtrlIdStrLen)
     {
-        hostName = dcmi::getHostName();
+        hostname.resize(dcmi::maxCtrlIdStrLen);
     }
-    catch (const InternalFailure& e)
+
+    if (offset >= hostname.size())
     {
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ipmi::responseParmOutOfRange();
     }
 
-    if (requestData->offset > hostName.length())
+    // silently truncate reads beyond the end of hostname
+    if ((offset + count) >= hostname.size())
     {
-        return IPMI_CC_PARM_OUT_OF_RANGE;
+        count = hostname.size() - offset;
     }
-    auto responseStr = hostName.substr(requestData->offset, requestData->bytes);
-    auto responseStrLen = std::min(static_cast<std::size_t>(requestData->bytes),
-                                   responseStr.length() + 1);
-    responseData->strLen = hostName.length();
-    std::copy(begin(responseStr), end(responseStr), responseData->data);
 
-    *data_len = sizeof(*responseData) + responseStrLen;
-    return IPMI_CC_OK;
+    auto nameSize = static_cast<uint8_t>(hostname.size());
+    std::vector<char> data{hostname.begin() + offset,
+                           hostname.begin() + offset + count};
+
+    return ipmi::responseSuccess(nameSize, data);
 }
 
-ipmi_ret_t setMgmntCtrlIdStr(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                             ipmi_request_t request, ipmi_response_t response,
-                             ipmi_data_len_t data_len, ipmi_context_t context)
+ipmi::RspType<uint8_t> setMgmntCtrlIdStr(ipmi::Context::ptr& ctx,
+                                         uint8_t offset, uint8_t count,
+                                         std::vector<char> data)
 {
-    static std::array<char, dcmi::maxCtrlIdStrLen + 1> newCtrlIdStr;
-
-    auto requestData =
-        reinterpret_cast<const dcmi::SetMgmntCtrlIdStrRequest*>(request);
-    auto responseData =
-        reinterpret_cast<dcmi::SetMgmntCtrlIdStrResponse*>(response);
-
-    *data_len = 0;
-
-    if (requestData->bytes > dcmi::maxBytes ||
-        requestData->offset + requestData->bytes > dcmi::maxCtrlIdStrLen + 1 ||
-        (requestData->offset + requestData->bytes ==
-             dcmi::maxCtrlIdStrLen + 1 &&
-         requestData->data[requestData->bytes - 1] != '\0'))
+    if ((offset > dcmi::maxCtrlIdStrLen) || (count > dcmi::maxBytes) ||
+        ((offset + count) > dcmi::maxCtrlIdStrLen))
     {
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        return ipmi::responseParmOutOfRange();
+    }
+    if (data.size() != count)
+    {
+        return ipmi::responseReqDataLenInvalid();
+    }
+    bool terminalWrite{data.back() == '\0'};
+    if (terminalWrite)
+    {
+        // remove the null termination from the data (no need with std::string)
+        data.resize(count - 1);
     }
 
-    try
+    static std::string hostname{};
+    // read in the current value if not starting at offset 0
+    if (hostname.size() == 0 && offset != 0)
     {
-        /* if there is no old value and offset is not 0 */
-        if (newCtrlIdStr[0] == '\0' && requestData->offset != 0)
+        /* read old ctrlIdStr */
+        std::optional<std::string> hostnameResp = dcmi::getHostName(ctx);
+        if (!hostnameResp)
         {
-            /* read old ctrlIdStr */
-            auto hostName = dcmi::getHostName();
-            hostName.resize(dcmi::maxCtrlIdStrLen);
-            std::copy(begin(hostName), end(hostName), begin(newCtrlIdStr));
-            newCtrlIdStr[hostName.length()] = '\0';
+            return ipmi::responseUnspecifiedError();
         }
+        hostname = hostnameResp.value();
+        hostname.resize(offset);
+    }
 
-        /* replace part of string and mark byte after the last as \0 */
-        auto restStrIter =
-            std::copy_n(requestData->data, requestData->bytes,
-                        begin(newCtrlIdStr) + requestData->offset);
-        /* if the last written byte is not 64th - add '\0' */
-        if (requestData->offset + requestData->bytes <= dcmi::maxCtrlIdStrLen)
-        {
-            *restStrIter = '\0';
-        }
+    // operation is to truncate at offset and append new data
+    hostname.append(data.begin(), data.end());
 
-        /* if input data contains '\0' whole string is sent - update hostname */
-        auto it = std::find(requestData->data,
-                            requestData->data + requestData->bytes, '\0');
-        if (it != requestData->data + requestData->bytes)
+    // do the update if this is the last write
+    if (terminalWrite)
+    {
+        boost::system::error_code ec = ipmi::setDbusProperty(
+            ctx, dcmi::networkServiceName, dcmi::networkConfigObj,
+            dcmi::networkConfigIntf, dcmi::hostNameProp, hostname);
+        hostname.clear();
+        if (ec.value())
         {
-            sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
-            ipmi::setDbusProperty(bus, dcmi::networkServiceName,
-                                  dcmi::networkConfigObj,
-                                  dcmi::networkConfigIntf, dcmi::hostNameProp,
-                                  std::string(newCtrlIdStr.data()));
+            return ipmi::responseUnspecifiedError();
         }
     }
-    catch (const InternalFailure& e)
-    {
-        *data_len = 0;
-        return IPMI_CC_UNSPECIFIED_ERROR;
-    }
 
-    responseData->offset = requestData->offset + requestData->bytes;
-    *data_len = sizeof(*responseData);
-    return IPMI_CC_OK;
+    auto totalIdSize = static_cast<uint8_t>(offset + count);
+    return ipmi::responseSuccess(totalIdSize);
 }
 
-// List of the capabilities under each parameter
-dcmi::DCMICaps dcmiCaps = {
-    // Supported DCMI Capabilities
-    {dcmi::DCMICapParameters::SUPPORTED_DCMI_CAPS,
-     {3,
-      {{"PowerManagement", 2, 0, 1},
-       {"OOBSecondaryLan", 3, 2, 1},
-       {"SerialTMODE", 3, 1, 1},
-       {"InBandSystemInterfaceChannel", 3, 0, 1}}}},
-    // Mandatory Platform Attributes
-    {dcmi::DCMICapParameters::MANDATORY_PLAT_ATTRIBUTES,
-     {5,
-      {{"SELAutoRollOver", 1, 15, 1},
-       {"FlushEntireSELUponRollOver", 1, 14, 1},
-       {"RecordLevelSELFlushUponRollOver", 1, 13, 1},
-       {"NumberOfSELEntries", 1, 0, 12},
-       {"TempMonitoringSamplingFreq", 5, 0, 8}}}},
-    // Optional Platform Attributes
-    {dcmi::DCMICapParameters::OPTIONAL_PLAT_ATTRIBUTES,
-     {2,
-      {{"PowerMgmtDeviceSlaveAddress", 1, 1, 7},
-       {"BMCChannelNumber", 2, 4, 4},
-       {"DeviceRivision", 2, 0, 4}}}},
-    // Manageability Access Attributes
-    {dcmi::DCMICapParameters::MANAGEABILITY_ACCESS_ATTRIBUTES,
-     {3,
-      {{"MandatoryPrimaryLanOOBSupport", 1, 0, 8},
-       {"OptionalSecondaryLanOOBSupport", 2, 0, 8},
-       {"OptionalSerialOOBMTMODECapability", 3, 0, 8}}}}};
-
-ipmi_ret_t getDCMICapabilities(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                               ipmi_request_t request, ipmi_response_t response,
-                               ipmi_data_len_t data_len, ipmi_context_t context)
+ipmi::RspType<ipmi::message::Payload> getDCMICapabilities(uint8_t parameter)
 {
-
     std::ifstream dcmiCapFile(dcmi::gDCMICapabilitiesConfig);
     if (!dcmiCapFile.is_open())
     {
         log<level::ERR>("DCMI Capabilities file not found");
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ipmi::responseUnspecifiedError();
     }
 
     auto data = nlohmann::json::parse(dcmiCapFile, nullptr, false);
     if (data.is_discarded())
     {
         log<level::ERR>("DCMI Capabilities JSON parser failure");
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ipmi::responseUnspecifiedError();
     }
 
-    auto requestData =
-        reinterpret_cast<const dcmi::GetDCMICapRequest*>(request);
+    constexpr bool reserved1{};
+    constexpr uint5_t reserved5{};
+    constexpr uint7_t reserved7{};
+    constexpr uint8_t reserved8{};
+    constexpr uint16_t reserved16{};
 
-    // get list of capabilities in a parameter
-    auto caps =
-        dcmiCaps.find(static_cast<dcmi::DCMICapParameters>(requestData->param));
-    if (caps == dcmiCaps.end())
-    {
-        log<level::ERR>("Invalid input parameter");
-        return IPMI_CC_INVALID_FIELD_REQUEST;
-    }
+    ipmi::message::Payload payload;
+    payload.pack(dcmi::specMajorVersion, dcmi::specMinorVersion,
+                 dcmi::parameterRevision);
 
-    auto responseData = reinterpret_cast<dcmi::GetDCMICapResponse*>(response);
+    enum class DCMICapParameters : uint8_t
+    {
+        SupportedDcmiCaps = 0x01,             // Supported DCMI Capabilities
+        MandatoryPlatAttributes = 0x02,       // Mandatory Platform Attributes
+        OptionalPlatAttributes = 0x03,        // Optional Platform Attributes
+        ManageabilityAccessAttributes = 0x04, // Manageability Access Attributes
+    };
 
-    // For each capabilities in a parameter fill the data from
-    // the json file based on the capability name.
-    for (auto cap : caps->second.capList)
+    switch (static_cast<DCMICapParameters>(parameter))
     {
-        // If the data is beyond first byte boundary, insert in a
-        // 16bit pattern for example number of SEL entries are represented
-        // in 12bits.
-        if ((cap.length + cap.position) > dcmi::gByteBitSize)
+        case DCMICapParameters::SupportedDcmiCaps:
         {
-            uint16_t val = data.value(cap.name.c_str(), 0);
-            // According to DCMI spec v1.5, max number of SEL entries is
-            // 4096, but bit 12b of DCMI capabilities Mandatory Platform
-            // Attributes field is reserved and therefore we can use only
-            // the provided 12 bits with maximum value of 4095.
-            // We're playing safe here by applying the mask
-            // to ensure that provided value will fit into 12 bits.
-            if (cap.length > dcmi::gByteBitSize)
-            {
-                val &= dcmi::gMaxSELEntriesMask;
-            }
-            val <<= cap.position;
-            responseData->data[cap.bytePosition - 1] |=
-                static_cast<uint8_t>(val);
-            responseData->data[cap.bytePosition] |= val >> dcmi::gByteBitSize;
+            bool powerManagement = data.value("PowerManagement", 0);
+            bool oobSecondaryLan = data.value("OOBSecondaryLan", 0);
+            bool serialTMode = data.value("SerialTMODE", 0);
+            bool inBandSystemInterfaceChannel =
+                data.value("InBandSystemInterfaceChannel", 0);
+            payload.pack(reserved8, powerManagement, reserved7,
+                         inBandSystemInterfaceChannel, serialTMode,
+                         oobSecondaryLan, reserved5);
+            break;
+        }
+            // Mandatory Platform Attributes
+        case DCMICapParameters::MandatoryPlatAttributes:
+        {
+            bool selAutoRollOver = data.value("SELAutoRollOver", 0);
+            bool flushEntireSELUponRollOver =
+                data.value("FlushEntireSELUponRollOver", 0);
+            bool recordLevelSELFlushUponRollOver =
+                data.value("RecordLevelSELFlushUponRollOver", 0);
+            uint12_t numberOfSELEntries = data.value("NumberOfSELEntries",
+                                                     0xcac);
+            uint8_t tempMonitoringSamplingFreq =
+                data.value("TempMonitoringSamplingFreq", 0);
+            payload.pack(numberOfSELEntries, reserved1,
+                         recordLevelSELFlushUponRollOver,
+                         flushEntireSELUponRollOver, selAutoRollOver,
+                         reserved16, tempMonitoringSamplingFreq);
+            break;
+        }
+        // Optional Platform Attributes
+        case DCMICapParameters::OptionalPlatAttributes:
+        {
+            uint7_t powerMgmtDeviceSlaveAddress =
+                data.value("PowerMgmtDeviceSlaveAddress", 0);
+            uint4_t bmcChannelNumber = data.value("BMCChannelNumber", 0);
+            uint4_t deviceRivision = data.value("DeviceRivision", 0);
+            payload.pack(powerMgmtDeviceSlaveAddress, reserved1, deviceRivision,
+                         bmcChannelNumber);
+            break;
         }
-        else
+        // Manageability Access Attributes
+        case DCMICapParameters::ManageabilityAccessAttributes:
         {
-            responseData->data[cap.bytePosition - 1] |=
-                data.value(cap.name.c_str(), 0) << cap.position;
+            uint8_t mandatoryPrimaryLanOOBSupport =
+                data.value("MandatoryPrimaryLanOOBSupport", 0xff);
+            uint8_t optionalSecondaryLanOOBSupport =
+                data.value("OptionalSecondaryLanOOBSupport", 0xff);
+            uint8_t optionalSerialOOBMTMODECapability =
+                data.value("OptionalSerialOOBMTMODECapability", 0xff);
+            payload.pack(mandatoryPrimaryLanOOBSupport,
+                         optionalSecondaryLanOOBSupport,
+                         optionalSerialOOBMTMODECapability);
+            break;
+        }
+        default:
+        {
+            log<level::ERR>("Invalid input parameter");
+            return ipmi::responseInvalidFieldRequest();
         }
     }
 
-    responseData->major = DCMI_SPEC_MAJOR_VERSION;
-    responseData->minor = DCMI_SPEC_MINOR_VERSION;
-    responseData->paramRevision = DCMI_PARAMETER_REVISION;
-    *data_len = sizeof(*responseData) + caps->second.size;
-
-    return IPMI_CC_OK;
+    return ipmi::responseSuccess(payload);
 }
 
 namespace dcmi
@@ -761,20 +719,25 @@ namespace dcmi
 namespace temp_readings
 {
 
-Temperature readTemp(const std::string& dbusService,
-                     const std::string& dbusPath)
+std::tuple<bool, bool, uint8_t> readTemp(ipmi::Context::ptr& ctx,
+                                         const std::string& dbusService,
+                                         const std::string& dbusPath)
 {
     // Read the temperature value from d-bus object. Need some conversion.
-    // As per the interface xyz.openbmc_project.Sensor.Value, the temperature
-    // is an double and in degrees C. It needs to be scaled by using the
-    // formula Value * 10^Scale. The ipmi spec has the temperature as a uint8_t,
-    // with a separate single bit for the sign.
-
-    sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
-    auto result = ipmi::getAllDbusProperties(
-        bus, dbusService, dbusPath, "xyz.openbmc_project.Sensor.Value");
-    auto temperature =
-        std::visit(ipmi::VariantToDoubleVisitor(), result.at("Value"));
+    // As per the interface xyz.openbmc_project.Sensor.Value, the
+    // temperature is an double and in degrees C. It needs to be scaled by
+    // using the formula Value * 10^Scale. The ipmi spec has the temperature
+    // as a uint8_t, with a separate single bit for the sign.
+
+    ipmi::PropertyMap result{};
+    boost::system::error_code ec = ipmi::getAllDbusProperties(
+        ctx, dbusService, dbusPath, "xyz.openbmc_project.Sensor.Value", result);
+    if (ec.value())
+    {
+        return std::make_tuple(false, false, 0);
+    }
+    auto temperature = std::visit(ipmi::VariantToDoubleVisitor(),
+                                  result.at("Value"));
     double absTemp = std::abs(temperature);
 
     auto findFactor = result.find("Scale");
@@ -786,199 +749,222 @@ Temperature readTemp(const std::string& dbusService,
     double scale = std::pow(10, factor);
 
     auto tempDegrees = absTemp * scale;
-    // Max absolute temp as per ipmi spec is 128.
+    // Max absolute temp as per ipmi spec is 127.
+    constexpr auto maxTemp = 127;
     if (tempDegrees > maxTemp)
     {
         tempDegrees = maxTemp;
     }
 
-    return std::make_tuple(static_cast<uint8_t>(tempDegrees),
-                           (temperature < 0));
+    return std::make_tuple(true, (temperature < 0),
+                           static_cast<uint8_t>(tempDegrees));
 }
 
-std::tuple<Response, NumInstances> read(const std::string& type,
-                                        uint8_t instance)
+std::tuple<std::vector<std::tuple<uint7_t, bool, uint8_t>>, uint8_t>
+    read(ipmi::Context::ptr& ctx, const std::string& type, uint8_t instance,
+         size_t count)
 {
-    Response response{};
-    sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
-
-    if (!instance)
-    {
-        log<level::ERR>("Expected non-zero instance");
-        elog<InternalFailure>();
-    }
+    std::vector<std::tuple<uint7_t, bool, uint8_t>> response{};
 
     auto data = parseJSONConfig(gDCMISensorsConfig);
-    static const std::vector<Json> empty{};
-    std::vector<Json> readings = data.value(type, empty);
-    size_t numInstances = readings.size();
+    static const std::vector<nlohmann::json> empty{};
+    std::vector<nlohmann::json> readings = data.value(type, empty);
     for (const auto& j : readings)
     {
+        // Max of 8 response data sets
+        if (response.size() == count)
+        {
+            break;
+        }
+
         uint8_t instanceNum = j.value("instance", 0);
-        // Not the instance we're interested in
-        if (instanceNum != instance)
+        // Not in the instance range we're interested in
+        if (instanceNum < instance)
         {
             continue;
         }
 
         std::string path = j.value("dbus", "");
-        std::string service;
-        try
+        std::string service{};
+        boost::system::error_code ec = ipmi::getService(
+            ctx, "xyz.openbmc_project.Sensor.Value", path, service);
+        if (ec.value())
         {
-            service =
-                ipmi::getService(bus, "xyz.openbmc_project.Sensor.Value", path);
+            // not found on dbus
+            continue;
         }
-        catch (const std::exception& e)
+
+        const auto& [ok, sign, temp] = readTemp(ctx, service, path);
+        if (ok)
         {
-            log<level::DEBUG>(e.what());
-            return std::make_tuple(response, numInstances);
+            response.emplace_back(uint7_t{temp}, sign, instanceNum);
         }
+    }
 
-        response.instance = instance;
-        uint8_t temp{};
-        bool sign{};
-        std::tie(temp, sign) = readTemp(service, path);
-        response.temperature = temp;
-        response.sign = sign;
+    auto totalInstances =
+        static_cast<uint8_t>(std::min(readings.size(), maxInstances));
+    return std::make_tuple(response, totalInstances);
+}
 
-        // Found the instance we're interested in
-        break;
+} // namespace temp_readings
+} // namespace dcmi
+
+ipmi::RspType<uint8_t,                // total instances for entity id
+              uint8_t,                // number of instances in this reply
+              std::vector<            // zero or more of the following two bytes
+                  std::tuple<uint7_t, // temperature value
+                             bool,    // sign bit
+                             uint8_t  // entity instance
+                             >>>
+    getTempReadings(ipmi::Context::ptr& ctx, uint8_t sensorType,
+                    uint8_t entityId, uint8_t entityInstance,
+                    uint8_t instanceStart)
+{
+    auto it = dcmi::entityIdToName.find(entityId);
+    if (it == dcmi::entityIdToName.end())
+    {
+        log<level::ERR>("Unknown Entity ID", entry("ENTITY_ID=%d", entityId));
+        return ipmi::responseInvalidFieldRequest();
     }
 
-    if (numInstances > maxInstances)
+    if (sensorType != dcmi::temperatureSensorType)
     {
-        numInstances = maxInstances;
+        log<level::ERR>("Invalid sensor type",
+                        entry("SENSOR_TYPE=%d", sensorType));
+        return ipmi::responseInvalidFieldRequest();
     }
-    return std::make_tuple(response, numInstances);
+
+    uint8_t requestedRecords = (entityInstance == 0) ? dcmi::maxRecords : 1;
+
+    // Read requested instances
+    const auto& [temps, totalInstances] = dcmi::temp_readings::read(
+        ctx, it->second, instanceStart, requestedRecords);
+
+    auto numInstances = static_cast<uint8_t>(temps.size());
+
+    return ipmi::responseSuccess(totalInstances, numInstances, temps);
 }
 
-std::tuple<ResponseList, NumInstances> readAll(const std::string& type,
-                                               uint8_t instanceStart)
+ipmi::RspType<> setDCMIConfParams(ipmi::Context::ptr& ctx, uint8_t parameter,
+                                  uint8_t setSelector,
+                                  ipmi::message::Payload& payload)
 {
-    ResponseList response{};
-    sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
-
-    size_t numInstances = 0;
-    auto data = parseJSONConfig(gDCMISensorsConfig);
-    static const std::vector<Json> empty{};
-    std::vector<Json> readings = data.value(type, empty);
-    numInstances = readings.size();
-    for (const auto& j : readings)
+    if (setSelector)
     {
-        try
+        return ipmi::responseInvalidFieldRequest();
+    }
+    // Take action based on the Parameter Selector
+    switch (static_cast<dcmi::DCMIConfigParameters>(parameter))
+    {
+        case dcmi::DCMIConfigParameters::ActivateDHCP:
         {
-            // Max of 8 response data sets
-            if (response.size() == maxDataSets)
+            uint7_t reserved{};
+            bool activate{};
+            if (payload.unpack(activate, reserved) || !payload.fullyUnpacked())
             {
-                break;
+                return ipmi::responseReqDataLenInvalid();
             }
-
-            uint8_t instanceNum = j.value("instance", 0);
-            // Not in the instance range we're interested in
-            if (instanceNum < instanceStart)
+            if (reserved)
             {
-                continue;
+                return ipmi::responseInvalidFieldRequest();
             }
-
-            std::string path = j.value("dbus", "");
-            auto service =
-                ipmi::getService(bus, "xyz.openbmc_project.Sensor.Value", path);
-
-            Response r{};
-            r.instance = instanceNum;
-            uint8_t temp{};
-            bool sign{};
-            std::tie(temp, sign) = readTemp(service, path);
-            r.temperature = temp;
-            r.sign = sign;
-            response.push_back(r);
+            std::optional<EthernetInterface::DHCPConf> dhcpEnabled =
+                dcmi::getDHCPEnabled(ctx);
+            if (!dhcpEnabled)
+            {
+                return ipmi::responseUnspecifiedError();
+            }
+            if (activate &&
+                (dhcpEnabled.value() != EthernetInterface::DHCPConf::none))
+            {
+                // When these conditions are met we have to trigger DHCP
+                // protocol restart using the latest parameter settings,
+                // but as per n/w manager design, each time when we
+                // update n/w parameters, n/w service is restarted. So
+                // we no need to take any action in this case.
+            }
+            break;
         }
-        catch (const std::exception& e)
+        case dcmi::DCMIConfigParameters::DiscoveryConfig:
         {
-            log<level::DEBUG>(e.what());
-            continue;
+            bool option12{};
+            uint6_t reserved1{};
+            bool randBackOff{};
+            if (payload.unpack(option12, reserved1, randBackOff) ||
+                !payload.fullyUnpacked())
+            {
+                return ipmi::responseReqDataLenInvalid();
+            }
+            // Systemd-networkd doesn't support Random Back off
+            if (reserved1 || randBackOff)
+            {
+                return ipmi::responseInvalidFieldRequest();
+            }
+            dcmi::setDHCPOption(ctx, dcmi::dhcpOpt12Enabled, option12);
+            break;
         }
-    }
-
-    if (numInstances > maxInstances)
-    {
-        numInstances = maxInstances;
-    }
-    return std::make_tuple(response, numInstances);
+        // Systemd-networkd doesn't allow to configure DHCP timigs
+        case dcmi::DCMIConfigParameters::DHCPTiming1:
+        case dcmi::DCMIConfigParameters::DHCPTiming2:
+        case dcmi::DCMIConfigParameters::DHCPTiming3:
+        default:
+            return ipmi::responseInvalidFieldRequest();
+    }
+    return ipmi::responseSuccess();
 }
 
-} // namespace temp_readings
-} // namespace dcmi
-
-ipmi_ret_t getTempReadings(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                           ipmi_request_t request, ipmi_response_t response,
-                           ipmi_data_len_t data_len, ipmi_context_t context)
+ipmi::RspType<ipmi::message::Payload> getDCMIConfParams(ipmi::Context::ptr& ctx,
+                                                        uint8_t parameter,
+                                                        uint8_t setSelector)
 {
-    auto requestData =
-        reinterpret_cast<const dcmi::GetTempReadingsRequest*>(request);
-    auto responseData =
-        reinterpret_cast<dcmi::GetTempReadingsResponseHdr*>(response);
-
-    if (*data_len != sizeof(dcmi::GetTempReadingsRequest))
+    if (setSelector)
     {
-        log<level::ERR>("Malformed request data",
-                        entry("DATA_SIZE=%d", *data_len));
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
+        return ipmi::responseInvalidFieldRequest();
     }
-    *data_len = 0;
+    ipmi::message::Payload payload;
+    payload.pack(dcmi::specMajorVersion, dcmi::specMinorVersion,
+                 dcmi::configParameterRevision);
 
-    auto it = dcmi::entityIdToName.find(requestData->entityId);
-    if (it == dcmi::entityIdToName.end())
+    // Take action based on the Parameter Selector
+    switch (static_cast<dcmi::DCMIConfigParameters>(parameter))
     {
-        log<level::ERR>("Unknown Entity ID",
-                        entry("ENTITY_ID=%d", requestData->entityId));
-        return IPMI_CC_INVALID_FIELD_REQUEST;
-    }
-
-    if (requestData->sensorType != dcmi::temperatureSensorType)
-    {
-        log<level::ERR>("Invalid sensor type",
-                        entry("SENSOR_TYPE=%d", requestData->sensorType));
-        return IPMI_CC_INVALID_FIELD_REQUEST;
-    }
-
-    dcmi::temp_readings::ResponseList temps{};
-    try
-    {
-        if (!requestData->entityInstance)
+        case dcmi::DCMIConfigParameters::ActivateDHCP:
+            payload.pack(dcmi::activateDhcpReply);
+            break;
+        case dcmi::DCMIConfigParameters::DiscoveryConfig:
         {
-            // Read all instances
-            std::tie(temps, responseData->numInstances) =
-                dcmi::temp_readings::readAll(it->second,
-                                             requestData->instanceStart);
-        }
-        else
-        {
-            // Read one instance
-            temps.resize(1);
-            std::tie(temps[0], responseData->numInstances) =
-                dcmi::temp_readings::read(it->second,
-                                          requestData->entityInstance);
+            uint8_t discovery{};
+            std::optional<bool> enabled =
+                dcmi::getDHCPOption(ctx, dcmi::dhcpOpt12Enabled);
+            if (!enabled.has_value())
+            {
+                return ipmi::responseUnspecifiedError();
+            }
+            if (enabled.value())
+            {
+                discovery = dcmi::option12Mask;
+            }
+            payload.pack(discovery);
+            break;
         }
-        responseData->numDataSets = temps.size();
-    }
-    catch (const InternalFailure& e)
-    {
-        return IPMI_CC_UNSPECIFIED_ERROR;
-    }
-
-    size_t payloadSize = temps.size() * sizeof(dcmi::temp_readings::Response);
-    if (!temps.empty())
-    {
-        memcpy(responseData + 1, // copy payload right after the response header
-               temps.data(), payloadSize);
-    }
-    *data_len = sizeof(dcmi::GetTempReadingsResponseHdr) + payloadSize;
-
-    return IPMI_CC_OK;
+        // Get below values from Systemd-networkd source code
+        case dcmi::DCMIConfigParameters::DHCPTiming1:
+            payload.pack(dcmi::dhcpTiming1);
+            break;
+        case dcmi::DCMIConfigParameters::DHCPTiming2:
+            payload.pack(dcmi::dhcpTiming2);
+            break;
+        case dcmi::DCMIConfigParameters::DHCPTiming3:
+            payload.pack(dcmi::dhcpTiming3);
+            break;
+        default:
+            return ipmi::responseInvalidFieldRequest();
+    }
+
+    return ipmi::responseSuccess();
 }
 
-int64_t getPowerReading(sdbusplus::bus::bus& bus)
+static std::optional<uint16_t> readPower(ipmi::Context::ptr& ctx)
 {
     std::ifstream sensorFile(POWER_READING_SENSOR);
     std::string objectPath;
@@ -986,7 +972,7 @@ int64_t getPowerReading(sdbusplus::bus::bus& bus)
     {
         log<level::ERR>("Power reading configuration file not found",
                         entry("POWER_SENSOR_FILE=%s", POWER_READING_SENSOR));
-        elog<InternalFailure>();
+        return std::nullopt;
     }
 
     auto data = nlohmann::json::parse(sensorFile, nullptr, false);
@@ -994,7 +980,7 @@ int64_t getPowerReading(sdbusplus::bus::bus& bus)
     {
         log<level::ERR>("Error in parsing configuration file",
                         entry("POWER_SENSOR_FILE=%s", POWER_READING_SENSOR));
-        elog<InternalFailure>();
+        return std::nullopt;
     }
 
     objectPath = data.value("path", "");
@@ -1002,215 +988,93 @@ int64_t getPowerReading(sdbusplus::bus::bus& bus)
     {
         log<level::ERR>("Power sensor D-Bus object path is empty",
                         entry("POWER_SENSOR_FILE=%s", POWER_READING_SENSOR));
-        elog<InternalFailure>();
+        return std::nullopt;
     }
 
     // Return default value if failed to read from D-Bus object
-    int64_t power = 0;
-    try
+    std::string service{};
+    boost::system::error_code ec = ipmi::getService(ctx, dcmi::sensorValueIntf,
+                                                    objectPath, service);
+    if (ec.value())
     {
-        auto service = ipmi::getService(bus, SENSOR_VALUE_INTF, objectPath);
-
-        // Read the sensor value and scale properties
-        auto properties = ipmi::getAllDbusProperties(bus, service, objectPath,
-                                                     SENSOR_VALUE_INTF);
-        auto value = std::get<int64_t>(properties[SENSOR_VALUE_PROP]);
-        auto scale = std::get<int64_t>(properties[SENSOR_SCALE_PROP]);
-
-        // Power reading needs to be scaled with the Scale value using the
-        // formula Value * 10^Scale.
-        power = value * std::pow(10, scale);
+        log<level::ERR>("Failed to fetch service for D-Bus object",
+                        entry("OBJECT_PATH=%s", objectPath.c_str()),
+                        entry("INTERFACE=%s", dcmi::sensorValueIntf));
+        return std::nullopt;
     }
-    catch (const std::exception& e)
+
+    // Read the sensor value and scale properties
+    double value{};
+    ec = ipmi::getDbusProperty(ctx, service, objectPath, dcmi::sensorValueIntf,
+                               dcmi::sensorValueProp, value);
+    if (ec.value())
     {
-        log<level::INFO>("Failure to read power value from D-Bus object",
-                         entry("OBJECT_PATH=%s", objectPath.c_str()),
-                         entry("INTERFACE=%s", SENSOR_VALUE_INTF));
+        log<level::ERR>("Failure to read power value from D-Bus object",
+                        entry("OBJECT_PATH=%s", objectPath.c_str()),
+                        entry("INTERFACE=%s", dcmi::sensorValueIntf));
+        return std::nullopt;
     }
+    auto power = static_cast<uint16_t>(value);
     return power;
 }
 
-ipmi_ret_t setDCMIConfParams(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                             ipmi_request_t request, ipmi_response_t response,
-                             ipmi_data_len_t data_len, ipmi_context_t context)
+ipmi::RspType<uint16_t, // current power
+              uint16_t, // minimum power
+              uint16_t, // maximum power
+              uint16_t, // average power
+              uint32_t, // timestamp
+              uint32_t, // sample period ms
+              uint6_t,  // reserved
+              bool,     // power measurement active
+              bool      // reserved
+              >
+    getPowerReading(ipmi::Context::ptr& ctx, uint8_t mode, uint8_t attributes,
+                    uint8_t reserved)
 {
-    auto requestData =
-        reinterpret_cast<const dcmi::SetConfParamsRequest*>(request);
-
-    if (*data_len < DCMI_SET_CONF_PARAM_REQ_PACKET_MIN_SIZE ||
-        *data_len > DCMI_SET_CONF_PARAM_REQ_PACKET_MAX_SIZE)
-    {
-        log<level::ERR>("Invalid Requested Packet size",
-                        entry("PACKET SIZE=%d", *data_len));
-        *data_len = 0;
-        return IPMI_CC_INVALID_FIELD_REQUEST;
-    }
-    *data_len = 0;
-
-    try
+    if (!dcmi::isDCMIPowerMgmtSupported())
     {
-        // Take action based on the Parameter Selector
-        switch (
-            static_cast<dcmi::DCMIConfigParameters>(requestData->paramSelect))
-        {
-            case dcmi::DCMIConfigParameters::ActivateDHCP:
-
-                if ((requestData->data[0] & DCMI_ACTIVATE_DHCP_MASK) &&
-                    dcmi::getDHCPEnabled())
-                {
-                    // When these conditions are met we have to trigger DHCP
-                    // protocol restart using the latest parameter settings, but
-                    // as per n/w manager design, each time when we update n/w
-                    // parameters, n/w service is restarted. So we no need to
-                    // take any action in this case.
-                }
-                break;
-
-            case dcmi::DCMIConfigParameters::DiscoveryConfig:
-
-                if (requestData->data[0] & DCMI_OPTION_12_MASK)
-                {
-                    dcmi::setDHCPOption(DHCP_OPT12_ENABLED, true);
-                }
-                else
-                {
-                    dcmi::setDHCPOption(DHCP_OPT12_ENABLED, false);
-                }
-
-                // Systemd-networkd doesn't support Random Back off
-                if (requestData->data[0] & DCMI_RAND_BACK_OFF_MASK)
-                {
-                    return IPMI_CC_INVALID;
-                }
-                break;
-            // Systemd-networkd doesn't allow to configure DHCP timigs
-            case dcmi::DCMIConfigParameters::DHCPTiming1:
-            case dcmi::DCMIConfigParameters::DHCPTiming2:
-            case dcmi::DCMIConfigParameters::DHCPTiming3:
-            default:
-                return IPMI_CC_INVALID;
-        }
+        log<level::ERR>("DCMI Power management is unsupported!");
+        return ipmi::responseInvalidCommand();
     }
-    catch (const std::exception& e)
+    if (reserved)
     {
-        log<level::ERR>(e.what());
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ipmi::responseInvalidFieldRequest();
     }
-    return IPMI_CC_OK;
-}
 
-ipmi_ret_t getDCMIConfParams(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                             ipmi_request_t request, ipmi_response_t response,
-                             ipmi_data_len_t data_len, ipmi_context_t context)
-{
-
-    auto requestData =
-        reinterpret_cast<const dcmi::GetConfParamsRequest*>(request);
-    auto responseData =
-        reinterpret_cast<dcmi::GetConfParamsResponse*>(response);
-
-    responseData->data[0] = 0x00;
-
-    if (*data_len != sizeof(dcmi::GetConfParamsRequest))
+    enum class PowerMode : uint8_t
     {
-        log<level::ERR>("Invalid Requested Packet size",
-                        entry("PACKET SIZE=%d", *data_len));
-        return IPMI_CC_INVALID_FIELD_REQUEST;
-    }
-
-    *data_len = 0;
+        SystemPowerStatistics = 1,
+        EnhancedSystemPowerStatistics = 2,
+    };
 
-    try
+    if (static_cast<PowerMode>(mode) != PowerMode::SystemPowerStatistics)
     {
-        // Take action based on the Parameter Selector
-        switch (
-            static_cast<dcmi::DCMIConfigParameters>(requestData->paramSelect))
-        {
-            case dcmi::DCMIConfigParameters::ActivateDHCP:
-                responseData->data[0] = DCMI_ACTIVATE_DHCP_REPLY;
-                *data_len = sizeof(dcmi::GetConfParamsResponse) + 1;
-                break;
-            case dcmi::DCMIConfigParameters::DiscoveryConfig:
-                if (dcmi::getDHCPOption(DHCP_OPT12_ENABLED))
-                {
-                    responseData->data[0] |= DCMI_OPTION_12_MASK;
-                }
-                *data_len = sizeof(dcmi::GetConfParamsResponse) + 1;
-                break;
-            // Get below values from Systemd-networkd source code
-            case dcmi::DCMIConfigParameters::DHCPTiming1:
-                responseData->data[0] = DHCP_TIMING1;
-                *data_len = sizeof(dcmi::GetConfParamsResponse) + 1;
-                break;
-            case dcmi::DCMIConfigParameters::DHCPTiming2:
-                responseData->data[0] = DHCP_TIMING2_LOWER;
-                responseData->data[1] = DHCP_TIMING2_UPPER;
-                *data_len = sizeof(dcmi::GetConfParamsResponse) + 2;
-                break;
-            case dcmi::DCMIConfigParameters::DHCPTiming3:
-                responseData->data[0] = DHCP_TIMING3_LOWER;
-                responseData->data[1] = DHCP_TIMING3_UPPER;
-                *data_len = sizeof(dcmi::GetConfParamsResponse) + 2;
-                break;
-            default:
-                *data_len = 0;
-                return IPMI_CC_INVALID;
-        }
+        return ipmi::responseInvalidFieldRequest();
     }
-    catch (const std::exception& e)
+    if (attributes)
     {
-        log<level::ERR>(e.what());
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ipmi::responseInvalidFieldRequest();
     }
 
-    responseData->major = DCMI_SPEC_MAJOR_VERSION;
-    responseData->minor = DCMI_SPEC_MINOR_VERSION;
-    responseData->paramRevision = DCMI_CONFIG_PARAMETER_REVISION;
-
-    return IPMI_CC_OK;
-}
-
-ipmi_ret_t getPowerReading(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                           ipmi_request_t request, ipmi_response_t response,
-                           ipmi_data_len_t data_len, ipmi_context_t context)
-{
-    *data_len = 0;
-    if (!dcmi::isDCMIPowerMgmtSupported())
+    std::optional<uint16_t> powerResp = readPower(ctx);
+    if (!powerResp)
     {
-        log<level::ERR>("DCMI Power management is unsupported!");
-        return IPMI_CC_INVALID;
-    }
-
-    ipmi_ret_t rc = IPMI_CC_OK;
-    auto responseData =
-        reinterpret_cast<dcmi::GetPowerReadingResponse*>(response);
-
-    sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
-    int64_t power = 0;
-    try
-    {
-        power = getPowerReading(bus);
-    }
-    catch (const InternalFailure& e)
-    {
-        log<level::ERR>("Error in reading power sensor value",
-                        entry("INTERFACE=%s", SENSOR_VALUE_INTF),
-                        entry("PROPERTY=%s", SENSOR_VALUE_PROP));
-        return IPMI_CC_UNSPECIFIED_ERROR;
+        return ipmi::responseUnspecifiedError();
     }
+    auto& power = powerResp.value();
 
     // TODO: openbmc/openbmc#2819
     // Minimum, Maximum, Average power, TimeFrame, TimeStamp,
     // PowerReadingState readings need to be populated
     // after Telemetry changes.
-    uint16_t totalPower = static_cast<uint16_t>(power);
-    responseData->currentPower = totalPower;
-    responseData->minimumPower = totalPower;
-    responseData->maximumPower = totalPower;
-    responseData->averagePower = totalPower;
-
-    *data_len = sizeof(*responseData);
-    return rc;
+    constexpr uint32_t samplePeriod = 1;
+    constexpr uint6_t reserved1 = 0;
+    constexpr bool measurementActive = true;
+    constexpr bool reserved2 = false;
+    auto timestamp = static_cast<uint32_t>(time(nullptr));
+    return ipmi::responseSuccess(power, power, power, power, timestamp,
+                                 samplePeriod, reserved1, measurementActive,
+                                 reserved2);
 }
 
 namespace dcmi
@@ -1218,237 +1082,139 @@ namespace dcmi
 namespace sensor_info
 {
 
-Response createFromJson(const Json& config)
-{
-    Response response{};
-    uint16_t recordId = config.value("record_id", 0);
-    response.recordIdLsb = recordId & 0xFF;
-    response.recordIdMsb = (recordId >> 8) & 0xFF;
-    return response;
-}
-
-std::tuple<Response, NumInstances> read(const std::string& type,
-                                        uint8_t instance, const Json& config)
+std::tuple<std::vector<uint16_t>, uint8_t> read(const std::string& type,
+                                                uint8_t instance,
+                                                const nlohmann::json& config,
+                                                uint8_t count)
 {
-    Response response{};
-
-    if (!instance)
-    {
-        log<level::ERR>("Expected non-zero instance");
-        elog<InternalFailure>();
-    }
+    std::vector<uint16_t> responses{};
 
-    static const std::vector<Json> empty{};
-    std::vector<Json> readings = config.value(type, empty);
-    size_t numInstances = readings.size();
+    static const std::vector<nlohmann::json> empty{};
+    std::vector<nlohmann::json> readings = config.value(type, empty);
+    uint8_t totalInstances = std::min(readings.size(), maxInstances);
     for (const auto& reading : readings)
     {
-        uint8_t instanceNum = reading.value("instance", 0);
-        // Not the instance we're interested in
-        if (instanceNum != instance)
+        // limit to requested count
+        if (responses.size() == count)
         {
-            continue;
+            break;
         }
 
-        response = createFromJson(reading);
-
-        // Found the instance we're interested in
-        break;
-    }
-
-    if (numInstances > maxInstances)
-    {
-        log<level::DEBUG>("Trimming IPMI num instances",
-                          entry("NUM_INSTANCES=%d", numInstances));
-        numInstances = maxInstances;
-    }
-    return std::make_tuple(response, numInstances);
-}
-
-std::tuple<ResponseList, NumInstances>
-    readAll(const std::string& type, uint8_t instanceStart, const Json& config)
-{
-    ResponseList responses{};
-
-    size_t numInstances = 0;
-    static const std::vector<Json> empty{};
-    std::vector<Json> readings = config.value(type, empty);
-    numInstances = readings.size();
-    for (const auto& reading : readings)
-    {
-        try
-        {
-            // Max of 8 records
-            if (responses.size() == maxRecords)
-            {
-                break;
-            }
-
-            uint8_t instanceNum = reading.value("instance", 0);
-            // Not in the instance range we're interested in
-            if (instanceNum < instanceStart)
-            {
-                continue;
-            }
-
-            Response response = createFromJson(reading);
-            responses.push_back(response);
-        }
-        catch (const std::exception& e)
+        uint8_t instanceNum = reading.value("instance", 0);
+        // Not in the instance range we're interested in
+        if (instanceNum < instance)
         {
-            log<level::DEBUG>(e.what());
             continue;
         }
-    }
 
-    if (numInstances > maxInstances)
-    {
-        log<level::DEBUG>("Trimming IPMI num instances",
-                          entry("NUM_INSTANCES=%d", numInstances));
-        numInstances = maxInstances;
+        uint16_t recordId = config.value("record_id", 0);
+        responses.emplace_back(recordId);
     }
-    return std::make_tuple(responses, numInstances);
+
+    return std::make_tuple(responses, totalInstances);
 }
 
 } // namespace sensor_info
 } // namespace dcmi
 
-ipmi_ret_t getSensorInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
-                         ipmi_request_t request, ipmi_response_t response,
-                         ipmi_data_len_t data_len, ipmi_context_t context)
+ipmi::RspType<uint8_t,              // total available instances
+              uint8_t,              // number of records in this response
+              std::vector<uint16_t> // records
+              >
+    getSensorInfo(uint8_t sensorType, uint8_t entityId, uint8_t entityInstance,
+                  uint8_t instanceStart)
 {
-    auto requestData =
-        reinterpret_cast<const dcmi::GetSensorInfoRequest*>(request);
-    auto responseData =
-        reinterpret_cast<dcmi::GetSensorInfoResponseHdr*>(response);
-
-    if (*data_len != sizeof(dcmi::GetSensorInfoRequest))
-    {
-        log<level::ERR>("Malformed request data",
-                        entry("DATA_SIZE=%d", *data_len));
-        return IPMI_CC_REQ_DATA_LEN_INVALID;
-    }
-    *data_len = 0;
-
-    auto it = dcmi::entityIdToName.find(requestData->entityId);
+    auto it = dcmi::entityIdToName.find(entityId);
     if (it == dcmi::entityIdToName.end())
     {
-        log<level::ERR>("Unknown Entity ID",
-                        entry("ENTITY_ID=%d", requestData->entityId));
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+        log<level::ERR>("Unknown Entity ID", entry("ENTITY_ID=%d", entityId));
+        return ipmi::responseInvalidFieldRequest();
     }
 
-    if (requestData->sensorType != dcmi::temperatureSensorType)
+    if (sensorType != dcmi::temperatureSensorType)
     {
         log<level::ERR>("Invalid sensor type",
-                        entry("SENSOR_TYPE=%d", requestData->sensorType));
-        return IPMI_CC_INVALID_FIELD_REQUEST;
+                        entry("SENSOR_TYPE=%d", sensorType));
+        return ipmi::responseInvalidFieldRequest();
     }
 
-    dcmi::sensor_info::ResponseList sensors{};
-    static dcmi::Json config{};
-    static bool parsed = false;
+    nlohmann::json config = dcmi::parseJSONConfig(dcmi::gDCMISensorsConfig);
 
-    try
-    {
-        if (!parsed)
-        {
-            config = dcmi::parseJSONConfig(dcmi::gDCMISensorsConfig);
-            parsed = true;
-        }
-
-        if (!requestData->entityInstance)
-        {
-            // Read all instances
-            std::tie(sensors, responseData->numInstances) =
-                dcmi::sensor_info::readAll(it->second,
-                                           requestData->instanceStart, config);
-        }
-        else
-        {
-            // Read one instance
-            sensors.resize(1);
-            std::tie(sensors[0], responseData->numInstances) =
-                dcmi::sensor_info::read(it->second, requestData->entityInstance,
-                                        config);
-        }
-        responseData->numRecords = sensors.size();
-    }
-    catch (const InternalFailure& e)
-    {
-        return IPMI_CC_UNSPECIFIED_ERROR;
-    }
+    uint8_t requestedRecords = (entityInstance == 0) ? dcmi::maxRecords : 1;
+    // Read requested instances
+    const auto& [sensors, totalInstances] = dcmi::sensor_info::read(
+        it->second, instanceStart, config, requestedRecords);
+    uint8_t numRecords = sensors.size();
 
-    size_t payloadSize = sensors.size() * sizeof(dcmi::sensor_info::Response);
-    if (!sensors.empty())
-    {
-        memcpy(responseData + 1, // copy payload right after the response header
-               sensors.data(), payloadSize);
-    }
-    *data_len = sizeof(dcmi::GetSensorInfoResponseHdr) + payloadSize;
-
-    return IPMI_CC_OK;
+    return ipmi::responseSuccess(totalInstances, numRecords, sensors);
 }
 
 void register_netfn_dcmi_functions()
 {
     // <Get Power Limit>
-
-    ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::GET_POWER_LIMIT, NULL,
-                           getPowerLimit, PRIVILEGE_USER);
+    registerGroupHandler(ipmi::prioOpenBmcBase, ipmi::groupDCMI,
+                         ipmi::dcmi::cmdGetPowerLimit, ipmi::Privilege::User,
+                         getPowerLimit);
 
     // <Set Power Limit>
-
-    ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::SET_POWER_LIMIT, NULL,
-                           setPowerLimit, PRIVILEGE_OPERATOR);
+    registerGroupHandler(ipmi::prioOpenBmcBase, ipmi::groupDCMI,
+                         ipmi::dcmi::cmdSetPowerLimit,
+                         ipmi::Privilege::Operator, setPowerLimit);
 
     // <Activate/Deactivate Power Limit>
-
-    ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::APPLY_POWER_LIMIT,
-                           NULL, applyPowerLimit, PRIVILEGE_OPERATOR);
+    registerGroupHandler(ipmi::prioOpenBmcBase, ipmi::groupDCMI,
+                         ipmi::dcmi::cmdActDeactivatePwrLimit,
+                         ipmi::Privilege::Operator, applyPowerLimit);
 
     // <Get Asset Tag>
-
-    ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::GET_ASSET_TAG, NULL,
-                           getAssetTag, PRIVILEGE_USER);
+    registerGroupHandler(ipmi::prioOpenBmcBase, ipmi::groupDCMI,
+                         ipmi::dcmi::cmdGetAssetTag, ipmi::Privilege::User,
+                         getAssetTag);
 
     // <Set Asset Tag>
-
-    ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::SET_ASSET_TAG, NULL,
-                           setAssetTag, PRIVILEGE_OPERATOR);
+    registerGroupHandler(ipmi::prioOpenBmcBase, ipmi::groupDCMI,
+                         ipmi::dcmi::cmdSetAssetTag, ipmi::Privilege::Operator,
+                         setAssetTag);
 
     // <Get Management Controller Identifier String>
-
-    ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::GET_MGMNT_CTRL_ID_STR,
-                           NULL, getMgmntCtrlIdStr, PRIVILEGE_USER);
+    registerGroupHandler(ipmi::prioOpenBmcBase, ipmi::groupDCMI,
+                         ipmi::dcmi::cmdGetMgmtCntlrIdString,
+                         ipmi::Privilege::User, getMgmntCtrlIdStr);
 
     // <Set Management Controller Identifier String>
-    ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::SET_MGMNT_CTRL_ID_STR,
-                           NULL, setMgmntCtrlIdStr, PRIVILEGE_ADMIN);
+    registerGroupHandler(ipmi::prioOpenBmcBase, ipmi::groupDCMI,
+                         ipmi::dcmi::cmdSetMgmtCntlrIdString,
+                         ipmi::Privilege::Admin, setMgmntCtrlIdStr);
 
     // <Get DCMI capabilities>
-    ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::GET_CAPABILITIES,
-                           NULL, getDCMICapabilities, PRIVILEGE_USER);
+    registerGroupHandler(ipmi::prioOpenBmcBase, ipmi::groupDCMI,
+                         ipmi::dcmi::cmdGetDcmiCapabilitiesInfo,
+                         ipmi::Privilege::User, getDCMICapabilities);
 
     // <Get Temperature Readings>
-    ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::GET_TEMP_READINGS,
-                           NULL, getTempReadings, PRIVILEGE_USER);
+    registerGroupHandler(ipmi::prioOpenBmcBase, ipmi::groupDCMI,
+                         ipmi::dcmi::cmdGetTemperatureReadings,
+                         ipmi::Privilege::User, getTempReadings);
 
     // <Get Power Reading>
-    ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::GET_POWER_READING,
-                           NULL, getPowerReading, PRIVILEGE_USER);
+    registerGroupHandler(ipmi::prioOpenBmcBase, ipmi::groupDCMI,
+                         ipmi::dcmi::cmdGetPowerReading, ipmi::Privilege::User,
+                         getPowerReading);
 
     // <Get Sensor Info>
-    ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::GET_SENSOR_INFO, NULL,
-                           getSensorInfo, PRIVILEGE_USER);
+    registerGroupHandler(ipmi::prioOpenBmcBase, ipmi::groupDCMI,
+                         ipmi::dcmi::cmdGetDcmiSensorInfo,
+                         ipmi::Privilege::Operator, getSensorInfo);
 
     // <Get DCMI Configuration Parameters>
-    ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::GET_CONF_PARAMS, NULL,
-                           getDCMIConfParams, PRIVILEGE_USER);
+    registerGroupHandler(ipmi::prioOpenBmcBase, ipmi::groupDCMI,
+                         ipmi::dcmi::cmdGetDcmiConfigParameters,
+                         ipmi::Privilege::User, getDCMIConfParams);
 
     // <Set DCMI Configuration Parameters>
-    ipmi_register_callback(NETFUN_GRPEXT, dcmi::Commands::SET_CONF_PARAMS, NULL,
-                           setDCMIConfParams, PRIVILEGE_ADMIN);
+    registerGroupHandler(ipmi::prioOpenBmcBase, ipmi::groupDCMI,
+                         ipmi::dcmi::cmdSetDcmiConfigParameters,
+                         ipmi::Privilege::Admin, setDCMIConfParams);
 
     return;
 }
diff --git a/dcmihandler.hpp b/dcmihandler.hpp
index 4f35bc6..5adbd73 100644
--- a/dcmihandler.hpp
+++ b/dcmihandler.hpp
@@ -10,27 +10,6 @@
 namespace dcmi
 {
 
-using NumInstances = size_t;
-using Json = nlohmann::json;
-
-enum Commands
-{
-    // Get capability bits
-    GET_CAPABILITIES = 0x01,
-    GET_POWER_READING = 0x02,
-    GET_POWER_LIMIT = 0x03,
-    SET_POWER_LIMIT = 0x04,
-    APPLY_POWER_LIMIT = 0x05,
-    GET_ASSET_TAG = 0x06,
-    GET_SENSOR_INFO = 0x07,
-    SET_ASSET_TAG = 0x08,
-    GET_MGMNT_CTRL_ID_STR = 0x09,
-    SET_MGMNT_CTRL_ID_STR = 0x0A,
-    GET_TEMP_READINGS = 0x10,
-    SET_CONF_PARAMS = 0x12,
-    GET_CONF_PARAMS = 0x13,
-};
-
 static constexpr auto propIntf = "org.freedesktop.DBus.Properties";
 static constexpr auto assetTagIntf =
     "xyz.openbmc_project.Inventory.Decorator.AssetTag";
@@ -41,7 +20,8 @@ static constexpr auto networkConfigIntf =
     "xyz.openbmc_project.Network.SystemConfiguration";
 static constexpr auto hostNameProp = "HostName";
 static constexpr auto temperatureSensorType = 0x01;
-static constexpr auto maxInstances = 255;
+static constexpr size_t maxInstances = 255;
+static constexpr uint8_t maxRecords = 8;
 static constexpr auto gDCMISensorsConfig =
     "/usr/share/ipmi-providers/dcmi_sensors.json";
 static constexpr auto ethernetIntf =
@@ -61,106 +41,6 @@ static constexpr auto gDCMIPowerMgmtSupported = 0x1;
 static constexpr auto gMaxSELEntriesMask = 0xFFF;
 static constexpr auto gByteBitSize = 8;
 
-namespace assettag
-{
-
-using ObjectPath = std::string;
-using Service = std::string;
-using Interfaces = std::vector<std::string>;
-using ObjectTree = std::map<ObjectPath, std::map<Service, Interfaces>>;
-
-} // namespace assettag
-
-namespace temp_readings
-{
-static constexpr auto maxDataSets = 8;
-static constexpr auto maxTemp = 127; // degrees C
-
-/** @struct Response
- *
- *  DCMI payload for Get Temperature Readings response
- */
-struct Response
-{
-#if BYTE_ORDER == LITTLE_ENDIAN
-    uint8_t temperature : 7; //!< Temperature reading in Celsius
-    uint8_t sign : 1;        //!< Sign bit
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
-    uint8_t sign : 1;        //!< Sign bit
-    uint8_t temperature : 7; //!< Temperature reading in Celsius
-#endif
-    uint8_t instance; //!< Entity instance number
-} __attribute__((packed));
-
-using ResponseList = std::vector<Response>;
-using Value = uint8_t;
-using Sign = bool;
-using Temperature = std::tuple<Value, Sign>;
-} // namespace temp_readings
-
-namespace sensor_info
-{
-static constexpr auto maxRecords = 8;
-
-/** @struct Response
- *
- *  DCMI payload for Get Sensor Info response
- */
-struct Response
-{
-    uint8_t recordIdLsb; //!< SDR record id LS byte
-    uint8_t recordIdMsb; //!< SDR record id MS byte
-} __attribute__((packed));
-
-using ResponseList = std::vector<Response>;
-} // namespace sensor_info
-
-static constexpr auto groupExtId = 0xDC;
-
-static constexpr auto assetTagMaxOffset = 62;
-static constexpr auto assetTagMaxSize = 63;
-static constexpr auto maxBytes = 16;
-static constexpr size_t maxCtrlIdStrLen = 63;
-
-/** @struct GetAssetTagRequest
- *
- *  DCMI payload for Get Asset Tag command request.
- */
-struct GetAssetTagRequest
-{
-    uint8_t offset; //!< Offset to read.
-    uint8_t bytes;  //!< Number of bytes to read.
-} __attribute__((packed));
-
-/** @struct GetAssetTagResponse
- *
- *  DCMI payload for Get Asset Tag command response.
- */
-struct GetAssetTagResponse
-{
-    uint8_t tagLength; //!< Total asset tag length.
-} __attribute__((packed));
-
-/** @struct SetAssetTagRequest
- *
- *  DCMI payload for Set Asset Tag command request.
- */
-struct SetAssetTagRequest
-{
-    uint8_t offset; //!< Offset to write.
-    uint8_t bytes;  //!< Number of bytes to write.
-} __attribute__((packed));
-
-/** @struct SetAssetTagResponse
- *
- *  DCMI payload for Set Asset Tag command response.
- */
-struct SetAssetTagResponse
-{
-    uint8_t tagLength; //!< Total asset tag length.
-} __attribute__((packed));
-
 /** @brief Check whether DCMI power management is supported
  *         in the DCMI Capabilities config file.
  *
@@ -168,416 +48,4 @@ struct SetAssetTagResponse
  */
 bool isDCMIPowerMgmtSupported();
 
-/** @brief Read the object tree to fetch the object path that implemented the
- *         Asset tag interface.
- *
- *  @param[in,out] objectTree - object tree
- *
- *  @return On success return the object tree with the object path that
- *          implemented the AssetTag interface.
- */
-void readAssetTagObjectTree(dcmi::assettag::ObjectTree& objectTree);
-
-/** @brief Read the asset tag of the server
- *
- *  @return On success return the asset tag.
- */
-std::string readAssetTag();
-
-/** @brief Write the asset tag to the asset tag DBUS property
- *
- *  @param[in] assetTag - Asset Tag to be written to the property.
- */
-void writeAssetTag(const std::string& assetTag);
-
-/** @brief Read the current power cap value
- *
- *  @param[in] bus - dbus connection
- *
- *  @return On success return the power cap value.
- */
-uint32_t getPcap(sdbusplus::bus::bus& bus);
-
-/** @brief Check if the power capping is enabled
- *
- *  @param[in] bus - dbus connection
- *
- *  @return true if the powerCap is enabled and false if the powercap
- *          is disabled.
- */
-bool getPcapEnabled(sdbusplus::bus::bus& bus);
-
-/** @struct GetPowerLimitResponse
- *
- *  DCMI payload for Get Power Limit command response.
- */
-struct GetPowerLimitResponse
-{
-    uint16_t reserved;       //!< Reserved.
-    uint8_t exceptionAction; //!< Exception action.
-    uint16_t powerLimit;     //!< Power limit requested in watts.
-    uint32_t correctionTime; //!< Correction time limit in milliseconds.
-    uint16_t reserved1;      //!< Reserved.
-    uint16_t samplingPeriod; //!< Statistics sampling period in seconds.
-} __attribute__((packed));
-
-/** @brief Set the power cap value
- *
- *  @param[in] bus - dbus connection
- *  @param[in] powerCap - power cap value
- */
-void setPcap(sdbusplus::bus::bus& bus, const uint32_t powerCap);
-
-/** @struct SetPowerLimitRequest
- *
- *  DCMI payload for Set Power Limit command request.
- */
-struct SetPowerLimitRequest
-{
-    uint16_t reserved;       //!< Reserved
-    uint8_t reserved1;       //!< Reserved
-    uint8_t exceptionAction; //!< Exception action.
-    uint16_t powerLimit;     //!< Power limit requested in watts.
-    uint32_t correctionTime; //!< Correction time limit in milliseconds.
-    uint16_t reserved2;      //!< Reserved.
-    uint16_t samplingPeriod; //!< Statistics sampling period in seconds.
-} __attribute__((packed));
-
-/** @brief Enable or disable the power capping
- *
- *  @param[in] bus - dbus connection
- *  @param[in] enabled - enable/disable
- */
-void setPcapEnable(sdbusplus::bus::bus& bus, bool enabled);
-
-/** @struct ApplyPowerLimitRequest
- *
- *  DCMI payload for Activate/Deactivate Power Limit command request.
- */
-struct ApplyPowerLimitRequest
-{
-    uint8_t powerLimitAction; //!< Power limit activation
-    uint16_t reserved;        //!< Reserved
-} __attribute__((packed));
-
-/** @struct GetMgmntCtrlIdStrRequest
- *
- *  DCMI payload for Get Management Controller Identifier String cmd request.
- */
-struct GetMgmntCtrlIdStrRequest
-{
-    uint8_t offset; //!< Offset to read.
-    uint8_t bytes;  //!< Number of bytes to read.
-} __attribute__((packed));
-
-/** @struct GetMgmntCtrlIdStrResponse
- *
- *  DCMI payload for Get Management Controller Identifier String cmd response.
- */
-struct GetMgmntCtrlIdStrResponse
-{
-    uint8_t strLen; //!< ID string length.
-    char data[];    //!< ID string
-} __attribute__((packed));
-
-/** @struct SetMgmntCtrlIdStrRequest
- *
- *  DCMI payload for Set Management Controller Identifier String cmd request.
- */
-struct SetMgmntCtrlIdStrRequest
-{
-    uint8_t offset; //!< Offset to write.
-    uint8_t bytes;  //!< Number of bytes to read.
-    char data[];    //!< ID string
-} __attribute__((packed));
-
-/** @struct GetMgmntCtrlIdStrResponse
- *
- *  DCMI payload for Get Management Controller Identifier String cmd response.
- */
-struct SetMgmntCtrlIdStrResponse
-{
-    uint8_t offset; //!< Last Offset Written.
-} __attribute__((packed));
-
-/** @enum DCMICapParameters
- *
- * DCMI Capability parameters
- */
-enum class DCMICapParameters
-{
-    SUPPORTED_DCMI_CAPS = 0x01,             //!< Supported DCMI Capabilities
-    MANDATORY_PLAT_ATTRIBUTES = 0x02,       //!< Mandatory Platform Attributes
-    OPTIONAL_PLAT_ATTRIBUTES = 0x03,        //!< Optional Platform Attributes
-    MANAGEABILITY_ACCESS_ATTRIBUTES = 0x04, //!< Manageability Access Attributes
-};
-
-/** @struct GetDCMICapRequest
- *
- *  DCMI payload for Get capabilities cmd request.
- */
-struct GetDCMICapRequest
-{
-    uint8_t param; //!< Capability parameter selector.
-} __attribute__((packed));
-
-/** @struct GetDCMICapRequest
- *
- *  DCMI payload for Get capabilities cmd response.
- */
-struct GetDCMICapResponse
-{
-    uint8_t major;         //!< DCMI Specification Conformance - major ver
-    uint8_t minor;         //!< DCMI Specification Conformance - minor ver
-    uint8_t paramRevision; //!< Parameter Revision = 02h
-    uint8_t data[];        //!< Capability array
-} __attribute__((packed));
-
-/** @struct DCMICap
- *
- *  DCMI capabilities protocol info.
- */
-struct DCMICap
-{
-    std::string name;     //!< Name of DCMI capability.
-    uint8_t bytePosition; //!< Starting byte number from DCMI spec.
-    uint8_t position;     //!< bit position from the DCMI spec.
-    uint8_t length;       //!< Length of the value from DCMI spec.
-};
-
-using DCMICapList = std::vector<DCMICap>;
-
-/** @struct DCMICapEntry
- *
- *  DCMI capabilities list and size for each parameter.
- */
-struct DCMICapEntry
-{
-    uint8_t size;        //!< Size of capability array in bytes.
-    DCMICapList capList; //!< List of capabilities for a parameter.
-};
-
-using DCMICaps = std::map<DCMICapParameters, DCMICapEntry>;
-
-/** @struct GetTempReadingsRequest
- *
- *  DCMI payload for Get Temperature Readings request
- */
-struct GetTempReadingsRequest
-{
-    uint8_t sensorType;     //!< Type of the sensor
-    uint8_t entityId;       //!< Entity ID
-    uint8_t entityInstance; //!< Entity Instance (0 means all instances)
-    uint8_t instanceStart;  //!< Instance start (used if instance is 0)
-} __attribute__((packed));
-
-/** @struct GetTempReadingsResponse
- *
- *  DCMI header for Get Temperature Readings response
- */
-struct GetTempReadingsResponseHdr
-{
-    uint8_t numInstances; //!< No. of instances for requested id
-    uint8_t numDataSets;  //!< No. of sets of temperature data
-} __attribute__((packed));
-
-/** @brief Parse out JSON config file.
- *
- *  @param[in] configFile - JSON config file name
- *
- *  @return A json object
- */
-Json parseJSONConfig(const std::string& configFile);
-
-namespace temp_readings
-{
-/** @brief Read temperature from a d-bus object, scale it as per dcmi
- *         get temperature reading requirements.
- *
- *  @param[in] dbusService - the D-Bus service
- *  @param[in] dbusPath - the D-Bus path
- *
- *  @return A temperature reading
- */
-Temperature readTemp(const std::string& dbusService,
-                     const std::string& dbusPath);
-
-/** @brief Read temperatures and fill up DCMI response for the Get
- *         Temperature Readings command. This looks at a specific
- *         instance.
- *
- *  @param[in] type - one of "inlet", "cpu", "baseboard"
- *  @param[in] instance - A non-zero Entity instance number
- *
- *  @return A tuple, containing a temperature reading and the
- *          number of instances.
- */
-std::tuple<Response, NumInstances> read(const std::string& type,
-                                        uint8_t instance);
-
-/** @brief Read temperatures and fill up DCMI response for the Get
- *         Temperature Readings command. This looks at a range of
- *         instances.
- *
- *  @param[in] type - one of "inlet", "cpu", "baseboard"
- *  @param[in] instanceStart - Entity instance start index
- *
- *  @return A tuple, containing a list of temperature readings and the
- *          number of instances.
- */
-std::tuple<ResponseList, NumInstances> readAll(const std::string& type,
-                                               uint8_t instanceStart);
-} // namespace temp_readings
-
-namespace sensor_info
-{
-/** @brief Create response from JSON config.
- *
- *  @param[in] config - JSON config info about DCMI sensors
- *
- *  @return Sensor info response
- */
-Response createFromJson(const Json& config);
-
-/** @brief Read sensor info and fill up DCMI response for the Get
- *         Sensor Info command. This looks at a specific
- *         instance.
- *
- *  @param[in] type - one of "inlet", "cpu", "baseboard"
- *  @param[in] instance - A non-zero Entity instance number
- *  @param[in] config - JSON config info about DCMI sensors
- *
- *  @return A tuple, containing a sensor info response and
- *          number of instances.
- */
-std::tuple<Response, NumInstances> read(const std::string& type,
-                                        uint8_t instance, const Json& config);
-
-/** @brief Read sensor info and fill up DCMI response for the Get
- *         Sensor Info command. This looks at a range of
- *         instances.
- *
- *  @param[in] type - one of "inlet", "cpu", "baseboard"
- *  @param[in] instanceStart - Entity instance start index
- *  @param[in] config - JSON config info about DCMI sensors
- *
- *  @return A tuple, containing a list of sensor info responses and the
- *          number of instances.
- */
-std::tuple<ResponseList, NumInstances>
-    readAll(const std::string& type, uint8_t instanceStart, const Json& config);
-} // namespace sensor_info
-
-/** @brief Read power reading from power reading sensor object
- *
- *  @param[in] bus - dbus connection
- *
- *  @return total power reading
- */
-int64_t getPowerReading(sdbusplus::bus::bus& bus);
-
-/** @struct GetPowerReadingRequest
- *
- *  DCMI Get Power Reading command request.
- *  Refer DCMI specification Version 1.1 Section 6.6.1
- */
-struct GetPowerReadingRequest
-{
-    uint8_t mode;          //!< Mode
-    uint8_t modeAttribute; //!< Mode Attributes
-} __attribute__((packed));
-
-/** @struct GetPowerReadingResponse
- *
- *  DCMI Get Power Reading command response.
- *  Refer DCMI specification Version 1.1 Section 6.6.1
- */
-struct GetPowerReadingResponse
-{
-    uint16_t currentPower;     //!< Current power in watts
-    uint16_t minimumPower;     //!< Minimum power over sampling duration
-                               //!< in watts
-    uint16_t maximumPower;     //!< Maximum power over sampling duration
-                               //!< in watts
-    uint16_t averagePower;     //!< Average power over sampling duration
-                               //!< in watts
-    uint32_t timeStamp;        //!< IPMI specification based time stamp
-    uint32_t timeFrame;        //!< Statistics reporting time period in milli
-                               //!< seconds.
-    uint8_t powerReadingState; //!< Power Reading State
-} __attribute__((packed));
-
-/** @struct GetSensorInfoRequest
- *
- *  DCMI payload for Get Sensor Info request
- */
-struct GetSensorInfoRequest
-{
-    uint8_t sensorType;     //!< Type of the sensor
-    uint8_t entityId;       //!< Entity ID
-    uint8_t entityInstance; //!< Entity Instance (0 means all instances)
-    uint8_t instanceStart;  //!< Instance start (used if instance is 0)
-} __attribute__((packed));
-
-/** @struct GetSensorInfoResponseHdr
- *
- *  DCMI header for Get Sensor Info response
- */
-struct GetSensorInfoResponseHdr
-{
-    uint8_t numInstances; //!< No. of instances for requested id
-    uint8_t numRecords;   //!< No. of record ids in the response
-} __attribute__((packed));
-/**
- *  @brief Parameters for DCMI Configuration Parameters
- */
-enum class DCMIConfigParameters : uint8_t
-{
-    ActivateDHCP = 1,
-    DiscoveryConfig,
-    DHCPTiming1,
-    DHCPTiming2,
-    DHCPTiming3,
-};
-
-/** @struct SetConfParamsRequest
- *
- *  DCMI Set DCMI Configuration Parameters Command.
- *  Refer DCMI specification Version 1.1 Section 6.1.2
- */
-struct SetConfParamsRequest
-{
-    uint8_t paramSelect; //!< Parameter selector.
-    uint8_t setSelect;   //!< Set Selector (use 00h for parameters that only
-                         //!< have one set).
-    uint8_t data[];      //!< Configuration parameter data.
-} __attribute__((packed));
-
-/** @struct GetConfParamsRequest
- *
- *  DCMI Get DCMI Configuration Parameters Command.
- *  Refer DCMI specification Version 1.1 Section 6.1.3
- */
-struct GetConfParamsRequest
-{
-    uint8_t paramSelect; //!< Parameter selector.
-    uint8_t setSelect;   //!< Set Selector. Selects a given set of parameters
-                         //!< under a given Parameter selector value. 00h if
-                         //!< parameter doesn't use a Set Selector.
-} __attribute__((packed));
-
-/** @struct GetConfParamsResponse
- *
- *  DCMI Get DCMI Configuration Parameters Command response.
- *  Refer DCMI specification Version 1.1 Section 6.1.3
- */
-struct GetConfParamsResponse
-{
-    uint8_t major;         //!< DCMI Spec Conformance - major ver = 01h.
-    uint8_t minor;         //!< DCMI Spec Conformance - minor ver = 05h.
-    uint8_t paramRevision; //!< Parameter Revision = 01h.
-    uint8_t data[];        //!< Parameter data.
-
-} __attribute__((packed));
-
 } // namespace dcmi
diff --git a/ipmid-new.cpp b/ipmid-new.cpp
index 7f558cd..d2ae3b3 100644
--- a/ipmid-new.cpp
+++ b/ipmid-new.cpp
@@ -23,7 +23,6 @@
 #include <any>
 #include <boost/algorithm/string.hpp>
 #include <boost/asio/io_context.hpp>
-#include <dcmihandler.hpp>
 #include <exception>
 #include <filesystem>
 #include <forward_list>
@@ -713,8 +712,8 @@ void ipmi_register_callback(ipmi_netfn_t netFn, ipmi_cmd_t cmd,
     // all the handlers were part of the DCMI group, so default to that.
     if (netFn == NETFUN_GRPEXT)
     {
-        ipmi::impl::registerGroupHandler(ipmi::prioOpenBmcBase,
-                                         dcmi::groupExtId, cmd, realPriv, h);
+        ipmi::impl::registerGroupHandler(ipmi::prioOpenBmcBase, ipmi::groupDCMI,
+                                         cmd, realPriv, h);
     }
     else
     {
-- 
2.17.1