Ejemplo n.º 1
0
/*******************************************************
* Optimize k8 with UMA.
* See BKDG_NPT_0F guide for details.
* The processor node is addressed by its Node ID on the HT link and can be
* accessed with a device number in the PCI configuration space on Bus0.
* The Node ID 0 is mapped to Device 24 (0x18), the Node ID 1 is mapped
* to Device 25, and so on.
* The processor implements configuration registers in PCI configuration
* space using the following four headers
*	Function0: HT technology configuration
*	Function1: Address map configuration
*	Function2: DRAM and HT technology Trace mode configuration
*	Function3: Miscellaneous configuration
*******************************************************/
static void k8_optimization(void)
{
	pci_devfn_t k8_f0, k8_f2, k8_f3;
	msr_t msr;

	printk(BIOS_INFO, "k8_optimization()\n");
	k8_f0 = PCI_DEV(0, 0x18, 0);
	k8_f2 = PCI_DEV(0, 0x18, 2);
	k8_f3 = PCI_DEV(0, 0x18, 3);

	/* 8.6.6 K8 Buffer Allocation Settings */
	pci_write_config32(k8_f0, 0x90, 0x01700169);	/* CIM NPT_Optimization */
	set_nbcfg_enable_bits(k8_f0, 0x68, 1 << 28, 0 << 28);
	set_nbcfg_enable_bits(k8_f0, 0x68, 3 << 26, 3 << 26);
	set_nbcfg_enable_bits(k8_f0, 0x68, 1 << 11, 1 << 11);
	/* set_nbcfg_enable_bits(k8_f0, 0x84, 1 << 11 | 1 << 13 | 1 << 15, 1 << 11 | 1 << 13 | 1 << 15); */	/* TODO */

	pci_write_config32(k8_f3, 0x70, 0x51220111);
	pci_write_config32(k8_f3, 0x74, 0x50404021);
	pci_write_config32(k8_f3, 0x78, 0x08002A00);
	if (pci_read_config32(k8_f3, 0xE8) & 0x3<<12)
		pci_write_config32(k8_f3, 0x7C, 0x0000211A); /* dual core */
	else
		pci_write_config32(k8_f3, 0x7C, 0x0000212B); /* single core */
	set_nbcfg_enable_bits_8(k8_f3, 0xDC, 0xFF, 0x25);

	set_nbcfg_enable_bits(k8_f2, 0xA0, 1 << 5, 1 << 5);
	set_nbcfg_enable_bits(k8_f2, 0x94, 0xF << 24, 7 << 24);
	set_nbcfg_enable_bits(k8_f2, 0x90, 1 << 10, 0 << 10);
	set_nbcfg_enable_bits(k8_f2, 0xA0, 3 << 2, 3 << 2);
	set_nbcfg_enable_bits(k8_f2, 0xA0, 1 << 5, 1 << 5);

	msr = rdmsr(NB_CFG_MSR);
	msr.lo &= ~(1 << 9);
	msr.hi &= ~(1 << 4);
	wrmsr(NB_CFG_MSR, msr);
}
Ejemplo n.º 2
0
/*****************************************
* rs780_por_pcicfg_init()
*****************************************/
static void rs780_por_pcicfg_init(pci_devfn_t nb_dev)
{
	/* enable PCI Memory Access */
	set_nbcfg_enable_bits_8(nb_dev, 0x04, (u8)(~0xFD), 0x02);
	/* Set RCRB Enable */
	set_nbcfg_enable_bits_8(nb_dev, 0x84, (u8)(~0xFF), 0x1);
	/* allow decode of 640k-1MB */
	set_nbcfg_enable_bits_8(nb_dev, 0x84, (u8)(~0xEF), 0x10);
	/* Enable PM2_CNTL(BAR2) IO mapped cfg write access to be broadcast to both NB and SB */
	set_nbcfg_enable_bits_8(nb_dev, 0x84, (u8)(~0xFF), 0x4);
	/* Power Management Register Enable */
	set_nbcfg_enable_bits_8(nb_dev, 0x84, (u8)(~0xFF), 0x80);

	/* Reg4Ch[1]=1 (APIC_ENABLE) force CPU request with address 0xFECx_xxxx to south-bridge
	 * Reg4Ch[6]=1 (BMMsgEn) enable BM_Set message generation
	 * BMMsgEn */
	set_nbcfg_enable_bits_8(nb_dev, 0x4C, (u8)(~0x00), 0x42 | 1);

	/* Reg4Ch[16]=1 (WakeC2En) enable Wake_from_C2 message generation.
	 * Reg4Ch[18]=1 (P4IntEnable) Enable north-bridge to accept MSI with address 0xFEEx_xxxx from south-bridge */
	set_nbcfg_enable_bits_8(nb_dev, 0x4E, (u8)(~0xFF), 0x05);
	/* Reg94h[4:0] = 0x0  P drive strength offset 0
	 * Reg94h[6:5] = 0x2  P drive strength additive adjust */
	set_nbcfg_enable_bits_8(nb_dev, 0x94, (u8)(~0x80), 0x40);

	/* Reg94h[20:16] = 0x0  N drive strength offset 0
	 * Reg94h[22:21] = 0x2  N drive strength additive adjust */
	set_nbcfg_enable_bits_8(nb_dev, 0x96, (u8)(~0x80), 0x40);

	/* Reg80h[4:0] = 0x0  Termination offset
	 * Reg80h[6:5] = 0x2  Termination additive adjust */
	set_nbcfg_enable_bits_8(nb_dev, 0x80, (u8)(~0x80), 0x40);

	/* Reg80h[14] = 0x1   Enable receiver termination control */
	set_nbcfg_enable_bits_8(nb_dev, 0x81, (u8)(~0xFF), 0x40);

	/* Reg94h[15] = 0x1 Enables HT transmitter advanced features to be turned on
	 * Reg94h[14] = 0x1  Enable drive strength control */
	set_nbcfg_enable_bits_8(nb_dev, 0x95, (u8)(~0x3F), 0xC4);

	/* Reg94h[31:29] = 0x7 Enables HT transmitter de-emphasis */
	set_nbcfg_enable_bits_8(nb_dev, 0x97, (u8)(~0x1F), 0xE0);

	/* Reg8Ch[9] enables Gfx Debug BAR programming
	 * Reg8Ch[10] enables Gfx Debug BAR operation
	 * Enable programming of the debug bar now, but enable
	 * operation only after it has been programmed */
	set_nbcfg_enable_bits_8(nb_dev, 0x8D, (u8)(~0xFF), 0x02);
}
Ejemplo n.º 3
0
void rs780_por_pcicfg_init(device_t nb_tag)
{
    printk_info("enter rs780_por_pcicfg_init\n");
    /* enable PCI Memory Access */
    set_nbcfg_enable_bits_8(nb_tag, 0x04, (u8)(~0xfd), 0x02);
    /* Set RCRB Enable */
    set_nbcfg_enable_bits_8(nb_tag, 0x84, (u8)(~0xFF), 0x1);

    /* allow decode of 640k-1MB */
    set_nbcfg_enable_bits_8(nb_tag, 0x84, (u8)(~0xEF), 0x10);
#if 1
    /* Enable PM2_CNTL(BAR2) IO mapped cfg write access to be broadcast to both NB and SB */
    set_nbcfg_enable_bits_8(nb_tag, 0x84, (u8)(~0xFF), 0x4);
    /* Power Management Register Enable */
    set_nbcfg_enable_bits_8(nb_tag, 0x84, (u8)(~0xFF), 0x80);

    /* Reg4Ch[1]=1 (APIC_ENABLE) force cpu request with address 0xFECx_xxxx to south-bridge
     * Reg4Ch[6]=1 (BMMsgEn) enable BM_Set message generation
     * BMMsgEn */
    //set_nbcfg_enable_bits_8(nb_tag, 0x4C, (u8)(~0x00), 0x42 | 1);
    //lycheng disable APIC_ENABLE
    set_nbcfg_enable_bits_8(nb_tag, 0x4C, (u8)(~0x00), 0x40 | 1);

    /* Reg4Ch[16]=1 (WakeC2En) enable Wake_from_C2 message generation.
     * Reg4Ch[18]=1 (P4IntEnable) Enable north-bridge to accept MSI with address 0xFEEx_xxxx from south-bridge */
    //set_nbcfg_enable_bits_8(nb_tag, 0x4E, (u8)(~0xFF), 0x05);
    //lycheng  disable P4IntEnable
    set_nbcfg_enable_bits_8(nb_tag, 0x4E, (u8)(~0xFF), 0x01);
#endif
    /* Reg94h[4:0] = 0x0  P drive strength offset 0
     * Reg94h[6:5] = 0x2  P drive strength additive adjust */
    set_nbcfg_enable_bits_8(nb_tag, 0x94, (u8)(~0x80), 0x40);

    /* Reg94h[20:16] = 0x0  N drive strength offset 0
     * Reg94h[22:21] = 0x2  N drive strength additive adjust */
    set_nbcfg_enable_bits_8(nb_tag, 0x96, (u8)(~0x80), 0x40);

    /* Reg80h[4:0] = 0x0  Termination offset
     * Reg80h[6:5] = 0x2  Termination additive adjust */
    set_nbcfg_enable_bits_8(nb_tag, 0x80, (u8)(~0x80), 0x40);

    /* Reg80h[14] = 0x1   Enable receiver termination control */
    set_nbcfg_enable_bits_8(nb_tag, 0x81, (u8)(~0xFF), 0x40);

    /* Reg94h[15] = 0x1 Enables HT transmitter advanced features to be turned on
     * Reg94h[14] = 0x1  Enable drive strength control */
    set_nbcfg_enable_bits_8(nb_tag, 0x95, (u8)(~0x3F), 0xC4);

    /* Reg94h[31:29] = 0x7 Enables HT transmitter de-emphasis */
    set_nbcfg_enable_bits_8(nb_tag, 0x97, (u8)(~0x1F), 0xE0);

    /*Reg8Ch[10:9] = 0x3 Enables Gfx Debug BAR,
     * force this BAR as mem type in rs780_gfx.c */
    set_nbcfg_enable_bits_8(nb_tag, 0x8D, (u8)(~0xFF), 0x03);

    printk_info("exit rs780_por_pcicfg_init\n");
}