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

TOMOYO Linux Cross Reference
Linux/arch/powerpc/kernel/eeh_dev.c

Version: ~ [ linux-5.5-rc1 ] ~ [ linux-5.4.2 ] ~ [ linux-5.3.15 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.88 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.158 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.206 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.206 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.78 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * The file intends to implement dynamic creation of EEH device, which will
  3  * be bound with OF node and PCI device simutaneously. The EEH devices would
  4  * be foundamental information for EEH core components to work proerly. Besides,
  5  * We have to support multiple situations where dynamic creation of EEH device
  6  * is required:
  7  *
  8  * 1) Before PCI emunation starts, we need create EEH devices according to the
  9  *    PCI sensitive OF nodes.
 10  * 2) When PCI emunation is done, we need do the binding between PCI device and
 11  *    the associated EEH device.
 12  * 3) DR (Dynamic Reconfiguration) would create PCI sensitive OF node. EEH device
 13  *    will be created while PCI sensitive OF node is detected from DR.
 14  * 4) PCI hotplug needs redoing the binding between PCI device and EEH device. If
 15  *    PHB is newly inserted, we also need create EEH devices accordingly.
 16  *
 17  * Copyright Benjamin Herrenschmidt & Gavin Shan, IBM Corporation 2012.
 18  *
 19  * This program is free software; you can redistribute it and/or modify
 20  * it under the terms of the GNU General Public License as published by
 21  * the Free Software Foundation; either version 2 of the License, or
 22  * (at your option) any later version.
 23  *
 24  * This program is distributed in the hope that it will be useful,
 25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 27  * GNU General Public License for more details.
 28  *
 29  * You should have received a copy of the GNU General Public License
 30  * along with this program; if not, write to the Free Software
 31  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 32  */
 33 
 34 #include <linux/export.h>
 35 #include <linux/gfp.h>
 36 #include <linux/init.h>
 37 #include <linux/kernel.h>
 38 #include <linux/pci.h>
 39 #include <linux/string.h>
 40 
 41 #include <asm/pci-bridge.h>
 42 #include <asm/ppc-pci.h>
 43 
 44 /**
 45  * eeh_dev_init - Create EEH device according to OF node
 46  * @dn: device node
 47  * @data: PHB
 48  *
 49  * It will create EEH device according to the given OF node. The function
 50  * might be called by PCI emunation, DR, PHB hotplug.
 51  */
 52 void *eeh_dev_init(struct device_node *dn, void *data)
 53 {
 54         struct pci_controller *phb = data;
 55         struct eeh_dev *edev;
 56 
 57         /* Allocate EEH device */
 58         edev = kzalloc(sizeof(*edev), GFP_KERNEL);
 59         if (!edev) {
 60                 pr_warn("%s: out of memory\n",
 61                         __func__);
 62                 return NULL;
 63         }
 64 
 65         /* Associate EEH device with OF node */
 66         PCI_DN(dn)->edev = edev;
 67         edev->dn  = dn;
 68         edev->phb = phb;
 69         INIT_LIST_HEAD(&edev->list);
 70 
 71         return NULL;
 72 }
 73 
 74 /**
 75  * eeh_dev_phb_init_dynamic - Create EEH devices for devices included in PHB
 76  * @phb: PHB
 77  *
 78  * Scan the PHB OF node and its child association, then create the
 79  * EEH devices accordingly
 80  */
 81 void eeh_dev_phb_init_dynamic(struct pci_controller *phb)
 82 {
 83         struct device_node *dn = phb->dn;
 84 
 85         /* EEH PE for PHB */
 86         eeh_phb_pe_create(phb);
 87 
 88         /* EEH device for PHB */
 89         eeh_dev_init(dn, phb);
 90 
 91         /* EEH devices for children OF nodes */
 92         traverse_pci_devices(dn, eeh_dev_init, phb);
 93 }
 94 
 95 /**
 96  * eeh_dev_phb_init - Create EEH devices for devices included in existing PHBs
 97  *
 98  * Scan all the existing PHBs and create EEH devices for their OF
 99  * nodes and their children OF nodes
100  */
101 static int __init eeh_dev_phb_init(void)
102 {
103         struct pci_controller *phb, *tmp;
104 
105         list_for_each_entry_safe(phb, tmp, &hose_list, list_node)
106                 eeh_dev_phb_init_dynamic(phb);
107 
108         pr_info("EEH: devices created\n");
109 
110         return 0;
111 }
112 
113 core_initcall(eeh_dev_phb_init);
114 

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp