static void ioapic_init(struct device *dev) { void *ioapic_base; pci_write_config32(dev, 0xF8, 0x1); ioapic_base = (void *)(pci_read_config32(dev, 0xFC) & 0xfffffff0); clear_ioapic(ioapic_base); setup_ioapic(ioapic_base, 1); }
static void sb700_enable(device_t dev) { struct southbridge_amd_cimx_sb700_config *sb_chip = (struct southbridge_amd_cimx_sb700_config *)(dev->chip_info); printk(BIOS_DEBUG, "sb700_enable() "); switch (dev->path.pci.devfn) { case (0x11 << 3) | 0: /* 0:11.0 SATA */ sb700_cimx_config(sb_config); if (dev->enabled) { sb_config->SataController = CIMX_OPTION_ENABLED; if (1 == sb_chip->boot_switch_sata_ide) sb_config->SataIdeCombMdPriSecOpt = 0; //0 -IDE as primary. else if (0 == sb_chip->boot_switch_sata_ide) sb_config->SataIdeCombMdPriSecOpt = 1; //1 -IDE as secondary. } else { sb_config->SataController = CIMX_OPTION_DISABLED; } break; case (0x12 << 3) | 0: /* 0:12:0 OHCI-USB1 */ case (0x12 << 3) | 2: /* 0:12:2 EHCI-USB1 */ case (0x13 << 3) | 0: /* 0:13:0 OHCI-USB2 */ case (0x13 << 3) | 2: /* 0:13:2 EHCI-USB2 */ break; case (0x14 << 3) | 0: /* 0:14:0 SMBUS */ { u32 ioapic_base; printk(BIOS_DEBUG, "sm_init().\n"); ioapic_base = IO_APIC_ADDR; clear_ioapic(ioapic_base); /* I/O APIC IDs are normally limited to 4-bits. Enforce this limit. */ if (CONFIG_MAX_CPUS >= 16) setup_ioapic(ioapic_base, 0); else setup_ioapic(ioapic_base, CONFIG_MAX_CPUS + 1); } break; case (0x14 << 3) | 1: /* 0:14:1 IDE */ break; case (0x14 << 3) | 2: /* 0:14:2 HDA */ if (dev->enabled) { if (AZALIA_DISABLE == sb_config->AzaliaController) { sb_config->AzaliaController = AZALIA_AUTO; } printk(BIOS_DEBUG, "hda enabled\n"); } else { sb_config->AzaliaController = AZALIA_DISABLE; printk(BIOS_DEBUG, "hda disabled\n"); } break; case (0x14 << 3) | 3: /* 0:14:3 LPC */ break; case (0x14 << 3) | 4: /* 0:14:4 PCI */ break; case (0x14 << 3) | 5: /* 0:14:5 OHCI-USB4 */ /* call CIMX entry after last device enable */ sb_Before_Pci_Init(); break; default: break; } }
/** * @brief SB Cimx entry point sbBeforePciInit wrapper */ static void sb800_enable(device_t dev) { struct southbridge_amd_cimx_sb800_config *sb_chip = (struct southbridge_amd_cimx_sb800_config *)(dev->chip_info); printk(BIOS_DEBUG, "sb800_enable() "); switch (dev->path.pci.devfn) { case (0x11 << 3) | 0: /* 0:11.0 SATA */ /* the first sb800 device */ switch (GPP_CFGMODE) { /* config the GPP PCIe ports */ case GPP_CFGMODE_X2200: abcfg_reg(0xc0, 0x01FF, 0x032); /* x2 Port_0, x2 Port_1 */ break; case GPP_CFGMODE_X2110: abcfg_reg(0xc0, 0x01FF, 0x073); /* x2 Port_0, x1 Port_1&2 */ break; case GPP_CFGMODE_X1111: abcfg_reg(0xc0, 0x01FF, 0x0F4); /* x1 Port_0&1&2&3 */ break; case GPP_CFGMODE_X4000: default: abcfg_reg(0xc0, 0x01FF, 0x010); /* x4 Port_0 */ break; } sb800_cimx_config(sb_config); if (dev->enabled) { sb_config->SATAMODE.SataMode.SataController = CIMX_OPTION_ENABLED; if (1 == sb_chip->boot_switch_sata_ide) sb_config->SATAMODE.SataMode.SataIdeCombMdPriSecOpt = 0; //0 -IDE as primary. else if (0 == sb_chip->boot_switch_sata_ide) sb_config->SATAMODE.SataMode.SataIdeCombMdPriSecOpt = 1; //1 -IDE as secondary. } else { sb_config->SATAMODE.SataMode.SataController = CIMX_OPTION_DISABLED; } break; case (0x14 << 3) | 0: /* 0:14:0 SMBUS */ printk(BIOS_INFO, "sm_init().\n"); clear_ioapic(IO_APIC_ADDR); #if CONFIG_CPU_AMD_AGESA /* Assign the ioapic ID the next available number after the processor core local APIC IDs */ setup_ioapic(IO_APIC_ADDR, CONFIG_MAX_CPUS); #else /* I/O APIC IDs are normally limited to 4-bits. Enforce this limit. */ #if (CONFIG_APIC_ID_OFFSET == 0 && CONFIG_MAX_CPUS * CONFIG_MAX_PHYSICAL_CPUS < 16) /* Assign the ioapic ID the next available number after the processor core local APIC IDs */ setup_ioapic(IO_APIC_ADDR, CONFIG_MAX_CPUS * CONFIG_MAX_PHYSICAL_CPUS); #elif (CONFIG_APIC_ID_OFFSET > 0) /* Assign the ioapic ID the value 0. Processor APIC IDs follow. */ setup_ioapic(IO_APIC_ADDR, 0); #else #error "The processor APIC IDs must be lifted to make room for the I/O APIC ID" #endif #endif break; case (0x14 << 3) | 1: /* 0:14:1 IDE */ break; case (0x14 << 3) | 2: /* 0:14:2 HDA */ if (dev->enabled) { if (AZALIA_DISABLE == sb_config->AzaliaController) { sb_config->AzaliaController = AZALIA_AUTO; } printk(BIOS_DEBUG, "hda enabled\n"); } else { sb_config->AzaliaController = AZALIA_DISABLE; printk(BIOS_DEBUG, "hda disabled\n"); } break; case (0x14 << 3) | 3: /* 0:14:3 LPC */ /* Initialize the fans */ #if CONFIG_SB800_IMC_FAN_CONTROL init_sb800_IMC_fans(dev); #elif CONFIG_SB800_MANUAL_FAN_CONTROL init_sb800_MANUAL_fans(dev); #endif break; case (0x14 << 3) | 4: /* 0:14:4 PCI */ break; case (0x14 << 3) | 6: /* 0:14:6 GEC */ if (dev->enabled) { sb_config->GecConfig = 0; printk(BIOS_DEBUG, "gec enabled\n"); } else { sb_config->GecConfig = 1; printk(BIOS_DEBUG, "gec disabled\n"); } break; case (0x15 << 3) | 0: /* 0:15:0 PCIe PortA */ { device_t device; for (device = dev; device; device = device->next) { if (dev->path.type != DEVICE_PATH_PCI) continue; if ((device->path.pci.devfn & ~7) != PCI_DEVFN(0x15,0)) break; sb_config->PORTCONFIG[device->path.pci.devfn & 3].PortCfg.PortPresent = device->enabled; } /* * GPP_CFGMODE_X4000: PortA Lanes[3:0] * GPP_CFGMODE_X2200: PortA Lanes[1:0], PortB Lanes[3:2] * GPP_CFGMODE_X2110: PortA Lanes[1:0], PortB Lane2, PortC Lane3 * GPP_CFGMODE_X1111: PortA Lanes0, PortB Lane1, PortC Lane2, PortD Lane3 */ sb_config->GppLinkConfig = sb_chip->gpp_configuration; } break; case (0x12 << 3) | 0: /* 0:12:0 OHCI-USB1 */ sb_config->USBMODE.UsbMode.Ohci1 = dev->enabled; break; case (0x12 << 3) | 2: /* 0:12:2 EHCI-USB1 */ sb_config->USBMODE.UsbMode.Ehci1 = dev->enabled; break; case (0x13 << 3) | 0: /* 0:13:0 OHCI-USB2 */ sb_config->USBMODE.UsbMode.Ohci2 = dev->enabled; break; case (0x13 << 3) | 2: /* 0:13:2 EHCI-USB2 */ sb_config->USBMODE.UsbMode.Ehci2 = dev->enabled; break; case (0x14 << 3) | 5: /* 0:14:5 OHCI-USB4 */ sb_config->USBMODE.UsbMode.Ohci4 = dev->enabled; break; case (0x16 << 3) | 0: /* 0:16:0 OHCI-USB3 */ sb_config->USBMODE.UsbMode.Ohci3 = dev->enabled; break; case (0x16 << 3) | 2: /* 0:16:2 EHCI-USB3 */ sb_config->USBMODE.UsbMode.Ehci3 = dev->enabled; /* call the CIMX entry at the last sb800 device, * so make sure the mainboard devicetree is complete */ if (!acpi_is_wakeup_s3()) sb_Before_Pci_Init(); else sb_Before_Pci_Restore_Init(); break; default: break; } }
static void sm_init(device_t dev) { u8 byte; u32 ioapic_base; printk(BIOS_INFO, "sm_init().\n"); ioapic_base = 0xFEC00000;//pci_read_config32(dev, 0x74) & (0xffffffe0); /* some like mem resource, but does not have enable bit */ /* Don't rename APIC ID */ /* TODO: We should call setup_ioapic() here. But kernel hangs if cpu is K8. * We need to check out why and change back. */ clear_ioapic(ioapic_base); //setup_ioapic(ioapic_base, 0); /* enable serial irq */ byte = pm_ioread(0x54); byte |= 1 << 7; /* enable serial irq function */ byte &= ~(0xF << 2); byte |= 4 << 2; /* set NumSerIrqBits=4 */ pm_iowrite(0x54, byte); pm_iowrite(0x00, 0x0E); pm_iowrite(0x0B, 0x02); /* 2.11 IO Trap Settings */ abcfg_reg(0x10090, 1 << 16, 1 << 16); /* 4.1 ab index */ //pci_write_config32(dev, 0xF0, AB_INDX); pm_iowrite(0xE0, AB_INDX & 0xFF); pm_iowrite(0xE1, (AB_INDX >> 8) & 0xFF); pm_iowrite(0xE2, (AB_INDX >> 16) & 0xFF); pm_iowrite(0xE3, (AB_INDX >> 24) & 0xFF); /* Initialize the real time clock */ rtc_init(0); byte = pm_ioread(0x8); byte |= 1 << 2 | 1 << 4; pm_iowrite(0x08, byte); byte = pm_ioread(0x9); byte |= 1 << 0; pm_iowrite(0x09, byte); abcfg_reg(0x10060, (BIT31), BIT31); abcfg_reg(0x1009C, (BIT4 + BIT5), BIT4 + BIT5); abcfg_reg(0x9C, (BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7), BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7); abcfg_reg(0x90, (BIT21 + BIT22 + BIT23), BIT21 + BIT22 + BIT23); abcfg_reg(0xF0, (BIT6 + BIT5), BIT6 + BIT5); abcfg_reg(0x10090, (BIT9 + BIT10 + BIT11 + BIT12), BIT9 + BIT10 + BIT11 + BIT12); abcfg_reg(0x58, (BIT10), BIT10); abcfg_reg(0xF0, (BIT3 + BIT4), BIT3 + BIT4); abcfg_reg(0x54, (BIT1), BIT1); // axindxc_reg(0x02, BIT9, BIT9); axindxc_reg(0x10, BIT9, BIT9); /* 4.2 Enabling Upstream DMA Access */ axcfg_reg(0x04, 1 << 2, 1 << 2); /* 4.3 Enabling PCIB Prefetch Settings */ abcfg_reg(0x10060, 1 << 20, 1 << 20); abcfg_reg(0x10064, 1 << 20, 1 << 20); /* 4.4 Enabling OHCI Prefetch for Performance Enhancement, A12 */ abcfg_reg(0x80, 1 << 0, 1<< 0); /* 4.5 B-Link Client's Credit Variable Settings for the Downstream Arbitration Equation */ /* 4.6 Enabling Additional Address Bits Checking in Downstream */ abcfg_reg(0x9c, 1 << 0, 1 << 0); //abcfg_reg(0x9c, 3 << 0, 3 << 0); //A11 /* 4.7 Set B-Link Prefetch Mode */ abcfg_reg(0x80, 3 << 17, 3 << 17); // RPR Enabled SMI ordering enhancement. ABCFG 0x90[21] // RPR USB Delay A-Link Express L1 State. ABCFG 0x90[17] abcfg_reg(0x90, 1 << 17 | 1 << 21, 1 << 17 | 1 << 21); /* 4.8 Enabling Detection of Upstream Interrupts */ abcfg_reg(0x94, 1 << 20 | 0x7FFFF, 1 << 20 | 0x00FEE); /* 4.9: Enabling Downstream Posted Transactions to Pass Non-Posted * Transactions for the K8 Platform (for All Revisions) */ abcfg_reg(0x10090, 1 << 8, 1 << 8); /* 4.10:Programming Cycle Delay for AB and BIF Clock Gating */ /* 4.11:Enabling AB Int_Arbiter Enhancement (for All Revisions) */ abcfg_reg(0x10054, 0xFFFF0000, 0x01040000); abcfg_reg(0x54, 0xFF << 16, 4 << 16); abcfg_reg(0x54, 1 << 24, 0 << 24); abcfg_reg(0x54, 1 << 26, 1 << 26); abcfg_reg(0x98, 0xFFFFFF00, 0x00004700); /* 4.12: Enabling AB and BIF Clock Gating */ abcfg_reg(0x10054, 0x0000FFFF, 0x07FF); /* 4.13:Enabling Requester ID for upstream traffic. */ abcfg_reg(0x98, 3 << 16, 3 << 16); abcfg_reg(0x50, 1 << 2, 0 << 2); /* 5.2 Enabling GPP Port A/B/C/D */ //abcfg_reg(0xC0, 0xF << 4, 0xF << 4); /* Enable SCI as irq9. */ outb(0x10, 0xC00); outb(0x9, 0xC01); /* Enabled IRQ input */ outb(0x9, 0xC00); outb(0xF7, 0xC01); abcfg_reg(0x90, 0xFFFFFFFF, 0x00F80040); abcfg_reg(0xA0, 0xFFFFFFFF, 0x00000000); abcfg_reg(0xA4, 0xFFFFFFFF, 0x00000000); abcfg_reg(0xC0, 0xFFFFFFFF, 0x0000F014); abcfg_reg(0x98, 0xFFFFFFFF, 0X01034700); }
/** * @brief SB Cimx entry point sbBeforePciInit wrapper */ static void sb800_enable(device_t dev) { struct southbridge_amd_cimx_sb800_config *sb_chip = (struct southbridge_amd_cimx_sb800_config *)(dev->chip_info); switch (dev->path.pci.devfn) { case (0x11 << 3) | 0: /* 0:11.0 SATA */ if (dev->enabled) { sb_config->SATAMODE.SataMode.SataController = CIMX_OPTION_ENABLED; if (1 == sb_chip->boot_switch_sata_ide) sb_config->SATAMODE.SataMode.SataIdeCombMdPriSecOpt = 0; //0 -IDE as primary. else if (0 == sb_chip->boot_switch_sata_ide) sb_config->SATAMODE.SataMode.SataIdeCombMdPriSecOpt = 1; //1 -IDE as secondary. } else { sb_config->SATAMODE.SataMode.SataController = CIMX_OPTION_DISABLED; } break; case (0x14 << 3) | 0: /* 0:14:0 SMBUS */ clear_ioapic(VIO_APIC_VADDR); #if CONFIG_CPU_AMD_AGESA /* Assign the ioapic ID the next available number after the processor core local APIC IDs */ setup_ioapic(VIO_APIC_VADDR, CONFIG_MAX_CPUS); #else /* I/O APIC IDs are normally limited to 4-bits. Enforce this limit. */ #if (CONFIG_APIC_ID_OFFSET == 0 && CONFIG_MAX_CPUS * CONFIG_MAX_PHYSICAL_CPUS < 16) /* Assign the ioapic ID the next available number after the processor core local APIC IDs */ setup_ioapic(VIO_APIC_VADDR, CONFIG_MAX_CPUS * CONFIG_MAX_PHYSICAL_CPUS); #elif (CONFIG_APIC_ID_OFFSET > 0) /* Assign the ioapic ID the value 0. Processor APIC IDs follow. */ setup_ioapic(VIO_APIC_VADDR, 0); #else #error "The processor APIC IDs must be lifted to make room for the I/O APIC ID" #endif #endif break; case (0x14 << 3) | 1: /* 0:14:1 IDE */ break; case (0x14 << 3) | 2: /* 0:14:2 HDA */ if (dev->enabled) { if (AZALIA_DISABLE == sb_config->AzaliaController) { sb_config->AzaliaController = AZALIA_AUTO; } } else { sb_config->AzaliaController = AZALIA_DISABLE; } break; case (0x14 << 3) | 3: /* 0:14:3 LPC */ /* Initialize the fans */ #if CONFIG_SB800_IMC_FAN_CONTROL init_sb800_IMC_fans(dev); #elif CONFIG_SB800_MANUAL_FAN_CONTROL init_sb800_MANUAL_fans(dev); #endif break; case (0x14 << 3) | 4: /* 0:14:4 PCI */ /* PcibConfig [PM_Reg: EAh], PCIDisable [Bit0] * 'PCIDisable' set to 0 to enable P2P bridge. * 'PCIDisable' set to 1 to disable P2P bridge and enable PCI interface pins * to function as GPIO {GPIO 35:0}. */ if (!sb_chip->disconnect_pcib && dev->enabled) RWMEM(ACPI_MMIO_BASE + PMIO_BASE + SB_PMIOA_REGEA, AccWidthUint8, ~BIT0, 0); else RWMEM(ACPI_MMIO_BASE + PMIO_BASE + SB_PMIOA_REGEA, AccWidthUint8, ~BIT0, BIT0); break; case (0x14 << 3) | 6: /* 0:14:6 GEC */ if (dev->enabled) { sb_config->GecConfig = 0; } else { sb_config->GecConfig = 1; } break; case (0x15 << 3) | 0: /* 0:15:0 PCIe PortA */ { device_t device; for (device = dev; device; device = device->next) { if (dev->path.type != DEVICE_PATH_PCI) continue; if ((device->path.pci.devfn & ~7) != PCI_DEVFN(0x15,0)) break; sb_config->PORTCONFIG[device->path.pci.devfn & 3].PortCfg.PortPresent = device->enabled; } /* * GPP_CFGMODE_X4000: PortA Lanes[3:0] * GPP_CFGMODE_X2200: PortA Lanes[1:0], PortB Lanes[3:2] * GPP_CFGMODE_X2110: PortA Lanes[1:0], PortB Lane2, PortC Lane3 * GPP_CFGMODE_X1111: PortA Lanes0, PortB Lane1, PortC Lane2, PortD Lane3 */ sb_config->GppLinkConfig = sb_chip->gpp_configuration; } break; case (0x12 << 3) | 0: /* 0:12:0 OHCI-USB1 */ sb_config->USBMODE.UsbMode.Ohci1 = dev->enabled; break; case (0x12 << 3) | 2: /* 0:12:2 EHCI-USB1 */ sb_config->USBMODE.UsbMode.Ehci1 = dev->enabled; break; case (0x13 << 3) | 0: /* 0:13:0 OHCI-USB2 */ sb_config->USBMODE.UsbMode.Ohci2 = dev->enabled; break; case (0x13 << 3) | 2: /* 0:13:2 EHCI-USB2 */ sb_config->USBMODE.UsbMode.Ehci2 = dev->enabled; break; case (0x14 << 3) | 5: /* 0:14:5 OHCI-USB4 */ sb_config->USBMODE.UsbMode.Ohci4 = dev->enabled; break; case (0x16 << 3) | 0: /* 0:16:0 OHCI-USB3 */ sb_config->USBMODE.UsbMode.Ohci3 = dev->enabled; break; case (0x16 << 3) | 2: /* 0:16:2 EHCI-USB3 */ sb_config->USBMODE.UsbMode.Ehci3 = dev->enabled; /* call the CIMX entry at the last sb800 device, * so make sure the mainboard devicetree is complete */ if (!acpi_is_wakeup_s3()) sb_Before_Pci_Init(); else sb_Before_Pci_Restore_Init(); break; default: break; } }
/* * SB600 enables all USB controllers by default in SMBUS Control. * SB600 enables SATA by default in SMBUS Control. */ static void sm_init(device_t dev) { u8 byte; u8 byte_old; u32 dword; u32 ioapic_base; u32 on; u32 nmi_option; printk(BIOS_INFO, "sm_init().\n"); ioapic_base = pci_read_config32(dev, 0x74) & (0xffffffe0); /* some like mem resource, but does not have enable bit */ /* Don't rename APIC ID */ clear_ioapic(ioapic_base); dword = pci_read_config8(dev, 0x62); dword |= 1 << 2; pci_write_config8(dev, 0x62, dword); dword = pci_read_config32(dev, 0x78); dword |= 1 << 9; pci_write_config32(dev, 0x78, dword); /* enable 0xCD6 0xCD7 */ /* bit 10: MultiMediaTimerIrqEn */ dword = pci_read_config8(dev, 0x64); dword |= 1 << 10; pci_write_config8(dev, 0x64, dword); /* enable serial irq */ byte = pci_read_config8(dev, 0x69); byte |= 1 << 7; /* enable serial irq function */ byte &= ~(0xF << 2); byte |= 4 << 2; /* set NumSerIrqBits=4 */ pci_write_config8(dev, 0x69, byte); byte = pm_ioread(0x61); byte |= 1 << 1; /* Set to enable NB/SB handshake during IOAPIC interrupt for AMD K8/K7 */ pm_iowrite(0x61, byte); /* disable SMI */ byte = pm_ioread(0x53); byte |= 1 << 3; pm_iowrite(0x53, byte); /* power after power fail */ on = CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL; get_option(&on, "power_on_after_fail"); byte = pm_ioread(0x74); byte &= ~0x03; if (on) { byte |= 1 << 0; } byte |= 1 << 2; pm_iowrite(0x74, byte); printk(BIOS_INFO, "set power %s after power fail\n", on ? "on" : "off"); /* sb600 rpr:2.3.3: */ byte = pm_ioread(0x9A); byte |= 1 << 5 | 1 << 4 | 1 << 2; pm_iowrite(0x9A, byte); byte = pm_ioread(0x8F); byte |= 1 << 5; byte &= ~(1 << 4); pm_iowrite(0x8F, byte); pm_iowrite(0x8B, 0x01); pm_iowrite(0x8A, 0x90); pm_iowrite(0x88, 0x10); /* A21 */ byte = pm_ioread(0x7C); byte |= 1 << 0; pm_iowrite(0x7C, byte); byte = pm_ioread(0x68); byte &= ~(1 << 1); /* 2.6 */ byte |= 1 << 2; pm_iowrite(0x68, byte); /* 2.6 */ byte = pm_ioread(0x65); byte &= ~(1 << 7); pm_iowrite(0x65, byte); /* 2.3.4 */ byte = pm_ioread(0x52); byte &= ~0x2F; byte |= 0x8; pm_iowrite(0x52, byte); byte = pm_ioread(0x8D); byte &= ~(1 << 6); pm_iowrite(0x8D, byte); byte = pm_ioread(0x61); byte &= ~(1 << 2); pm_iowrite(0x61, byte); byte = pm_ioread(0x42); byte &= ~(1 << 2); pm_iowrite(0x42, byte); /* Set up NMI on errors */ byte = inb(0x70); /* RTC70 */ byte_old = byte; nmi_option = NMI_OFF; get_option(&nmi_option, "nmi"); if (nmi_option) { byte &= ~(1 << 7); /* set NMI */ printk(BIOS_INFO, "++++++++++set NMI+++++\n"); } else { byte |= (1 << 7); /* Can not mask NMI from PCI-E and NMI_NOW */ printk(BIOS_INFO, "++++++++++no set NMI+++++\n"); } byte &= ~(1 << 7); if (byte != byte_old) { outb(byte, 0x70); } /* 2.10 IO Trap Settings */ abcfg_reg(0x10090, 1 << 16, 1 << 16); /* ab index */ pci_write_config32(dev, 0xF0, AB_INDX); /* Initialize the real time clock */ rtc_init(0); /*3.4 Enabling IDE/PCIB Prefetch for Performance Enhancement */ abcfg_reg(0x10060, 9 << 17, 9 << 17); abcfg_reg(0x10064, 9 << 17, 9 << 17); /* 3.5 Enabling OHCI Prefetch for Performance Enhancement */ abcfg_reg(0x80, 1 << 0, 1<< 0); /* 3.6 B-Link Client's Credit Variable Settings for the Downstream Arbitration Equation */ /* 3.7 Enabling Additional Address Bits Checking in Downstream */ abcfg_reg(0x9c, 3 << 0, 3 << 0); /* 3.8 Set B-Link Prefetch Mode */ abcfg_reg(0x80, 3 << 17, 3 << 17); /* 3.9 Enabling Detection of Upstream Interrupts */ abcfg_reg(0x94, 1 << 20,1 << 20); /* 3.10: Enabling Downstream Posted Transactions to Pass Non-Posted * Transactions for the K8 Platform (for All Revisions) */ abcfg_reg(0x10090, 1 << 8, 1 << 8); /* 3.11:Programming Cycle Delay for AB and BIF Clock Gating */ /* 3.12: Enabling AB and BIF Clock Gating */ abcfg_reg(0x10054, 0xFFFF0000, 0x1040000); abcfg_reg(0x54, 0xFF << 16, 4 << 16); printk(BIOS_INFO, "3.11, ABCFG:0x54\n"); abcfg_reg(0x54, 1 << 24, 1 << 24); printk(BIOS_INFO, "3.12, ABCFG:0x54\n"); abcfg_reg(0x98, 0x0000FF00, 0x00004700); /* 3.13:Enabling AB Int_Arbiter Enhancement (for All Revisions) */ abcfg_reg(0x10054, 0x0000FFFF, 0x07FF); /* 3.14:Enabling L1 on A-link Express */ axcfg_reg(0x68, 0x00000003, 0x2); axindxp_reg(0xa0, 0x0000F000, 0x6000); abcfg_reg(0x10098, 0xFFFFFFFF, 0x4000); abcfg_reg(0x04, 0xFFFFFFFF, 0x6); printk(BIOS_INFO, "sm_init() end\n"); /* Enable NbSb virtual channel */ axcfg_reg(0x114, 0x3f << 1, 0 << 1); axcfg_reg(0x120, 0x7f << 1, 0x7f << 1); axcfg_reg(0x120, 7 << 24, 1 << 24); axcfg_reg(0x120, 1 << 31, 1 << 31); abcfg_reg(0x50, 1 << 3, 1 << 3); }
/** * @brief SB Cimx entry point sbBeforePciInit wrapper */ static void sb800_enable(device_t dev) { struct southbridge_amd_cimx_wrapper_sb800_config *sb_chip = (struct southbridge_amd_cimx_wrapper_sb800_config *)(dev->chip_info); sb800_cimx_config(sb_config); printk(BIOS_DEBUG, "sb800_enable() "); /* Config SouthBridge SMBUS/ACPI/IDE/LPC/PCIB.*/ commonInitEarlyBoot(sb_config); commonInitEarlyPost(sb_config); switch (dev->path.pci.devfn) { case (0x11 << 3) | 0: /* 0:11.0 SATA */ if (dev->enabled) { sb_config->SATAMODE.SataMode.SataController = CIMX_OPTION_ENABLED; if (1 == sb_chip->boot_switch_sata_ide) sb_config->SATAMODE.SataMode.SataIdeCombMdPriSecOpt = 0; //0 -IDE as primary. else if (0 == sb_chip->boot_switch_sata_ide) sb_config->SATAMODE.SataMode.SataIdeCombMdPriSecOpt = 1; //1 -IDE as secondary. } else { sb_config->SATAMODE.SataMode.SataController = CIMX_OPTION_DISABLED; } sataInitBeforePciEnum(sb_config); // Init SATA class code and PHY break; case (0x12 << 3) | 0: /* 0:12:0 OHCI-USB1 */ case (0x12 << 3) | 2: /* 0:12:2 EHCI-USB1 */ case (0x13 << 3) | 0: /* 0:13:0 OHCI-USB2 */ case (0x13 << 3) | 2: /* 0:13:2 EHCI-USB2 */ case (0x14 << 3) | 5: /* 0:14:5 OHCI-USB4 */ case (0x16 << 3) | 0: /* 0:16:0 OHCI-USB3 */ case (0x16 << 3) | 2: /* 0:16:2 EHCI-USB3 */ usbInitBeforePciEnum(sb_config); // USB POST TIME Only break; case (0x14 << 3) | 0: /* 0:14:0 SMBUS */ { u32 ioapic_base; printk(BIOS_INFO, "sm_init().\n"); ioapic_base = IO_APIC_ADDR; clear_ioapic(ioapic_base); /* I/O APIC IDs are normally limited to 4-bits. Enforce this limit. */ #if (CONFIG_APIC_ID_OFFSET == 0 && CONFIG_MAX_CPUS * CONFIG_MAX_PHYSICAL_CPUS < 16) /* Assign the ioapic ID the next available number after the processor core local APIC IDs */ setup_ioapic(ioapic_base, CONFIG_MAX_CPUS * CONFIG_MAX_PHYSICAL_CPUS); #elif (CONFIG_APIC_ID_OFFSET > 0) /* Assign the ioapic ID the value 0. Processor APIC IDs follow. */ setup_ioapic(ioapic_base, 0); #else #error "The processor APIC IDs must be lifted to make room for the I/O APIC ID" #endif } break; case (0x14 << 3) | 1: /* 0:14:1 IDE */ if (dev->enabled) { sb_config->SATAMODE.SataMode.SataIdeCombinedMode = CIMX_OPTION_ENABLED; } else { sb_config->SATAMODE.SataMode.SataIdeCombinedMode = CIMX_OPTION_DISABLED; } sataInitBeforePciEnum(sb_config); // Init SATA class code and PHY break; case (0x14 << 3) | 2: /* 0:14:2 HDA */ if (dev->enabled) { if (AZALIA_DISABLE == sb_config->AzaliaController) { sb_config->AzaliaController = AZALIA_AUTO; } printk(BIOS_DEBUG, "hda enabled\n"); } else { sb_config->AzaliaController = AZALIA_DISABLE; printk(BIOS_DEBUG, "hda disabled\n"); } azaliaInitBeforePciEnum(sb_config); // Detect and configure High Definition Audio break; case (0x14 << 3) | 3: /* 0:14:3 LPC */ break; case (0x14 << 3) | 4: /* 0:14:4 PCI */ break; case (0x14 << 3) | 6: /* 0:14:6 GEC */ if (dev->enabled) { sb_config->GecConfig = 0; printk(BIOS_DEBUG, "gec enabled\n"); } else { sb_config->GecConfig = 1; printk(BIOS_DEBUG, "gec disabled\n"); } gecInitBeforePciEnum(sb_config); // Init GEC break; case (0x15 << 3) | 0: /* 0:15:0 PCIe PortA */ sb_config->PORTCONFIG[0].PortCfg.PortPresent = dev->enabled; return; case (0x15 << 3) | 1: /* 0:15:1 PCIe PortB */ sb_config->PORTCONFIG[1].PortCfg.PortPresent = dev->enabled; return; case (0x15 << 3) | 2: /* 0:15:2 PCIe PortC */ sb_config->PORTCONFIG[2].PortCfg.PortPresent = dev->enabled; return; case (0x15 << 3) | 3: /* 0:15:3 PCIe PortD */ sb_config->PORTCONFIG[3].PortCfg.PortPresent = dev->enabled; /* * GPP_CFGMODE_X4000: PortA Lanes[3:0] * GPP_CFGMODE_X2200: PortA Lanes[1:0], PortB Lanes[3:2] * GPP_CFGMODE_X2110: PortA Lanes[1:0], PortB Lane2, PortC Lane3 * GPP_CFGMODE_X1111: PortA Lanes0, PortB Lane1, PortC Lane2, PortD Lane3 */ if (sb_config->GppLinkConfig != sb_chip->gpp_configuration) { sb_config->GppLinkConfig = sb_chip->gpp_configuration; } sbPcieGppEarlyInit(sb_config); break; default: break; } /* Special setting ABCFG registers before PCI emulation. */ abSpecialSetBeforePciEnum(sb_config); usbDesertPll(sb_config); //sb_config->StdHeader.Func = SB_BEFORE_PCI_INIT; //AmdSbDispatcher(sb_config); }