Add AMD rs690 VID DID reporting and some minor cleanups.
Signed-off-by: Joe Bao <zheng.bao@amd.com> Reviewed-by: Maggie Li <maggie.li@amd.com> Acked-by: Ronald G. Minnich <rminnich@gmail.com> Acked-by: Marc Jones <marcj303@gmail.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3786 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
164463c551
commit
40d46ba383
|
@ -23,7 +23,7 @@
|
||||||
/* Member variables are defined in Config.lb. */
|
/* Member variables are defined in Config.lb. */
|
||||||
struct southbridge_amd_rs690_config
|
struct southbridge_amd_rs690_config
|
||||||
{
|
{
|
||||||
unsigned long vga_rom_address; /* The location that the VGA rom has been appened. */
|
u32 vga_rom_address; /* The location that the VGA rom has been appened. */
|
||||||
u8 gpp_configuration; /* The configuration of General Purpose Port, A/B/C/D/E. */
|
u8 gpp_configuration; /* The configuration of General Purpose Port, A/B/C/D/E. */
|
||||||
u8 port_enable; /* Which port is enabled? GFX(2,3), GPP(4,5,6,7) */
|
u8 port_enable; /* Which port is enabled? GFX(2,3), GPP(4,5,6,7) */
|
||||||
u8 gfx_dev2_dev3; /* for GFX Core initialization REFCLK_SEL */
|
u8 gfx_dev2_dev3; /* for GFX Core initialization REFCLK_SEL */
|
||||||
|
|
|
@ -29,25 +29,6 @@
|
||||||
#include <cpu/amd/mtrr.h>
|
#include <cpu/amd/mtrr.h>
|
||||||
#include "rs690.h"
|
#include "rs690.h"
|
||||||
|
|
||||||
static device_t find_nb_dev(device_t dev, u32 devfn)
|
|
||||||
{
|
|
||||||
device_t nb_dev;
|
|
||||||
|
|
||||||
nb_dev = dev_find_slot(dev->bus->secondary, devfn);
|
|
||||||
|
|
||||||
if (!nb_dev)
|
|
||||||
return nb_dev;
|
|
||||||
|
|
||||||
if ((nb_dev->vendor != PCI_VENDOR_ID_ATI)
|
|
||||||
|| (nb_dev->device != PCI_DEVICE_ID_ATI_RS690_HT)) {
|
|
||||||
u32 id;
|
|
||||||
id = pci_read_config32(nb_dev, PCI_VENDOR_ID);
|
|
||||||
if (id != (PCI_VENDOR_ID_ATI | (PCI_DEVICE_ID_ATI_RS690_HT << 16))) {
|
|
||||||
nb_dev = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nb_dev;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************
|
/*****************************************
|
||||||
* Compliant with CIM_33's ATINB_MiscClockCtrl
|
* Compliant with CIM_33's ATINB_MiscClockCtrl
|
||||||
|
@ -65,7 +46,7 @@ void static rs690_config_misc_clk(device_t nb_dev)
|
||||||
|
|
||||||
word = pci_cf8_conf1.read16(&pbus, 0, 1, 0xf8);
|
word = pci_cf8_conf1.read16(&pbus, 0, 1, 0xf8);
|
||||||
word &= 0xf00;
|
word &= 0xf00;
|
||||||
pci_cf8_conf1.write16(&pbus, 0, 1, 0xf8, word);
|
pci_cf8_conf1.write16(&pbus, 0, 1, 0xf8, word);
|
||||||
|
|
||||||
word = pci_cf8_conf1.read16(&pbus, 0, 1, 0xe8);
|
word = pci_cf8_conf1.read16(&pbus, 0, 1, 0xe8);
|
||||||
word &= ~((1 << 12) | (1 << 13) | (1 << 14));
|
word &= ~((1 << 12) | (1 << 13) | (1 << 14));
|
||||||
|
@ -123,6 +104,12 @@ void static rs690_config_misc_clk(device_t nb_dev)
|
||||||
set_htiu_enable_bits(nb_dev, 0x05, 7 << 8, 7 << 8);
|
set_htiu_enable_bits(nb_dev, 0x05, 7 << 8, 7 << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
u32 get_vid_did(device_t dev)
|
||||||
|
{
|
||||||
|
return pci_read_config32(dev, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************
|
/***********************************************
|
||||||
* 0:00.0 NBCFG :
|
* 0:00.0 NBCFG :
|
||||||
* 0:00.1 CLK : bit 0 of nb_cfg 0x4c : 0 - disable, default
|
* 0:00.1 CLK : bit 0 of nb_cfg 0x4c : 0 - disable, default
|
||||||
|
@ -140,39 +127,25 @@ void static rs690_config_misc_clk(device_t nb_dev)
|
||||||
void rs690_enable(device_t dev)
|
void rs690_enable(device_t dev)
|
||||||
{
|
{
|
||||||
device_t nb_dev = 0, sb_dev = 0;
|
device_t nb_dev = 0, sb_dev = 0;
|
||||||
int index = -1;
|
int dev_ind;
|
||||||
u32 i;
|
|
||||||
u32 devfn;
|
|
||||||
u32 deviceid, vendorid;
|
|
||||||
|
|
||||||
vendorid = pci_read_config32(dev, PCI_VENDOR_ID);
|
printk_info("rs690_enable: dev=0x%x, VID_DID=0x%x\n", dev, get_vid_did(dev));
|
||||||
deviceid = (vendorid >> 16) & 0xffff;
|
|
||||||
vendorid &= 0xffff;
|
|
||||||
printk_info("rs690_enable VID=0x%x, DID=0x%x\n", vendorid, deviceid);
|
|
||||||
|
|
||||||
/**********************************************************
|
nb_dev = dev_find_slot(0, PCI_DEVFN(0, 0));
|
||||||
* Work for bus0, internal GFX located on bus1 and will return after find_nb_dev.
|
|
||||||
**********************************************************/
|
|
||||||
i = (dev->path.u.pci.devfn) & ~7;
|
|
||||||
for (devfn = 0; devfn <= i; devfn += (1 << 3)) {
|
|
||||||
nb_dev = find_nb_dev(dev, devfn);
|
|
||||||
if (nb_dev)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!nb_dev) {
|
if (!nb_dev) {
|
||||||
printk_info("CAN NOT FIND RS690 DEVICE!\n");
|
die("rs690_enable: CAN NOT FIND RS690 DEVICE, HALT!\n");
|
||||||
return; /* nb_dev is not dev */
|
/* NOT REACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sb_dev (dev 8) is a bridge that links to southbridge. */
|
/* sb_dev (dev 8) is a bridge that links to southbridge. */
|
||||||
sb_dev = dev_find_slot(0, PCI_DEVFN(8, 0));
|
sb_dev = dev_find_slot(0, PCI_DEVFN(8, 0));
|
||||||
if (!sb_dev) {
|
if (!sb_dev) {
|
||||||
printk_info("rs690_enable CAN NOT FIND SB bridge, HALT!\n");
|
die("rs690_enable: CAN NOT FIND SB bridge, HALT!\n");
|
||||||
for (;;) ;
|
/* NOT REACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
printk_info("rs690_enable bus0, dev=0x%x\n", (dev->path.u.pci.devfn - devfn) >> 3);
|
dev_ind = dev->path.u.pci.devfn >> 3;
|
||||||
switch (dev->path.u.pci.devfn - devfn) {
|
switch (dev_ind) {
|
||||||
case 0: /* bus0, dev0, fun0; */
|
case 0: /* bus0, dev0, fun0; */
|
||||||
printk_info("Bus-0, Dev-0, Fun-0.\n");
|
printk_info("Bus-0, Dev-0, Fun-0.\n");
|
||||||
enable_pcie_bar3(nb_dev); /* PCIEMiscInit */
|
enable_pcie_bar3(nb_dev); /* PCIEMiscInit */
|
||||||
|
@ -185,36 +158,34 @@ void rs690_enable(device_t dev)
|
||||||
rs690_config_misc_clk(nb_dev);
|
rs690_config_misc_clk(nb_dev);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1 << 3: /* bus0, dev1 */
|
case 1: /* bus0, dev1 */
|
||||||
printk_info("Bus-0, Dev-1, Fun-0.\n");
|
printk_info("Bus-0, Dev-1, Fun-0.\n");
|
||||||
break;
|
break;
|
||||||
case 2 << 3: /* bus0, dev2,3, two GFX */
|
case 2: /* bus0, dev2,3, two GFX */
|
||||||
case 3 << 3:
|
case 3:
|
||||||
printk_info("Bus-0, Dev-2,3, Fun-0. enable=%d\n", dev->enabled);
|
printk_info("Bus-0, Dev-2,3, Fun-0. enable=%d\n", dev->enabled);
|
||||||
index = (dev->path.u.pci.devfn - devfn) >> 3;
|
set_nbmisc_enable_bits(nb_dev, 0x0c, 1 << dev_ind,
|
||||||
set_nbmisc_enable_bits(nb_dev, 0x0c, 1 << index,
|
(dev->enabled ? 0 : 1) << dev_ind);
|
||||||
(dev->enabled ? 0 : 1) << index);
|
|
||||||
if (dev->enabled)
|
if (dev->enabled)
|
||||||
rs690_gfx_init(nb_dev, dev, index);
|
rs690_gfx_init(nb_dev, dev, dev_ind);
|
||||||
break;
|
break;
|
||||||
case 4 << 3: /* bus0, dev4-7, four GPP */
|
case 4: /* bus0, dev4-7, four GPP */
|
||||||
case 5 << 3:
|
case 5:
|
||||||
case 6 << 3:
|
case 6:
|
||||||
case 7 << 3:
|
case 7:
|
||||||
printk_info("Bus-0, Dev-4,5,6,7, Fun-0. enable=%d\n",
|
printk_info("Bus-0, Dev-4,5,6,7, Fun-0. enable=%d\n",
|
||||||
dev->enabled);
|
dev->enabled);
|
||||||
index = (dev->path.u.pci.devfn - devfn) >> 3;
|
set_nbmisc_enable_bits(nb_dev, 0x0c, 1 << dev_ind,
|
||||||
set_nbmisc_enable_bits(nb_dev, 0x0c, 1 << index,
|
(dev->enabled ? 0 : 1) << dev_ind);
|
||||||
(dev->enabled ? 0 : 1) << index);
|
|
||||||
if (dev->enabled)
|
if (dev->enabled)
|
||||||
rs690_gpp_sb_init(nb_dev, dev, index);
|
rs690_gpp_sb_init(nb_dev, dev, dev_ind);
|
||||||
break;
|
break;
|
||||||
case 8 << 3: /* bus0, dev8, SB */
|
case 8: /* bus0, dev8, SB */
|
||||||
printk_info("Bus-0, Dev-8, Fun-0. enable=%d\n", dev->enabled);
|
printk_info("Bus-0, Dev-8, Fun-0. enable=%d\n", dev->enabled);
|
||||||
set_nbmisc_enable_bits(nb_dev, 0x00, 1 << 6,
|
set_nbmisc_enable_bits(nb_dev, 0x00, 1 << 6,
|
||||||
(dev->enabled ? 1 : 0) << 6);
|
(dev->enabled ? 1 : 0) << 6);
|
||||||
if (dev->enabled)
|
if (dev->enabled)
|
||||||
rs690_gpp_sb_init(nb_dev, dev, index);
|
rs690_gpp_sb_init(nb_dev, dev, dev_ind);
|
||||||
disable_pcie_bar3(nb_dev);
|
disable_pcie_bar3(nb_dev);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -63,8 +63,8 @@ void pci_ext_write_config32(device_t nb_dev, device_t dev, u32 reg_pos, u32 mask
|
||||||
|
|
||||||
/*get BAR3 base address for nbcfg0x1c */
|
/*get BAR3 base address for nbcfg0x1c */
|
||||||
u32 addr = pci_read_config32(nb_dev, 0x1c);
|
u32 addr = pci_read_config32(nb_dev, 0x1c);
|
||||||
printk_debug("write: addr=%x,bus=%x,devfn=%x\n", addr, dev->bus->secondary,
|
/*printk_debug("write: addr=%x,bus=%x,devfn=%x\n", addr, dev->bus->secondary,
|
||||||
dev->path.u.pci.devfn);
|
dev->path.u.pci.devfn);*/
|
||||||
addr |= dev->bus->secondary << 20 | /* bus num */
|
addr |= dev->bus->secondary << 20 | /* bus num */
|
||||||
dev->path.u.pci.devfn << 12 | reg_pos;
|
dev->path.u.pci.devfn << 12 | reg_pos;
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define NBHTIU_INDEX 0xA8
|
#define NBHTIU_INDEX 0xA8
|
||||||
#define NBMISC_INDEX 0x60
|
#define NBMISC_INDEX 0x60
|
||||||
#define NBMC_INDEX 0xE8
|
#define NBMC_INDEX 0xE8
|
||||||
|
|
|
@ -72,7 +72,7 @@ static void rs690_gfx_read_resources(device_t dev)
|
||||||
|
|
||||||
static void internal_gfx_pci_dev_init(struct device *dev)
|
static void internal_gfx_pci_dev_init(struct device *dev)
|
||||||
{
|
{
|
||||||
unsigned short deviceid, vendorid;
|
u16 deviceid, vendorid;
|
||||||
struct southbridge_amd_rs690_config *cfg =
|
struct southbridge_amd_rs690_config *cfg =
|
||||||
(struct southbridge_amd_rs690_config *)dev->chip_info;
|
(struct southbridge_amd_rs690_config *)dev->chip_info;
|
||||||
deviceid = pci_read_config16(dev, PCI_DEVICE_ID);
|
deviceid = pci_read_config16(dev, PCI_DEVICE_ID);
|
||||||
|
@ -109,11 +109,6 @@ static void internal_gfx_pci_dev_init(struct device *dev)
|
||||||
clkind_write(dev, 0x5C, 0x0);
|
clkind_write(dev, 0x5C, 0x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rs690_gfx_set_resources(struct device *dev)
|
|
||||||
{
|
|
||||||
printk_info("rs690_gfx_set_resources.\n");
|
|
||||||
pci_dev_set_resources(dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set registers in RS690 and CPU to enable the internal GFX.
|
* Set registers in RS690 and CPU to enable the internal GFX.
|
||||||
|
@ -206,9 +201,9 @@ static struct pci_operations lops_pci = {
|
||||||
.set_subsystem = pci_dev_set_subsystem,
|
.set_subsystem = pci_dev_set_subsystem,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct device_operations ht_ops = {
|
static struct device_operations pcie_ops = {
|
||||||
.read_resources = rs690_gfx_read_resources,
|
.read_resources = rs690_gfx_read_resources,
|
||||||
.set_resources = rs690_gfx_set_resources,
|
.set_resources = pci_dev_set_resources,
|
||||||
.enable_resources = pci_dev_enable_resources,
|
.enable_resources = pci_dev_enable_resources,
|
||||||
.init = internal_gfx_pci_dev_init, /* The option ROM initializes the device. rs690_gfx_init, */
|
.init = internal_gfx_pci_dev_init, /* The option ROM initializes the device. rs690_gfx_init, */
|
||||||
.scan_bus = 0,
|
.scan_bus = 0,
|
||||||
|
@ -216,8 +211,8 @@ static struct device_operations ht_ops = {
|
||||||
.ops_pci = &lops_pci,
|
.ops_pci = &lops_pci,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct pci_driver internal_gfx_driver __pci_driver = {
|
static struct pci_driver pcie_driver __pci_driver = {
|
||||||
.ops = &ht_ops,
|
.ops = &pcie_ops,
|
||||||
.vendor = PCI_VENDOR_ID_ATI,
|
.vendor = PCI_VENDOR_ID_ATI,
|
||||||
.device = PCI_DEVICE_ID_ATI_RS690MT_INT_GFX,
|
.device = PCI_DEVICE_ID_ATI_RS690MT_INT_GFX,
|
||||||
};
|
};
|
||||||
|
|
|
@ -116,37 +116,6 @@ static void pcie_init(struct device *dev)
|
||||||
pci_write_config32(dev, 0x04, dword);
|
pci_write_config32(dev, 0x04, dword);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct pci_operations lops_pci = {
|
|
||||||
.set_subsystem = 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct device_operations pcie_ops = {
|
|
||||||
.read_resources = pci_bus_read_resources,
|
|
||||||
.set_resources = pci_dev_set_resources,
|
|
||||||
.enable_resources = pci_bus_enable_resources,
|
|
||||||
.init = pcie_init,
|
|
||||||
.scan_bus = pci_scan_bridge,
|
|
||||||
/*.enable = rs690_enable, */
|
|
||||||
.ops_pci = &lops_pci,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct pci_driver pcie_driver __pci_driver = {
|
|
||||||
.ops = &pcie_ops,
|
|
||||||
.vendor = PCI_VENDOR_ID_ATI,
|
|
||||||
.device = PCI_DEVICE_ID_ATI_RS690_PCIE,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct pci_driver pcie_driver_dev7 __pci_driver = {
|
|
||||||
.ops = &pcie_ops,
|
|
||||||
.vendor = PCI_VENDOR_ID_ATI,
|
|
||||||
.device = PCI_DEVICE_ID_ATI_RS690_PCIE_DEV7,
|
|
||||||
};
|
|
||||||
static struct pci_driver pcie_driver_dev8 __pci_driver = {
|
|
||||||
.ops = &pcie_ops,
|
|
||||||
.vendor = PCI_VENDOR_ID_ATI,
|
|
||||||
.device = PCI_DEVICE_ID_ATI_RS690_PCIE_DEV8,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static void switching_gpp_configurations(device_t nb_dev, device_t sb_dev)
|
static void switching_gpp_configurations(device_t nb_dev, device_t sb_dev)
|
||||||
|
|
Loading…
Reference in New Issue