Home | History | Annotate | Download | only in PlatformDxe
      1 /** @file
      2 
      3   Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
      4 
      5   This program and the accompanying materials are licensed and made available under
      7   the terms and conditions of the BSD License that accompanies this distribution.
      9   The full text of the license may be found at
     11   http://opensource.org/licenses/bsd-license.php.
     13 
     15   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     17   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     19 
     21 
     23 Module Name:
     24 
     25 
     26   SensorVar.c
     27 
     28 Abstract:
     29 
     30   Initialization for the Sensor Info variable.
     31 
     32 Revision History
     33 
     34 --*/
     35 
     36 #include "PlatformDxe.h"
     37 #include "Guid/SensorInfoVariable.h"
     38 
     39 //
     40 // Sensor Information (board specific)
     41 //
     42 
     43 #define TEMPERATURE_SENSORS_COUNT       4
     44 #define VOLTAGE_SENSORS_COUNT           6
     45 #define FAN_SENSORS_COUNT               4
     46 #define FAN_CONTROLLERS_COUNT           3
     47 
     48 TYPEDEF_TEMP_SENSOR_SECTION(TEMPERATURE_SENSORS_COUNT);
     49 TYPEDEF_VOLT_SENSOR_SECTION(VOLTAGE_SENSORS_COUNT);
     50 TYPEDEF_FAN_SENSOR_SECTION(FAN_SENSORS_COUNT);
     51 TYPEDEF_FAN_CONTROLLER_SECTION(FAN_CONTROLLERS_COUNT);
     52 TYPEDEF_SENSOR_INFO_VAR;
     53 
     54 SENSOR_INFO_VAR               mSensorInfoData =
     55 {
     56 	  //
     57     // Temperature Sensors
     58     //
     59     TEMPERATURE_SENSORS_COUNT,
     60     {
     61         { 0, 3, CPU_CORE_TEMPERATURE,            TRUE  },
     62         { 0, 1, MOTHERBOARD_AMBIENT_TEMPERATURE, FALSE },
     63         { 0, 2, VR_TEMPERATURE,                  FALSE },
     64         { 0, 0, IOH_TEMPERATURE,                 FALSE }
     65     },
     66 
     67     //
     68     // Voltage Sensors
     69     //
     70     VOLTAGE_SENSORS_COUNT,
     71     {
     72         { 0, 0, PLUS_12_VOLTS       },
     73         { 0, 1, PLUS_5_VOLTS        },
     74         { 0, 2, PLUS_3P3_VOLTS      },
     75         { 0, 3, MCH_VCC_VOLTAGE     },
     76         { 0, 4, CPU_1_VCCP_VOLTAGE  },
     77         { 0, 5, CPU_VTT_VOLTAGE     }
     78     },
     79 
     80     //
     81     // Fan Speed Sensors
     82     //
     83     FAN_SENSORS_COUNT,
     84     {
     85         { 0, 0, CPU_COOLING_FAN,    FAN_4WIRE,         0 },
     86         { 0, 1, AUX_COOLING_FAN,    FAN_4WIRE,         1 },
     87         { 0, 2, CHASSIS_INLET_FAN,  FAN_3WIRE_VOLTAGE, 1 },
     88         { 0, 3, CHASSIS_OUTLET_FAN, FAN_3WIRE_VOLTAGE, 2 }
     89     },
     90 
     91     //
     92     // Fan Speed Controllers
     93     //
     94     FAN_CONTROLLERS_COUNT,
     95     {
     96         { 0, 0, CPU_COOLING_FAN,     { 0, 0xff, 0xff, 0xff } },
     97         { 0, 1, CHASSIS_COOLING_FAN, { 1,    2, 0xff, 0xff } },
     98         { 0, 2, CHASSIS_COOLING_FAN, { 3, 0xff, 0xff, 0xff } }
     99     }
    100 };
    101 
    102 /**
    103 
    104   Write the Sensor Info variable if it does not already exist.
    105 
    106 **/
    107 VOID
    108 InitializeSensorInfoVariable (
    109   )
    110 {
    111   //
    112   // Set the Sensor Info variable.  If it already exists and the data matches,
    113   // the variable driver will simply return without writing; otherwise, the
    114   // driver will write the variable.
    115   //
    116   gRT->SetVariable (
    117          gEfiSensorInfoVarNameWithPassword,
    118          &gEfiSensorInfoVarGuid,
    119          EFI_VARIABLE_NON_VOLATILE |
    120          EFI_VARIABLE_BOOTSERVICE_ACCESS |
    121          EFI_VARIABLE_RUNTIME_ACCESS,
    122          sizeof (SENSOR_INFO_VAR),
    123          &mSensorInfoData
    124          );
    125 }
    126 
    127