summaryrefslogtreecommitdiffstats
path: root/Vlv2TbltDevicePkg/PlatformDxe/SensorVar.c
blob: 5d13e99443a4e711763dd200c695f68d82e63a77 (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
/** @file

  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
                                                                                   

  SPDX-License-Identifier: BSD-2-Clause-Patent

                                                                                   


Module Name:


  SensorVar.c

Abstract:

  Initialization for the Sensor Info variable.

Revision History

--*/

#include "PlatformDxe.h"
#include "Guid/SensorInfoVariable.h"

//
// Sensor Information (board specific)
//

#define TEMPERATURE_SENSORS_COUNT       4
#define VOLTAGE_SENSORS_COUNT           6
#define FAN_SENSORS_COUNT               4
#define FAN_CONTROLLERS_COUNT           3

TYPEDEF_TEMP_SENSOR_SECTION(TEMPERATURE_SENSORS_COUNT);
TYPEDEF_VOLT_SENSOR_SECTION(VOLTAGE_SENSORS_COUNT);
TYPEDEF_FAN_SENSOR_SECTION(FAN_SENSORS_COUNT);
TYPEDEF_FAN_CONTROLLER_SECTION(FAN_CONTROLLERS_COUNT);
TYPEDEF_SENSOR_INFO_VAR;

SENSOR_INFO_VAR               mSensorInfoData =
{
	  //
    // Temperature Sensors
    //
    TEMPERATURE_SENSORS_COUNT,
    {
        { 0, 3, CPU_CORE_TEMPERATURE,            TRUE  },
        { 0, 1, MOTHERBOARD_AMBIENT_TEMPERATURE, FALSE },
        { 0, 2, VR_TEMPERATURE,                  FALSE },
        { 0, 0, IOH_TEMPERATURE,                 FALSE }
    },

    //
    // Voltage Sensors
    //
    VOLTAGE_SENSORS_COUNT,
    {
        { 0, 0, PLUS_12_VOLTS       },
        { 0, 1, PLUS_5_VOLTS        },
        { 0, 2, PLUS_3P3_VOLTS      },
        { 0, 3, MCH_VCC_VOLTAGE     },
        { 0, 4, CPU_1_VCCP_VOLTAGE  },
        { 0, 5, CPU_VTT_VOLTAGE     }
    },

    //
    // Fan Speed Sensors
    //
    FAN_SENSORS_COUNT,
    {
        { 0, 0, CPU_COOLING_FAN,    FAN_4WIRE,         0 },
        { 0, 1, AUX_COOLING_FAN,    FAN_4WIRE,         1 },
        { 0, 2, CHASSIS_INLET_FAN,  FAN_3WIRE_VOLTAGE, 1 },
        { 0, 3, CHASSIS_OUTLET_FAN, FAN_3WIRE_VOLTAGE, 2 }
    },

    //
    // Fan Speed Controllers
    //
    FAN_CONTROLLERS_COUNT,
    {
        { 0, 0, CPU_COOLING_FAN,     { 0, 0xff, 0xff, 0xff } },
        { 0, 1, CHASSIS_COOLING_FAN, { 1,    2, 0xff, 0xff } },
        { 0, 2, CHASSIS_COOLING_FAN, { 3, 0xff, 0xff, 0xff } }
    }
};

/**

  Write the Sensor Info variable if it does not already exist.

**/
VOID
InitializeSensorInfoVariable (
  )
{
  //
  // Set the Sensor Info variable.  If it already exists and the data matches,
  // the variable driver will simply return without writing; otherwise, the
  // driver will write the variable.
  //
  gRT->SetVariable (
         gEfiSensorInfoVarNameWithPassword,
         &gEfiSensorInfoVarGuid,
         EFI_VARIABLE_NON_VOLATILE |
         EFI_VARIABLE_BOOTSERVICE_ACCESS |
         EFI_VARIABLE_RUNTIME_ACCESS,
         sizeof (SENSOR_INFO_VAR),
         &mSensorInfoData
         );
}