diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2007-09-14 00:09:29 +0000 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2007-09-14 00:09:29 +0000 |
commit | 3335adb771c5e6bf2fb200285a8af7134446bb71 (patch) | |
tree | 60a70d32b72273e6d32736aa3b2e871b5500c393 /src/southbridge/amd/cs5530/cs5530_isa.c | |
parent | 741e1e658f060435cfd5505f96cab55045a889d5 (diff) |
This is a full rewrite of all the CS5530/CS5530A code. The previous code was
mostly undocumented, had a broken coding style, contained lots of dead
code and had several other problems, e.g. it enabled write access to the
ROM (why?), it unconditionally enabled primary/secondary IDE (which should
have a config option) and that even _twice_ (which is um... wrong).
The new code
- has 'ide0_enable' and 'ide1_enable' config options (which actually
work) to enable/disable the primary/secondary IDE interface in
Config.lb.
- Does _not_ enable write access to the ROM (or is there some good
reason to do that? If so, it should at least have a config option).
- Contains a bit more documentation.
- Uses readable (and documented) #defines instead of hardcoded magic values.
- aaand... it actually compiles ;-) Yep, that's right. The previous code
wouldn't even build, as it hadn't been fully ported from v1 (still used
v1 functions which are simply not available in v2).
Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2775 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/southbridge/amd/cs5530/cs5530_isa.c')
-rw-r--r-- | src/southbridge/amd/cs5530/cs5530_isa.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/southbridge/amd/cs5530/cs5530_isa.c b/src/southbridge/amd/cs5530/cs5530_isa.c new file mode 100644 index 0000000000..955a93b02e --- /dev/null +++ b/src/southbridge/amd/cs5530/cs5530_isa.c @@ -0,0 +1,60 @@ +/* + * This file is part of the LinuxBIOS project. + * + * Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de> + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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 <console/console.h> +#include <arch/io.h> +#include <device/device.h> +#include <device/pci.h> +#include <device/pci_ids.h> +#include "cs5530.h" + +static void isa_init(struct device *dev) +{ + uint8_t reg8; + + // TODO: Test if needed, otherwise drop. + + /* Set positive decode on ROM. */ + reg8 = pci_read_config8(dev, DECODE_CONTROL_REG2); + reg8 |= BIOS_ROM_POSITIVE_DECODE; + pci_write_config8(dev, DECODE_CONTROL_REG2, reg8); +} + +static void cs5530_pci_dev_enable_resources(device_t dev) +{ + // TODO: Needed? + pci_dev_enable_resources(dev); + enable_childrens_resources(dev); +} + +static struct device_operations isa_ops = { + .read_resources = pci_dev_read_resources, + .set_resources = pci_dev_set_resources, + .enable_resources = cs5530_pci_dev_enable_resources, + .init = isa_init, + .enable = 0, + .scan_bus = scan_static_bus, +}; + +static struct pci_driver isa_driver __pci_driver = { + .ops = &isa_ops, + .vendor = PCI_VENDOR_ID_CYRIX, + .device = PCI_DEVICE_ID_CYRIX_5530_LEGACY, +}; |