acpica_ec.c revision 8e56767d5805b843712c67bce2d732cc722f154b
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Solaris x86 ACPI CA Embedded Controller operation region handler
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* EC status bits
*/
#define EC_IBF (0x02)
#define EC_OBF (0x01)
#define EC_SMI (0x40)
#define EC_SCI (0x20)
/*
* EC commands
*/
#define EC_RD (0x80)
#define EC_WR (0x81)
#define EC_BE (0x82)
#define EC_BD (0x83)
#define EC_QR (0x84)
#define IO_PORT_DES (0x47)
/*
* EC softstate
*/
struct ec_softstate {
} ec;
/* I/O port range descriptor */
typedef struct io_port_des {
/*
* ACPI CA address space handler interface functions
*/
/*ARGSUSED*/
static ACPI_STATUS
{
return (AE_OK);
}
static int
{
int cnt;
#ifdef DEBUG
}
}
#endif
cnt = 0;
cnt += 1;
drv_usecwait(10);
if (cnt > 10000) {
"for IBF to clear");
return (-1);
}
}
cnt = 0;
cnt += 1;
drv_usecwait(10);
if (cnt > 10000) {
" for IBF to clear");
return (-1);
}
}
cnt = 0;
cnt += 1;
drv_usecwait(10);
if (cnt > 10000) {
" for OBF to set");
return (-1);
}
}
}
static int
{
int cnt;
#ifdef DEBUG
}
}
#endif
cnt = 0;
cnt += 1;
drv_usecwait(10);
if (cnt > 10000) {
"for IBF to clear");
return (-1);
}
}
cnt = 0;
cnt += 1;
drv_usecwait(10);
if (cnt > 10000) {
" for IBF to clear");
return (-1);
}
}
cnt += 1;
drv_usecwait(10);
if (cnt > 10000) {
" for IBF to clear");
return (-1);
}
}
return (0);
}
static int
ec_query(void)
{
int cnt;
return (-1);
}
cnt = 0;
cnt += 1;
drv_usecwait(10);
if (cnt > 10000) {
"for IBF to clear");
return (-1);
}
}
cnt = 0;
cnt += 1;
drv_usecwait(10);
if (cnt > 10000) {
" for OBF to set");
return (-1);
}
}
}
static ACPI_STATUS
{
int tmp;
switch (func) {
case ACPI_READ:
if (tmp < 0)
return (AE_ERROR);
break;
case ACPI_WRITE:
return (AE_ERROR);
break;
default:
return (AE_ERROR);
}
return (AE_OK);
}
static void
ec_gpe_callback(void *ctx)
{
char query_str[5];
if (query >= 0) {
}
}
static UINT32
ec_gpe_handler(void *ctx)
{
return (0);
}
/*
* Called from AcpiWalkDevices() when an EC device is found
*/
static ACPI_STATUS
{
int status, i;
int io_port_cnt;
/*
* Save the one EC object we have
*/
/*
* Find ec_base and ec_sc addresses
*/
if (ACPI_FAILURE(res)) {
"failed");
return (AE_OK);
}
return (AE_OK);
}
if (*tmp != IO_PORT_DES)
continue;
/*
* Assuming first port is ec_base and second is ec_sc
*/
if (io_port_cnt)
else
io_port_cnt++;
/*
* Increment ahead to next struct.
*/
i += 7;
#if 0
#endif
}
/*
* Get GPE
*/
/*
* grab contents of GPE object
*/
"failed");
return (AE_OK);
}
return (AE_OK);
}
/*
* Enable EC GPE
*/
" = %d", status);
}
/* should remove GPE handler here */
}
return (AE_OK);
}
#ifdef DEBUG
/*ARGSUSED*/
static ACPI_STATUS
{
return (AE_OK);
}
/*ARGSUSED*/
static ACPI_STATUS
{
return (AE_OK);
}
#endif /* DEBUG */
#ifdef NOTYET
static void
{
}
static void
{
return;
}
}
#endif /* NOTYET */
void
acpica_ec_init(void)
{
#ifdef NOTYET
/*
* Search the ACPI tables for an ECDT; if
* found, use it to install an EC handler
*/
#endif /* NOTYET */
/*
* General model is: use GetDevices callback to install
* handler(s) when device is present.
*/
#ifdef DEBUG
#endif /* DEBUG */
}