summaryrefslogtreecommitdiff
path: root/Chipset/SB/RTC.h
blob: 3c883613a1c5fda3c3a4ff4d08ffa070bb631be2 (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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
//*************************************************************************
//*************************************************************************
//**                                                                     **
//**        (C)Copyright 1985-2011, American Megatrends, Inc.            **
//**                                                                     **
//**                       All Rights Reserved.                          **
//**                                                                     **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093           **
//**                                                                     **
//**                       Phone: (770)-246-8600                         **
//**                                                                     **
//*************************************************************************
//*************************************************************************

//*************************************************************************
// $Header: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Chipset/RTC.h 3     7/17/13 1:54a Scottyang $
//
// $Revision: 3 $
//
// $Date: 7/17/13 1:54a $
//*************************************************************************
// Revision History
// ----------------
// $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Chipset/RTC.h $
// 
// 3     7/17/13 1:54a Scottyang
// [TAG]  		EIP128233
// [Category]  	Improvement
// [Description]  	Improving UEFI PXE image downloading proformance.
// [Files]  		RTC.h
// SBRun.c
// 
// 2     1/11/13 1:51a Scottyang
// [TAG]  		EIP88358
// [Category]  	Improvement
// [Description]  	Add FORCE_USER_TO_SETUP_IF_CMOS_BAD token
// [Files]  		SBDex.c, SBPei.c, RTC.h, SB.sdl
// 
// 1     2/08/12 8:24a Yurenlai
// Intel Lynx Point/SB eChipset initially releases.
// 
//*************************************************************************
//<AMI_FHDR_START>
//
// Name:        RTC.h
//
// Description: Real Time Clock and CMOS Data bank registr definitions.
//
//<AMI_FHDR_END>
//*************************************************************************

#ifndef __RTC__H__
#define __RTC__H__
#ifdef __cplusplus
extern "C" {
#endif

#include <Efi.h>

#define EFI_TIME_VARIABLE_GUID \
  {0x9d0da369, 0x540b, 0x46f8, 0x85, 0xa0, 0x2b, 0x5f, 0x2c, 0x30, 0x1e, 0x15}
                                                                     // [EIP88358] >>
#define CMOS_BAD_HOB_GUID \
  {0x7e7369ce, 0x0188, 0x4183, 0x8c, 0x2d, 0xda, 0xf7, 0xb7, 0x30, 0xe4, 0x2b}
                                                                     // [EIP88358] <<
//---------------------------------------------------------------------------
// Define Real Time Clock INDEX and DATA registers
//---------------------------------------------------------------------------
#define RTC_INDEX_REG       0x70
#define RTC_DATA_REG        0x71

//---------------------------------------------------------------------------
// Define Internal Registers for Real Time Clock
//---------------------------------------------------------------------------
#define RTC_SECONDS_REG         0x00    // R/W  Range 0..59
#define RTC_SECONDS_ALARM_REG   0x01    // R/W  Range 0..59
#define RTC_MINUTES_REG         0x02    // R/W  Range 0..59
#define RTC_MINUTES_ALARM_REG   0x03    // R/W  Range 0..59
#define RTC_HOURS_REG           0x04    // R/W  Range 1..12 or 0..23
                                        // Bit 7 is AM/PM
#define RTC_HOURS_ALARM_REG     0x05    // R/W  Range 1..12 or 0..23
                                        // Bit 7 is AM/PM
#define RTC_DAY_OF_WEEK_REG     0x06    // R/W  Range 1..7
#define RTC_DAY_OF_MONTH_REG    0x07    // R/W  Range 1..31
#define RTC_MONTH_REG           0x08    // R/W  Range 1..12
#define RTC_YEAR_REG            0x09    // R/W  Range 0..99
#define RTC_REG_A_INDEX         0x0a    // R/W[0..6]  R0[7]
#define RTC_REG_B_INDEX         0x0b    // R/W
#define RTC_REG_C_INDEX         0x0c    // RO
#define RTC_REG_D_INDEX         0x0d    // RO

#define RTC_NMI_MASK            0x80

#pragma pack(push,1)

//---------------------------------------------------------------------------
// Register A Bit definitions
//---------------------------------------------------------------------------
typedef union {
    UINT8       REG_A;
    struct {
        UINT8   RateSel     : 4;
        UINT8   Divisor     : 3;
        UINT8   UpdInProgr  : 1;
    };
} RTC_REG_A;

//---------------------------------------------------------------------------
// Register B Bit definitions
//---------------------------------------------------------------------------
typedef union {
    UINT8       REG_B;
    struct {
        UINT8   DaylightSav : 1;    // 0 - Daylight saving disabled
                                    // 1 - Daylight savings enabled 
        UINT8   Mode        : 1;    // 0 - 12 hour mode
                                    // 1 - 24 hour mode 
        UINT8   Format      : 1;    // 0 - BCD Format
                                    // 1 - Binary Format 
        UINT8   SquareWave  : 1;    // 0 - Disable SQWE output
                                    // 1 - Enable SQWE output 
        UINT8   UpdateInt   : 1;    // 0 - Update INT disabled
                                    // 1 - Update INT enabled 
        UINT8   AlarmInt    : 1;    // 0 - Alarm INT disabled
                                    // 1 - Alarm INT Enabled 
        UINT8   PeriodicInt : 1;    // 0 - Periodic INT disabled
                                    // 1 - Periodic INT Enabled 
        UINT8   Set         : 1;    // 0 - Normal operation
                                    // 1 - Updates inhibited 
    };
} RTC_REG_B;

//---------------------------------------------------------------------------
// Register C Bit definitions
//---------------------------------------------------------------------------
typedef union {
    UINT8       REG_C;
    struct {
        UINT8 Reserved      : 4;    // Read as zero.  Can not be written.
        UINT8 UpdEndFlag    : 1;    // Update End Interrupt Flag
        UINT8 AlarmFlag     : 1;    // Alarm Interrupt Flag
        UINT8 PeriodicFlag  : 1;    // Periodic Interrupt Flag
        UINT8 IrqFlag       : 1;    // Iterrupt Request Flag =
                                    // PF & PIE | AF & AIE | UF & UIE 
    };
} RTC_REG_C;

//---------------------------------------------------------------------------
// Register D Bit definitions
//---------------------------------------------------------------------------
typedef union {
    UINT8       REG_D;
    struct {
        UINT8 Reserved      : 7;
        UINT8 DataValid     : 1;    // Valid RAM and Time
    };
} RTC_REG_D;


//---------------------------------------------------------------------------
// Bit definitions for Day Alarm Register (Porting Required if needed)
//---------------------------------------------------------------------------
typedef union {
    UINT8       REG_DATE_ALARM;
    struct {
        UINT8 DateAlarm     : 6;
        UINT8 Reserved      : 2;
    };
} RTC_DATE_ALARM_REG;

//---------------------------------------------------------------------------
// Bit definitions for Month Alarm Register (Porting Required if needed)
//---------------------------------------------------------------------------
typedef union {
    UINT8       REG_MONTH_ALARM;
    struct {
        UINT8 MonthAlarm    : 6;
        UINT8 Reserved      : 2;
    };
} RTC_MONTH_ALARM_REG;
                                                                     // [EIP88358] >>
typedef struct _CMOS_BAD_HOB {
    EFI_HOB_GUID_TYPE           Header;
} CMOS_BAD_HOB;
                                                                     // [EIP88358] <<
#pragma pack(pop)

/****** DO NOT WRITE BELOW THIS LINE *******/
#ifdef __cplusplus
}
#endif
#endif

//*************************************************************************
//*************************************************************************
//**                                                                     **
//**        (C)Copyright 1985-2011, American Megatrends, Inc.            **
//**                                                                     **
//**                       All Rights Reserved.                          **
//**                                                                     **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093           **
//**                                                                     **
//**                       Phone: (770)-246-8600                         **
//**                                                                     **
//*************************************************************************
//*************************************************************************