blob: c7ed11ce6c6cda25c0f3e972352ffd409e206e56 [file] [log] [blame]
Zheng Bao9db833b2009-12-28 09:59:44 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2000 AG Electronics Ltd.
5 * Copyright (C) 2003-2004 Linux Networx
Uwe Hermanna69d9782010-11-15 19:35:14 +00006 * Copyright (C) 2004 Tyan
Zheng Bao9db833b2009-12-28 09:59:44 +00007 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
Zheng Bao9db833b2009-12-28 09:59:44 +000017 */
18
Stefan Reinauer24d1d4b2013-03-21 11:51:41 -070019#include <arch/io.h>
Edward O'Callaghanb8f05d42015-01-04 16:17:54 +110020#include <device/pnp.h>
21#include <stdint.h>
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000022#include "pc87417.h"
23
Edward O'Callaghanb8f05d42015-01-04 16:17:54 +110024void pc87417_disable_dev(pnp_devfn_t dev)
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000025{
26 pnp_set_logical_device(dev);
27 pnp_set_enable(dev, 0);
28}
Zheng Bao9db833b2009-12-28 09:59:44 +000029
Edward O'Callaghanb8f05d42015-01-04 16:17:54 +110030void pc87417_enable_dev(pnp_devfn_t dev)
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000031{
32 pnp_set_logical_device(dev);
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000033 pnp_set_enable(dev, 1);
34}
Zheng Bao9db833b2009-12-28 09:59:44 +000035
Edward O'Callaghanb8f05d42015-01-04 16:17:54 +110036void xbus_cfg(pnp_devfn_t dev)
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000037{
Edward O'Callaghanb8f05d42015-01-04 16:17:54 +110038 u8 i;
Uwe Hermanna69d9782010-11-15 19:35:14 +000039 u16 xbus_index;
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000040
41 pnp_set_logical_device(dev);
Uwe Hermanna69d9782010-11-15 19:35:14 +000042 /* Select proper BIOS size (4MB). */
43 pnp_write_config(dev, PC87417_XMEMCNF2,
44 (pnp_read_config(dev, PC87417_XMEMCNF2)) | 0x04);
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000045 xbus_index = pnp_read_iobase(dev, 0x60);
46
Uwe Hermanna69d9782010-11-15 19:35:14 +000047 /* Enable writes to devices attached to XCS0 (XBUS Chip Select 0). */
48 for (i = 0; i <= 0xf; i++)
49 outb((i << 4), xbus_index + PC87417_HAP0);
Zheng Bao9db833b2009-12-28 09:59:44 +000050}