achware.h revision 231844
167754Smsmith/******************************************************************************
267754Smsmith *
367754Smsmith * Name: achware.h -- hardware specific interfaces
467754Smsmith *
567754Smsmith *****************************************************************************/
667754Smsmith
7217365Sjkim/*
8229989Sjkim * Copyright (C) 2000 - 2012, Intel Corp.
970243Smsmith * All rights reserved.
1067754Smsmith *
11217365Sjkim * Redistribution and use in source and binary forms, with or without
12217365Sjkim * modification, are permitted provided that the following conditions
13217365Sjkim * are met:
14217365Sjkim * 1. Redistributions of source code must retain the above copyright
15217365Sjkim *    notice, this list of conditions, and the following disclaimer,
16217365Sjkim *    without modification.
17217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18217365Sjkim *    substantially similar to the "NO WARRANTY" disclaimer below
19217365Sjkim *    ("Disclaimer") and any redistribution must be conditioned upon
20217365Sjkim *    including a substantially similar Disclaimer requirement for further
21217365Sjkim *    binary redistribution.
22217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names
23217365Sjkim *    of any contributors may be used to endorse or promote products derived
24217365Sjkim *    from this software without specific prior written permission.
2567754Smsmith *
26217365Sjkim * Alternatively, this software may be distributed under the terms of the
27217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free
28217365Sjkim * Software Foundation.
2967754Smsmith *
30217365Sjkim * NO WARRANTY
31217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41217365Sjkim * POSSIBILITY OF SUCH DAMAGES.
42217365Sjkim */
4367754Smsmith
4467754Smsmith#ifndef __ACHWARE_H__
4567754Smsmith#define __ACHWARE_H__
4667754Smsmith
4767754Smsmith
48193267Sjkim/* Values for the _SST predefined method */
49151937Sjkim
50151937Sjkim#define ACPI_SST_INDICATOR_OFF  0
51151937Sjkim#define ACPI_SST_WORKING        1
52151937Sjkim#define ACPI_SST_WAKING         2
53151937Sjkim#define ACPI_SST_SLEEPING       3
54151937Sjkim#define ACPI_SST_SLEEP_CONTEXT  4
55151937Sjkim
56151937Sjkim
57151937Sjkim/*
58151937Sjkim * hwacpi - high level functions
59151937Sjkim */
6067754SmsmithACPI_STATUS
6167754SmsmithAcpiHwSetMode (
6267754Smsmith    UINT32                  Mode);
6367754Smsmith
6467754SmsmithUINT32
6567754SmsmithAcpiHwGetMode (
6667754Smsmith    void);
6767754Smsmith
6867754Smsmith
69151937Sjkim/*
70151937Sjkim * hwregs - ACPI Register I/O
71151937Sjkim */
72197104SjkimACPI_STATUS
73197104SjkimAcpiHwValidateRegister (
74197104Sjkim    ACPI_GENERIC_ADDRESS    *Reg,
75197104Sjkim    UINT8                   MaxBitWidth,
76197104Sjkim    UINT64                  *Address);
77197104Sjkim
78197104SjkimACPI_STATUS
79197104SjkimAcpiHwRead (
80197104Sjkim    UINT32                  *Value,
81197104Sjkim    ACPI_GENERIC_ADDRESS    *Reg);
82197104Sjkim
83197104SjkimACPI_STATUS
84197104SjkimAcpiHwWrite (
85197104Sjkim    UINT32                  Value,
86197104Sjkim    ACPI_GENERIC_ADDRESS    *Reg);
87197104Sjkim
8891116SmsmithACPI_BIT_REGISTER_INFO *
8991116SmsmithAcpiHwGetBitRegisterInfo (
9091116Smsmith    UINT32                  RegisterId);
9169450Smsmith
9299679SiwasakiACPI_STATUS
93193267SjkimAcpiHwWritePm1Control (
94193267Sjkim    UINT32                  Pm1aControl,
95193267Sjkim    UINT32                  Pm1bControl);
96193267Sjkim
97193267SjkimACPI_STATUS
9869450SmsmithAcpiHwRegisterRead (
9999679Siwasaki    UINT32                  RegisterId,
10099679Siwasaki    UINT32                  *ReturnValue);
10169450Smsmith
10299679SiwasakiACPI_STATUS
10369450SmsmithAcpiHwRegisterWrite (
10469450Smsmith    UINT32                  RegisterId,
10569450Smsmith    UINT32                  Value);
10669450Smsmith
10799679SiwasakiACPI_STATUS
108193267SjkimAcpiHwClearAcpiStatus (
109193267Sjkim    void);
110193267Sjkim
111193267Sjkim
112193267Sjkim/*
113231844Sjkim * hwsleep - sleep/wake support (Legacy sleep registers)
114231844Sjkim */
115231844SjkimACPI_STATUS
116231844SjkimAcpiHwLegacySleep (
117231844Sjkim    UINT8                   SleepState);
118231844Sjkim
119231844SjkimACPI_STATUS
120231844SjkimAcpiHwLegacyWakePrep (
121231844Sjkim    UINT8                   SleepState);
122231844Sjkim
123231844SjkimACPI_STATUS
124231844SjkimAcpiHwLegacyWake (
125231844Sjkim    UINT8                   SleepState);
126231844Sjkim
127231844Sjkim
128231844Sjkim/*
129231844Sjkim * hwesleep - sleep/wake support (Extended FADT-V5 sleep registers)
130231844Sjkim */
131231844Sjkimvoid
132231844SjkimAcpiHwExecuteSleepMethod (
133231844Sjkim    char                    *MethodName,
134231844Sjkim    UINT32                  IntegerArgument);
135231844Sjkim
136231844SjkimACPI_STATUS
137231844SjkimAcpiHwExtendedSleep (
138231844Sjkim    UINT8                   SleepState);
139231844Sjkim
140231844SjkimACPI_STATUS
141231844SjkimAcpiHwExtendedWakePrep (
142231844Sjkim    UINT8                   SleepState);
143231844Sjkim
144231844SjkimACPI_STATUS
145231844SjkimAcpiHwExtendedWake (
146231844Sjkim    UINT8                   SleepState);
147231844Sjkim
148231844Sjkim
149231844Sjkim/*
150193267Sjkim * hwvalid - Port I/O with validation
151193267Sjkim */
152193267SjkimACPI_STATUS
153193267SjkimAcpiHwReadPort (
154193267Sjkim    ACPI_IO_ADDRESS         Address,
15599679Siwasaki    UINT32                  *Value,
156193267Sjkim    UINT32                  Width);
15769450Smsmith
15899679SiwasakiACPI_STATUS
159193267SjkimAcpiHwWritePort (
160193267Sjkim    ACPI_IO_ADDRESS         Address,
16169450Smsmith    UINT32                  Value,
162193267Sjkim    UINT32                  Width);
16369450Smsmith
16467754Smsmith
165151937Sjkim/*
166151937Sjkim * hwgpe - GPE support
167151937Sjkim */
168209746SjkimUINT32
169209746SjkimAcpiHwGetGpeRegisterBit (
170209746Sjkim    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
171209746Sjkim    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo);
172193267Sjkim
173193267SjkimACPI_STATUS
174209746SjkimAcpiHwLowSetGpe (
175209746Sjkim    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
176209746Sjkim    UINT32                  Action);
17767754Smsmith
17899679SiwasakiACPI_STATUS
179117521SnjlAcpiHwDisableGpeBlock (
180117521Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
181193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
182193267Sjkim    void                    *Context);
183117521Snjl
18499679SiwasakiACPI_STATUS
18567754SmsmithAcpiHwClearGpe (
186114237Snjl    ACPI_GPE_EVENT_INFO     *GpeEventInfo);
18767754Smsmith
18899679SiwasakiACPI_STATUS
189117521SnjlAcpiHwClearGpeBlock (
190117521Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
191193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
192193267Sjkim    void                    *Context);
193117521Snjl
194117521SnjlACPI_STATUS
19567754SmsmithAcpiHwGetGpeStatus (
196117521Snjl    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
19767754Smsmith    ACPI_EVENT_STATUS       *EventStatus);
19867754Smsmith
19999679SiwasakiACPI_STATUS
200129684SnjlAcpiHwDisableAllGpes (
201151937Sjkim    void);
20284491Smsmith
20399679SiwasakiACPI_STATUS
204129684SnjlAcpiHwEnableAllRuntimeGpes (
205151937Sjkim    void);
20684491Smsmith
207129684SnjlACPI_STATUS
208129684SnjlAcpiHwEnableAllWakeupGpes (
209151937Sjkim    void);
21084491Smsmith
211129684SnjlACPI_STATUS
212129684SnjlAcpiHwEnableRuntimeGpeBlock (
213129684Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
214193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
215193267Sjkim    void                    *Context);
216129684Snjl
217129684Snjl
218151937Sjkim/*
219212761Sjkim * hwpci - PCI configuration support
220212761Sjkim */
221212761SjkimACPI_STATUS
222212761SjkimAcpiHwDerivePciId (
223212761Sjkim    ACPI_PCI_ID             *PciId,
224212761Sjkim    ACPI_HANDLE             RootPciDevice,
225212761Sjkim    ACPI_HANDLE             PciRegion);
226212761Sjkim
227212761Sjkim
22867754Smsmith#endif /* __ACHWARE_H__ */
229