Subversion Repositories Kolibri OS

Rev

Rev 1498 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1498 Rev 2216
Line 7... Line 7...
7
/******************************************************************************
7
/******************************************************************************
8
 *
8
 *
9
 * 1. Copyright Notice
9
 * 1. Copyright Notice
10
 *
10
 *
11
 * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
11
 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
12
 * All rights reserved.
12
 * All rights reserved.
13
 *
13
 *
14
 * 2. License
14
 * 2. License
15
 *
15
 *
16
 * 2.1. This is your license from Intel Corp. under its intellectual property
16
 * 2.1. This is your license from Intel Corp. under its intellectual property
Line 130... Line 130...
130
 
130
 
Line 131... Line 131...
131
 
131
 
132
/******************************************************************************
132
/******************************************************************************
-
 
133
 *
-
 
134
 * FUNCTION:    AcpiHwGetGpeRegisterBit
-
 
135
 *
-
 
136
 * PARAMETERS:  GpeEventInfo        - Info block for the GPE
-
 
137
 *              GpeRegisterInfo     - Info block for the GPE register
-
 
138
 *
-
 
139
 * RETURN:      Register mask with a one in the GPE bit position
-
 
140
 *
-
 
141
 * DESCRIPTION: Compute the register mask for this GPE. One bit is set in the
-
 
142
 *              correct position for the input GPE.
-
 
143
 *
-
 
144
 ******************************************************************************/
-
 
145
 
-
 
146
UINT32
-
 
147
AcpiHwGetGpeRegisterBit (
-
 
148
    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
-
 
149
    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo)
-
 
150
{
-
 
151
 
-
 
152
    return ((UINT32) 1 <<
-
 
153
        (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber));
-
 
154
}
-
 
155
 
-
 
156
 
-
 
157
/******************************************************************************
133
 *
158
 *
134
 * FUNCTION:    AcpiHwLowDisableGpe
159
 * FUNCTION:    AcpiHwLowSetGpe
135
 *
160
 *
-
 
161
 * PARAMETERS:  GpeEventInfo        - Info block for the GPE to be disabled
136
 * PARAMETERS:  GpeEventInfo        - Info block for the GPE to be disabled
162
 *              Action              - Enable or disable
137
 *
163
 *
138
 * RETURN:      Status
164
 * RETURN:      Status
139
 *
165
 *
140
 * DESCRIPTION: Disable a single GPE in the enable register.
166
 * DESCRIPTION: Enable or disable a single GPE in the parent enable register.
141
 *
167
 *
Line 142... Line 168...
142
 ******************************************************************************/
168
 ******************************************************************************/
143
 
169
 
144
ACPI_STATUS
170
ACPI_STATUS
-
 
171
AcpiHwLowSetGpe (
145
AcpiHwLowDisableGpe (
172
    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
146
    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
173
    UINT32                  Action)
147
{
174
{
148
    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
175
    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
-
 
176
    ACPI_STATUS             Status;
-
 
177
    UINT32                  EnableMask;
-
 
178
    UINT32                  RegisterBit;
-
 
179
 
Line 149... Line 180...
149
    ACPI_STATUS             Status;
180
 
Line 150... Line 181...
150
    UINT32                  EnableMask;
181
    ACPI_FUNCTION_ENTRY ();
Line 165... Line 196...
165
    {
196
    {
166
        return (Status);
197
        return (Status);
167
    }
198
    }
168
 
199
 
Line 169... Line 200...
169
    /* Clear just the bit that corresponds to this GPE */
200
    /* Set or clear just the bit that corresponds to this GPE */
170
 
-
 
171
    ACPI_CLEAR_BIT (EnableMask, ((UINT32) 1 <<
-
 
172
        (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber)));
-
 
173
 
-
 
174
 
-
 
175
    /* Write the updated enable mask */
-
 
176
 
-
 
177
    Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress);
-
 
178
    return (Status);
-
 
179
}
-
 
180
 
-
 
181
 
-
 
182
/******************************************************************************
-
 
183
 *
-
 
184
 * FUNCTION:    AcpiHwWriteGpeEnableReg
-
 
185
 *
-
 
186
 * PARAMETERS:  GpeEventInfo        - Info block for the GPE to be enabled
-
 
187
 *
-
 
188
 * RETURN:      Status
-
 
189
 *
-
 
190
 * DESCRIPTION: Write a GPE enable register.  Note: The bit for this GPE must
-
 
191
 *              already be cleared or set in the parent register
-
 
192
 *              EnableForRun mask.
-
 
193
 *
-
 
194
 ******************************************************************************/
-
 
Line 195... Line -...
195
 
-
 
196
ACPI_STATUS
201
 
197
AcpiHwWriteGpeEnableReg (
202
    RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo);
198
    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
203
    switch (Action)
199
{
204
    {
200
    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
-
 
Line -... Line 205...
-
 
205
    case ACPI_GPE_CONDITIONAL_ENABLE:
Line -... Line 206...
-
 
206
 
-
 
207
        /* Only enable if the EnableForRun bit is set */
201
    ACPI_STATUS             Status;
208
 
-
 
209
        if (!(RegisterBit & GpeRegisterInfo->EnableForRun))
Line -... Line 210...
-
 
210
        {
Line -... Line 211...
-
 
211
            return (AE_BAD_PARAMETER);
-
 
212
        }
-
 
213
 
-
 
214
        /*lint -fallthrough */
-
 
215
 
202
 
216
    case ACPI_GPE_ENABLE:
-
 
217
        ACPI_SET_BIT (EnableMask, RegisterBit);
Line 203... Line -...
203
 
-
 
204
    ACPI_FUNCTION_ENTRY ();
-
 
205
 
218
        break;
-
 
219
 
206
 
220
    case ACPI_GPE_DISABLE:
207
    /* Get the info block for the entire GPE register */
221
        ACPI_CLEAR_BIT (EnableMask, RegisterBit);
Line 208... Line 222...
208
 
222
        break;
209
    GpeRegisterInfo = GpeEventInfo->RegisterInfo;
-
 
210
    if (!GpeRegisterInfo)
-
 
211
    {
-
 
Line -... Line 223...
-
 
223
 
212
        return (AE_NOT_EXIST);
224
    default:
213
    }
225
        ACPI_ERROR ((AE_INFO, "Invalid GPE Action, %u\n", Action));
Line 214... Line 226...
214
 
226
        return (AE_BAD_PARAMETER);
Line 236... Line 248...
236
ACPI_STATUS
248
ACPI_STATUS
237
AcpiHwClearGpe (
249
AcpiHwClearGpe (
238
    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
250
    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
239
{
251
{
-
 
252
    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
240
    ACPI_STATUS             Status;
253
    ACPI_STATUS             Status;
241
    UINT8                   RegisterBit;
254
    UINT32                  RegisterBit;
Line 242... Line 255...
242
 
255
 
Line -... Line 256...
-
 
256
 
Line 243... Line 257...
243
 
257
    ACPI_FUNCTION_ENTRY ();
244
    ACPI_FUNCTION_ENTRY ();
258
 
-
 
259
    /* Get the info block for the entire GPE register */
-
 
260
 
-
 
261
    GpeRegisterInfo = GpeEventInfo->RegisterInfo;
Line 245... Line 262...
245
 
262
    if (!GpeRegisterInfo)
246
 
263
    {
247
    RegisterBit = (UINT8) (1 <<
264
        return (AE_NOT_EXIST);
248
        (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
265
    }
-
 
266
 
-
 
267
    /*
249
 
268
     * Write a one to the appropriate bit in the status register to
250
    /*
269
     * clear this GPE.
Line 251... Line 270...
251
     * Write a one to the appropriate bit in the status register to
270
     */
252
     * clear this GPE.
271
    RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo);
Line 276... Line 295...
276
    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
295
    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
277
    ACPI_EVENT_STATUS       *EventStatus)
296
    ACPI_EVENT_STATUS       *EventStatus)
278
{
297
{
279
    UINT32                  InByte;
298
    UINT32                  InByte;
280
    UINT8                   RegisterBit;
299
    UINT32                  RegisterBit;
281
    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
300
    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
282
    ACPI_STATUS             Status;
301
    ACPI_EVENT_STATUS       LocalEventStatus = 0;
283
    ACPI_EVENT_STATUS       LocalEventStatus = 0;
-
 
284
 
302
    ACPI_STATUS             Status;
-
 
303
 
Line 285... Line 304...
285
 
304
 
Line 296... Line 315...
296
    GpeRegisterInfo = GpeEventInfo->RegisterInfo;
315
    GpeRegisterInfo = GpeEventInfo->RegisterInfo;
Line 297... Line 316...
297
 
316
 
Line 298... Line -...
298
    /* Get the register bitmask for this GPE */
-
 
299
 
317
    /* Get the register bitmask for this GPE */
Line 300... Line 318...
300
    RegisterBit = (UINT8) (1 <<
318
 
Line 301... Line 319...
301
        (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
319
    RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo);
302
 
320