Add support to read SOL non-volatile bitrate

We can read the SOL bit rate over D-Bus from the default obmc-console
instance.

Also enforce that the SOL Privilege Level can only be set to USER or
greater as per IPMI 2.0 spec.

Tested: With dependency I055f2a95c515636b38a694bf565b71aa648fe7b7
-> With 115200 baud configured:
bmc# ipmitool sol info 3
...
Non-Volatile Bit Rate (kbps)    : 115.2
...

-> With 921600 baud configured:
bmc# ipmitool sol info 3
...
Non-Volatile Bit Rate (kbps)    : IPMI-Over-Serial-Setting
...

Change-Id: I05a60b02130087474fcbae928d8aa15ef9620c69
Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>
diff --git a/transporthandler.cpp b/transporthandler.cpp
index eb012b8..40ef88f 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -1613,7 +1613,7 @@
             }
 
             uint8_t privilege = static_cast<uint8_t>(privilegeBits);
-            if (privilege < static_cast<uint8_t>(Privilege::None) ||
+            if (privilege < static_cast<uint8_t>(Privilege::User) ||
                 privilege > static_cast<uint8_t>(Privilege::Oem))
             {
                 return ipmi::responseInvalidFieldRequest();
@@ -1848,6 +1848,39 @@
             return responseSuccess(std::move(ret));
         }
         case SolConfParam::NonVbitrate:
+        {
+            uint64_t baudRate;
+            uint8_t encodedBitRate = 0;
+            if (ipmi::getDbusProperty(
+                    ctx, "xyz.openbmc_project.Console.default",
+                    "/xyz/openbmc_project/console/default",
+                    "xyz.openbmc_project.Console.UART", "Baud", baudRate))
+            {
+                return ipmi::responseUnspecifiedError();
+            }
+            switch (baudRate)
+            {
+                case 9600:
+                    encodedBitRate = 0x06;
+                    break;
+                case 19200:
+                    encodedBitRate = 0x07;
+                    break;
+                case 38400:
+                    encodedBitRate = 0x08;
+                    break;
+                case 57600:
+                    encodedBitRate = 0x09;
+                    break;
+                case 115200:
+                    encodedBitRate = 0x0a;
+                    break;
+                default:
+                    break;
+            }
+            ret.pack(encodedBitRate);
+            return responseSuccess(std::move(ret));
+        }
         case SolConfParam::Vbitrate:
         default:
             return response(ipmiCCParamNotSupported);