control:p10bmc:config:everest: Fan floor tables

Add the fan floor table config received from the thermal team.  Also
update the maximimum fan speed on Everest to 11300.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Id4352f596c3ae0ec92d4a4aba04dad1a1612f94b
diff --git a/control/config_files/p10bmc/ibm,everest/events.json b/control/config_files/p10bmc/ibm,everest/events.json
index 8fa161f..a635fe9 100644
--- a/control/config_files/p10bmc/ibm,everest/events.json
+++ b/control/config_files/p10bmc/ibm,everest/events.json
@@ -24,7 +24,7 @@
          "name": "count_state_before_target",
          "count": 1,
          "state": false,
-         "target": 10700
+         "target": 11300
        }
      ]
    },
@@ -68,7 +68,7 @@
          "name": "count_state_before_target",
          "count": 1,
          "state": false,
-         "target": 10700
+         "target": 11300
        }
      ]
    },
@@ -175,7 +175,7 @@
                  "property": { "name": "Value" }
                }
              ],
-             "target": 10700
+             "target": 11300
            }
          ]
        }
@@ -212,7 +212,7 @@
         "name": "count_state_floor",
         "count": 1,
         "state": false,
-        "floor": 10700
+        "floor": 11300
       }
     ]
   },
@@ -376,7 +376,7 @@
         "name": "count_state_floor",
         "count": 1,
         "state": false,
-        "floor": 10700
+        "floor": 11300
       }
     ]
   },
@@ -1810,5 +1810,311 @@
          "signal": "interfaces_removed"
        }
      ]
+   },
+   {
+     "name": "set pcie floor index",
+     "groups": [
+       {
+         "name": "pcie slots",
+         "interface": "xyz.openbmc_project.State.Decorator.PowerState",
+         "property": {
+           "name": "PowerState"
+         }
+       },
+       {
+         "name": "pcie cards",
+         "interface": "xyz.openbmc_project.Inventory.Item.PCIeDevice",
+         "property": {
+           "name": "Function0DeviceId"
+         }
+       },
+       {
+         "name": "pcie cards",
+         "interface": "xyz.openbmc_project.Inventory.Item.PCIeDevice",
+         "property": {
+           "name": "Function0VendorId"
+         }
+       },
+       {
+         "name": "pcie cards",
+         "interface": "xyz.openbmc_project.Inventory.Item.PCIeDevice",
+         "property": {
+           "name": "Function0SubsystemId"
+         }
+       },
+       {
+         "name": "pcie cards",
+         "interface": "xyz.openbmc_project.Inventory.Item.PCIeDevice",
+         "property": {
+           "name": "Function0SubsystemVendorId"
+         }
+       }
+     ],
+     "triggers": [
+       {
+         "class": "init",
+         "method": "get_properties"
+       },
+       {
+         "class": "signal",
+         "signal": "properties_changed"
+       },
+       {
+         "class": "signal",
+         "signal": "interfaces_added"
+       }
+     ],
+     "actions": [
+       {
+         "name": "pcie_card_floors",
+         "use_config_specific_files": true,
+         "settle_time": 2
+       }
+     ]
+   },
+   {
+     "name": "Set altitude offset parameter",
+     "groups": [
+       {
+         "name": "altitude",
+         "interface": "xyz.openbmc_project.Sensor.Value",
+         "property": { "name": "Value" }
+       }
+     ],
+     "triggers": [
+       {
+         "class": "init",
+         "method": "get_properties"
+       },
+       {
+         "class": "signal",
+         "signal": "interfaces_added"
+       },
+       {
+         // Refresh altitude every 24hrs
+         "class": "timer",
+         "type": "repeating",
+         "interval": 86400000000,
+         "preload_groups": true
+       }
+     ],
+     "actions": [
+       {
+         "name": "set_parameter_from_group_max",
+         "parameter_name": "ambient_20_altitude_offset",
+         "modifier": {
+           "operator": "less_than",
+           "default_value": 5000,
+           "value": [
+             { "arg_value": 500, "parameter_value": 0 },
+             { "arg_value": 1000, "parameter_value": 375 },
+             { "arg_value": 1500, "parameter_value": 550 },
+             { "arg_value": 2000, "parameter_value": 775 },
+             { "arg_value": 2500, "parameter_value": 1000 },
+             { "arg_value": 3050, "parameter_value": 1275 }
+           ]
+         }
+       },
+       {
+         "name": "set_parameter_from_group_max",
+         "parameter_name": "ambient_25_altitude_offset",
+         "modifier": {
+           "operator": "less_than",
+           "default_value": 5000,
+           "value": [
+             { "arg_value": 500, "parameter_value": 0 },
+             { "arg_value": 1000, "parameter_value": 450 },
+             { "arg_value": 1500, "parameter_value": 700 },
+             { "arg_value": 2000, "parameter_value": 975 },
+             { "arg_value": 2500, "parameter_value": 1275 },
+             { "arg_value": 3050, "parameter_value": 1625 }
+           ]
+         }
+       },
+       {
+         "name": "set_parameter_from_group_max",
+         "parameter_name": "ambient_30_altitude_offset",
+         "modifier": {
+           "operator": "less_than",
+           "default_value": 5000,
+           "value": [
+             { "arg_value": 500, "parameter_value": 0 },
+             { "arg_value": 1000, "parameter_value": 600 },
+             { "arg_value": 1500, "parameter_value": 900 },
+             { "arg_value": 2000, "parameter_value": 1275 },
+             { "arg_value": 2500, "parameter_value": 1650 },
+             { "arg_value": 3050, "parameter_value": 2100 }
+           ]
+         }
+       },
+       {
+         "name": "set_parameter_from_group_max",
+         "parameter_name": "ambient_35_altitude_offset",
+         "modifier": {
+           "operator": "less_than",
+           "default_value": 5000,
+           "value": [
+             { "arg_value": 500, "parameter_value": 0 },
+             { "arg_value": 1000, "parameter_value": 750 },
+             { "arg_value": 1500, "parameter_value": 1175 },
+             { "arg_value": 2000, "parameter_value": 1625 },
+             { "arg_value": 2500, "parameter_value": 2125 },
+             { "arg_value": 3050, "parameter_value": 2725 }
+           ]
+         }
+       },
+       {
+         "name": "set_parameter_from_group_max",
+         "parameter_name": "ambient_40_altitude_offset",
+         "modifier": {
+           "operator": "less_than",
+           "default_value": 5000,
+           "value": [
+             { "arg_value": 500, "parameter_value": 0 },
+             { "arg_value": 1000, "parameter_value": 975 },
+             { "arg_value": 1500, "parameter_value": 1500 },
+             { "arg_value": 2000, "parameter_value": 2100 },
+             { "arg_value": 2500, "parameter_value": 2750 },
+             { "arg_value": 3050, "parameter_value": 3500 }
+           ]
+         }
+       }
+     ]
+   },
+   {
+     "name": "Fan floors",
+     "groups": [
+      {
+        "name": "ambient temp",
+        "interface": "xyz.openbmc_project.Sensor.Value",
+        "property": { "name": "Value" }
+      }
+     ],
+     "triggers": [
+       {
+         "class": "init",
+         "method": "get_properties"
+       },
+       {
+         "class": "signal",
+         "signal": "properties_changed"
+       },
+       {
+         "class": "signal",
+         "signal": "interfaces_added"
+       },
+       {
+         "class": "parameter",
+         "parameter": "pcie_floor_index"
+       },
+       {
+         "class": "parameter",
+         "parameter": "ambient_20_altitude_offset"
+       },
+       {
+         "class": "parameter",
+         "parameter": "ambient_25_altitude_offset"
+       },
+       {
+         "class": "parameter",
+         "parameter": "ambient_30_altitude_offset"
+       },
+       {
+         "class": "parameter",
+         "parameter": "ambient_35_altitude_offset"
+       },
+       {
+         "class": "parameter",
+         "parameter": "ambient_40_altitude_offset"
+       }
+     ],
+     "actions": [
+       {
+         "name": "mapped_floor",
+         "key_group": "ambient temp",
+         "fan_floors": [
+          {
+            // Entry valid for temps < 20
+            "key": 20,
+            "default_floor": 5400,
+            "floor_offset_parameter": "ambient_20_altitude_offset",
+            "floors": [
+              {
+                "parameter": "pcie_floor_index",
+                "floors": [
+                  { "value": 1, "floor": 3800 },
+                  { "value": 2, "floor": 4200 },
+                  { "value": 3, "floor": 4600 }
+                ]
+              }
+            ]
+          },
+          {
+            // Entry valid for temps < 25
+            "key": 25,
+            "default_floor": 7300,
+            "floor_offset_parameter": "ambient_25_altitude_offset",
+            "floors": [
+              {
+                "parameter": "pcie_floor_index",
+                "floors": [
+                  { "value": 1, "floor": 4400 },
+                  { "value": 2, "floor": 4800 },
+                  { "value": 3, "floor": 5400 }
+                ]
+              }
+            ]
+          },
+          {
+            // Entry valid for temps < 30
+            "key": 30,
+            "default_floor": 9100,
+            "floor_offset_parameter": "ambient_30_altitude_offset",
+            "floors": [
+              {
+                "parameter": "pcie_floor_index",
+                "floors": [
+                  { "value": 1, "floor": 5000 },
+                  { "value": 2, "floor": 5600 },
+                  { "value": 3, "floor": 6500 }
+                ]
+              }
+            ]
+          },
+          {
+            // Entry valid for temps < 35
+            "key": 35,
+            "default_floor": 10800,
+            "floor_offset_parameter": "ambient_35_altitude_offset",
+            "floors": [
+              {
+                "parameter": "pcie_floor_index",
+                "floors": [
+                  { "value": 1, "floor": 5800 },
+                  { "value": 2, "floor": 6700 },
+                  { "value": 3, "floor": 7700 }
+                ]
+              }
+            ]
+          },
+          {
+            // Entry valid for temps < 40
+            "key": 40,
+            "default_floor": 12600,
+            "floor_offset_parameter": "ambient_40_altitude_offset",
+            "floors": [
+              {
+                "parameter": "pcie_floor_index",
+                "floors": [
+                  { "value": 1, "floor": 6900 },
+                  { "value": 2, "floor": 7900 },
+                  { "value": 3, "floor": 9200 }
+                ]
+              }
+            ]
+          }
+        ]
+       }
+     ]
    }
 ]
diff --git a/control/config_files/p10bmc/ibm,everest/groups.json b/control/config_files/p10bmc/ibm,everest/groups.json
index 8eb1245..ff8e5ec 100644
--- a/control/config_files/p10bmc/ibm,everest/groups.json
+++ b/control/config_files/p10bmc/ibm,everest/groups.json
@@ -938,5 +938,37 @@
    "members": [
       "/xyz/openbmc_project/sensors/altitude/Altitude"
    ]
+ },
+ {
+   "name": "pcie cards",
+   "members": [
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot1/pcie_card1",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot2/pcie_card2",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot3/pcie_card3",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot4/pcie_card4",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot5/pcie_card5",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot6/pcie_card6",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot7/pcie_card7",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot8/pcie_card8",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot9/pcie_card9",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot10/pcie_card10",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot11/pcie_card11"
+   ]
+ },
+ {
+   "name": "pcie slots",
+   "members": [
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot1",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot2",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot3",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot4",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot5",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot6",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot7",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot8",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot9",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot10",
+     "/xyz/openbmc_project/inventory/system/chassis/motherboard/pcieslot11"
+   ]
  }
 ]
diff --git a/control/config_files/p10bmc/ibm,everest/pcie_cards.json b/control/config_files/p10bmc/ibm,everest/pcie_cards.json
new file mode 100755
index 0000000..aca5675
--- /dev/null
+++ b/control/config_files/p10bmc/ibm,everest/pcie_cards.json
@@ -0,0 +1,148 @@
+{
+  "cards": [
+    {
+      "name": "PHYP had errors getting IDs",
+      "vendor_id": "0xFFFF",
+      "device_id": "0xFFFF",
+      "subsystem_vendor_id": "0xFFFF",
+      "subsystem_id": "0xFFFF",
+      "floor_index": 3
+    },
+    {
+      "name": "Bear Lake and Bear River",
+      "vendor_id": "0x1014",
+      "device_id": "0x04F2",
+      "subsystem_vendor_id": "0x1014",
+      "subsystem_id": "0x0004",
+      "has_temp_sensor": true
+    },
+    {
+      "name": "GTO",
+      "vendor_id": "0x1014",
+      "device_id": "0x034A",
+      "subsystem_vendor_id": "0x1014",
+      "subsystem_id": "0x033B",
+      "floor_index": 2
+    },
+    {
+      "name": "ZR1",
+      "vendor_id": "0x1014",
+      "device_id": "0x034A",
+      "subsystem_vendor_id": "0x1014",
+      "subsystem_id": "0x035E",
+      "floor_index": 1
+    },
+    {
+      "name": "Z06",
+      "vendor_id": "0x1014",
+      "device_id": "0x034A",
+      "subsystem_vendor_id": "0x1014",
+      "subsystem_id": "0x0355",
+      "floor_index": 2
+    },
+    {
+      "name": "Glacier Park EDR 2Port",
+      "vendor_id": "0x15B3",
+      "device_id": "0x1013",
+      "subsystem_vendor_id": "0x1014",
+      "subsystem_id": "0x04F1",
+      "floor_index": 1
+    },
+    {
+      "name": "Glacier Park EDR 1Port",
+      "vendor_id": "0x15B3",
+      "device_id": "0x1013",
+      "subsystem_vendor_id": "0x1014",
+      "subsystem_id": "0x04F4",
+      "floor_index": 1
+    },
+    {
+      "name": "Glacier Park EN 2Port",
+      "vendor_id": "0x15B3",
+      "device_id": "0x1013",
+      "subsystem_vendor_id": "0x1014",
+      "subsystem_id": "0x04F7",
+      "floor_index": 1
+    },
+    {
+      "name": "Lassen Dual Port",
+      "vendor_id": "0x15B3",
+      "device_id": "0x1019",
+      "subsystem_vendor_id": "0x1014",
+      "subsystem_id": "0x0617",
+      "floor_index": 1
+    },
+    {
+      "name": "Lassen Single Port",
+      "vendor_id": "0x15B3",
+      "device_id": "0x1017",
+      "subsystem_vendor_id": "0x1014",
+      "subsystem_id": "0x0616",
+      "floor_index": 1
+    },
+    {
+      "name": "Everglades 10Gb 2Port",
+      "vendor_id": "0x15B3",
+      "device_id": "0x1015",
+      "subsystem_vendor_id": "0x1014",
+      "subsystem_id": "0x061F",
+      "floor_index": 1
+    },
+    {
+      "name": "Everglades 25Gb 2Port",
+      "vendor_id": "0x15B3",
+      "device_id": "0x1015",
+      "subsystem_vendor_id": "0x1014",
+      "subsystem_id": "0x061E",
+      "floor_index": 1
+    },
+    {
+      "name": "Haleakala EN 2Port 100Gb",
+      "vendor_id": "0x15B3",
+      "device_id": "0x1019",
+      "subsystem_vendor_id": "0x1014",
+      "subsystem_id": "0x0635",
+      "floor_index": 2
+    },
+    {
+      "name": "Bono HMS",
+      "vendor_id": "0x1014",
+      "device_id": "0x04F2",
+      "subsystem_vendor_id": "0x1014",
+      "subsystem_id": "0x0005",
+      "floor_index": 1
+    },
+    {
+      "name": "Cedar Lake 100G 2port",
+      "vendor_id": "0x15B3",
+      "device_id": "0x101D",
+      "subsystem_vendor_id": "0x1014",
+      "subsystem_id": "0x06A6",
+      "floor_index": 3
+    },
+    {
+      "name": "Cedar Lake Crypto 100G 2port",
+      "vendor_id": "0x15B3",
+      "device_id": "0x101D",
+      "subsystem_vendor_id": "0x1014",
+      "subsystem_id": "0x06A5",
+      "floor_index": 3
+    },
+    {
+      "name": "Castello",
+      "vendor_id": "0x1014",
+      "device_id": "0x0611",
+      "subsystem_vendor_id": "0x1014",
+      "subsystem_id": "0x0611",
+      "floor_index": 3
+    },
+    {
+      "name": "Baby Blue Tip (CX-3 Pro)",
+      "vendor_id": "0x15B3",
+      "device_id": "0x1007",
+      "subsystem_vendor_id": "0x1014",
+      "subsystem_id": "0x04E7",
+      "floor_index": 1
+    }
+  ]
+}
diff --git a/control/config_files/p10bmc/ibm,everest/zones.json b/control/config_files/p10bmc/ibm,everest/zones.json
index c83707a..9fa88e9 100644
--- a/control/config_files/p10bmc/ibm,everest/zones.json
+++ b/control/config_files/p10bmc/ibm,everest/zones.json
@@ -1,9 +1,9 @@
 [
     {
         "name": "0",
-        "poweron_target": 10700,
-        "default_floor": 10700,
+        "poweron_target": 11300,
+        "default_floor": 11300,
         "increase_delay": 5,
-        "decrease_interval": 30
+        "decrease_interval": 15
     }
 ]