arbiter.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. /*
  2. * Memory arbiter functions. Allocates bandwidth through the
  3. * arbiter and sets up arbiter breakpoints.
  4. *
  5. * The algorithm first assigns slots to the clients that has specified
  6. * bandwidth (e.g. ethernet) and then the remaining slots are divided
  7. * on all the active clients.
  8. *
  9. * Copyright (c) 2004-2007 Axis Communications AB.
  10. *
  11. * The artpec-3 has two arbiters. The memory hierarchy looks like this:
  12. *
  13. *
  14. * CPU DMAs
  15. * | |
  16. * | |
  17. * -------------- ------------------
  18. * | foo arbiter|----| Internal memory|
  19. * -------------- ------------------
  20. * |
  21. * --------------
  22. * | L2 cache |
  23. * --------------
  24. * |
  25. * h264 etc |
  26. * | |
  27. * | |
  28. * --------------
  29. * | bar arbiter|
  30. * --------------
  31. * |
  32. * ---------
  33. * | SDRAM |
  34. * ---------
  35. *
  36. */
  37. #include <hwregs/reg_map.h>
  38. #include <hwregs/reg_rdwr.h>
  39. #include <hwregs/marb_foo_defs.h>
  40. #include <hwregs/marb_bar_defs.h>
  41. #include <arbiter.h>
  42. #include <hwregs/intr_vect.h>
  43. #include <linux/interrupt.h>
  44. #include <linux/irq.h>
  45. #include <linux/signal.h>
  46. #include <linux/errno.h>
  47. #include <linux/spinlock.h>
  48. #include <asm/io.h>
  49. #include <asm/irq_regs.h>
  50. #define D(x)
  51. struct crisv32_watch_entry {
  52. unsigned long instance;
  53. watch_callback *cb;
  54. unsigned long start;
  55. unsigned long end;
  56. int used;
  57. };
  58. #define NUMBER_OF_BP 4
  59. #define SDRAM_BANDWIDTH 400000000
  60. #define INTMEM_BANDWIDTH 400000000
  61. #define NBR_OF_SLOTS 64
  62. #define NBR_OF_REGIONS 2
  63. #define NBR_OF_CLIENTS 15
  64. #define ARBITERS 2
  65. #define UNASSIGNED 100
  66. struct arbiter {
  67. unsigned long instance;
  68. int nbr_regions;
  69. int nbr_clients;
  70. int requested_slots[NBR_OF_REGIONS][NBR_OF_CLIENTS];
  71. int active_clients[NBR_OF_REGIONS][NBR_OF_CLIENTS];
  72. };
  73. static struct crisv32_watch_entry watches[ARBITERS][NUMBER_OF_BP] =
  74. {
  75. {
  76. {regi_marb_foo_bp0},
  77. {regi_marb_foo_bp1},
  78. {regi_marb_foo_bp2},
  79. {regi_marb_foo_bp3}
  80. },
  81. {
  82. {regi_marb_bar_bp0},
  83. {regi_marb_bar_bp1},
  84. {regi_marb_bar_bp2},
  85. {regi_marb_bar_bp3}
  86. }
  87. };
  88. struct arbiter arbiters[ARBITERS] =
  89. {
  90. { /* L2 cache arbiter */
  91. .instance = regi_marb_foo,
  92. .nbr_regions = 2,
  93. .nbr_clients = 15
  94. },
  95. { /* DDR2 arbiter */
  96. .instance = regi_marb_bar,
  97. .nbr_regions = 1,
  98. .nbr_clients = 9
  99. }
  100. };
  101. static int max_bandwidth[NBR_OF_REGIONS] = {SDRAM_BANDWIDTH, INTMEM_BANDWIDTH};
  102. DEFINE_SPINLOCK(arbiter_lock);
  103. static irqreturn_t
  104. crisv32_foo_arbiter_irq(int irq, void *dev_id);
  105. static irqreturn_t
  106. crisv32_bar_arbiter_irq(int irq, void *dev_id);
  107. /*
  108. * "I'm the arbiter, I know the score.
  109. * From square one I'll be watching all 64."
  110. * (memory arbiter slots, that is)
  111. *
  112. * Or in other words:
  113. * Program the memory arbiter slots for "region" according to what's
  114. * in requested_slots[] and active_clients[], while minimizing
  115. * latency. A caller may pass a non-zero positive amount for
  116. * "unused_slots", which must then be the unallocated, remaining
  117. * number of slots, free to hand out to any client.
  118. */
  119. static void crisv32_arbiter_config(int arbiter, int region, int unused_slots)
  120. {
  121. int slot;
  122. int client;
  123. int interval = 0;
  124. /*
  125. * This vector corresponds to the hardware arbiter slots (see
  126. * the hardware documentation for semantics). We initialize
  127. * each slot with a suitable sentinel value outside the valid
  128. * range {0 .. NBR_OF_CLIENTS - 1} and replace them with
  129. * client indexes. Then it's fed to the hardware.
  130. */
  131. s8 val[NBR_OF_SLOTS];
  132. for (slot = 0; slot < NBR_OF_SLOTS; slot++)
  133. val[slot] = -1;
  134. for (client = 0; client < arbiters[arbiter].nbr_clients; client++) {
  135. int pos;
  136. /* Allocate the requested non-zero number of slots, but
  137. * also give clients with zero-requests one slot each
  138. * while stocks last. We do the latter here, in client
  139. * order. This makes sure zero-request clients are the
  140. * first to get to any spare slots, else those slots
  141. * could, when bandwidth is allocated close to the limit,
  142. * all be allocated to low-index non-zero-request clients
  143. * in the default-fill loop below. Another positive but
  144. * secondary effect is a somewhat better spread of the
  145. * zero-bandwidth clients in the vector, avoiding some of
  146. * the latency that could otherwise be caused by the
  147. * partitioning of non-zero-bandwidth clients at low
  148. * indexes and zero-bandwidth clients at high
  149. * indexes. (Note that this spreading can only affect the
  150. * unallocated bandwidth.) All the above only matters for
  151. * memory-intensive situations, of course.
  152. */
  153. if (!arbiters[arbiter].requested_slots[region][client]) {
  154. /*
  155. * Skip inactive clients. Also skip zero-slot
  156. * allocations in this pass when there are no known
  157. * free slots.
  158. */
  159. if (!arbiters[arbiter].active_clients[region][client] ||
  160. unused_slots <= 0)
  161. continue;
  162. unused_slots--;
  163. /* Only allocate one slot for this client. */
  164. interval = NBR_OF_SLOTS;
  165. } else
  166. interval = NBR_OF_SLOTS /
  167. arbiters[arbiter].requested_slots[region][client];
  168. pos = 0;
  169. while (pos < NBR_OF_SLOTS) {
  170. if (val[pos] >= 0)
  171. pos++;
  172. else {
  173. val[pos] = client;
  174. pos += interval;
  175. }
  176. }
  177. }
  178. client = 0;
  179. for (slot = 0; slot < NBR_OF_SLOTS; slot++) {
  180. /*
  181. * Allocate remaining slots in round-robin
  182. * client-number order for active clients. For this
  183. * pass, we ignore requested bandwidth and previous
  184. * allocations.
  185. */
  186. if (val[slot] < 0) {
  187. int first = client;
  188. while (!arbiters[arbiter].active_clients[region][client]) {
  189. client = (client + 1) %
  190. arbiters[arbiter].nbr_clients;
  191. if (client == first)
  192. break;
  193. }
  194. val[slot] = client;
  195. client = (client + 1) % arbiters[arbiter].nbr_clients;
  196. }
  197. if (arbiter == 0) {
  198. if (region == EXT_REGION)
  199. REG_WR_INT_VECT(marb_foo, regi_marb_foo,
  200. rw_l2_slots, slot, val[slot]);
  201. else if (region == INT_REGION)
  202. REG_WR_INT_VECT(marb_foo, regi_marb_foo,
  203. rw_intm_slots, slot, val[slot]);
  204. } else {
  205. REG_WR_INT_VECT(marb_bar, regi_marb_bar,
  206. rw_ddr2_slots, slot, val[slot]);
  207. }
  208. }
  209. }
  210. extern char _stext, _etext;
  211. static void crisv32_arbiter_init(void)
  212. {
  213. static int initialized;
  214. if (initialized)
  215. return;
  216. initialized = 1;
  217. /*
  218. * CPU caches are always set to active, but with zero
  219. * bandwidth allocated. It should be ok to allocate zero
  220. * bandwidth for the caches, because DMA for other channels
  221. * will supposedly finish, once their programmed amount is
  222. * done, and then the caches will get access according to the
  223. * "fixed scheme" for unclaimed slots. Though, if for some
  224. * use-case somewhere, there's a maximum CPU latency for
  225. * e.g. some interrupt, we have to start allocating specific
  226. * bandwidth for the CPU caches too.
  227. */
  228. arbiters[0].active_clients[EXT_REGION][11] = 1;
  229. arbiters[0].active_clients[EXT_REGION][12] = 1;
  230. crisv32_arbiter_config(0, EXT_REGION, 0);
  231. crisv32_arbiter_config(0, INT_REGION, 0);
  232. crisv32_arbiter_config(1, EXT_REGION, 0);
  233. if (request_irq(MEMARB_FOO_INTR_VECT, crisv32_foo_arbiter_irq,
  234. 0, "arbiter", NULL))
  235. printk(KERN_ERR "Couldn't allocate arbiter IRQ\n");
  236. if (request_irq(MEMARB_BAR_INTR_VECT, crisv32_bar_arbiter_irq,
  237. 0, "arbiter", NULL))
  238. printk(KERN_ERR "Couldn't allocate arbiter IRQ\n");
  239. #ifndef CONFIG_ETRAX_KGDB
  240. /* Global watch for writes to kernel text segment. */
  241. crisv32_arbiter_watch(virt_to_phys(&_stext), &_etext - &_stext,
  242. MARB_CLIENTS(arbiter_all_clients, arbiter_bar_all_clients),
  243. arbiter_all_write, NULL);
  244. #endif
  245. /* Set up max burst sizes by default */
  246. REG_WR_INT(marb_bar, regi_marb_bar, rw_h264_rd_burst, 3);
  247. REG_WR_INT(marb_bar, regi_marb_bar, rw_h264_wr_burst, 3);
  248. REG_WR_INT(marb_bar, regi_marb_bar, rw_ccd_burst, 3);
  249. REG_WR_INT(marb_bar, regi_marb_bar, rw_vin_wr_burst, 3);
  250. REG_WR_INT(marb_bar, regi_marb_bar, rw_vin_rd_burst, 3);
  251. REG_WR_INT(marb_bar, regi_marb_bar, rw_sclr_rd_burst, 3);
  252. REG_WR_INT(marb_bar, regi_marb_bar, rw_vout_burst, 3);
  253. REG_WR_INT(marb_bar, regi_marb_bar, rw_sclr_fifo_burst, 3);
  254. REG_WR_INT(marb_bar, regi_marb_bar, rw_l2cache_burst, 3);
  255. }
  256. int crisv32_arbiter_allocate_bandwidth(int client, int region,
  257. unsigned long bandwidth)
  258. {
  259. int i;
  260. int total_assigned = 0;
  261. int total_clients = 0;
  262. int req;
  263. int arbiter = 0;
  264. crisv32_arbiter_init();
  265. if (client & 0xffff0000) {
  266. arbiter = 1;
  267. client >>= 16;
  268. }
  269. for (i = 0; i < arbiters[arbiter].nbr_clients; i++) {
  270. total_assigned += arbiters[arbiter].requested_slots[region][i];
  271. total_clients += arbiters[arbiter].active_clients[region][i];
  272. }
  273. /* Avoid division by 0 for 0-bandwidth requests. */
  274. req = bandwidth == 0
  275. ? 0 : NBR_OF_SLOTS / (max_bandwidth[region] / bandwidth);
  276. /*
  277. * We make sure that there are enough slots only for non-zero
  278. * requests. Requesting 0 bandwidth *may* allocate slots,
  279. * though if all bandwidth is allocated, such a client won't
  280. * get any and will have to rely on getting memory access
  281. * according to the fixed scheme that's the default when one
  282. * of the slot-allocated clients doesn't claim their slot.
  283. */
  284. if (total_assigned + req > NBR_OF_SLOTS)
  285. return -ENOMEM;
  286. arbiters[arbiter].active_clients[region][client] = 1;
  287. arbiters[arbiter].requested_slots[region][client] = req;
  288. crisv32_arbiter_config(arbiter, region, NBR_OF_SLOTS - total_assigned);
  289. /* Propagate allocation from foo to bar */
  290. if (arbiter == 0)
  291. crisv32_arbiter_allocate_bandwidth(8 << 16,
  292. EXT_REGION, bandwidth);
  293. return 0;
  294. }
  295. /*
  296. * Main entry for bandwidth deallocation.
  297. *
  298. * Strictly speaking, for a somewhat constant set of clients where
  299. * each client gets a constant bandwidth and is just enabled or
  300. * disabled (somewhat dynamically), no action is necessary here to
  301. * avoid starvation for non-zero-allocation clients, as the allocated
  302. * slots will just be unused. However, handing out those unused slots
  303. * to active clients avoids needless latency if the "fixed scheme"
  304. * would give unclaimed slots to an eager low-index client.
  305. */
  306. void crisv32_arbiter_deallocate_bandwidth(int client, int region)
  307. {
  308. int i;
  309. int total_assigned = 0;
  310. int arbiter = 0;
  311. if (client & 0xffff0000)
  312. arbiter = 1;
  313. arbiters[arbiter].requested_slots[region][client] = 0;
  314. arbiters[arbiter].active_clients[region][client] = 0;
  315. for (i = 0; i < arbiters[arbiter].nbr_clients; i++)
  316. total_assigned += arbiters[arbiter].requested_slots[region][i];
  317. crisv32_arbiter_config(arbiter, region, NBR_OF_SLOTS - total_assigned);
  318. }
  319. int crisv32_arbiter_watch(unsigned long start, unsigned long size,
  320. unsigned long clients, unsigned long accesses,
  321. watch_callback *cb)
  322. {
  323. int i;
  324. int arbiter;
  325. int used[2];
  326. int ret = 0;
  327. crisv32_arbiter_init();
  328. if (start > 0x80000000) {
  329. printk(KERN_ERR "Arbiter: %lX doesn't look like a "
  330. "physical address", start);
  331. return -EFAULT;
  332. }
  333. spin_lock(&arbiter_lock);
  334. if (clients & 0xffff)
  335. used[0] = 1;
  336. if (clients & 0xffff0000)
  337. used[1] = 1;
  338. for (arbiter = 0; arbiter < ARBITERS; arbiter++) {
  339. if (!used[arbiter])
  340. continue;
  341. for (i = 0; i < NUMBER_OF_BP; i++) {
  342. if (!watches[arbiter][i].used) {
  343. unsigned intr_mask;
  344. if (arbiter)
  345. intr_mask = REG_RD_INT(marb_bar,
  346. regi_marb_bar, rw_intr_mask);
  347. else
  348. intr_mask = REG_RD_INT(marb_foo,
  349. regi_marb_foo, rw_intr_mask);
  350. watches[arbiter][i].used = 1;
  351. watches[arbiter][i].start = start;
  352. watches[arbiter][i].end = start + size;
  353. watches[arbiter][i].cb = cb;
  354. ret |= (i + 1) << (arbiter + 8);
  355. if (arbiter) {
  356. REG_WR_INT(marb_bar_bp,
  357. watches[arbiter][i].instance,
  358. rw_first_addr,
  359. watches[arbiter][i].start);
  360. REG_WR_INT(marb_bar_bp,
  361. watches[arbiter][i].instance,
  362. rw_last_addr,
  363. watches[arbiter][i].end);
  364. REG_WR_INT(marb_bar_bp,
  365. watches[arbiter][i].instance,
  366. rw_op, accesses);
  367. REG_WR_INT(marb_bar_bp,
  368. watches[arbiter][i].instance,
  369. rw_clients,
  370. clients & 0xffff);
  371. } else {
  372. REG_WR_INT(marb_foo_bp,
  373. watches[arbiter][i].instance,
  374. rw_first_addr,
  375. watches[arbiter][i].start);
  376. REG_WR_INT(marb_foo_bp,
  377. watches[arbiter][i].instance,
  378. rw_last_addr,
  379. watches[arbiter][i].end);
  380. REG_WR_INT(marb_foo_bp,
  381. watches[arbiter][i].instance,
  382. rw_op, accesses);
  383. REG_WR_INT(marb_foo_bp,
  384. watches[arbiter][i].instance,
  385. rw_clients, clients >> 16);
  386. }
  387. if (i == 0)
  388. intr_mask |= 1;
  389. else if (i == 1)
  390. intr_mask |= 2;
  391. else if (i == 2)
  392. intr_mask |= 4;
  393. else if (i == 3)
  394. intr_mask |= 8;
  395. if (arbiter)
  396. REG_WR_INT(marb_bar, regi_marb_bar,
  397. rw_intr_mask, intr_mask);
  398. else
  399. REG_WR_INT(marb_foo, regi_marb_foo,
  400. rw_intr_mask, intr_mask);
  401. spin_unlock(&arbiter_lock);
  402. break;
  403. }
  404. }
  405. }
  406. spin_unlock(&arbiter_lock);
  407. if (ret)
  408. return ret;
  409. else
  410. return -ENOMEM;
  411. }
  412. int crisv32_arbiter_unwatch(int id)
  413. {
  414. int arbiter;
  415. int intr_mask;
  416. crisv32_arbiter_init();
  417. spin_lock(&arbiter_lock);
  418. for (arbiter = 0; arbiter < ARBITERS; arbiter++) {
  419. int id2;
  420. if (arbiter)
  421. intr_mask = REG_RD_INT(marb_bar, regi_marb_bar,
  422. rw_intr_mask);
  423. else
  424. intr_mask = REG_RD_INT(marb_foo, regi_marb_foo,
  425. rw_intr_mask);
  426. id2 = (id & (0xff << (arbiter + 8))) >> (arbiter + 8);
  427. if (id2 == 0)
  428. continue;
  429. id2--;
  430. if ((id2 >= NUMBER_OF_BP) || (!watches[arbiter][id2].used)) {
  431. spin_unlock(&arbiter_lock);
  432. return -EINVAL;
  433. }
  434. memset(&watches[arbiter][id2], 0,
  435. sizeof(struct crisv32_watch_entry));
  436. if (id2 == 0)
  437. intr_mask &= ~1;
  438. else if (id2 == 1)
  439. intr_mask &= ~2;
  440. else if (id2 == 2)
  441. intr_mask &= ~4;
  442. else if (id2 == 3)
  443. intr_mask &= ~8;
  444. if (arbiter)
  445. REG_WR_INT(marb_bar, regi_marb_bar, rw_intr_mask,
  446. intr_mask);
  447. else
  448. REG_WR_INT(marb_foo, regi_marb_foo, rw_intr_mask,
  449. intr_mask);
  450. }
  451. spin_unlock(&arbiter_lock);
  452. return 0;
  453. }
  454. extern void show_registers(struct pt_regs *regs);
  455. static irqreturn_t
  456. crisv32_foo_arbiter_irq(int irq, void *dev_id)
  457. {
  458. reg_marb_foo_r_masked_intr masked_intr =
  459. REG_RD(marb_foo, regi_marb_foo, r_masked_intr);
  460. reg_marb_foo_bp_r_brk_clients r_clients;
  461. reg_marb_foo_bp_r_brk_addr r_addr;
  462. reg_marb_foo_bp_r_brk_op r_op;
  463. reg_marb_foo_bp_r_brk_first_client r_first;
  464. reg_marb_foo_bp_r_brk_size r_size;
  465. reg_marb_foo_bp_rw_ack ack = {0};
  466. reg_marb_foo_rw_ack_intr ack_intr = {
  467. .bp0 = 1, .bp1 = 1, .bp2 = 1, .bp3 = 1
  468. };
  469. struct crisv32_watch_entry *watch;
  470. unsigned arbiter = (unsigned)dev_id;
  471. masked_intr = REG_RD(marb_foo, regi_marb_foo, r_masked_intr);
  472. if (masked_intr.bp0)
  473. watch = &watches[arbiter][0];
  474. else if (masked_intr.bp1)
  475. watch = &watches[arbiter][1];
  476. else if (masked_intr.bp2)
  477. watch = &watches[arbiter][2];
  478. else if (masked_intr.bp3)
  479. watch = &watches[arbiter][3];
  480. else
  481. return IRQ_NONE;
  482. /* Retrieve all useful information and print it. */
  483. r_clients = REG_RD(marb_foo_bp, watch->instance, r_brk_clients);
  484. r_addr = REG_RD(marb_foo_bp, watch->instance, r_brk_addr);
  485. r_op = REG_RD(marb_foo_bp, watch->instance, r_brk_op);
  486. r_first = REG_RD(marb_foo_bp, watch->instance, r_brk_first_client);
  487. r_size = REG_RD(marb_foo_bp, watch->instance, r_brk_size);
  488. printk(KERN_DEBUG "Arbiter IRQ\n");
  489. printk(KERN_DEBUG "Clients %X addr %X op %X first %X size %X\n",
  490. REG_TYPE_CONV(int, reg_marb_foo_bp_r_brk_clients, r_clients),
  491. REG_TYPE_CONV(int, reg_marb_foo_bp_r_brk_addr, r_addr),
  492. REG_TYPE_CONV(int, reg_marb_foo_bp_r_brk_op, r_op),
  493. REG_TYPE_CONV(int, reg_marb_foo_bp_r_brk_first_client, r_first),
  494. REG_TYPE_CONV(int, reg_marb_foo_bp_r_brk_size, r_size));
  495. REG_WR(marb_foo_bp, watch->instance, rw_ack, ack);
  496. REG_WR(marb_foo, regi_marb_foo, rw_ack_intr, ack_intr);
  497. printk(KERN_DEBUG "IRQ occurred at %X\n", (unsigned)get_irq_regs());
  498. if (watch->cb)
  499. watch->cb();
  500. return IRQ_HANDLED;
  501. }
  502. static irqreturn_t
  503. crisv32_bar_arbiter_irq(int irq, void *dev_id)
  504. {
  505. reg_marb_bar_r_masked_intr masked_intr =
  506. REG_RD(marb_bar, regi_marb_bar, r_masked_intr);
  507. reg_marb_bar_bp_r_brk_clients r_clients;
  508. reg_marb_bar_bp_r_brk_addr r_addr;
  509. reg_marb_bar_bp_r_brk_op r_op;
  510. reg_marb_bar_bp_r_brk_first_client r_first;
  511. reg_marb_bar_bp_r_brk_size r_size;
  512. reg_marb_bar_bp_rw_ack ack = {0};
  513. reg_marb_bar_rw_ack_intr ack_intr = {
  514. .bp0 = 1, .bp1 = 1, .bp2 = 1, .bp3 = 1
  515. };
  516. struct crisv32_watch_entry *watch;
  517. unsigned arbiter = (unsigned)dev_id;
  518. masked_intr = REG_RD(marb_bar, regi_marb_bar, r_masked_intr);
  519. if (masked_intr.bp0)
  520. watch = &watches[arbiter][0];
  521. else if (masked_intr.bp1)
  522. watch = &watches[arbiter][1];
  523. else if (masked_intr.bp2)
  524. watch = &watches[arbiter][2];
  525. else if (masked_intr.bp3)
  526. watch = &watches[arbiter][3];
  527. else
  528. return IRQ_NONE;
  529. /* Retrieve all useful information and print it. */
  530. r_clients = REG_RD(marb_bar_bp, watch->instance, r_brk_clients);
  531. r_addr = REG_RD(marb_bar_bp, watch->instance, r_brk_addr);
  532. r_op = REG_RD(marb_bar_bp, watch->instance, r_brk_op);
  533. r_first = REG_RD(marb_bar_bp, watch->instance, r_brk_first_client);
  534. r_size = REG_RD(marb_bar_bp, watch->instance, r_brk_size);
  535. printk(KERN_DEBUG "Arbiter IRQ\n");
  536. printk(KERN_DEBUG "Clients %X addr %X op %X first %X size %X\n",
  537. REG_TYPE_CONV(int, reg_marb_bar_bp_r_brk_clients, r_clients),
  538. REG_TYPE_CONV(int, reg_marb_bar_bp_r_brk_addr, r_addr),
  539. REG_TYPE_CONV(int, reg_marb_bar_bp_r_brk_op, r_op),
  540. REG_TYPE_CONV(int, reg_marb_bar_bp_r_brk_first_client, r_first),
  541. REG_TYPE_CONV(int, reg_marb_bar_bp_r_brk_size, r_size));
  542. REG_WR(marb_bar_bp, watch->instance, rw_ack, ack);
  543. REG_WR(marb_bar, regi_marb_bar, rw_ack_intr, ack_intr);
  544. printk(KERN_DEBUG "IRQ occurred at %X\n", (unsigned)get_irq_regs()->erp);
  545. if (watch->cb)
  546. watch->cb();
  547. return IRQ_HANDLED;
  548. }