core_mcpcia.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. /*
  2. * linux/arch/alpha/kernel/core_mcpcia.c
  3. *
  4. * Based on code written by David A Rusling (david.rusling@reo.mts.dec.com).
  5. *
  6. * Code common to all MCbus-PCI Adaptor core logic chipsets
  7. */
  8. #define __EXTERN_INLINE inline
  9. #include <asm/io.h>
  10. #include <asm/core_mcpcia.h>
  11. #undef __EXTERN_INLINE
  12. #include <linux/types.h>
  13. #include <linux/pci.h>
  14. #include <linux/sched.h>
  15. #include <linux/init.h>
  16. #include <linux/delay.h>
  17. #include <asm/ptrace.h>
  18. #include "proto.h"
  19. #include "pci_impl.h"
  20. /*
  21. * NOTE: Herein lie back-to-back mb instructions. They are magic.
  22. * One plausible explanation is that the i/o controller does not properly
  23. * handle the system transaction. Another involves timing. Ho hum.
  24. */
  25. /*
  26. * BIOS32-style PCI interface:
  27. */
  28. #define DEBUG_CFG 0
  29. #if DEBUG_CFG
  30. # define DBG_CFG(args) printk args
  31. #else
  32. # define DBG_CFG(args)
  33. #endif
  34. /*
  35. * Given a bus, device, and function number, compute resulting
  36. * configuration space address and setup the MCPCIA_HAXR2 register
  37. * accordingly. It is therefore not safe to have concurrent
  38. * invocations to configuration space access routines, but there
  39. * really shouldn't be any need for this.
  40. *
  41. * Type 0:
  42. *
  43. * 3 3|3 3 2 2|2 2 2 2|2 2 2 2|1 1 1 1|1 1 1 1|1 1
  44. * 3 2|1 0 9 8|7 6 5 4|3 2 1 0|9 8 7 6|5 4 3 2|1 0 9 8|7 6 5 4|3 2 1 0
  45. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  46. * | | |D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|F|F|F|R|R|R|R|R|R|0|0|
  47. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  48. *
  49. * 31:11 Device select bit.
  50. * 10:8 Function number
  51. * 7:2 Register number
  52. *
  53. * Type 1:
  54. *
  55. * 3 3|3 3 2 2|2 2 2 2|2 2 2 2|1 1 1 1|1 1 1 1|1 1
  56. * 3 2|1 0 9 8|7 6 5 4|3 2 1 0|9 8 7 6|5 4 3 2|1 0 9 8|7 6 5 4|3 2 1 0
  57. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  58. * | | | | | | | | | | |B|B|B|B|B|B|B|B|D|D|D|D|D|F|F|F|R|R|R|R|R|R|0|1|
  59. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  60. *
  61. * 31:24 reserved
  62. * 23:16 bus number (8 bits = 128 possible buses)
  63. * 15:11 Device number (5 bits)
  64. * 10:8 function number
  65. * 7:2 register number
  66. *
  67. * Notes:
  68. * The function number selects which function of a multi-function device
  69. * (e.g., SCSI and Ethernet).
  70. *
  71. * The register selects a DWORD (32 bit) register offset. Hence it
  72. * doesn't get shifted by 2 bits as we want to "drop" the bottom two
  73. * bits.
  74. */
  75. static unsigned int
  76. conf_read(unsigned long addr, unsigned char type1,
  77. struct pci_controller *hose)
  78. {
  79. unsigned long flags;
  80. unsigned long mid = MCPCIA_HOSE2MID(hose->index);
  81. unsigned int stat0, value, cpu;
  82. cpu = smp_processor_id();
  83. local_irq_save(flags);
  84. DBG_CFG(("conf_read(addr=0x%lx, type1=%d, hose=%d)\n",
  85. addr, type1, mid));
  86. /* Reset status register to avoid losing errors. */
  87. stat0 = *(vuip)MCPCIA_CAP_ERR(mid);
  88. *(vuip)MCPCIA_CAP_ERR(mid) = stat0;
  89. mb();
  90. *(vuip)MCPCIA_CAP_ERR(mid);
  91. DBG_CFG(("conf_read: MCPCIA_CAP_ERR(%d) was 0x%x\n", mid, stat0));
  92. mb();
  93. draina();
  94. mcheck_expected(cpu) = 1;
  95. mcheck_taken(cpu) = 0;
  96. mcheck_extra(cpu) = mid;
  97. mb();
  98. /* Access configuration space. */
  99. value = *((vuip)addr);
  100. mb();
  101. mb(); /* magic */
  102. if (mcheck_taken(cpu)) {
  103. mcheck_taken(cpu) = 0;
  104. value = 0xffffffffU;
  105. mb();
  106. }
  107. mcheck_expected(cpu) = 0;
  108. mb();
  109. DBG_CFG(("conf_read(): finished\n"));
  110. local_irq_restore(flags);
  111. return value;
  112. }
  113. static void
  114. conf_write(unsigned long addr, unsigned int value, unsigned char type1,
  115. struct pci_controller *hose)
  116. {
  117. unsigned long flags;
  118. unsigned long mid = MCPCIA_HOSE2MID(hose->index);
  119. unsigned int stat0, cpu;
  120. cpu = smp_processor_id();
  121. local_irq_save(flags); /* avoid getting hit by machine check */
  122. /* Reset status register to avoid losing errors. */
  123. stat0 = *(vuip)MCPCIA_CAP_ERR(mid);
  124. *(vuip)MCPCIA_CAP_ERR(mid) = stat0; mb();
  125. *(vuip)MCPCIA_CAP_ERR(mid);
  126. DBG_CFG(("conf_write: MCPCIA CAP_ERR(%d) was 0x%x\n", mid, stat0));
  127. draina();
  128. mcheck_expected(cpu) = 1;
  129. mcheck_extra(cpu) = mid;
  130. mb();
  131. /* Access configuration space. */
  132. *((vuip)addr) = value;
  133. mb();
  134. mb(); /* magic */
  135. *(vuip)MCPCIA_CAP_ERR(mid); /* read to force the write */
  136. mcheck_expected(cpu) = 0;
  137. mb();
  138. DBG_CFG(("conf_write(): finished\n"));
  139. local_irq_restore(flags);
  140. }
  141. static int
  142. mk_conf_addr(struct pci_bus *pbus, unsigned int devfn, int where,
  143. struct pci_controller *hose, unsigned long *pci_addr,
  144. unsigned char *type1)
  145. {
  146. u8 bus = pbus->number;
  147. unsigned long addr;
  148. DBG_CFG(("mk_conf_addr(bus=%d,devfn=0x%x,hose=%d,where=0x%x,"
  149. " pci_addr=0x%p, type1=0x%p)\n",
  150. bus, devfn, hose->index, where, pci_addr, type1));
  151. /* Type 1 configuration cycle for *ALL* busses. */
  152. *type1 = 1;
  153. if (!pbus->parent) /* No parent means peer PCI bus. */
  154. bus = 0;
  155. addr = (bus << 16) | (devfn << 8) | (where);
  156. addr <<= 5; /* swizzle for SPARSE */
  157. addr |= hose->config_space_base;
  158. *pci_addr = addr;
  159. DBG_CFG(("mk_conf_addr: returning pci_addr 0x%lx\n", addr));
  160. return 0;
  161. }
  162. static int
  163. mcpcia_read_config(struct pci_bus *bus, unsigned int devfn, int where,
  164. int size, u32 *value)
  165. {
  166. struct pci_controller *hose = bus->sysdata;
  167. unsigned long addr, w;
  168. unsigned char type1;
  169. if (mk_conf_addr(bus, devfn, where, hose, &addr, &type1))
  170. return PCIBIOS_DEVICE_NOT_FOUND;
  171. addr |= (size - 1) * 8;
  172. w = conf_read(addr, type1, hose);
  173. switch (size) {
  174. case 1:
  175. *value = __kernel_extbl(w, where & 3);
  176. break;
  177. case 2:
  178. *value = __kernel_extwl(w, where & 3);
  179. break;
  180. case 4:
  181. *value = w;
  182. break;
  183. }
  184. return PCIBIOS_SUCCESSFUL;
  185. }
  186. static int
  187. mcpcia_write_config(struct pci_bus *bus, unsigned int devfn, int where,
  188. int size, u32 value)
  189. {
  190. struct pci_controller *hose = bus->sysdata;
  191. unsigned long addr;
  192. unsigned char type1;
  193. if (mk_conf_addr(bus, devfn, where, hose, &addr, &type1))
  194. return PCIBIOS_DEVICE_NOT_FOUND;
  195. addr |= (size - 1) * 8;
  196. value = __kernel_insql(value, where & 3);
  197. conf_write(addr, value, type1, hose);
  198. return PCIBIOS_SUCCESSFUL;
  199. }
  200. struct pci_ops mcpcia_pci_ops =
  201. {
  202. .read = mcpcia_read_config,
  203. .write = mcpcia_write_config,
  204. };
  205. void
  206. mcpcia_pci_tbi(struct pci_controller *hose, dma_addr_t start, dma_addr_t end)
  207. {
  208. wmb();
  209. *(vuip)MCPCIA_SG_TBIA(MCPCIA_HOSE2MID(hose->index)) = 0;
  210. mb();
  211. }
  212. static int __init
  213. mcpcia_probe_hose(int h)
  214. {
  215. int cpu = smp_processor_id();
  216. int mid = MCPCIA_HOSE2MID(h);
  217. unsigned int pci_rev;
  218. /* Gotta be REAL careful. If hose is absent, we get an mcheck. */
  219. mb();
  220. mb();
  221. draina();
  222. wrmces(7);
  223. mcheck_expected(cpu) = 2; /* indicates probing */
  224. mcheck_taken(cpu) = 0;
  225. mcheck_extra(cpu) = mid;
  226. mb();
  227. /* Access the bus revision word. */
  228. pci_rev = *(vuip)MCPCIA_REV(mid);
  229. mb();
  230. mb(); /* magic */
  231. if (mcheck_taken(cpu)) {
  232. mcheck_taken(cpu) = 0;
  233. pci_rev = 0xffffffff;
  234. mb();
  235. }
  236. mcheck_expected(cpu) = 0;
  237. mb();
  238. return (pci_rev >> 16) == PCI_CLASS_BRIDGE_HOST;
  239. }
  240. static void __init
  241. mcpcia_new_hose(int h)
  242. {
  243. struct pci_controller *hose;
  244. struct resource *io, *mem, *hae_mem;
  245. int mid = MCPCIA_HOSE2MID(h);
  246. hose = alloc_pci_controller();
  247. if (h == 0)
  248. pci_isa_hose = hose;
  249. io = alloc_resource();
  250. mem = alloc_resource();
  251. hae_mem = alloc_resource();
  252. hose->io_space = io;
  253. hose->mem_space = hae_mem;
  254. hose->sparse_mem_base = MCPCIA_SPARSE(mid) - IDENT_ADDR;
  255. hose->dense_mem_base = MCPCIA_DENSE(mid) - IDENT_ADDR;
  256. hose->sparse_io_base = MCPCIA_IO(mid) - IDENT_ADDR;
  257. hose->dense_io_base = 0;
  258. hose->config_space_base = MCPCIA_CONF(mid);
  259. hose->index = h;
  260. io->start = MCPCIA_IO(mid) - MCPCIA_IO_BIAS;
  261. io->end = io->start + 0xffff;
  262. io->name = pci_io_names[h];
  263. io->flags = IORESOURCE_IO;
  264. mem->start = MCPCIA_DENSE(mid) - MCPCIA_MEM_BIAS;
  265. mem->end = mem->start + 0xffffffff;
  266. mem->name = pci_mem_names[h];
  267. mem->flags = IORESOURCE_MEM;
  268. hae_mem->start = mem->start;
  269. hae_mem->end = mem->start + MCPCIA_MEM_MASK;
  270. hae_mem->name = pci_hae0_name;
  271. hae_mem->flags = IORESOURCE_MEM;
  272. if (request_resource(&ioport_resource, io) < 0)
  273. printk(KERN_ERR "Failed to request IO on hose %d\n", h);
  274. if (request_resource(&iomem_resource, mem) < 0)
  275. printk(KERN_ERR "Failed to request MEM on hose %d\n", h);
  276. if (request_resource(mem, hae_mem) < 0)
  277. printk(KERN_ERR "Failed to request HAE_MEM on hose %d\n", h);
  278. }
  279. static void
  280. mcpcia_pci_clr_err(int mid)
  281. {
  282. *(vuip)MCPCIA_CAP_ERR(mid);
  283. *(vuip)MCPCIA_CAP_ERR(mid) = 0xffffffff; /* Clear them all. */
  284. mb();
  285. *(vuip)MCPCIA_CAP_ERR(mid); /* Re-read for force write. */
  286. }
  287. static void __init
  288. mcpcia_startup_hose(struct pci_controller *hose)
  289. {
  290. int mid = MCPCIA_HOSE2MID(hose->index);
  291. unsigned int tmp;
  292. mcpcia_pci_clr_err(mid);
  293. /*
  294. * Set up error reporting.
  295. */
  296. tmp = *(vuip)MCPCIA_CAP_ERR(mid);
  297. tmp |= 0x0006; /* master/target abort */
  298. *(vuip)MCPCIA_CAP_ERR(mid) = tmp;
  299. mb();
  300. tmp = *(vuip)MCPCIA_CAP_ERR(mid);
  301. /*
  302. * Set up the PCI->physical memory translation windows.
  303. *
  304. * Window 0 is scatter-gather 8MB at 8MB (for isa)
  305. * Window 1 is scatter-gather (up to) 1GB at 1GB (for pci)
  306. * Window 2 is direct access 2GB at 2GB
  307. */
  308. hose->sg_isa = iommu_arena_new(hose, 0x00800000, 0x00800000, 0);
  309. hose->sg_pci = iommu_arena_new(hose, 0x40000000,
  310. size_for_memory(0x40000000), 0);
  311. __direct_map_base = 0x80000000;
  312. __direct_map_size = 0x80000000;
  313. *(vuip)MCPCIA_W0_BASE(mid) = hose->sg_isa->dma_base | 3;
  314. *(vuip)MCPCIA_W0_MASK(mid) = (hose->sg_isa->size - 1) & 0xfff00000;
  315. *(vuip)MCPCIA_T0_BASE(mid) = virt_to_phys(hose->sg_isa->ptes) >> 8;
  316. *(vuip)MCPCIA_W1_BASE(mid) = hose->sg_pci->dma_base | 3;
  317. *(vuip)MCPCIA_W1_MASK(mid) = (hose->sg_pci->size - 1) & 0xfff00000;
  318. *(vuip)MCPCIA_T1_BASE(mid) = virt_to_phys(hose->sg_pci->ptes) >> 8;
  319. *(vuip)MCPCIA_W2_BASE(mid) = __direct_map_base | 1;
  320. *(vuip)MCPCIA_W2_MASK(mid) = (__direct_map_size - 1) & 0xfff00000;
  321. *(vuip)MCPCIA_T2_BASE(mid) = 0;
  322. *(vuip)MCPCIA_W3_BASE(mid) = 0x0;
  323. mcpcia_pci_tbi(hose, 0, -1);
  324. *(vuip)MCPCIA_HBASE(mid) = 0x0;
  325. mb();
  326. *(vuip)MCPCIA_HAE_MEM(mid) = 0U;
  327. mb();
  328. *(vuip)MCPCIA_HAE_MEM(mid); /* read it back. */
  329. *(vuip)MCPCIA_HAE_IO(mid) = 0;
  330. mb();
  331. *(vuip)MCPCIA_HAE_IO(mid); /* read it back. */
  332. }
  333. void __init
  334. mcpcia_init_arch(void)
  335. {
  336. /* With multiple PCI busses, we play with I/O as physical addrs. */
  337. ioport_resource.end = ~0UL;
  338. /* Allocate hose 0. That's the one that all the ISA junk hangs
  339. off of, from which we'll be registering stuff here in a bit.
  340. Other hose detection is done in mcpcia_init_hoses, which is
  341. called from init_IRQ. */
  342. mcpcia_new_hose(0);
  343. }
  344. /* This is called from init_IRQ, since we cannot take interrupts
  345. before then. Which means we cannot do this in init_arch. */
  346. void __init
  347. mcpcia_init_hoses(void)
  348. {
  349. struct pci_controller *hose;
  350. int hose_count;
  351. int h;
  352. /* First, find how many hoses we have. */
  353. hose_count = 0;
  354. for (h = 0; h < MCPCIA_MAX_HOSES; ++h) {
  355. if (mcpcia_probe_hose(h)) {
  356. if (h != 0)
  357. mcpcia_new_hose(h);
  358. hose_count++;
  359. }
  360. }
  361. printk("mcpcia_init_hoses: found %d hoses\n", hose_count);
  362. /* Now do init for each hose. */
  363. for (hose = hose_head; hose; hose = hose->next)
  364. mcpcia_startup_hose(hose);
  365. }
  366. static void
  367. mcpcia_print_uncorrectable(struct el_MCPCIA_uncorrected_frame_mcheck *logout)
  368. {
  369. struct el_common_EV5_uncorrectable_mcheck *frame;
  370. int i;
  371. frame = &logout->procdata;
  372. /* Print PAL fields */
  373. for (i = 0; i < 24; i += 2) {
  374. printk(" paltmp[%d-%d] = %16lx %16lx\n",
  375. i, i+1, frame->paltemp[i], frame->paltemp[i+1]);
  376. }
  377. for (i = 0; i < 8; i += 2) {
  378. printk(" shadow[%d-%d] = %16lx %16lx\n",
  379. i, i+1, frame->shadow[i],
  380. frame->shadow[i+1]);
  381. }
  382. printk(" Addr of excepting instruction = %16lx\n",
  383. frame->exc_addr);
  384. printk(" Summary of arithmetic traps = %16lx\n",
  385. frame->exc_sum);
  386. printk(" Exception mask = %16lx\n",
  387. frame->exc_mask);
  388. printk(" Base address for PALcode = %16lx\n",
  389. frame->pal_base);
  390. printk(" Interrupt Status Reg = %16lx\n",
  391. frame->isr);
  392. printk(" CURRENT SETUP OF EV5 IBOX = %16lx\n",
  393. frame->icsr);
  394. printk(" I-CACHE Reg %s parity error = %16lx\n",
  395. (frame->ic_perr_stat & 0x800L) ?
  396. "Data" : "Tag",
  397. frame->ic_perr_stat);
  398. printk(" D-CACHE error Reg = %16lx\n",
  399. frame->dc_perr_stat);
  400. if (frame->dc_perr_stat & 0x2) {
  401. switch (frame->dc_perr_stat & 0x03c) {
  402. case 8:
  403. printk(" Data error in bank 1\n");
  404. break;
  405. case 4:
  406. printk(" Data error in bank 0\n");
  407. break;
  408. case 20:
  409. printk(" Tag error in bank 1\n");
  410. break;
  411. case 10:
  412. printk(" Tag error in bank 0\n");
  413. break;
  414. }
  415. }
  416. printk(" Effective VA = %16lx\n",
  417. frame->va);
  418. printk(" Reason for D-stream = %16lx\n",
  419. frame->mm_stat);
  420. printk(" EV5 SCache address = %16lx\n",
  421. frame->sc_addr);
  422. printk(" EV5 SCache TAG/Data parity = %16lx\n",
  423. frame->sc_stat);
  424. printk(" EV5 BC_TAG_ADDR = %16lx\n",
  425. frame->bc_tag_addr);
  426. printk(" EV5 EI_ADDR: Phys addr of Xfer = %16lx\n",
  427. frame->ei_addr);
  428. printk(" Fill Syndrome = %16lx\n",
  429. frame->fill_syndrome);
  430. printk(" EI_STAT reg = %16lx\n",
  431. frame->ei_stat);
  432. printk(" LD_LOCK = %16lx\n",
  433. frame->ld_lock);
  434. }
  435. static void
  436. mcpcia_print_system_area(unsigned long la_ptr)
  437. {
  438. struct el_common *frame;
  439. struct pci_controller *hose;
  440. struct IOD_subpacket {
  441. unsigned long base;
  442. unsigned int whoami;
  443. unsigned int rsvd1;
  444. unsigned int pci_rev;
  445. unsigned int cap_ctrl;
  446. unsigned int hae_mem;
  447. unsigned int hae_io;
  448. unsigned int int_ctl;
  449. unsigned int int_reg;
  450. unsigned int int_mask0;
  451. unsigned int int_mask1;
  452. unsigned int mc_err0;
  453. unsigned int mc_err1;
  454. unsigned int cap_err;
  455. unsigned int rsvd2;
  456. unsigned int pci_err1;
  457. unsigned int mdpa_stat;
  458. unsigned int mdpa_syn;
  459. unsigned int mdpb_stat;
  460. unsigned int mdpb_syn;
  461. unsigned int rsvd3;
  462. unsigned int rsvd4;
  463. unsigned int rsvd5;
  464. } *iodpp;
  465. frame = (struct el_common *)la_ptr;
  466. iodpp = (struct IOD_subpacket *) (la_ptr + frame->sys_offset);
  467. for (hose = hose_head; hose; hose = hose->next, iodpp++) {
  468. printk("IOD %d Register Subpacket - Bridge Base Address %16lx\n",
  469. hose->index, iodpp->base);
  470. printk(" WHOAMI = %8x\n", iodpp->whoami);
  471. printk(" PCI_REV = %8x\n", iodpp->pci_rev);
  472. printk(" CAP_CTRL = %8x\n", iodpp->cap_ctrl);
  473. printk(" HAE_MEM = %8x\n", iodpp->hae_mem);
  474. printk(" HAE_IO = %8x\n", iodpp->hae_io);
  475. printk(" INT_CTL = %8x\n", iodpp->int_ctl);
  476. printk(" INT_REG = %8x\n", iodpp->int_reg);
  477. printk(" INT_MASK0 = %8x\n", iodpp->int_mask0);
  478. printk(" INT_MASK1 = %8x\n", iodpp->int_mask1);
  479. printk(" MC_ERR0 = %8x\n", iodpp->mc_err0);
  480. printk(" MC_ERR1 = %8x\n", iodpp->mc_err1);
  481. printk(" CAP_ERR = %8x\n", iodpp->cap_err);
  482. printk(" PCI_ERR1 = %8x\n", iodpp->pci_err1);
  483. printk(" MDPA_STAT = %8x\n", iodpp->mdpa_stat);
  484. printk(" MDPA_SYN = %8x\n", iodpp->mdpa_syn);
  485. printk(" MDPB_STAT = %8x\n", iodpp->mdpb_stat);
  486. printk(" MDPB_SYN = %8x\n", iodpp->mdpb_syn);
  487. }
  488. }
  489. void
  490. mcpcia_machine_check(unsigned long vector, unsigned long la_ptr)
  491. {
  492. struct el_MCPCIA_uncorrected_frame_mcheck *mchk_logout;
  493. unsigned int cpu = smp_processor_id();
  494. int expected;
  495. mchk_logout = (struct el_MCPCIA_uncorrected_frame_mcheck *)la_ptr;
  496. expected = mcheck_expected(cpu);
  497. mb();
  498. mb(); /* magic */
  499. draina();
  500. switch (expected) {
  501. case 0:
  502. {
  503. /* FIXME: how do we figure out which hose the
  504. error was on? */
  505. struct pci_controller *hose;
  506. for (hose = hose_head; hose; hose = hose->next)
  507. mcpcia_pci_clr_err(MCPCIA_HOSE2MID(hose->index));
  508. break;
  509. }
  510. case 1:
  511. mcpcia_pci_clr_err(mcheck_extra(cpu));
  512. break;
  513. default:
  514. /* Otherwise, we're being called from mcpcia_probe_hose
  515. and there's no hose clear an error from. */
  516. break;
  517. }
  518. wrmces(0x7);
  519. mb();
  520. process_mcheck_info(vector, la_ptr, "MCPCIA", expected != 0);
  521. if (!expected && vector != 0x620 && vector != 0x630) {
  522. mcpcia_print_uncorrectable(mchk_logout);
  523. mcpcia_print_system_area(la_ptr);
  524. }
  525. }