eeh.c 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215
  1. /*
  2. * Copyright IBM Corporation 2001, 2005, 2006
  3. * Copyright Dave Engebretsen & Todd Inglett 2001
  4. * Copyright Linas Vepstas 2005, 2006
  5. * Copyright 2001-2012 IBM Corporation.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. * Please address comments and feedback to Linas Vepstas <linas@austin.ibm.com>
  22. */
  23. #include <linux/delay.h>
  24. #include <linux/sched.h>
  25. #include <linux/init.h>
  26. #include <linux/list.h>
  27. #include <linux/pci.h>
  28. #include <linux/proc_fs.h>
  29. #include <linux/rbtree.h>
  30. #include <linux/seq_file.h>
  31. #include <linux/spinlock.h>
  32. #include <linux/export.h>
  33. #include <linux/of.h>
  34. #include <linux/atomic.h>
  35. #include <asm/eeh.h>
  36. #include <asm/eeh_event.h>
  37. #include <asm/io.h>
  38. #include <asm/machdep.h>
  39. #include <asm/ppc-pci.h>
  40. #include <asm/rtas.h>
  41. /** Overview:
  42. * EEH, or "Extended Error Handling" is a PCI bridge technology for
  43. * dealing with PCI bus errors that can't be dealt with within the
  44. * usual PCI framework, except by check-stopping the CPU. Systems
  45. * that are designed for high-availability/reliability cannot afford
  46. * to crash due to a "mere" PCI error, thus the need for EEH.
  47. * An EEH-capable bridge operates by converting a detected error
  48. * into a "slot freeze", taking the PCI adapter off-line, making
  49. * the slot behave, from the OS'es point of view, as if the slot
  50. * were "empty": all reads return 0xff's and all writes are silently
  51. * ignored. EEH slot isolation events can be triggered by parity
  52. * errors on the address or data busses (e.g. during posted writes),
  53. * which in turn might be caused by low voltage on the bus, dust,
  54. * vibration, humidity, radioactivity or plain-old failed hardware.
  55. *
  56. * Note, however, that one of the leading causes of EEH slot
  57. * freeze events are buggy device drivers, buggy device microcode,
  58. * or buggy device hardware. This is because any attempt by the
  59. * device to bus-master data to a memory address that is not
  60. * assigned to the device will trigger a slot freeze. (The idea
  61. * is to prevent devices-gone-wild from corrupting system memory).
  62. * Buggy hardware/drivers will have a miserable time co-existing
  63. * with EEH.
  64. *
  65. * Ideally, a PCI device driver, when suspecting that an isolation
  66. * event has occurred (e.g. by reading 0xff's), will then ask EEH
  67. * whether this is the case, and then take appropriate steps to
  68. * reset the PCI slot, the PCI device, and then resume operations.
  69. * However, until that day, the checking is done here, with the
  70. * eeh_check_failure() routine embedded in the MMIO macros. If
  71. * the slot is found to be isolated, an "EEH Event" is synthesized
  72. * and sent out for processing.
  73. */
  74. /* If a device driver keeps reading an MMIO register in an interrupt
  75. * handler after a slot isolation event, it might be broken.
  76. * This sets the threshold for how many read attempts we allow
  77. * before printing an error message.
  78. */
  79. #define EEH_MAX_FAILS 2100000
  80. /* Time to wait for a PCI slot to report status, in milliseconds */
  81. #define PCI_BUS_RESET_WAIT_MSEC (60*1000)
  82. /* Platform dependent EEH operations */
  83. struct eeh_ops *eeh_ops = NULL;
  84. int eeh_subsystem_enabled;
  85. EXPORT_SYMBOL(eeh_subsystem_enabled);
  86. /* Lock to avoid races due to multiple reports of an error */
  87. static DEFINE_RAW_SPINLOCK(confirm_error_lock);
  88. /* Buffer for reporting pci register dumps. Its here in BSS, and
  89. * not dynamically alloced, so that it ends up in RMO where RTAS
  90. * can access it.
  91. */
  92. #define EEH_PCI_REGS_LOG_LEN 4096
  93. static unsigned char pci_regs_buf[EEH_PCI_REGS_LOG_LEN];
  94. /* System monitoring statistics */
  95. static unsigned long no_device;
  96. static unsigned long no_dn;
  97. static unsigned long no_cfg_addr;
  98. static unsigned long ignored_check;
  99. static unsigned long total_mmio_ffs;
  100. static unsigned long false_positives;
  101. static unsigned long slot_resets;
  102. #define IS_BRIDGE(class_code) (((class_code)<<16) == PCI_BASE_CLASS_BRIDGE)
  103. /**
  104. * eeh_gather_pci_data - Copy assorted PCI config space registers to buff
  105. * @edev: device to report data for
  106. * @buf: point to buffer in which to log
  107. * @len: amount of room in buffer
  108. *
  109. * This routine captures assorted PCI configuration space data,
  110. * and puts them into a buffer for RTAS error logging.
  111. */
  112. static size_t eeh_gather_pci_data(struct eeh_dev *edev, char * buf, size_t len)
  113. {
  114. struct device_node *dn = eeh_dev_to_of_node(edev);
  115. struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
  116. u32 cfg;
  117. int cap, i;
  118. int n = 0;
  119. n += scnprintf(buf+n, len-n, "%s\n", dn->full_name);
  120. printk(KERN_WARNING "EEH: of node=%s\n", dn->full_name);
  121. rtas_read_config(PCI_DN(dn), PCI_VENDOR_ID, 4, &cfg);
  122. n += scnprintf(buf+n, len-n, "dev/vend:%08x\n", cfg);
  123. printk(KERN_WARNING "EEH: PCI device/vendor: %08x\n", cfg);
  124. rtas_read_config(PCI_DN(dn), PCI_COMMAND, 4, &cfg);
  125. n += scnprintf(buf+n, len-n, "cmd/stat:%x\n", cfg);
  126. printk(KERN_WARNING "EEH: PCI cmd/status register: %08x\n", cfg);
  127. if (!dev) {
  128. printk(KERN_WARNING "EEH: no PCI device for this of node\n");
  129. return n;
  130. }
  131. /* Gather bridge-specific registers */
  132. if (dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) {
  133. rtas_read_config(PCI_DN(dn), PCI_SEC_STATUS, 2, &cfg);
  134. n += scnprintf(buf+n, len-n, "sec stat:%x\n", cfg);
  135. printk(KERN_WARNING "EEH: Bridge secondary status: %04x\n", cfg);
  136. rtas_read_config(PCI_DN(dn), PCI_BRIDGE_CONTROL, 2, &cfg);
  137. n += scnprintf(buf+n, len-n, "brdg ctl:%x\n", cfg);
  138. printk(KERN_WARNING "EEH: Bridge control: %04x\n", cfg);
  139. }
  140. /* Dump out the PCI-X command and status regs */
  141. cap = pci_find_capability(dev, PCI_CAP_ID_PCIX);
  142. if (cap) {
  143. rtas_read_config(PCI_DN(dn), cap, 4, &cfg);
  144. n += scnprintf(buf+n, len-n, "pcix-cmd:%x\n", cfg);
  145. printk(KERN_WARNING "EEH: PCI-X cmd: %08x\n", cfg);
  146. rtas_read_config(PCI_DN(dn), cap+4, 4, &cfg);
  147. n += scnprintf(buf+n, len-n, "pcix-stat:%x\n", cfg);
  148. printk(KERN_WARNING "EEH: PCI-X status: %08x\n", cfg);
  149. }
  150. /* If PCI-E capable, dump PCI-E cap 10, and the AER */
  151. cap = pci_find_capability(dev, PCI_CAP_ID_EXP);
  152. if (cap) {
  153. n += scnprintf(buf+n, len-n, "pci-e cap10:\n");
  154. printk(KERN_WARNING
  155. "EEH: PCI-E capabilities and status follow:\n");
  156. for (i=0; i<=8; i++) {
  157. rtas_read_config(PCI_DN(dn), cap+4*i, 4, &cfg);
  158. n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg);
  159. printk(KERN_WARNING "EEH: PCI-E %02x: %08x\n", i, cfg);
  160. }
  161. cap = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
  162. if (cap) {
  163. n += scnprintf(buf+n, len-n, "pci-e AER:\n");
  164. printk(KERN_WARNING
  165. "EEH: PCI-E AER capability register set follows:\n");
  166. for (i=0; i<14; i++) {
  167. rtas_read_config(PCI_DN(dn), cap+4*i, 4, &cfg);
  168. n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg);
  169. printk(KERN_WARNING "EEH: PCI-E AER %02x: %08x\n", i, cfg);
  170. }
  171. }
  172. }
  173. /* Gather status on devices under the bridge */
  174. if (dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) {
  175. struct device_node *child;
  176. for_each_child_of_node(dn, child) {
  177. if (of_node_to_eeh_dev(child))
  178. n += eeh_gather_pci_data(of_node_to_eeh_dev(child), buf+n, len-n);
  179. }
  180. }
  181. return n;
  182. }
  183. /**
  184. * eeh_slot_error_detail - Generate combined log including driver log and error log
  185. * @edev: device to report error log for
  186. * @severity: temporary or permanent error log
  187. *
  188. * This routine should be called to generate the combined log, which
  189. * is comprised of driver log and error log. The driver log is figured
  190. * out from the config space of the corresponding PCI device, while
  191. * the error log is fetched through platform dependent function call.
  192. */
  193. void eeh_slot_error_detail(struct eeh_dev *edev, int severity)
  194. {
  195. size_t loglen = 0;
  196. pci_regs_buf[0] = 0;
  197. eeh_pci_enable(edev, EEH_OPT_THAW_MMIO);
  198. eeh_ops->configure_bridge(eeh_dev_to_of_node(edev));
  199. eeh_restore_bars(edev);
  200. loglen = eeh_gather_pci_data(edev, pci_regs_buf, EEH_PCI_REGS_LOG_LEN);
  201. eeh_ops->get_log(eeh_dev_to_of_node(edev), severity, pci_regs_buf, loglen);
  202. }
  203. /**
  204. * eeh_token_to_phys - Convert EEH address token to phys address
  205. * @token: I/O token, should be address in the form 0xA....
  206. *
  207. * This routine should be called to convert virtual I/O address
  208. * to physical one.
  209. */
  210. static inline unsigned long eeh_token_to_phys(unsigned long token)
  211. {
  212. pte_t *ptep;
  213. unsigned long pa;
  214. ptep = find_linux_pte(init_mm.pgd, token);
  215. if (!ptep)
  216. return token;
  217. pa = pte_pfn(*ptep) << PAGE_SHIFT;
  218. return pa | (token & (PAGE_SIZE-1));
  219. }
  220. /**
  221. * eeh_find_device_pe - Retrieve the PE for the given device
  222. * @dn: device node
  223. *
  224. * Return the PE under which this device lies
  225. */
  226. struct device_node *eeh_find_device_pe(struct device_node *dn)
  227. {
  228. while (dn->parent && of_node_to_eeh_dev(dn->parent) &&
  229. (of_node_to_eeh_dev(dn->parent)->mode & EEH_MODE_SUPPORTED)) {
  230. dn = dn->parent;
  231. }
  232. return dn;
  233. }
  234. /**
  235. * __eeh_mark_slot - Mark all child devices as failed
  236. * @parent: parent device
  237. * @mode_flag: failure flag
  238. *
  239. * Mark all devices that are children of this device as failed.
  240. * Mark the device driver too, so that it can see the failure
  241. * immediately; this is critical, since some drivers poll
  242. * status registers in interrupts ... If a driver is polling,
  243. * and the slot is frozen, then the driver can deadlock in
  244. * an interrupt context, which is bad.
  245. */
  246. static void __eeh_mark_slot(struct device_node *parent, int mode_flag)
  247. {
  248. struct device_node *dn;
  249. for_each_child_of_node(parent, dn) {
  250. if (of_node_to_eeh_dev(dn)) {
  251. /* Mark the pci device driver too */
  252. struct pci_dev *dev = of_node_to_eeh_dev(dn)->pdev;
  253. of_node_to_eeh_dev(dn)->mode |= mode_flag;
  254. if (dev && dev->driver)
  255. dev->error_state = pci_channel_io_frozen;
  256. __eeh_mark_slot(dn, mode_flag);
  257. }
  258. }
  259. }
  260. /**
  261. * eeh_mark_slot - Mark the indicated device and its children as failed
  262. * @dn: parent device
  263. * @mode_flag: failure flag
  264. *
  265. * Mark the indicated device and its child devices as failed.
  266. * The device drivers are marked as failed as well.
  267. */
  268. void eeh_mark_slot(struct device_node *dn, int mode_flag)
  269. {
  270. struct pci_dev *dev;
  271. dn = eeh_find_device_pe(dn);
  272. /* Back up one, since config addrs might be shared */
  273. if (!pcibios_find_pci_bus(dn) && of_node_to_eeh_dev(dn->parent))
  274. dn = dn->parent;
  275. of_node_to_eeh_dev(dn)->mode |= mode_flag;
  276. /* Mark the pci device too */
  277. dev = of_node_to_eeh_dev(dn)->pdev;
  278. if (dev)
  279. dev->error_state = pci_channel_io_frozen;
  280. __eeh_mark_slot(dn, mode_flag);
  281. }
  282. /**
  283. * __eeh_clear_slot - Clear failure flag for the child devices
  284. * @parent: parent device
  285. * @mode_flag: flag to be cleared
  286. *
  287. * Clear failure flag for the child devices.
  288. */
  289. static void __eeh_clear_slot(struct device_node *parent, int mode_flag)
  290. {
  291. struct device_node *dn;
  292. for_each_child_of_node(parent, dn) {
  293. if (of_node_to_eeh_dev(dn)) {
  294. of_node_to_eeh_dev(dn)->mode &= ~mode_flag;
  295. of_node_to_eeh_dev(dn)->check_count = 0;
  296. __eeh_clear_slot(dn, mode_flag);
  297. }
  298. }
  299. }
  300. /**
  301. * eeh_clear_slot - Clear failure flag for the indicated device and its children
  302. * @dn: parent device
  303. * @mode_flag: flag to be cleared
  304. *
  305. * Clear failure flag for the indicated device and its children.
  306. */
  307. void eeh_clear_slot(struct device_node *dn, int mode_flag)
  308. {
  309. unsigned long flags;
  310. raw_spin_lock_irqsave(&confirm_error_lock, flags);
  311. dn = eeh_find_device_pe(dn);
  312. /* Back up one, since config addrs might be shared */
  313. if (!pcibios_find_pci_bus(dn) && of_node_to_eeh_dev(dn->parent))
  314. dn = dn->parent;
  315. of_node_to_eeh_dev(dn)->mode &= ~mode_flag;
  316. of_node_to_eeh_dev(dn)->check_count = 0;
  317. __eeh_clear_slot(dn, mode_flag);
  318. raw_spin_unlock_irqrestore(&confirm_error_lock, flags);
  319. }
  320. /**
  321. * eeh_dn_check_failure - Check if all 1's data is due to EEH slot freeze
  322. * @dn: device node
  323. * @dev: pci device, if known
  324. *
  325. * Check for an EEH failure for the given device node. Call this
  326. * routine if the result of a read was all 0xff's and you want to
  327. * find out if this is due to an EEH slot freeze. This routine
  328. * will query firmware for the EEH status.
  329. *
  330. * Returns 0 if there has not been an EEH error; otherwise returns
  331. * a non-zero value and queues up a slot isolation event notification.
  332. *
  333. * It is safe to call this routine in an interrupt context.
  334. */
  335. int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
  336. {
  337. int ret;
  338. unsigned long flags;
  339. struct eeh_dev *edev;
  340. int rc = 0;
  341. const char *location;
  342. total_mmio_ffs++;
  343. if (!eeh_subsystem_enabled)
  344. return 0;
  345. if (!dn) {
  346. no_dn++;
  347. return 0;
  348. }
  349. dn = eeh_find_device_pe(dn);
  350. edev = of_node_to_eeh_dev(dn);
  351. /* Access to IO BARs might get this far and still not want checking. */
  352. if (!(edev->mode & EEH_MODE_SUPPORTED) ||
  353. edev->mode & EEH_MODE_NOCHECK) {
  354. ignored_check++;
  355. pr_debug("EEH: Ignored check (%x) for %s %s\n",
  356. edev->mode, eeh_pci_name(dev), dn->full_name);
  357. return 0;
  358. }
  359. if (!edev->config_addr && !edev->pe_config_addr) {
  360. no_cfg_addr++;
  361. return 0;
  362. }
  363. /* If we already have a pending isolation event for this
  364. * slot, we know it's bad already, we don't need to check.
  365. * Do this checking under a lock; as multiple PCI devices
  366. * in one slot might report errors simultaneously, and we
  367. * only want one error recovery routine running.
  368. */
  369. raw_spin_lock_irqsave(&confirm_error_lock, flags);
  370. rc = 1;
  371. if (edev->mode & EEH_MODE_ISOLATED) {
  372. edev->check_count++;
  373. if (edev->check_count % EEH_MAX_FAILS == 0) {
  374. location = of_get_property(dn, "ibm,loc-code", NULL);
  375. printk(KERN_ERR "EEH: %d reads ignored for recovering device at "
  376. "location=%s driver=%s pci addr=%s\n",
  377. edev->check_count, location,
  378. eeh_driver_name(dev), eeh_pci_name(dev));
  379. printk(KERN_ERR "EEH: Might be infinite loop in %s driver\n",
  380. eeh_driver_name(dev));
  381. dump_stack();
  382. }
  383. goto dn_unlock;
  384. }
  385. /*
  386. * Now test for an EEH failure. This is VERY expensive.
  387. * Note that the eeh_config_addr may be a parent device
  388. * in the case of a device behind a bridge, or it may be
  389. * function zero of a multi-function device.
  390. * In any case they must share a common PHB.
  391. */
  392. ret = eeh_ops->get_state(dn, NULL);
  393. /* Note that config-io to empty slots may fail;
  394. * they are empty when they don't have children.
  395. * We will punt with the following conditions: Failure to get
  396. * PE's state, EEH not support and Permanently unavailable
  397. * state, PE is in good state.
  398. */
  399. if ((ret < 0) ||
  400. (ret == EEH_STATE_NOT_SUPPORT) ||
  401. (ret & (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE)) ==
  402. (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE)) {
  403. false_positives++;
  404. edev->false_positives ++;
  405. rc = 0;
  406. goto dn_unlock;
  407. }
  408. slot_resets++;
  409. /* Avoid repeated reports of this failure, including problems
  410. * with other functions on this device, and functions under
  411. * bridges.
  412. */
  413. eeh_mark_slot(dn, EEH_MODE_ISOLATED);
  414. raw_spin_unlock_irqrestore(&confirm_error_lock, flags);
  415. eeh_send_failure_event(edev);
  416. /* Most EEH events are due to device driver bugs. Having
  417. * a stack trace will help the device-driver authors figure
  418. * out what happened. So print that out.
  419. */
  420. dump_stack();
  421. return 1;
  422. dn_unlock:
  423. raw_spin_unlock_irqrestore(&confirm_error_lock, flags);
  424. return rc;
  425. }
  426. EXPORT_SYMBOL_GPL(eeh_dn_check_failure);
  427. /**
  428. * eeh_check_failure - Check if all 1's data is due to EEH slot freeze
  429. * @token: I/O token, should be address in the form 0xA....
  430. * @val: value, should be all 1's (XXX why do we need this arg??)
  431. *
  432. * Check for an EEH failure at the given token address. Call this
  433. * routine if the result of a read was all 0xff's and you want to
  434. * find out if this is due to an EEH slot freeze event. This routine
  435. * will query firmware for the EEH status.
  436. *
  437. * Note this routine is safe to call in an interrupt context.
  438. */
  439. unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val)
  440. {
  441. unsigned long addr;
  442. struct pci_dev *dev;
  443. struct device_node *dn;
  444. /* Finding the phys addr + pci device; this is pretty quick. */
  445. addr = eeh_token_to_phys((unsigned long __force) token);
  446. dev = pci_addr_cache_get_device(addr);
  447. if (!dev) {
  448. no_device++;
  449. return val;
  450. }
  451. dn = pci_device_to_OF_node(dev);
  452. eeh_dn_check_failure(dn, dev);
  453. pci_dev_put(dev);
  454. return val;
  455. }
  456. EXPORT_SYMBOL(eeh_check_failure);
  457. /**
  458. * eeh_pci_enable - Enable MMIO or DMA transfers for this slot
  459. * @edev: pci device node
  460. *
  461. * This routine should be called to reenable frozen MMIO or DMA
  462. * so that it would work correctly again. It's useful while doing
  463. * recovery or log collection on the indicated device.
  464. */
  465. int eeh_pci_enable(struct eeh_dev *edev, int function)
  466. {
  467. int rc;
  468. struct device_node *dn = eeh_dev_to_of_node(edev);
  469. rc = eeh_ops->set_option(dn, function);
  470. if (rc)
  471. printk(KERN_WARNING "EEH: Unexpected state change %d, err=%d dn=%s\n",
  472. function, rc, dn->full_name);
  473. rc = eeh_ops->wait_state(dn, PCI_BUS_RESET_WAIT_MSEC);
  474. if (rc > 0 && (rc & EEH_STATE_MMIO_ENABLED) &&
  475. (function == EEH_OPT_THAW_MMIO))
  476. return 0;
  477. return rc;
  478. }
  479. /**
  480. * pcibios_set_pcie_slot_reset - Set PCI-E reset state
  481. * @dev: pci device struct
  482. * @state: reset state to enter
  483. *
  484. * Return value:
  485. * 0 if success
  486. */
  487. int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state)
  488. {
  489. struct device_node *dn = pci_device_to_OF_node(dev);
  490. switch (state) {
  491. case pcie_deassert_reset:
  492. eeh_ops->reset(dn, EEH_RESET_DEACTIVATE);
  493. break;
  494. case pcie_hot_reset:
  495. eeh_ops->reset(dn, EEH_RESET_HOT);
  496. break;
  497. case pcie_warm_reset:
  498. eeh_ops->reset(dn, EEH_RESET_FUNDAMENTAL);
  499. break;
  500. default:
  501. return -EINVAL;
  502. };
  503. return 0;
  504. }
  505. /**
  506. * __eeh_set_pe_freset - Check the required reset for child devices
  507. * @parent: parent device
  508. * @freset: return value
  509. *
  510. * Each device might have its preferred reset type: fundamental or
  511. * hot reset. The routine is used to collect the information from
  512. * the child devices so that they could be reset accordingly.
  513. */
  514. void __eeh_set_pe_freset(struct device_node *parent, unsigned int *freset)
  515. {
  516. struct device_node *dn;
  517. for_each_child_of_node(parent, dn) {
  518. if (of_node_to_eeh_dev(dn)) {
  519. struct pci_dev *dev = of_node_to_eeh_dev(dn)->pdev;
  520. if (dev && dev->driver)
  521. *freset |= dev->needs_freset;
  522. __eeh_set_pe_freset(dn, freset);
  523. }
  524. }
  525. }
  526. /**
  527. * eeh_set_pe_freset - Check the required reset for the indicated device and its children
  528. * @dn: parent device
  529. * @freset: return value
  530. *
  531. * Each device might have its preferred reset type: fundamental or
  532. * hot reset. The routine is used to collected the information for
  533. * the indicated device and its children so that the bunch of the
  534. * devices could be reset properly.
  535. */
  536. void eeh_set_pe_freset(struct device_node *dn, unsigned int *freset)
  537. {
  538. struct pci_dev *dev;
  539. dn = eeh_find_device_pe(dn);
  540. /* Back up one, since config addrs might be shared */
  541. if (!pcibios_find_pci_bus(dn) && of_node_to_eeh_dev(dn->parent))
  542. dn = dn->parent;
  543. dev = of_node_to_eeh_dev(dn)->pdev;
  544. if (dev)
  545. *freset |= dev->needs_freset;
  546. __eeh_set_pe_freset(dn, freset);
  547. }
  548. /**
  549. * eeh_reset_pe_once - Assert the pci #RST line for 1/4 second
  550. * @edev: pci device node to be reset.
  551. *
  552. * Assert the PCI #RST line for 1/4 second.
  553. */
  554. static void eeh_reset_pe_once(struct eeh_dev *edev)
  555. {
  556. unsigned int freset = 0;
  557. struct device_node *dn = eeh_dev_to_of_node(edev);
  558. /* Determine type of EEH reset required for
  559. * Partitionable Endpoint, a hot-reset (1)
  560. * or a fundamental reset (3).
  561. * A fundamental reset required by any device under
  562. * Partitionable Endpoint trumps hot-reset.
  563. */
  564. eeh_set_pe_freset(dn, &freset);
  565. if (freset)
  566. eeh_ops->reset(dn, EEH_RESET_FUNDAMENTAL);
  567. else
  568. eeh_ops->reset(dn, EEH_RESET_HOT);
  569. /* The PCI bus requires that the reset be held high for at least
  570. * a 100 milliseconds. We wait a bit longer 'just in case'.
  571. */
  572. #define PCI_BUS_RST_HOLD_TIME_MSEC 250
  573. msleep(PCI_BUS_RST_HOLD_TIME_MSEC);
  574. /* We might get hit with another EEH freeze as soon as the
  575. * pci slot reset line is dropped. Make sure we don't miss
  576. * these, and clear the flag now.
  577. */
  578. eeh_clear_slot(dn, EEH_MODE_ISOLATED);
  579. eeh_ops->reset(dn, EEH_RESET_DEACTIVATE);
  580. /* After a PCI slot has been reset, the PCI Express spec requires
  581. * a 1.5 second idle time for the bus to stabilize, before starting
  582. * up traffic.
  583. */
  584. #define PCI_BUS_SETTLE_TIME_MSEC 1800
  585. msleep(PCI_BUS_SETTLE_TIME_MSEC);
  586. }
  587. /**
  588. * eeh_reset_pe - Reset the indicated PE
  589. * @edev: PCI device associated EEH device
  590. *
  591. * This routine should be called to reset indicated device, including
  592. * PE. A PE might include multiple PCI devices and sometimes PCI bridges
  593. * might be involved as well.
  594. */
  595. int eeh_reset_pe(struct eeh_dev *edev)
  596. {
  597. int i, rc;
  598. struct device_node *dn = eeh_dev_to_of_node(edev);
  599. /* Take three shots at resetting the bus */
  600. for (i=0; i<3; i++) {
  601. eeh_reset_pe_once(edev);
  602. rc = eeh_ops->wait_state(dn, PCI_BUS_RESET_WAIT_MSEC);
  603. if (rc == (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE))
  604. return 0;
  605. if (rc < 0) {
  606. printk(KERN_ERR "EEH: unrecoverable slot failure %s\n",
  607. dn->full_name);
  608. return -1;
  609. }
  610. printk(KERN_ERR "EEH: bus reset %d failed on slot %s, rc=%d\n",
  611. i+1, dn->full_name, rc);
  612. }
  613. return -1;
  614. }
  615. /** Save and restore of PCI BARs
  616. *
  617. * Although firmware will set up BARs during boot, it doesn't
  618. * set up device BAR's after a device reset, although it will,
  619. * if requested, set up bridge configuration. Thus, we need to
  620. * configure the PCI devices ourselves.
  621. */
  622. /**
  623. * eeh_restore_one_device_bars - Restore the Base Address Registers for one device
  624. * @edev: PCI device associated EEH device
  625. *
  626. * Loads the PCI configuration space base address registers,
  627. * the expansion ROM base address, the latency timer, and etc.
  628. * from the saved values in the device node.
  629. */
  630. static inline void eeh_restore_one_device_bars(struct eeh_dev *edev)
  631. {
  632. int i;
  633. u32 cmd;
  634. struct device_node *dn = eeh_dev_to_of_node(edev);
  635. if (!edev->phb)
  636. return;
  637. for (i=4; i<10; i++) {
  638. rtas_write_config(PCI_DN(dn), i*4, 4, edev->config_space[i]);
  639. }
  640. /* 12 == Expansion ROM Address */
  641. rtas_write_config(PCI_DN(dn), 12*4, 4, edev->config_space[12]);
  642. #define BYTE_SWAP(OFF) (8*((OFF)/4)+3-(OFF))
  643. #define SAVED_BYTE(OFF) (((u8 *)(edev->config_space))[BYTE_SWAP(OFF)])
  644. rtas_write_config(PCI_DN(dn), PCI_CACHE_LINE_SIZE, 1,
  645. SAVED_BYTE(PCI_CACHE_LINE_SIZE));
  646. rtas_write_config(PCI_DN(dn), PCI_LATENCY_TIMER, 1,
  647. SAVED_BYTE(PCI_LATENCY_TIMER));
  648. /* max latency, min grant, interrupt pin and line */
  649. rtas_write_config(PCI_DN(dn), 15*4, 4, edev->config_space[15]);
  650. /* Restore PERR & SERR bits, some devices require it,
  651. * don't touch the other command bits
  652. */
  653. rtas_read_config(PCI_DN(dn), PCI_COMMAND, 4, &cmd);
  654. if (edev->config_space[1] & PCI_COMMAND_PARITY)
  655. cmd |= PCI_COMMAND_PARITY;
  656. else
  657. cmd &= ~PCI_COMMAND_PARITY;
  658. if (edev->config_space[1] & PCI_COMMAND_SERR)
  659. cmd |= PCI_COMMAND_SERR;
  660. else
  661. cmd &= ~PCI_COMMAND_SERR;
  662. rtas_write_config(PCI_DN(dn), PCI_COMMAND, 4, cmd);
  663. }
  664. /**
  665. * eeh_restore_bars - Restore the PCI config space info
  666. * @edev: EEH device
  667. *
  668. * This routine performs a recursive walk to the children
  669. * of this device as well.
  670. */
  671. void eeh_restore_bars(struct eeh_dev *edev)
  672. {
  673. struct device_node *dn;
  674. if (!edev)
  675. return;
  676. if ((edev->mode & EEH_MODE_SUPPORTED) && !IS_BRIDGE(edev->class_code))
  677. eeh_restore_one_device_bars(edev);
  678. for_each_child_of_node(eeh_dev_to_of_node(edev), dn)
  679. eeh_restore_bars(of_node_to_eeh_dev(dn));
  680. }
  681. /**
  682. * eeh_save_bars - Save device bars
  683. * @edev: PCI device associated EEH device
  684. *
  685. * Save the values of the device bars. Unlike the restore
  686. * routine, this routine is *not* recursive. This is because
  687. * PCI devices are added individually; but, for the restore,
  688. * an entire slot is reset at a time.
  689. */
  690. static void eeh_save_bars(struct eeh_dev *edev)
  691. {
  692. int i;
  693. struct device_node *dn;
  694. if (!edev)
  695. return;
  696. dn = eeh_dev_to_of_node(edev);
  697. for (i = 0; i < 16; i++)
  698. rtas_read_config(PCI_DN(dn), i * 4, 4, &edev->config_space[i]);
  699. }
  700. /**
  701. * eeh_early_enable - Early enable EEH on the indicated device
  702. * @dn: device node
  703. * @data: BUID
  704. *
  705. * Enable EEH functionality on the specified PCI device. The function
  706. * is expected to be called before real PCI probing is done. However,
  707. * the PHBs have been initialized at this point.
  708. */
  709. static void *eeh_early_enable(struct device_node *dn, void *data)
  710. {
  711. int ret;
  712. const u32 *class_code = of_get_property(dn, "class-code", NULL);
  713. const u32 *vendor_id = of_get_property(dn, "vendor-id", NULL);
  714. const u32 *device_id = of_get_property(dn, "device-id", NULL);
  715. const u32 *regs;
  716. int enable;
  717. struct eeh_dev *edev = of_node_to_eeh_dev(dn);
  718. edev->class_code = 0;
  719. edev->mode = 0;
  720. edev->check_count = 0;
  721. edev->freeze_count = 0;
  722. edev->false_positives = 0;
  723. if (!of_device_is_available(dn))
  724. return NULL;
  725. /* Ignore bad nodes. */
  726. if (!class_code || !vendor_id || !device_id)
  727. return NULL;
  728. /* There is nothing to check on PCI to ISA bridges */
  729. if (dn->type && !strcmp(dn->type, "isa")) {
  730. edev->mode |= EEH_MODE_NOCHECK;
  731. return NULL;
  732. }
  733. edev->class_code = *class_code;
  734. /* Ok... see if this device supports EEH. Some do, some don't,
  735. * and the only way to find out is to check each and every one.
  736. */
  737. regs = of_get_property(dn, "reg", NULL);
  738. if (regs) {
  739. /* First register entry is addr (00BBSS00) */
  740. /* Try to enable eeh */
  741. ret = eeh_ops->set_option(dn, EEH_OPT_ENABLE);
  742. enable = 0;
  743. if (ret == 0) {
  744. edev->config_addr = regs[0];
  745. /* If the newer, better, ibm,get-config-addr-info is supported,
  746. * then use that instead.
  747. */
  748. edev->pe_config_addr = eeh_ops->get_pe_addr(dn);
  749. /* Some older systems (Power4) allow the
  750. * ibm,set-eeh-option call to succeed even on nodes
  751. * where EEH is not supported. Verify support
  752. * explicitly.
  753. */
  754. ret = eeh_ops->get_state(dn, NULL);
  755. if (ret > 0 && ret != EEH_STATE_NOT_SUPPORT)
  756. enable = 1;
  757. }
  758. if (enable) {
  759. eeh_subsystem_enabled = 1;
  760. edev->mode |= EEH_MODE_SUPPORTED;
  761. pr_debug("EEH: %s: eeh enabled, config=%x pe_config=%x\n",
  762. dn->full_name, edev->config_addr,
  763. edev->pe_config_addr);
  764. } else {
  765. /* This device doesn't support EEH, but it may have an
  766. * EEH parent, in which case we mark it as supported.
  767. */
  768. if (dn->parent && of_node_to_eeh_dev(dn->parent) &&
  769. (of_node_to_eeh_dev(dn->parent)->mode & EEH_MODE_SUPPORTED)) {
  770. /* Parent supports EEH. */
  771. edev->mode |= EEH_MODE_SUPPORTED;
  772. edev->config_addr = of_node_to_eeh_dev(dn->parent)->config_addr;
  773. return NULL;
  774. }
  775. }
  776. } else {
  777. printk(KERN_WARNING "EEH: %s: unable to get reg property.\n",
  778. dn->full_name);
  779. }
  780. eeh_save_bars(edev);
  781. return NULL;
  782. }
  783. /**
  784. * eeh_ops_register - Register platform dependent EEH operations
  785. * @ops: platform dependent EEH operations
  786. *
  787. * Register the platform dependent EEH operation callback
  788. * functions. The platform should call this function before
  789. * any other EEH operations.
  790. */
  791. int __init eeh_ops_register(struct eeh_ops *ops)
  792. {
  793. if (!ops->name) {
  794. pr_warning("%s: Invalid EEH ops name for %p\n",
  795. __func__, ops);
  796. return -EINVAL;
  797. }
  798. if (eeh_ops && eeh_ops != ops) {
  799. pr_warning("%s: EEH ops of platform %s already existing (%s)\n",
  800. __func__, eeh_ops->name, ops->name);
  801. return -EEXIST;
  802. }
  803. eeh_ops = ops;
  804. return 0;
  805. }
  806. /**
  807. * eeh_ops_unregister - Unreigster platform dependent EEH operations
  808. * @name: name of EEH platform operations
  809. *
  810. * Unregister the platform dependent EEH operation callback
  811. * functions.
  812. */
  813. int __exit eeh_ops_unregister(const char *name)
  814. {
  815. if (!name || !strlen(name)) {
  816. pr_warning("%s: Invalid EEH ops name\n",
  817. __func__);
  818. return -EINVAL;
  819. }
  820. if (eeh_ops && !strcmp(eeh_ops->name, name)) {
  821. eeh_ops = NULL;
  822. return 0;
  823. }
  824. return -EEXIST;
  825. }
  826. /**
  827. * eeh_init - EEH initialization
  828. *
  829. * Initialize EEH by trying to enable it for all of the adapters in the system.
  830. * As a side effect we can determine here if eeh is supported at all.
  831. * Note that we leave EEH on so failed config cycles won't cause a machine
  832. * check. If a user turns off EEH for a particular adapter they are really
  833. * telling Linux to ignore errors. Some hardware (e.g. POWER5) won't
  834. * grant access to a slot if EEH isn't enabled, and so we always enable
  835. * EEH for all slots/all devices.
  836. *
  837. * The eeh-force-off option disables EEH checking globally, for all slots.
  838. * Even if force-off is set, the EEH hardware is still enabled, so that
  839. * newer systems can boot.
  840. */
  841. void __init eeh_init(void)
  842. {
  843. struct device_node *phb, *np;
  844. int ret;
  845. /* call platform initialization function */
  846. if (!eeh_ops) {
  847. pr_warning("%s: Platform EEH operation not found\n",
  848. __func__);
  849. return;
  850. } else if ((ret = eeh_ops->init())) {
  851. pr_warning("%s: Failed to call platform init function (%d)\n",
  852. __func__, ret);
  853. return;
  854. }
  855. raw_spin_lock_init(&confirm_error_lock);
  856. np = of_find_node_by_path("/rtas");
  857. if (np == NULL)
  858. return;
  859. /* Enable EEH for all adapters. Note that eeh requires buid's */
  860. for (phb = of_find_node_by_name(NULL, "pci"); phb;
  861. phb = of_find_node_by_name(phb, "pci")) {
  862. unsigned long buid;
  863. buid = get_phb_buid(phb);
  864. if (buid == 0 || !of_node_to_eeh_dev(phb))
  865. continue;
  866. traverse_pci_devices(phb, eeh_early_enable, NULL);
  867. }
  868. if (eeh_subsystem_enabled)
  869. printk(KERN_INFO "EEH: PCI Enhanced I/O Error Handling Enabled\n");
  870. else
  871. printk(KERN_WARNING "EEH: No capable adapters found\n");
  872. }
  873. /**
  874. * eeh_add_device_early - Enable EEH for the indicated device_node
  875. * @dn: device node for which to set up EEH
  876. *
  877. * This routine must be used to perform EEH initialization for PCI
  878. * devices that were added after system boot (e.g. hotplug, dlpar).
  879. * This routine must be called before any i/o is performed to the
  880. * adapter (inluding any config-space i/o).
  881. * Whether this actually enables EEH or not for this device depends
  882. * on the CEC architecture, type of the device, on earlier boot
  883. * command-line arguments & etc.
  884. */
  885. static void eeh_add_device_early(struct device_node *dn)
  886. {
  887. struct pci_controller *phb;
  888. if (!dn || !of_node_to_eeh_dev(dn))
  889. return;
  890. phb = of_node_to_eeh_dev(dn)->phb;
  891. /* USB Bus children of PCI devices will not have BUID's */
  892. if (NULL == phb || 0 == phb->buid)
  893. return;
  894. eeh_early_enable(dn, NULL);
  895. }
  896. /**
  897. * eeh_add_device_tree_early - Enable EEH for the indicated device
  898. * @dn: device node
  899. *
  900. * This routine must be used to perform EEH initialization for the
  901. * indicated PCI device that was added after system boot (e.g.
  902. * hotplug, dlpar).
  903. */
  904. void eeh_add_device_tree_early(struct device_node *dn)
  905. {
  906. struct device_node *sib;
  907. for_each_child_of_node(dn, sib)
  908. eeh_add_device_tree_early(sib);
  909. eeh_add_device_early(dn);
  910. }
  911. EXPORT_SYMBOL_GPL(eeh_add_device_tree_early);
  912. /**
  913. * eeh_add_device_late - Perform EEH initialization for the indicated pci device
  914. * @dev: pci device for which to set up EEH
  915. *
  916. * This routine must be used to complete EEH initialization for PCI
  917. * devices that were added after system boot (e.g. hotplug, dlpar).
  918. */
  919. static void eeh_add_device_late(struct pci_dev *dev)
  920. {
  921. struct device_node *dn;
  922. struct eeh_dev *edev;
  923. if (!dev || !eeh_subsystem_enabled)
  924. return;
  925. pr_debug("EEH: Adding device %s\n", pci_name(dev));
  926. dn = pci_device_to_OF_node(dev);
  927. edev = pci_dev_to_eeh_dev(dev);
  928. if (edev->pdev == dev) {
  929. pr_debug("EEH: Already referenced !\n");
  930. return;
  931. }
  932. WARN_ON(edev->pdev);
  933. pci_dev_get(dev);
  934. edev->pdev = dev;
  935. dev->dev.archdata.edev = edev;
  936. pci_addr_cache_insert_device(dev);
  937. eeh_sysfs_add_device(dev);
  938. }
  939. /**
  940. * eeh_add_device_tree_late - Perform EEH initialization for the indicated PCI bus
  941. * @bus: PCI bus
  942. *
  943. * This routine must be used to perform EEH initialization for PCI
  944. * devices which are attached to the indicated PCI bus. The PCI bus
  945. * is added after system boot through hotplug or dlpar.
  946. */
  947. void eeh_add_device_tree_late(struct pci_bus *bus)
  948. {
  949. struct pci_dev *dev;
  950. list_for_each_entry(dev, &bus->devices, bus_list) {
  951. eeh_add_device_late(dev);
  952. if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
  953. struct pci_bus *subbus = dev->subordinate;
  954. if (subbus)
  955. eeh_add_device_tree_late(subbus);
  956. }
  957. }
  958. }
  959. EXPORT_SYMBOL_GPL(eeh_add_device_tree_late);
  960. /**
  961. * eeh_remove_device - Undo EEH setup for the indicated pci device
  962. * @dev: pci device to be removed
  963. *
  964. * This routine should be called when a device is removed from
  965. * a running system (e.g. by hotplug or dlpar). It unregisters
  966. * the PCI device from the EEH subsystem. I/O errors affecting
  967. * this device will no longer be detected after this call; thus,
  968. * i/o errors affecting this slot may leave this device unusable.
  969. */
  970. static void eeh_remove_device(struct pci_dev *dev)
  971. {
  972. struct eeh_dev *edev;
  973. if (!dev || !eeh_subsystem_enabled)
  974. return;
  975. edev = pci_dev_to_eeh_dev(dev);
  976. /* Unregister the device with the EEH/PCI address search system */
  977. pr_debug("EEH: Removing device %s\n", pci_name(dev));
  978. if (!edev || !edev->pdev) {
  979. pr_debug("EEH: Not referenced !\n");
  980. return;
  981. }
  982. edev->pdev = NULL;
  983. dev->dev.archdata.edev = NULL;
  984. pci_dev_put(dev);
  985. pci_addr_cache_remove_device(dev);
  986. eeh_sysfs_remove_device(dev);
  987. }
  988. /**
  989. * eeh_remove_bus_device - Undo EEH setup for the indicated PCI device
  990. * @dev: PCI device
  991. *
  992. * This routine must be called when a device is removed from the
  993. * running system through hotplug or dlpar. The corresponding
  994. * PCI address cache will be removed.
  995. */
  996. void eeh_remove_bus_device(struct pci_dev *dev)
  997. {
  998. struct pci_bus *bus = dev->subordinate;
  999. struct pci_dev *child, *tmp;
  1000. eeh_remove_device(dev);
  1001. if (bus && dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
  1002. list_for_each_entry_safe(child, tmp, &bus->devices, bus_list)
  1003. eeh_remove_bus_device(child);
  1004. }
  1005. }
  1006. EXPORT_SYMBOL_GPL(eeh_remove_bus_device);
  1007. static int proc_eeh_show(struct seq_file *m, void *v)
  1008. {
  1009. if (0 == eeh_subsystem_enabled) {
  1010. seq_printf(m, "EEH Subsystem is globally disabled\n");
  1011. seq_printf(m, "eeh_total_mmio_ffs=%ld\n", total_mmio_ffs);
  1012. } else {
  1013. seq_printf(m, "EEH Subsystem is enabled\n");
  1014. seq_printf(m,
  1015. "no device=%ld\n"
  1016. "no device node=%ld\n"
  1017. "no config address=%ld\n"
  1018. "check not wanted=%ld\n"
  1019. "eeh_total_mmio_ffs=%ld\n"
  1020. "eeh_false_positives=%ld\n"
  1021. "eeh_slot_resets=%ld\n",
  1022. no_device, no_dn, no_cfg_addr,
  1023. ignored_check, total_mmio_ffs,
  1024. false_positives,
  1025. slot_resets);
  1026. }
  1027. return 0;
  1028. }
  1029. static int proc_eeh_open(struct inode *inode, struct file *file)
  1030. {
  1031. return single_open(file, proc_eeh_show, NULL);
  1032. }
  1033. static const struct file_operations proc_eeh_operations = {
  1034. .open = proc_eeh_open,
  1035. .read = seq_read,
  1036. .llseek = seq_lseek,
  1037. .release = single_release,
  1038. };
  1039. static int __init eeh_init_proc(void)
  1040. {
  1041. if (machine_is(pseries))
  1042. proc_create("powerpc/eeh", 0, NULL, &proc_eeh_operations);
  1043. return 0;
  1044. }
  1045. __initcall(eeh_init_proc);