Lines Matching full:bridge

3  * Fake VME bridge support.
5 * This drive provides a fake VME bridge chip, this enables debugging of the
96 struct fake_driver *bridge; in fake_VIRQ_tasklet() local
99 bridge = fake_bridge->driver_priv; in fake_VIRQ_tasklet()
101 vme_irq_handler(fake_bridge, bridge->int_level, bridge->int_statid); in fake_VIRQ_tasklet()
130 struct fake_driver *bridge; in fake_irq_generate() local
132 bridge = fake_bridge->driver_priv; in fake_irq_generate()
134 mutex_lock(&bridge->vme_int); in fake_irq_generate()
136 bridge->int_level = level; in fake_irq_generate()
138 bridge->int_statid = statid; in fake_irq_generate()
144 tasklet_schedule(&bridge->int_tasklet); in fake_irq_generate()
146 mutex_unlock(&bridge->vme_int); in fake_irq_generate()
161 struct fake_driver *bridge; in fake_slave_set() local
164 bridge = fake_bridge->driver_priv; in fake_slave_set()
208 bridge->slaves[i].enabled = enabled; in fake_slave_set()
209 bridge->slaves[i].vme_base = vme_base; in fake_slave_set()
210 bridge->slaves[i].size = size; in fake_slave_set()
211 bridge->slaves[i].buf_base = fake_pci_to_ptr(buf_base); in fake_slave_set()
212 bridge->slaves[i].aspace = aspace; in fake_slave_set()
213 bridge->slaves[i].cycle = cycle; in fake_slave_set()
228 struct fake_driver *bridge; in fake_slave_get() local
230 bridge = image->parent->driver_priv; in fake_slave_get()
236 *enabled = bridge->slaves[i].enabled; in fake_slave_get()
237 *vme_base = bridge->slaves[i].vme_base; in fake_slave_get()
238 *size = bridge->slaves[i].size; in fake_slave_get()
239 *buf_base = fake_ptr_to_pci(bridge->slaves[i].buf_base); in fake_slave_get()
240 *aspace = bridge->slaves[i].aspace; in fake_slave_get()
241 *cycle = bridge->slaves[i].cycle; in fake_slave_get()
258 struct fake_driver *bridge; in fake_master_set() local
262 bridge = fake_bridge->driver_priv; in fake_master_set()
317 bridge->masters[i].enabled = enabled; in fake_master_set()
318 bridge->masters[i].vme_base = vme_base; in fake_master_set()
319 bridge->masters[i].size = size; in fake_master_set()
320 bridge->masters[i].aspace = aspace; in fake_master_set()
321 bridge->masters[i].cycle = cycle; in fake_master_set()
322 bridge->masters[i].dwidth = dwidth; in fake_master_set()
343 struct fake_driver *bridge; in __fake_master_get() local
345 bridge = image->parent->driver_priv; in __fake_master_get()
349 *enabled = bridge->masters[i].enabled; in __fake_master_get()
350 *vme_base = bridge->masters[i].vme_base; in __fake_master_get()
351 *size = bridge->masters[i].size; in __fake_master_get()
352 *aspace = bridge->masters[i].aspace; in __fake_master_get()
353 *cycle = bridge->masters[i].cycle; in __fake_master_get()
354 *dwidth = bridge->masters[i].dwidth; in __fake_master_get()
377 static void fake_lm_check(struct fake_driver *bridge, unsigned long long addr, in fake_lm_check() argument
388 fake_bridge = bridge->parent; in fake_lm_check()
395 if (bridge->lm_enabled == 0) in fake_lm_check()
398 lm_base = bridge->lm_base; in fake_lm_check()
399 lm_aspace = bridge->lm_aspace; in fake_lm_check()
400 lm_cycle = bridge->lm_cycle; in fake_lm_check()
408 if (bridge->lm_callback[i]) in fake_lm_check()
409 bridge->lm_callback[i]( in fake_lm_check()
410 bridge->lm_data[i]); in fake_lm_check()
417 static noinline_for_stack u8 fake_vmeread8(struct fake_driver *bridge, in fake_vmeread8() argument
427 start = bridge->slaves[i].vme_base; in fake_vmeread8()
428 end = bridge->slaves[i].vme_base + bridge->slaves[i].size; in fake_vmeread8()
430 if (aspace != bridge->slaves[i].aspace) in fake_vmeread8()
433 if (cycle != bridge->slaves[i].cycle) in fake_vmeread8()
437 offset = addr - bridge->slaves[i].vme_base; in fake_vmeread8()
438 loc = (u8 *)(bridge->slaves[i].buf_base + offset); in fake_vmeread8()
445 fake_lm_check(bridge, addr, aspace, cycle); in fake_vmeread8()
450 static noinline_for_stack u16 fake_vmeread16(struct fake_driver *bridge, in fake_vmeread16() argument
460 if (aspace != bridge->slaves[i].aspace) in fake_vmeread16()
463 if (cycle != bridge->slaves[i].cycle) in fake_vmeread16()
466 start = bridge->slaves[i].vme_base; in fake_vmeread16()
467 end = bridge->slaves[i].vme_base + bridge->slaves[i].size; in fake_vmeread16()
470 offset = addr - bridge->slaves[i].vme_base; in fake_vmeread16()
471 loc = (u16 *)(bridge->slaves[i].buf_base + offset); in fake_vmeread16()
478 fake_lm_check(bridge, addr, aspace, cycle); in fake_vmeread16()
483 static noinline_for_stack u32 fake_vmeread32(struct fake_driver *bridge, in fake_vmeread32() argument
493 if (aspace != bridge->slaves[i].aspace) in fake_vmeread32()
496 if (cycle != bridge->slaves[i].cycle) in fake_vmeread32()
499 start = bridge->slaves[i].vme_base; in fake_vmeread32()
500 end = bridge->slaves[i].vme_base + bridge->slaves[i].size; in fake_vmeread32()
503 offset = addr - bridge->slaves[i].vme_base; in fake_vmeread32()
504 loc = (u32 *)(bridge->slaves[i].buf_base + offset); in fake_vmeread32()
511 fake_lm_check(bridge, addr, aspace, cycle); in fake_vmeread32()
544 * On the other hand, the bridge itself assures that the maximum data in fake_master_read()
615 static noinline_for_stack void fake_vmewrite8(struct fake_driver *bridge, in fake_vmewrite8() argument
624 if (aspace != bridge->slaves[i].aspace) in fake_vmewrite8()
627 if (cycle != bridge->slaves[i].cycle) in fake_vmewrite8()
630 start = bridge->slaves[i].vme_base; in fake_vmewrite8()
631 end = bridge->slaves[i].vme_base + bridge->slaves[i].size; in fake_vmewrite8()
634 offset = addr - bridge->slaves[i].vme_base; in fake_vmewrite8()
635 loc = (u8 *)((void *)bridge->slaves[i].buf_base + offset); in fake_vmewrite8()
642 fake_lm_check(bridge, addr, aspace, cycle); in fake_vmewrite8()
646 static noinline_for_stack void fake_vmewrite16(struct fake_driver *bridge, in fake_vmewrite16() argument
655 if (aspace != bridge->slaves[i].aspace) in fake_vmewrite16()
658 if (cycle != bridge->slaves[i].cycle) in fake_vmewrite16()
661 start = bridge->slaves[i].vme_base; in fake_vmewrite16()
662 end = bridge->slaves[i].vme_base + bridge->slaves[i].size; in fake_vmewrite16()
665 offset = addr - bridge->slaves[i].vme_base; in fake_vmewrite16()
666 loc = (u16 *)((void *)bridge->slaves[i].buf_base + offset); in fake_vmewrite16()
673 fake_lm_check(bridge, addr, aspace, cycle); in fake_vmewrite16()
677 static noinline_for_stack void fake_vmewrite32(struct fake_driver *bridge, in fake_vmewrite32() argument
686 if (aspace != bridge->slaves[i].aspace) in fake_vmewrite32()
689 if (cycle != bridge->slaves[i].cycle) in fake_vmewrite32()
692 start = bridge->slaves[i].vme_base; in fake_vmewrite32()
693 end = bridge->slaves[i].vme_base + bridge->slaves[i].size; in fake_vmewrite32()
696 offset = addr - bridge->slaves[i].vme_base; in fake_vmewrite32()
697 loc = (u32 *)((void *)bridge->slaves[i].buf_base + offset); in fake_vmewrite32()
704 fake_lm_check(bridge, addr, aspace, cycle); in fake_vmewrite32()
719 struct fake_driver *bridge; in fake_master_write() local
723 bridge = fake_bridge->driver_priv; in fake_master_write()
727 addr = bridge->masters[i].vme_base + offset; in fake_master_write()
728 aspace = bridge->masters[i].aspace; in fake_master_write()
729 cycle = bridge->masters[i].cycle; in fake_master_write()
730 dwidth = bridge->masters[i].dwidth; in fake_master_write()
738 fake_vmewrite8(bridge, (u8 *)buf, addr, aspace, cycle); in fake_master_write()
747 fake_vmewrite8(bridge, (u8 *)(buf + done), in fake_master_write()
752 fake_vmewrite16(bridge, (u16 *)(buf + done), in fake_master_write()
762 fake_vmewrite32(bridge, (u32 *)(buf + done), in fake_master_write()
769 fake_vmewrite16(bridge, (u16 *)(buf + done), in fake_master_write()
776 fake_vmewrite8(bridge, (u8 *)(buf + done), addr + done, in fake_master_write()
785 fake_vmewrite16(bridge, (u16 *)(buf + done), in fake_master_write()
792 fake_vmewrite8(bridge, (u8 *)(buf + done), addr + done, aspace, in fake_master_write()
817 struct fake_driver *bridge; in fake_master_rmw() local
819 bridge = image->parent->driver_priv; in fake_master_rmw()
824 base = bridge->masters[i].vme_base; in fake_master_rmw()
825 aspace = bridge->masters[i].aspace; in fake_master_rmw()
826 cycle = bridge->masters[i].cycle; in fake_master_rmw()
832 tmp = fake_vmeread32(bridge, base + offset, aspace, cycle); in fake_master_rmw()
840 fake_vmewrite32(bridge, &tmp, base + offset, aspace, cycle); in fake_master_rmw()
861 struct fake_driver *bridge; in fake_lm_set() local
865 bridge = fake_bridge->driver_priv; in fake_lm_set()
871 if (bridge->lm_callback[i]) { in fake_lm_set()
890 bridge->lm_base = lm_base; in fake_lm_set()
891 bridge->lm_aspace = aspace; in fake_lm_set()
892 bridge->lm_cycle = cycle; in fake_lm_set()
905 struct fake_driver *bridge; in fake_lm_get() local
907 bridge = lm->parent->driver_priv; in fake_lm_get()
911 *lm_base = bridge->lm_base; in fake_lm_get()
912 *aspace = bridge->lm_aspace; in fake_lm_get()
913 *cycle = bridge->lm_cycle; in fake_lm_get()
917 return bridge->lm_enabled; in fake_lm_get()
929 struct fake_driver *bridge; in fake_lm_attach() local
933 bridge = fake_bridge->driver_priv; in fake_lm_attach()
938 if (bridge->lm_cycle == 0) { in fake_lm_attach()
945 if (bridge->lm_callback[monitor]) { in fake_lm_attach()
952 bridge->lm_callback[monitor] = callback; in fake_lm_attach()
953 bridge->lm_data[monitor] = data; in fake_lm_attach()
956 bridge->lm_enabled = 1; in fake_lm_attach()
970 struct fake_driver *bridge; in fake_lm_detach() local
972 bridge = lm->parent->driver_priv; in fake_lm_detach()
977 bridge->lm_callback[monitor] = NULL; in fake_lm_detach()
978 bridge->lm_data[monitor] = NULL; in fake_lm_detach()
983 if (bridge->lm_callback[i]) in fake_lm_detach()
988 bridge->lm_enabled = 0; in fake_lm_detach()
1037 struct fake_driver *bridge; in fake_crcsr_init() local
1039 bridge = fake_bridge->driver_priv; in fake_crcsr_init()
1042 bridge->crcsr_kernel = kzalloc(VME_CRCSR_BUF_SIZE, GFP_KERNEL); in fake_crcsr_init()
1043 bridge->crcsr_bus = fake_ptr_to_pci(bridge->crcsr_kernel); in fake_crcsr_init()
1044 if (!bridge->crcsr_kernel) in fake_crcsr_init()
1056 struct fake_driver *bridge; in fake_crcsr_exit() local
1058 bridge = fake_bridge->driver_priv; in fake_crcsr_exit()
1060 kfree(bridge->crcsr_kernel); in fake_crcsr_exit()
1077 /* If we want to support more than one bridge at some point, we need to in fake_init()
1250 struct fake_driver *bridge; in fake_exit() local
1254 bridge = fake_bridge->driver_priv; in fake_exit()
1262 bridge->masters[i].enabled = 0; in fake_exit()
1265 bridge->slaves[i].enabled = 0; in fake_exit()
1270 bridge->lm_enabled = 0; in fake_exit()
1301 MODULE_DESCRIPTION("Fake VME bridge driver");