xref: /dragonfly/sys/dev/acpica/acpi_cpu_cstate.h (revision ef3ac1d1)
1 /*-
2  * Copyright (c) 2003-2005 Nate Lawson (SDG)
3  * Copyright (c) 2001 Michael Smith
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  * $FreeBSD: src/sys/dev/acpica/acpi_cpu.c,v 1.72 2008/04/12 12:06:00 rpaulo Exp $
28  */
29 
30 #ifndef __ACPI_CPU_CSTATE_H__
31 #define __ACPI_CPU_CSTATE_H__
32 
33 #ifndef _SYS_BUS_H_
34 #include <sys/bus.h>
35 #endif
36 
37 struct acpi_cst_cx {
38     uint32_t		type;		/* C1-3+. */
39     uint32_t		trans_lat;	/* Transition latency (usec). */
40     int			preamble;	/* ACPI_CST_CX_PREAMBLE_ */
41     uint32_t		flags;		/* ACPI_CST_CX_FLAG_ */
42     uint32_t		md_arg0;	/* machine depend arg */
43     void		(*enter)(const struct acpi_cst_cx *);
44     bus_space_tag_t	btag;
45     bus_space_handle_t	bhand;
46 
47     struct resource	*res;
48     ACPI_GENERIC_ADDRESS gas;
49     int			rid;
50     int			res_type;
51     uint32_t		power;		/* Power consumed (mW). */
52 };
53 
54 #define ACPI_CST_CX_PREAMBLE_NONE	0
55 #define ACPI_CST_CX_PREAMBLE_WBINVD	1	/* flush cache */
56 #define ACPI_CST_CX_PREAMBLE_BM_ARB	2	/* disable BM_ARB */
57 
58 #define ACPI_CST_CX_FLAG_BM_STS		0x1	/* check BM_STS */
59 
60 extern int	acpi_cst_quirks;	/* ACPI_CST_QUIRK_ */
61 
62 #define ACPI_CST_QUIRK_NO_C3		0x1	/* C3(+) not usable. */
63 #define ACPI_CST_QUIRK_NO_BM		0x2	/* No bus mastering. */
64 
65 int	acpi_cst_md_cx_setup(struct acpi_cst_cx *);
66 
67 #endif	/* !__ACPI_CPU_CSTATE_H__ */
68