diff --git a/Kconfig b/Kconfig index e79ef84584..67faadaf76 100644 --- a/Kconfig +++ b/Kconfig @@ -84,6 +84,8 @@ config SOUTHBRIDGE_INTEL_I82371EB boolean config SOUTHBRIDGE_NVIDIA_MCP55 boolean +config SOUTHBRIDGE_AMD_AMD8111 + boolean # Super I/Os: config SUPERIO_WINBOND_W83627HF diff --git a/device/hypertransport.c b/device/hypertransport.c index 9bb66cfc6e..609601fac8 100644 --- a/device/hypertransport.c +++ b/device/hypertransport.c @@ -23,22 +23,26 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include #include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include +#include #include -#include -#include +#include +#include +#include +#include #define OPT_HT_LINK 0 -#if OPT_HT_LINK == 1 -#include -#endif - static struct device *ht_scan_get_devs(struct device **old_devices) { struct device *first, *last; @@ -322,7 +326,7 @@ static void ht_collapse_early_enumeration(struct bus *bus, } while ((ctrl & (1 << 5)) == 0); /* Actually, only for one HT device HT chain, and unitid is 0. */ -#if HT_CHAIN_UNITID_BASE == 0 +#if CONFIG_HT_CHAIN_UNITID_BASE == 0 if (offset_unitid) { return; } @@ -332,8 +336,8 @@ static void ht_collapse_early_enumeration(struct bus *bus, if ((!offset_unitid) || (offset_unitid && - (!((HT_CHAIN_END_UNITID_BASE == 0) - && (HT_CHAIN_END_UNITID_BASE < HT_CHAIN_UNITID_BASE))))) { + (!((CONFIG_HT_CHAIN_END_UNITID_BASE == 0) + && (CONFIG_HT_CHAIN_END_UNITID_BASE < CONFIG_HT_CHAIN_UNITID_BASE))))) { struct device dummy; u32 id; dummy.bus = bus; @@ -361,8 +365,9 @@ static void ht_collapse_early_enumeration(struct bus *bus, (id == 0x0000ffff) || (id == 0xffff0000)) { continue; } - dummy.vendor = id & 0xffff; - dummy.device = (id >> 16) & 0xffff; + dummy.id.type = DEVICE_ID_PCI; + dummy.id.pci.vendor = id & 0xffff; + dummy.id.pci.device = (id >> 16) & 0xffff; dummy.hdr_type = pci_read_config8(&dummy, PCI_HEADER_TYPE); pos = ht_lookup_slave_capability(&dummy); if (!pos) { @@ -374,7 +379,7 @@ static void ht_collapse_early_enumeration(struct bus *bus, flags &= ~0x1f; pci_write_config16(&dummy, pos + PCI_CAP_FLAGS, flags); printk(BIOS_SPEW, "Collapsing %s [%04x/%04x]\n", - dev_path(&dummy), dummy.vendor, dummy.device); + dev_path(&dummy), dummy.id.pci.vendor, dummy.id.pci.device); } } @@ -384,20 +389,20 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned int min_devfn, unsigned int *ht_unitid_base, unsigned int offset_unitid) { - /* Even HT_CHAIN_UNITID_BASE == 0, we still can go through this + /* Even CONFIG_HT_CHAIN_UNITID_BASE == 0, we still can go through this * function, because of end_of_chain check, also we need it to * optimize link. */ unsigned int next_unitid, last_unitid; struct device *old_devices, *dev, *func; - unsigned int min_unitid = (offset_unitid) ? HT_CHAIN_UNITID_BASE : 1; + unsigned int min_unitid = (offset_unitid) ? CONFIG_HT_CHAIN_UNITID_BASE : 1; struct ht_link prev; struct device *last_func = 0; int ht_dev_num = 0; -#if HT_CHAIN_END_UNITID_BASE < HT_CHAIN_UNITID_BASE +#if CONFIG_HT_CHAIN_END_UNITID_BASE < CONFIG_HT_CHAIN_UNITID_BASE /* Let's record the device of last HT device, so we can set the - * unitid to HT_CHAIN_END_UNITID_BASE. + * unitid to CONFIG_HT_CHAIN_END_UNITID_BASE. */ unsigned int real_last_unitid; u8 real_last_pos; @@ -509,7 +514,7 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned int min_devfn, /* Update the unitid of the next device. */ ht_unitid_base[ht_dev_num] = next_unitid; ht_dev_num++; -#if HT_CHAIN_END_UNITID_BASE < HT_CHAIN_UNITID_BASE +#if CONFIG_HT_CHAIN_END_UNITID_BASE < CONFIG_HT_CHAIN_UNITID_BASE if (offset_unitid) { real_last_unitid = next_unitid; real_last_pos = pos; @@ -523,7 +528,7 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned int min_devfn, printk(BIOS_DEBUG, "%s [%04x/%04x] %s next_unitid: %04x\n", dev_path(dev), - dev->vendor, dev->device, + dev->id.pci.vendor, dev->id.pci.device, (dev->enabled ? "enabled" : "disabled"), next_unitid); @@ -538,7 +543,7 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned int min_devfn, } #endif -#if HT_CHAIN_END_UNITID_BASE < HT_CHAIN_UNITID_BASE +#if CONFIG_HT_CHAIN_END_UNITID_BASE < CONFIG_HT_CHAIN_UNITID_BASE if (offset_unitid && (ht_dev_num > 0)) { u16 flags; int i; @@ -546,19 +551,19 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned int min_devfn, flags = pci_read_config16(real_last_dev, real_last_pos + PCI_CAP_FLAGS); flags &= ~0x1f; - flags |= HT_CHAIN_END_UNITID_BASE & 0x1f; + flags |= CONFIG_HT_CHAIN_END_UNITID_BASE & 0x1f; pci_write_config16(real_last_dev, real_last_pos + PCI_CAP_FLAGS, flags); for (func = real_last_dev; func; func = func->sibling) { func->path.pci.devfn -= ((real_last_unitid - - HT_CHAIN_END_UNITID_BASE) << 3); + CONFIG_HT_CHAIN_END_UNITID_BASE) << 3); last_func = func; } /* Update last one. */ - ht_unitid_base[ht_dev_num - 1] = HT_CHAIN_END_UNITID_BASE; + ht_unitid_base[ht_dev_num - 1] = CONFIG_HT_CHAIN_END_UNITID_BASE; next_unitid = real_last_unitid; } @@ -629,12 +634,11 @@ static const struct pci_operations ht_bus_ops_pci = { }; const struct device_operations default_ht_ops_bus = { - .read_resources = pci_bus_read_resources, - .set_resources = pci_dev_set_resources, - .enable_resources = pci_bus_enable_resources, - .init = 0, - .scan_bus = ht_scan_bridge, - .enable = 0, + .phase3_scan = ht_scan_bridge, + .phase4_read_resources = pci_bus_read_resources, + .phase4_set_resources = pci_dev_set_resources, + .phase5_enable_resources = pci_bus_enable_resources, + .phase6_init = 0, .reset_bus = pci_bus_reset, .ops_pci = &ht_bus_ops_pci, }; diff --git a/include/device/hypertransport.h b/include/device/hypertransport.h index 7060a52d33..7992cb4278 100644 --- a/include/device/hypertransport.h +++ b/include/device/hypertransport.h @@ -24,7 +24,7 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned min_devfn, unsigned max_devfn, unsigned int max, unsigned *ht_unit_base, unsigned offset_unitid); unsigned int ht_scan_bridge(struct device *dev, unsigned int max); -extern struct device_operations default_ht_ops_bus; +extern const struct device_operations default_ht_ops_bus; #define HT_IO_HOST_ALIGN 4096 #define HT_MEM_HOST_ALIGN (1024*1024) diff --git a/mainboard/amd/Kconfig b/mainboard/amd/Kconfig index 23240ceba4..81e9b70ef1 100644 --- a/mainboard/amd/Kconfig +++ b/mainboard/amd/Kconfig @@ -52,6 +52,7 @@ config BOARD_AMD_SERENGETI select OPTION_TABLE select CPU_AMD_K8 select NORTHBRIDGE_AMD_K8 + select SOUTHBRIDGE_AMD_AMD8111 select IOAPIC help AMD Serengeti diff --git a/mainboard/amd/serengeti/dts b/mainboard/amd/serengeti/dts index 3409880cf0..f1425f9c4f 100644 --- a/mainboard/amd/serengeti/dts +++ b/mainboard/amd/serengeti/dts @@ -17,25 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -/*00:00.0 RAM memory: nVidia Corporation MCP55 Memory Controller (rev a1) -00:01.0 ISA bridge: nVidia Corporation MCP55 LPC Bridge (rev a2) -00:01.1 SMBus: nVidia Corporation MCP55 SMBus (rev a2) -00:02.0 USB Controller: nVidia Corporation MCP55 USB Controller (rev a1) -00:02.1 USB Controller: nVidia Corporation MCP55 USB Controller (rev a2) -00:04.0 IDE interface: nVidia Corporation MCP55 IDE (rev a1) -00:05.0 IDE interface: nVidia Corporation MCP55 SATA Controller (rev a2) -00:05.1 IDE interface: nVidia Corporation MCP55 SATA Controller (rev a2) -00:06.0 PCI bridge: nVidia Corporation MCP55 PCI bridge (rev a2) -00:06.1 Audio device: nVidia Corporation MCP55 High Definition Audio (rev a2) -00:08.0 Bridge: nVidia Corporation MCP55 Ethernet (rev a2) -00:0f.0 PCI bridge: nVidia Corporation MCP55 PCI Express bridge (rev a2) -00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration -00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map -00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller -00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control -01:0a.0 FireWire (IEEE 1394): Texas Instruments TSB43AB23 IEEE-1394a-2000 Controller (PHY/Link) -02:00.0 VGA compatible controller: nVidia Corporation G72 [GeForce 7300 LE] (rev a1) -*/ /{ mainboard_vendor = "AMD"; @@ -46,11 +27,18 @@ domain@0 { pci@1,0{ }; + /* guesses; we need a real lspci */ pci@18,0 { /config/("northbridge/amd/k8/pci"); pci@0,0 { /config/("southbridge/amd/amd8111/amd8111.dts"); }; + pci@4,0 { + /config/("southbridge/amd/amd8111/ide.dts"); + }; + pci@5,0 { + /config/("southbridge/amd/amd8111/nic.dts"); + }; }; }; }; diff --git a/northbridge/amd/k8/Makefile b/northbridge/amd/k8/Makefile index cff10fe5a6..9366319d00 100644 --- a/northbridge/amd/k8/Makefile +++ b/northbridge/amd/k8/Makefile @@ -26,6 +26,7 @@ STAGE2_CHIPSET_SRC += $(src)/northbridge/amd/k8/get_sblk_pci1234.c \ $(src)/northbridge/amd/k8/common.c \ $(src)/northbridge/amd/k8/cpu.c \ $(src)/northbridge/amd/k8/domain.c \ - $(src)/northbridge/amd/k8/pci.c + $(src)/northbridge/amd/k8/pci.c \ + $(src)/device/hypertransport.c endif diff --git a/northbridge/amd/k8/domain.c b/northbridge/amd/k8/domain.c index b4f6bd2baa..4ae8b8ebd5 100644 --- a/northbridge/amd/k8/domain.c +++ b/northbridge/amd/k8/domain.c @@ -360,7 +360,7 @@ static void k8_pci_domain_set_resources(struct device * dev) k8_ram_resource(dev, (idx | i), basek, sizek); idx += 0x10; } - assign_resources(&dev->link[0]); + phase4_assign_resources(&dev->link[0]); } static unsigned int k8_domain_scan_bus(struct device * dev, unsigned int max) diff --git a/northbridge/amd/k8/pci.c b/northbridge/amd/k8/pci.c index da6c43e13c..d6e1bc48fa 100644 --- a/northbridge/amd/k8/pci.c +++ b/northbridge/amd/k8/pci.c @@ -546,7 +546,7 @@ static void amdk8_set_resources(struct device * dev) struct bus *bus; bus = &dev->link[link]; if (bus->children) { - assign_resources(bus); + phase4_assign_resources(bus); } } } diff --git a/southbridge/amd/amd8111/Makefile b/southbridge/amd/amd8111/Makefile index 92ae2aae51..34a56d78ca 100644 --- a/southbridge/amd/amd8111/Makefile +++ b/southbridge/amd/amd8111/Makefile @@ -34,7 +34,7 @@ STAGE2_CHIPSET_SRC += \ $(src)/southbridge/amd/amd8111/usb.c \ $(src)/southbridge/amd/amd8111/usb2.c -STAGE0_CHIPSET_SRC += $(src)/southbridge/amd/amd8111/stage1.c +STAGE0_CHIPSET_SRC += endif diff --git a/southbridge/amd/amd8111/ac97.c b/southbridge/amd/amd8111/ac97.c index 40a56e4289..e0fead9e3a 100644 --- a/southbridge/amd/amd8111/ac97.c +++ b/southbridge/amd/amd8111/ac97.c @@ -17,11 +17,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include +#include +#include +#include #include +#include +#include #include -#include +#include +#include #include "amd8111.h" static void lpci_set_subsystem(struct device * dev, unsigned vendor, unsigned device) diff --git a/southbridge/amd/amd8111/acpi.c b/southbridge/amd/amd8111/acpi.c index 45fa71ef3f..6d7d1fff4c 100644 --- a/southbridge/amd/amd8111/acpi.c +++ b/southbridge/amd/amd8111/acpi.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include +#include #include #include #include @@ -27,7 +27,10 @@ #include #include #include -#include #include "amd8111.h" +#include +#include +#include +#include "amd8111.h" #include "amd8111_smbus.h" #define PREVIOUS_POWER_STATE 0x43 @@ -43,6 +46,7 @@ static int lsmbus_recv_byte(struct device * dev) { + int do_smbus_recv_byte(u16 smbus_io_base, u16 device); unsigned device; struct resource *res; @@ -54,6 +58,7 @@ static int lsmbus_recv_byte(struct device * dev) static int lsmbus_send_byte(struct device * dev, u8 val) { + int do_smbus_send_byte(u16 smbus_io_base, u8 device, u8 val); unsigned device; struct resource *res; @@ -66,6 +71,7 @@ static int lsmbus_send_byte(struct device * dev, u8 val) static int lsmbus_read_byte(struct device * dev, u8 address) { + int do_smbus_read_byte(u16 smbus_io_base, u8 device, u8 address); unsigned device; struct resource *res; @@ -77,6 +83,7 @@ static int lsmbus_read_byte(struct device * dev, u8 address) static int lsmbus_write_byte(struct device * dev, u8 address, u8 val) { + int do_smbus_write_byte(u16 smbus_io_base, u8 device, u8 address, u8 val); unsigned device; struct resource *res; @@ -140,7 +147,7 @@ static void acpi_init(struct device *dev) byte |= 0x40; } pci_write_config8(dev, PREVIOUS_POWER_STATE, byte); - printk_info("set power %s after power fail\n", on?"on":"off"); + printk(BIOS_INFO, "set power %s after power fail\n", on?"on":"off"); /* switch serial irq logic from quiet mode to continuous * mode for Winbond W83627HF Rev. 17 @@ -218,11 +225,7 @@ static struct pci_operations lops_pci = { .set_subsystem = lpci_set_subsystem, }; -static struct pci_operations lops_pci = { - .set_subsystem = lpci_set_subsystem, -}; - -struct device_operations ac97audio = { +struct device_operations acpi = { .id = {.type = DEVICE_ID_PCI, {.pci = {.vendor = PCI_VENDOR_ID_AMD, .device = PCI_DEVICE_ID_AMD_8111_ACPI}}}, diff --git a/southbridge/amd/amd8111/amd8111.c b/southbridge/amd/amd8111/amd8111.c index 64aea15853..d9bc5f2b86 100644 --- a/southbridge/amd/amd8111/amd8111.c +++ b/southbridge/amd/amd8111/amd8111.c @@ -41,27 +41,27 @@ void amd8111_enable(struct device * dev) /* See if we are behind the amd8111 pci bridge */ bus_dev = dev->bus->dev; - if ((bus_dev->vendor == PCI_VENDOR_ID_AMD) && - (bus_dev->device == PCI_DEVICE_ID_AMD_8111_PCI)) + if ((bus_dev->id.pci.vendor == PCI_VENDOR_ID_AMD) && + (bus_dev->id.pci.device == PCI_DEVICE_ID_AMD_8111_PCI)) { unsigned devfn; devfn = bus_dev->path.pci.devfn + (1 << 3); lpc_dev = dev_find_slot(bus_dev->bus->secondary, devfn); - index = ((dev->path.u.pci.devfn & ~7) >> 3) + 8; - if (dev->path.u.pci.devfn == 2) { /* EHCI */ + index = ((dev->path.pci.devfn & ~7) >> 3) + 8; + if (dev->path.pci.devfn == 2) { /* EHCI */ index = 16; } } else { unsigned devfn; - devfn = (dev->path.u.pci.devfn) & ~7; + devfn = (dev->path.pci.devfn) & ~7; lpc_dev = dev_find_slot(dev->bus->secondary, devfn); - index = dev->path.u.pci.devfn & 7; + index = dev->path.pci.devfn & 7; } if ((!lpc_dev) || (index >= 17)) { return; } - if ((lpc_dev->vendor != PCI_VENDOR_ID_AMD) || - (lpc_dev->device != PCI_DEVICE_ID_AMD_8111_ISA)) + if ((lpc_dev->id.pci.vendor != PCI_VENDOR_ID_AMD) || + (lpc_dev->id.pci.device != PCI_DEVICE_ID_AMD_8111_ISA)) { u32 id; id = pci_read_config32(lpc_dev, PCI_VENDOR_ID); diff --git a/southbridge/amd/amd8111/ide.c b/southbridge/amd/amd8111/ide.c index 207e209e88..78182ccd83 100644 --- a/southbridge/amd/amd8111/ide.c +++ b/southbridge/amd/amd8111/ide.c @@ -26,7 +26,7 @@ #include #include #include -#nclude "amd8111.h" +#include "amd8111.h" static void ide_init(struct device *dev) { @@ -34,7 +34,7 @@ static void ide_init(struct device *dev) /* Enable ide devices so the linux ide driver will work */ u16 word; u8 byte; - conf = dev->chip_info; + conf = dev->device_configuration; word = pci_read_config16(dev, 0x40); /* Ensure prefetch is disabled */ @@ -72,7 +72,7 @@ static struct pci_operations lops_pci = { .set_subsystem = lpci_set_subsystem, }; -struct device_operations mcp55_ide = { +struct device_operations amd8111_ide = { .id = {.type = DEVICE_ID_PCI, {.pci = {.vendor = PCI_VENDOR_ID_AMD, .device = PCI_DEVICE_ID_AMD_8111_IDE}}}, diff --git a/southbridge/amd/amd8111/lpc.c b/southbridge/amd/amd8111/lpc.c index 7f7c4b32ed..0f799b385f 100644 --- a/southbridge/amd/amd8111/lpc.c +++ b/southbridge/amd/amd8111/lpc.c @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include "amd8111.h" #define NMI_OFF 0 @@ -103,7 +105,7 @@ static void setup_ioapic(void) l[4] = a->value_high; value_high = l[4]; if ((i==0) && (value_low == 0xffffffff)) { - printk_warning("IO APIC not responding.\n"); + printk(BIOS_WARNING, "IO APIC not responding.\n"); return; } printk(BIOS_SPEW, "for IRQ, reg 0x%08x value 0x%08x 0x%08x\n", diff --git a/southbridge/amd/amd8111/nic.c b/southbridge/amd/amd8111/nic.c index 32c0c2005c..004f9fde26 100644 --- a/southbridge/amd/amd8111/nic.c +++ b/southbridge/amd/amd8111/nic.c @@ -71,6 +71,7 @@ static void nic_init(struct device *dev) /* Hard Reset PHY */ printk(BIOS_DEBUG, "Reseting PHY... "); +/* if (conf->phy_lowreset) { writel(VAL0 | PHY_RST_POL | RESET_PHY , (void *)(mmio + CMD3)); } else { @@ -78,6 +79,7 @@ static void nic_init(struct device *dev) } mdelay(15); writel(RESET_PHY, (void *)(mmio + CMD3)); +*/ printk(BIOS_DEBUG, "Done\n"); } diff --git a/southbridge/amd/amd8111/nic.dts b/southbridge/amd/amd8111/nic.dts index 09ce892be3..fc3a05b8d4 100644 --- a/southbridge/amd/amd8111/nic.dts +++ b/southbridge/amd/amd8111/nic.dts @@ -20,4 +20,5 @@ { device_operations = "amd8111_nic"; + phy_lowreset = "0"; }; diff --git a/southbridge/amd/amd8111/smbus.c b/southbridge/amd/amd8111/smbus.c index 84e8e36f02..1b9b26fcc5 100644 --- a/southbridge/amd/amd8111/smbus.c +++ b/southbridge/amd/amd8111/smbus.c @@ -26,13 +26,12 @@ #include #include #include -#include #include #include #include #include #include -#include +#include #include "amd8111.h" static void lpci_set_subsystem(struct device * dev, unsigned vendor, unsigned device) @@ -59,6 +58,6 @@ struct device_operations amd8111_smbus = { .phase4_set_resources = pci_dev_set_resources, .phase5_enable_resources = pci_dev_enable_resources, .phase6_init = NULL, - .ops_pci = &lops_pci + .ops_pci = &lops_pci, .ops_smbus_bus = &lops_smbus_bus, }; diff --git a/southbridge/amd/amd8111/usb.c b/southbridge/amd/amd8111/usb.c index 40b0f7cfea..e366bf40c0 100644 --- a/southbridge/amd/amd8111/usb.c +++ b/southbridge/amd/amd8111/usb.c @@ -26,13 +26,11 @@ #include #include #include -#include #include #include -#include #include #include -#include +#include #include "amd8111.h" diff --git a/southbridge/amd/amd8111/usb2.c b/southbridge/amd/amd8111/usb2.c index 716807da7c..24f9d365ee 100644 --- a/southbridge/amd/amd8111/usb2.c +++ b/southbridge/amd/amd8111/usb2.c @@ -27,13 +27,12 @@ #include #include #include -#include #include #include #include #include #include -#include +#include #include "amd8111.h" static void amd8111_usb2_enable(struct device *dev)