Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 1 | /* |
Stefan Reinauer | 7e61e45 | 2008-01-18 10:35:56 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2005 Digital Design Corporation |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 5 | * (Written by Steven J. Magnani <steve@digidescorp.com> for Digital Design) |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 6 | * Copyright (C) 2007 Corey Osgood <corey.osgood@gmail.com> |
| 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. |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 17 | */ |
| 18 | |
| 19 | #include <console/console.h> |
| 20 | #include <device/device.h> |
| 21 | #include <device/pci.h> |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 22 | #include "i82801bx.h" |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 23 | |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 24 | void i82801bx_enable(device_t dev) |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 25 | { |
Uwe Hermann | 0ea281f | 2010-10-11 21:38:49 +0000 | [diff] [blame] | 26 | u16 reg16, index; |
| 27 | device_t lpc_dev; |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 28 | |
Uwe Hermann | 0ea281f | 2010-10-11 21:38:49 +0000 | [diff] [blame] | 29 | /* Search for the 82801BA/BAM LPC device (D31:F0) on PCI bus 0. */ |
| 30 | lpc_dev = dev_find_slot(0, PCI_DEVFN(0x1f, 0)); |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 31 | if (!lpc_dev) |
| 32 | return; |
| 33 | |
Uwe Hermann | 0ea281f | 2010-10-11 21:38:49 +0000 | [diff] [blame] | 34 | index = PCI_FUNC(dev->path.pci.devfn); |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 35 | |
Uwe Hermann | 0ea281f | 2010-10-11 21:38:49 +0000 | [diff] [blame] | 36 | reg16 = pci_read_config16(lpc_dev, FUNC_DIS); |
| 37 | reg16 &= ~(1 << index); /* Enable device. */ |
| 38 | if (!dev->enabled) |
| 39 | reg16 |= (1 << index); /* Disable device, if desired. */ |
| 40 | pci_write_config16(lpc_dev, FUNC_DIS, reg16); |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 41 | } |
| 42 | |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 43 | struct chip_operations southbridge_intel_i82801bx_ops = { |
| 44 | CHIP_NAME("Intel ICH2 (82801Bx) Series Southbridge") |
| 45 | .enable_dev = i82801bx_enable, |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 46 | }; |