ppmvar.h revision 444f66e774d0e4f449866c7f5e64095f2fb0def0
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2009, Intel Corporation.
* All Rights Reserved.
*/
#ifndef _SYS_PPMVAR_H
#define _SYS_PPMVAR_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ppm_unit {
} ppm_unit_t;
/*
* driver states
*/
/*
* Check for domain operational
*/
/*
* LED constants
*/
#define PPM_LEDOFF 0 /* (s10) */
/*
* internal form of "ppm.conf" data
*/
struct ppm_db {
char *name; /* device name */
int plen; /* strlen before wildcard(s10) */
int wccnt; /* upto 2 '*' allowed */
};
struct ppm_cdata {
char *name; /* property name */
char **strings; /* string array */
};
/*
* ppm device info
*/
struct ppm_dev {
struct ppm_domain *domp;
char *path; /* OBP device pathname */
int cmpt; /* component number */
int rplvl; /* last requested power level */
int level; /* actual current power level */
int lowest; /* lowest power level for device */
int highest; /* highest power level for device */
};
/*
* ppm_dev.flags field
*/
/* from PM is in progress. */
/* changed through */
/* pm_power_has_changed path */
/* while power level change, */
/* initiated from PM is in */
/* progress. */
/*
* per domain record of device _ever_ managed by ppm
*/
struct ppm_owned {
char *path; /* device pathname */
int initializing; /* initializing flag */
};
typedef struct ppm_owned ppm_owned_t;
/*
* domain control data structure -
* when you need to do an op for a domain, look up the op in the
* cmd member of the struct, and then perform the method on the
* path using iowr cmd with the args specified in val or val and
* mask or the speed index.
*/
struct ppm_dc {
char *path; /* control device prom pathname */
/* one of: PPMDC_CPU_NEXT */
/* PPMDC_CPU_GO, PPMDC_FET_ON, */
/* PPMDC_FET_OFF, PPMDC_LED_ON, */
/* PPMDC_LED_OFF, PPMDC_PCI_ON, */
/* PPMDC_ENTER_S3, PPMDC_PCI_OFF */
/* PPMDC_EXIT_S3 commands */
/* one of PPMDC_KIO, PPMDC_I2CKIO, */
/* PPMDC_CPUSPEEDKIO */
union {
/* In each sub struct in union, the first three fields */
/* must be .iord, .iowr and .val and in such order. */
/* The .method field above selects a union sub struct */
/* for a particular .cmd operation. */
/* The association between .method and .cmd is platform */
/* specific, therefore described in ppm.conf file. */
/* PPMDC_KIO: simple KIO */
struct m_kio {
/* operation can be carried out */
} kio;
#ifdef sun4u
/* PPMDC_I2CKIO: KIO requires 'arg' as struct i2c_gpio */
/* (defined in i2c_client.h) */
struct m_i2ckio {
/* of register content */
/* operation can be carried out */
} i2c;
#endif
/* PPMDC_CPUSPEEDKIO, PPMDC_VCORE: cpu estar related */
/* simple KIO */
struct m_cpu {
int val; /* new register value */
} cpu;
} m_un;
};
/*
* ppm_dc.cmd field -
*/
#define PPMDC_CPU_NEXT 2
#define PPMDC_PRE_CHNG 3
#define PPMDC_CPU_GO 4
#define PPMDC_POST_CHNG 5
#define PPMDC_FET_ON 6
#define PPMDC_FET_OFF 7
#define PPMDC_LED_ON 8
#define PPMDC_LED_OFF 9
#define PPMDC_CLK_ON 10
#define PPMDC_CLK_OFF 11
#define PPMDC_PRE_PWR_OFF 12
#define PPMDC_PRE_PWR_ON 13
#define PPMDC_POST_PWR_ON 14
#define PPMDC_PWR_OFF 15
#define PPMDC_PWR_ON 16
#define PPMDC_RESET_OFF 17
#define PPMDC_RESET_ON 18
#define PPMDC_ENTER_S3 19
#define PPMDC_EXIT_S3 20
/*
* ppm_dc.method field - select union element
*/
#ifdef sun4u
#endif
/*
* devices that are powered by the same source
* are grouped by this struct as a "power domain"
*/
struct ppm_domain {
char *name; /* domain name */
int dflags; /* domain flags */
int pwr_cnt; /* number of powered up devices */
char *propname; /* domain property name */
int refcnt; /* domain lock ref count */
int model; /* pm model, CPU, FET or LED */
int status; /* domain specific status */
int sub_domain; /* sub-domain */
};
typedef struct ppm_domain ppm_domain_t;
/*
* ppm_domain.model field -
*/
#define PPMD_IS_PCI(model) \
/*
* ppm_domain.status field -
*/
/*
* ppm_domain.dflags field -
*/
#define PPMD_LOCK_ONE 0x1
#define PPMD_LOCK_ALL 0x4
struct ppm_domit {
char *name;
int model;
int dflags;
int status;
};
extern struct ppm_domit ppm_domit_data[];
/*
* XXppm driver-specific routines called from common code (s10)
*/
struct ppm_funcs {
};
extern ppm_domain_t *ppm_domain_p;
extern void *ppm_statep;
extern int ppm_inst;
extern void ppm_dev_init(ppm_dev_t *);
extern void ppm_dev_fini(ppm_dev_t *);
extern int ppm_create_db(dev_info_t *);
extern int ppm_claim_dev(dev_info_t *);
extern void ppm_rem_dev(dev_info_t *);
extern void ppm_init_cb(dev_info_t *);
extern ppm_domain_t *ppm_lookup_domain(char *);
extern ppm_domain_t *ppm_get_domain_by_dev(const char *);
extern int ppm_change_cpu_power(ppm_dev_t *, int);
extern int ppm_revert_cpu_power(ppm_dev_t *, int);
#define PPM_GET_PRIVATE(dip) \
#define PPM_LOCK_DOMAIN(domp) { \
}
#define PPM_UNLOCK_DOMAIN(domp) { \
}
/*
* debug support
*/
#ifdef DEBUG
extern char *ppm_get_ctlstr(int, uint_t);
extern void ppm_print_dc(struct ppm_dc *);
#define D_CREATEDB 0x00000001
#define D_CLAIMDEV 0x00000002
#define D_ADDDEV 0x00000004
#define D_REMDEV 0x00000008
#define D_LOWEST 0x00000010
#define D_SETLVL 0x00000020
#define D_GPIO 0x00000040
#define D_CPU 0x00000080
#define D_FET 0x00000100
#define D_PCIUPA 0x00000200
#define D_1394 0x00000400
#define D_CTLOPS1 0x00000800
#define D_CTLOPS2 0x00001000
#define D_SOME 0x00002000
#define D_LOCKS 0x00004000
#define D_IOCTL 0x00008000
#define D_ATTACH 0x00010000
#define D_DETACH 0x00020000
#define D_OPEN 0x00040000
#define D_CLOSE 0x00080000
#define D_INIT 0x00100000
#define D_FINI 0x00200000
#define D_ERROR 0x00400000
#define D_SETPWR 0x00800000
#define D_LED 0x01000000
#define D_PCI 0x02000000
#define D_PPMDC 0x04000000
#define D_CPR 0x08000000
} \
}
/* (s10) */
#else /* DEBUG */
#endif /* DEBUG */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_PPMVAR_H */