The handler should return 1 if it handled the request. The current code returns 0, which causes 'Unknown function' logs. Change-Id: Ic296819a5f8c6f1f97b7d47148182226684882a0 Signed-off-by: Sven Schnelle <svens@stackframe.org> Reviewed-on: http://review.coreboot.org/29 Tested-by: build bot (Jenkins)
78 lines
1.9 KiB
C
78 lines
1.9 KiB
C
/*
|
|
* This file is part of the coreboot project.
|
|
*
|
|
* Copyright (C) 2008-2009 coresystems GmbH
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License as
|
|
* published by the Free Software Foundation; version 2 of
|
|
* the License.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
|
* MA 02110-1301 USA
|
|
*/
|
|
|
|
#include <arch/io.h>
|
|
#include <arch/romcc_io.h>
|
|
#include <console/console.h>
|
|
#include <cpu/x86/smm.h>
|
|
#include "southbridge/intel/i82801gx/nvs.h"
|
|
#include <ec/acpi/ec.h>
|
|
#include "dock.h"
|
|
#include "smi.h"
|
|
|
|
/* The southbridge SMI handler checks whether gnvs has a
|
|
* valid pointer before calling the trap handler
|
|
*/
|
|
extern global_nvs_t *gnvs;
|
|
|
|
static void mainboard_smm_init(void)
|
|
{
|
|
printk(BIOS_DEBUG, "initializing SMI\n");
|
|
/* Enable 0x1600/0x1600 register pair */
|
|
ec_set_bit(0x00, 0x05);
|
|
ec_set_ports(0x1604, 0x1600);
|
|
}
|
|
|
|
int mainboard_io_trap_handler(int smif)
|
|
{
|
|
static int smm_initialized;
|
|
|
|
if (!smm_initialized) {
|
|
mainboard_smm_init();
|
|
smm_initialized = 1;
|
|
}
|
|
|
|
switch (smif) {
|
|
case SMI_DOCK_CONNECT:
|
|
dlpc_init();
|
|
if (!dock_connect()) {
|
|
/* set dock LED to indicate status */
|
|
ec_write(0x0c, 0x88);
|
|
} else {
|
|
/* blink dock LED to indicate failure */
|
|
ec_write(0x0c, 0xc8);
|
|
}
|
|
break;
|
|
|
|
case SMI_DOCK_DISCONNECT:
|
|
dock_disconnect();
|
|
ec_write(0x0c, 0x08);
|
|
break;
|
|
|
|
default:
|
|
return 0;
|
|
}
|
|
|
|
/* On success, the IO Trap Handler returns 1
|
|
* On failure, the IO Trap Handler returns a value != 1 */
|
|
return 1;
|
|
}
|