Dbus Interface Remote BIOS configuration

Remote BIOS configuration via BMC.
provide ability for the user to view and modify the
BIOS setup configuration parameters remotely via a BMC at any Host state.

Change-Id: Icacc398efca042ec7422aa6e5728ab75b8a2086b
Signed-off-by: Suryakanth Sekar <suryakanth.sekar@linux.intel.com>
Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
diff --git a/xyz/openbmc_project/BIOSConfig/Common.errors.yaml b/xyz/openbmc_project/BIOSConfig/Common.errors.yaml
new file mode 100644
index 0000000..41da935
--- /dev/null
+++ b/xyz/openbmc_project/BIOSConfig/Common.errors.yaml
@@ -0,0 +1,12 @@
+# xyz.openbmc_project.BIOSConfig.Common.Error.AttributeNotFound
+- name: AttributeNotFound
+  description: Specified Attribute is not found.
+# xyz.openbmc_project.BIOSConfig.Common.Error.AttributeReadOnly
+- name: AttributeReadOnly
+  description: Specified Attribute is ReadOnly.
+# xyz.openbmc_project.BIOSConfig.Common.Error.InvalidCurrentPassword
+- name: InvalidCurrentPassword
+  description: CurrentPassword verification failed.
+# xyz.openbmc_project.BIOSConfig.Common.Error.PasswordNotSettable
+- name: PasswordNotSettable
+  description: Unable to set the new password.
diff --git a/xyz/openbmc_project/BIOSConfig/Common.metadata.yaml b/xyz/openbmc_project/BIOSConfig/Common.metadata.yaml
new file mode 100644
index 0000000..bb0389d
--- /dev/null
+++ b/xyz/openbmc_project/BIOSConfig/Common.metadata.yaml
@@ -0,0 +1,23 @@
+- name: AttributeNotFound
+  level: ERR
+- name: AttributeSettingFailed
+  level: ERR
+  meta:
+    - str: "REASON = %s"
+      type: string
+- name: AttributeReadOnly
+  level: ERR
+  meta:
+    - str: "REASON=%s"
+      type: string
+- name: NoResource
+  level: ERR
+- name: InvalidValue
+  level: ERR
+  meta:
+    - str: "UNSUPPORTED_VALUE=%s"
+      type: string
+- name: InvalidCurrentPassword
+  level: ERR
+- name: PasswordNotSettable
+  level: ERR
diff --git a/xyz/openbmc_project/BIOSConfig/Manager.interface.yaml b/xyz/openbmc_project/BIOSConfig/Manager.interface.yaml
new file mode 100644
index 0000000..225ccaa
--- /dev/null
+++ b/xyz/openbmc_project/BIOSConfig/Manager.interface.yaml
@@ -0,0 +1,171 @@
+description: >
+    Provides Remote BIOS Configuration management functionality.
+    As communication to this service is done through authenticated
+    & authorized session, there won't be any validation for both.
+    https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/29320
+
+methods:
+    - name: SetAttribute
+      description: >
+          To set the new value on existing attribute name.
+          It will create or add the pending attributes.
+      parameters:
+         - name: AttributeName
+           type: string
+           description: >
+               AttributeName which has to be changed.
+         - name: AttributeValue
+           type: variant[int64,string]
+           description: >
+               New attribute value
+
+      errors:
+        - xyz.openbmc_project.Common.Error.InternalFailure
+        - xyz.openbmc_project.BIOSConfig.Common.Error.AttributeReadOnly
+        - xyz.openbmc_project.BIOSConfig.Common.Error.AttributeNotFound
+
+    - name: GetAttribute
+      description: >
+          To get the attribute value of existing attributes.
+      parameters:
+         - name: AttributeName
+           type: string
+           description: >
+               To get the bios attribute current values and
+               pending values if previously set by setAttribute or
+               SetPendingAttributes.
+
+      returns:
+        - name: AttributeValueType
+          type: enum[self.AttributeType]
+          description: >
+              PLDM attribute Type present in PLDM spec
+        - name: CurrentValue
+          type: variant[int64,string]
+          description: >
+              The attribute current value.
+        - name: PendingValue
+          type: variant[int64,string]
+          description: >
+              The pending attribute value if its available.
+      errors:
+        - xyz.openbmc_project.Common.Error.InternalFailure
+        - xyz.openbmc_project.BIOSConfig.Common.Error.AttributeNotFound
+
+properties:
+
+    - name: ResetBIOSSettings
+      type: enum[self.ResetFlag]
+      default: NoAction
+      description: >
+          Contain reset BIOS setting type:
+          Interface have to set NoAction this property.
+          when Reset BIOS settings are informed to the BIOS.
+
+    - name: BaseBIOSTable
+      type: dict[string,struct[enum[self.AttributeType],boolean,string,string,string,variant[int64,string],variant[int64,string],array[struct[enum[self.BoundType], variant[int64, string]]]]]
+      description: >
+              map{attributeName,struct{attributeType,readonlyStatus,displayname,
+              description,menuPath,current,default,
+              array{struct{optionstring,optionvalue}}}}
+              Example 1:
+              {"DdrFreqLimit",
+              {xyz.openbmc_project.BIOSConfig.Manager.AttributeType.String,
+               false,
+               "Memory Operating Speed Selection",
+               "Force specific Memory Operating Speed or use Auto setting.",
+               "Advanced/Memory Configuration/Memory Operating Speed Selection",
+               "0x00",
+               "0x0B",
+               { {"OneOf", "auto"},
+                 {"OneOf", "2133"},
+                 {"OneOf", "2400"},
+                 {"OneOf", "2664"},
+                 {"OneOf", "2933"}
+               }
+              }
+              }
+               Example 2:
+              {"BIOSSerialDebugLevel",
+              {xyz.openbmc_project.BIOSConfig.Manager.AttributeType.Integer,
+               false,
+               "BIOS Serial Debug level",
+               "BIOS Serial Debug level during system boot.",
+               "Advanced/Debug Feature Selection",
+               0x00,
+               0x01,
+               { {"MinBound", 0},
+                 {"MaxBound", 4},
+                 {"ScalarIncrement",1}
+               }
+              }
+              }
+
+
+    - name: PendingAttributes
+      type: dict[string,struct[enum[self.AttributeType],variant[int64,string]]]
+      description: >
+              The Pending attribute name and new value.
+              ex- { {"QuietBoot",Type.Integer, 0x1},
+                    { "DdrFreqLimit",Type.String,"2933"}
+                  }
+
+
+enumerations:
+    - name: AttributeType
+      description: >
+        Attribute Type.
+      values:
+        - name: Enumeration
+          description: >
+            Enumeration value Type.
+        - name: String
+          description: >
+             string value Type.
+        - name: Password
+          description: >
+             Encoded string value Type
+        - name: Integer
+          description: >
+            Integer value Type.
+        - name: Boolean
+          description: >
+            Boolean value Type
+
+    - name: ResetFlag
+      description: >
+        Reset BIOS setting type requested by user.
+      values:
+        - name: NoAction
+          description: >
+            Default value, In order to cancel the reset BIOS settings.
+        - name: FactoryDefaults
+          description: >
+            Used to set factory default settings.
+        - name: FailSafeDefaults
+          description: >
+            Used to set the fail safe settings.
+
+    - name: BoundType
+      description: >
+        Contain BoundType value for string and integer
+      values:
+        - name: LowerBound
+          description: >
+            Used to define the lower bound value.
+        - name: UpperBound
+          description: >
+            Used to define the upper bound value.
+        - name: ScalarIncrement
+          description: >
+            Used to define scalar value of integer.
+        - name: MinStringLength
+          description: >
+            Used to define minimum string length.
+        - name: MaxStringLength
+          description: >
+            Used to define maximum string length.
+        - name: OneOf
+          description: >
+            Used to define the enumeration options.
+
diff --git a/xyz/openbmc_project/BIOSConfig/Password.interface.yaml b/xyz/openbmc_project/BIOSConfig/Password.interface.yaml
new file mode 100644
index 0000000..913201f
--- /dev/null
+++ b/xyz/openbmc_project/BIOSConfig/Password.interface.yaml
@@ -0,0 +1,34 @@
+description: >
+    Remote BIOS Config manager daemon will create payload objects
+    for every payload received in the system under
+    object path /xyz/openbmc_project/biosconfigMgr/<PayloadType>.
+    Password interface is used to change and verify the BIOS setup Password
+methods:
+    - name: ChangePassword
+      description: >
+          Change the BIOS setup password.
+      parameters:
+        - name: UserName
+          type: string
+          description: >
+              User name - user / admin.
+        - name: CurrentPassword
+          type: string
+          description: >
+              Current user/ admin Password.
+        - name: NewPassword
+          type: string
+          description: >
+              New user/ admin Password.
+      errors:
+        - xyz.openbmc_project.Common.Error.InternalFailure
+        - xyz.openbmc_project.BIOSConfig.Common.Error.PasswordNotSettable
+        - xyz.openbmc_project.BIOSConfig.Common.Error.InvalidCurrentPassword
+
+properties:
+
+     - name: PasswordInitialized
+       type: boolean
+       description: >
+           To indicate BIOS password related details are recevied or not.
+
diff --git a/xyz/openbmc_project/BIOSConfig/README.md b/xyz/openbmc_project/BIOSConfig/README.md
new file mode 100644
index 0000000..f553cda
--- /dev/null
+++ b/xyz/openbmc_project/BIOSConfig/README.md
@@ -0,0 +1,46 @@
+Remote BIOS Configuration via BMC
+Overview
+Provides ability for the user to view and modify the
+BIOS setup configuration parameters remotely via BMC at any Host state.
+Modifications to the parameters take place upon the next system reboot or
+immediate based on the host firmware.
+Please refer https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/29320
+
+Remote BIOS Configuration (RBC) service exposes D-Bus methods for
+BIOS settings management operations.
+
+RBC Manager Interface
+xyz.openbmc_project.BIOSConfigManager provides following methods, properties.
+
+Object Path : /xyz/openbmc_project/bios_config/manager0
+
+xyz.openbmc_project.BIOSConfigManager
+
+methods:
+SetAttribute -To set the particular BIOS attribute  with new value.
+GetAttribute -To get the bios attribute current and pending values.
+GetPendingAttributes -To get all pending bios Atrributes list.
+SetPendingAttributes -To set all pending bios Atrributes list.
+
+
+Properites:
+ResetBIOSSettings  - To reset the BIOS settings based on the Reset Flag.
+AllBaseAttributes-To store all bios attributes details.
+
+Signals:
+PendingAttributesCreated - Signal sent out, when Pending attributes list created.
+
+PasswordInterface:
+
+xyz.openbmc_project.BIOSConfig.Password provides following Methods and Properities.
+
+xyz.openbmc_project.BIOSConfig.Password Interface
+
+Methods:
+VerifyPassword
+ChangePassword
+
+Properities:
+IsPasswordInitDone - To indicate BIOS password related details are recevied or not.
+
+