Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 1 | /* |
| 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 Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 6 | * Copyright (C) 2004 Tyan |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 7 | * |
| 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 Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 17 | */ |
| 18 | |
Stefan Reinauer | 24d1d4b | 2013-03-21 11:51:41 -0700 | [diff] [blame] | 19 | #include <arch/io.h> |
Edward O'Callaghan | b8f05d4 | 2015-01-04 16:17:54 +1100 | [diff] [blame] | 20 | #include <device/pnp.h> |
| 21 | #include <stdint.h> |
Ronald G. Minnich | 1cf26a8 | 2005-10-19 17:35:18 +0000 | [diff] [blame] | 22 | #include "pc87417.h" |
| 23 | |
Edward O'Callaghan | b8f05d4 | 2015-01-04 16:17:54 +1100 | [diff] [blame] | 24 | void pc87417_disable_dev(pnp_devfn_t dev) |
Ronald G. Minnich | 1cf26a8 | 2005-10-19 17:35:18 +0000 | [diff] [blame] | 25 | { |
| 26 | pnp_set_logical_device(dev); |
| 27 | pnp_set_enable(dev, 0); |
| 28 | } |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 29 | |
Edward O'Callaghan | b8f05d4 | 2015-01-04 16:17:54 +1100 | [diff] [blame] | 30 | void pc87417_enable_dev(pnp_devfn_t dev) |
Ronald G. Minnich | 1cf26a8 | 2005-10-19 17:35:18 +0000 | [diff] [blame] | 31 | { |
| 32 | pnp_set_logical_device(dev); |
Ronald G. Minnich | 1cf26a8 | 2005-10-19 17:35:18 +0000 | [diff] [blame] | 33 | pnp_set_enable(dev, 1); |
| 34 | } |
Zheng Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 35 | |
Edward O'Callaghan | b8f05d4 | 2015-01-04 16:17:54 +1100 | [diff] [blame] | 36 | void xbus_cfg(pnp_devfn_t dev) |
Ronald G. Minnich | 1cf26a8 | 2005-10-19 17:35:18 +0000 | [diff] [blame] | 37 | { |
Edward O'Callaghan | b8f05d4 | 2015-01-04 16:17:54 +1100 | [diff] [blame] | 38 | u8 i; |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 39 | u16 xbus_index; |
Ronald G. Minnich | 1cf26a8 | 2005-10-19 17:35:18 +0000 | [diff] [blame] | 40 | |
| 41 | pnp_set_logical_device(dev); |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 42 | /* Select proper BIOS size (4MB). */ |
| 43 | pnp_write_config(dev, PC87417_XMEMCNF2, |
| 44 | (pnp_read_config(dev, PC87417_XMEMCNF2)) | 0x04); |
Ronald G. Minnich | 1cf26a8 | 2005-10-19 17:35:18 +0000 | [diff] [blame] | 45 | xbus_index = pnp_read_iobase(dev, 0x60); |
| 46 | |
Uwe Hermann | a69d978 | 2010-11-15 19:35:14 +0000 | [diff] [blame] | 47 | /* 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 Bao | 9db833b | 2009-12-28 09:59:44 +0000 | [diff] [blame] | 50 | } |