167754Smsmith/******************************************************************************
267754Smsmith *
367754Smsmith * Name: achware.h -- hardware specific interfaces
467754Smsmith *
567754Smsmith *****************************************************************************/
667754Smsmith
7217365Sjkim/*
8245582Sjkim * Copyright (C) 2000 - 2013, 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 (
117239340Sjkim    UINT8                   SleepState);
118231844Sjkim
119231844SjkimACPI_STATUS
120231844SjkimAcpiHwLegacyWakePrep (
121239340Sjkim    UINT8                   SleepState);
122231844Sjkim
123231844SjkimACPI_STATUS
124231844SjkimAcpiHwLegacyWake (
125239340Sjkim    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 (
138239340Sjkim    UINT8                   SleepState);
139231844Sjkim
140231844SjkimACPI_STATUS
141231844SjkimAcpiHwExtendedWakePrep (
142239340Sjkim    UINT8                   SleepState);
143231844Sjkim
144231844SjkimACPI_STATUS
145231844SjkimAcpiHwExtendedWake (
146239340Sjkim    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 (
170239340Sjkim    ACPI_GPE_EVENT_INFO     *GpeEventInfo);
171193267Sjkim
172193267SjkimACPI_STATUS
173209746SjkimAcpiHwLowSetGpe (
174209746Sjkim    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
175209746Sjkim    UINT32                  Action);
17667754Smsmith
17799679SiwasakiACPI_STATUS
178117521SnjlAcpiHwDisableGpeBlock (
179117521Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
180193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
181193267Sjkim    void                    *Context);
182117521Snjl
18399679SiwasakiACPI_STATUS
18467754SmsmithAcpiHwClearGpe (
185114237Snjl    ACPI_GPE_EVENT_INFO     *GpeEventInfo);
18667754Smsmith
18799679SiwasakiACPI_STATUS
188117521SnjlAcpiHwClearGpeBlock (
189117521Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
190193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
191193267Sjkim    void                    *Context);
192117521Snjl
193117521SnjlACPI_STATUS
19467754SmsmithAcpiHwGetGpeStatus (
195117521Snjl    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
19667754Smsmith    ACPI_EVENT_STATUS       *EventStatus);
19767754Smsmith
19899679SiwasakiACPI_STATUS
199129684SnjlAcpiHwDisableAllGpes (
200151937Sjkim    void);
20184491Smsmith
20299679SiwasakiACPI_STATUS
203129684SnjlAcpiHwEnableAllRuntimeGpes (
204151937Sjkim    void);
20584491Smsmith
206129684SnjlACPI_STATUS
207129684SnjlAcpiHwEnableAllWakeupGpes (
208151937Sjkim    void);
20984491Smsmith
210129684SnjlACPI_STATUS
211129684SnjlAcpiHwEnableRuntimeGpeBlock (
212129684Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
213193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
214193267Sjkim    void                    *Context);
215129684Snjl
216129684Snjl
217151937Sjkim/*
218212761Sjkim * hwpci - PCI configuration support
219212761Sjkim */
220212761SjkimACPI_STATUS
221212761SjkimAcpiHwDerivePciId (
222212761Sjkim    ACPI_PCI_ID             *PciId,
223212761Sjkim    ACPI_HANDLE             RootPciDevice,
224212761Sjkim    ACPI_HANDLE             PciRegion);
225212761Sjkim
226212761Sjkim
22767754Smsmith#endif /* __ACHWARE_H__ */
228