~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/x86/pci/broadcom_bus.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-or-later
  2 /*
  3  * Read address ranges from a Broadcom CNB20LE Host Bridge
  4  *
  5  * Copyright (c) 2010 Ira W. Snyder <iws@ovro.caltech.edu>
  6  */
  7 
  8 #include <linux/acpi.h>
  9 #include <linux/delay.h>
 10 #include <linux/dmi.h>
 11 #include <linux/pci.h>
 12 #include <linux/init.h>
 13 #include <asm/pci_x86.h>
 14 #include <asm/pci-direct.h>
 15 
 16 #include "bus_numa.h"
 17 
 18 static void __init cnb20le_res(u8 bus, u8 slot, u8 func)
 19 {
 20         struct pci_root_info *info;
 21         struct pci_root_res *root_res;
 22         struct resource res;
 23         u16 word1, word2;
 24         u8 fbus, lbus;
 25 
 26         /* read the PCI bus numbers */
 27         fbus = read_pci_config_byte(bus, slot, func, 0x44);
 28         lbus = read_pci_config_byte(bus, slot, func, 0x45);
 29         info = alloc_pci_root_info(fbus, lbus, 0, 0);
 30 
 31         /*
 32          * Add the legacy IDE ports on bus 0
 33          *
 34          * These do not exist anywhere in the bridge registers, AFAICT. I do
 35          * not have the datasheet, so this is the best I can do.
 36          */
 37         if (fbus == 0) {
 38                 update_res(info, 0x01f0, 0x01f7, IORESOURCE_IO, 0);
 39                 update_res(info, 0x03f6, 0x03f6, IORESOURCE_IO, 0);
 40                 update_res(info, 0x0170, 0x0177, IORESOURCE_IO, 0);
 41                 update_res(info, 0x0376, 0x0376, IORESOURCE_IO, 0);
 42                 update_res(info, 0xffa0, 0xffaf, IORESOURCE_IO, 0);
 43         }
 44 
 45         /* read the non-prefetchable memory window */
 46         word1 = read_pci_config_16(bus, slot, func, 0xc0);
 47         word2 = read_pci_config_16(bus, slot, func, 0xc2);
 48         if (word1 != word2) {
 49                 res.start = ((resource_size_t) word1 << 16) | 0x0000;
 50                 res.end   = ((resource_size_t) word2 << 16) | 0xffff;
 51                 res.flags = IORESOURCE_MEM;
 52                 update_res(info, res.start, res.end, res.flags, 0);
 53         }
 54 
 55         /* read the prefetchable memory window */
 56         word1 = read_pci_config_16(bus, slot, func, 0xc4);
 57         word2 = read_pci_config_16(bus, slot, func, 0xc6);
 58         if (word1 != word2) {
 59                 res.start = ((resource_size_t) word1 << 16) | 0x0000;
 60                 res.end   = ((resource_size_t) word2 << 16) | 0xffff;
 61                 res.flags = IORESOURCE_MEM | IORESOURCE_PREFETCH;
 62                 update_res(info, res.start, res.end, res.flags, 0);
 63         }
 64 
 65         /* read the IO port window */
 66         word1 = read_pci_config_16(bus, slot, func, 0xd0);
 67         word2 = read_pci_config_16(bus, slot, func, 0xd2);
 68         if (word1 != word2) {
 69                 res.start = word1;
 70                 res.end   = word2;
 71                 res.flags = IORESOURCE_IO;
 72                 update_res(info, res.start, res.end, res.flags, 0);
 73         }
 74 
 75         /* print information about this host bridge */
 76         res.start = fbus;
 77         res.end   = lbus;
 78         res.flags = IORESOURCE_BUS;
 79         printk(KERN_INFO "CNB20LE PCI Host Bridge (domain 0000 %pR)\n", &res);
 80 
 81         list_for_each_entry(root_res, &info->resources, list)
 82                 printk(KERN_INFO "host bridge window %pR\n", &root_res->res);
 83 }
 84 
 85 static int __init broadcom_postcore_init(void)
 86 {
 87         u8 bus = 0, slot = 0;
 88         u32 id;
 89         u16 vendor, device;
 90 
 91 #ifdef CONFIG_ACPI
 92         /*
 93          * We should get host bridge information from ACPI unless the BIOS
 94          * doesn't support it.
 95          */
 96         if (!acpi_disabled && acpi_os_get_root_pointer())
 97                 return 0;
 98 #endif
 99 
100         id = read_pci_config(bus, slot, 0, PCI_VENDOR_ID);
101         vendor = id & 0xffff;
102         device = (id >> 16) & 0xffff;
103 
104         if (vendor == PCI_VENDOR_ID_SERVERWORKS &&
105             device == PCI_DEVICE_ID_SERVERWORKS_LE) {
106                 cnb20le_res(bus, slot, 0);
107                 cnb20le_res(bus, slot, 1);
108         }
109         return 0;
110 }
111 
112 postcore_initcall(broadcom_postcore_init);
113 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php