aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac
diff options
context:
space:
mode:
authorDoug Thompson <dougthompson@xmission.com>2009-04-27 10:25:05 -0400
committerBorislav Petkov <borislav.petkov@amd.com>2009-06-10 06:18:57 -0400
commit4d37607adbff69596a3170cf84badaf26efc59ac (patch)
treede5b3d0837e03fc1ed01df1bb4be8ee138fb5c31 /drivers/edac
parentf71d0a05001afd10e2be491ca002c55c7df42ed8 (diff)
amd64_edac: add per-family descriptors
Borislav: - fix comments - fix function return value patterns Reviewed-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Doug Thompson <dougthompson@xmission.com> Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/amd64_edac.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index c2e2c3c37f5c..e5f4a92faa3b 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -1824,3 +1824,75 @@ static int f10_probe_valid_hardware(struct amd64_pvt *pvt)
1824 return ret; 1824 return ret;
1825} 1825}
1826 1826
1827/*
1828 * There currently are 3 types type of MC devices for AMD Athlon/Opterons
1829 * (as per PCI DEVICE_IDs):
1830 *
1831 * Family K8: That is the Athlon64 and Opteron CPUs. They all have the same PCI
1832 * DEVICE ID, even though there is differences between the different Revisions
1833 * (CG,D,E,F).
1834 *
1835 * Family F10h and F11h.
1836 *
1837 */
1838static struct amd64_family_type amd64_family_types[] = {
1839 [K8_CPUS] = {
1840 .ctl_name = "RevF",
1841 .addr_f1_ctl = PCI_DEVICE_ID_AMD_K8_NB_ADDRMAP,
1842 .misc_f3_ctl = PCI_DEVICE_ID_AMD_K8_NB_MISC,
1843 .ops = {
1844 .early_channel_count = k8_early_channel_count,
1845 .get_error_address = k8_get_error_address,
1846 .read_dram_base_limit = k8_read_dram_base_limit,
1847 .map_sysaddr_to_csrow = k8_map_sysaddr_to_csrow,
1848 .dbam_map_to_pages = k8_dbam_map_to_pages,
1849 }
1850 },
1851 [F10_CPUS] = {
1852 .ctl_name = "Family 10h",
1853 .addr_f1_ctl = PCI_DEVICE_ID_AMD_10H_NB_MAP,
1854 .misc_f3_ctl = PCI_DEVICE_ID_AMD_10H_NB_MISC,
1855 .ops = {
1856 .probe_valid_hardware = f10_probe_valid_hardware,
1857 .early_channel_count = f10_early_channel_count,
1858 .get_error_address = f10_get_error_address,
1859 .read_dram_base_limit = f10_read_dram_base_limit,
1860 .read_dram_ctl_register = f10_read_dram_ctl_register,
1861 .map_sysaddr_to_csrow = f10_map_sysaddr_to_csrow,
1862 .dbam_map_to_pages = f10_dbam_map_to_pages,
1863 }
1864 },
1865 [F11_CPUS] = {
1866 .ctl_name = "Family 11h",
1867 .addr_f1_ctl = PCI_DEVICE_ID_AMD_11H_NB_MAP,
1868 .misc_f3_ctl = PCI_DEVICE_ID_AMD_11H_NB_MISC,
1869 .ops = {
1870 .probe_valid_hardware = f10_probe_valid_hardware,
1871 .early_channel_count = f10_early_channel_count,
1872 .get_error_address = f10_get_error_address,
1873 .read_dram_base_limit = f10_read_dram_base_limit,
1874 .read_dram_ctl_register = f10_read_dram_ctl_register,
1875 .map_sysaddr_to_csrow = f10_map_sysaddr_to_csrow,
1876 .dbam_map_to_pages = f10_dbam_map_to_pages,
1877 }
1878 },
1879};
1880
1881static struct pci_dev *pci_get_related_function(unsigned int vendor,
1882 unsigned int device,
1883 struct pci_dev *related)
1884{
1885 struct pci_dev *dev = NULL;
1886
1887 dev = pci_get_device(vendor, device, dev);
1888 while (dev) {
1889 if ((dev->bus->number == related->bus->number) &&
1890 (PCI_SLOT(dev->devfn) == PCI_SLOT(related->devfn)))
1891 break;
1892 dev = pci_get_device(vendor, device, dev);
1893 }
1894
1895 return dev;
1896}
1897
1898