diff options
| -rw-r--r-- | arch/tile/gxio/Kconfig | 6 | ||||
| -rw-r--r-- | arch/tile/gxio/Makefile | 1 | ||||
| -rw-r--r-- | arch/tile/gxio/iorpc_mpipe.c | 529 | ||||
| -rw-r--r-- | arch/tile/gxio/iorpc_mpipe_info.c | 85 | ||||
| -rw-r--r-- | arch/tile/gxio/mpipe.c | 545 | ||||
| -rw-r--r-- | arch/tile/include/arch/mpipe.h | 359 | ||||
| -rw-r--r-- | arch/tile/include/arch/mpipe_constants.h | 42 | ||||
| -rw-r--r-- | arch/tile/include/arch/mpipe_def.h | 39 | ||||
| -rw-r--r-- | arch/tile/include/arch/mpipe_shm.h | 509 | ||||
| -rw-r--r-- | arch/tile/include/arch/mpipe_shm_def.h | 23 | ||||
| -rw-r--r-- | arch/tile/include/gxio/iorpc_mpipe.h | 136 | ||||
| -rw-r--r-- | arch/tile/include/gxio/iorpc_mpipe_info.h | 46 | ||||
| -rw-r--r-- | arch/tile/include/gxio/mpipe.h | 1736 | ||||
| -rw-r--r-- | arch/tile/include/hv/drv_mpipe_intf.h | 602 |
14 files changed, 4658 insertions, 0 deletions
diff --git a/arch/tile/gxio/Kconfig b/arch/tile/gxio/Kconfig index ecd076c8cfd5..8aeebb70a3df 100644 --- a/arch/tile/gxio/Kconfig +++ b/arch/tile/gxio/Kconfig | |||
| @@ -9,3 +9,9 @@ config TILE_GXIO | |||
| 9 | config TILE_GXIO_DMA | 9 | config TILE_GXIO_DMA |
| 10 | bool | 10 | bool |
| 11 | select TILE_GXIO | 11 | select TILE_GXIO |
| 12 | |||
| 13 | # Support direct access to the TILE-Gx mPIPE hardware from kernel space. | ||
| 14 | config TILE_GXIO_MPIPE | ||
| 15 | bool | ||
| 16 | select TILE_GXIO | ||
| 17 | select TILE_GXIO_DMA | ||
diff --git a/arch/tile/gxio/Makefile b/arch/tile/gxio/Makefile index 97ab468fb8c5..130eec48c152 100644 --- a/arch/tile/gxio/Makefile +++ b/arch/tile/gxio/Makefile | |||
| @@ -4,3 +4,4 @@ | |||
| 4 | 4 | ||
| 5 | obj-$(CONFIG_TILE_GXIO) += iorpc_globals.o kiorpc.o | 5 | obj-$(CONFIG_TILE_GXIO) += iorpc_globals.o kiorpc.o |
| 6 | obj-$(CONFIG_TILE_GXIO_DMA) += dma_queue.o | 6 | obj-$(CONFIG_TILE_GXIO_DMA) += dma_queue.o |
| 7 | obj-$(CONFIG_TILE_GXIO_MPIPE) += mpipe.o iorpc_mpipe.o iorpc_mpipe_info.o | ||
diff --git a/arch/tile/gxio/iorpc_mpipe.c b/arch/tile/gxio/iorpc_mpipe.c new file mode 100644 index 000000000000..31b87bf8c027 --- /dev/null +++ b/arch/tile/gxio/iorpc_mpipe.c | |||
| @@ -0,0 +1,529 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2012 Tilera Corporation. All Rights Reserved. | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or | ||
| 5 | * modify it under the terms of the GNU General Public License | ||
| 6 | * as published by the Free Software Foundation, version 2. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, but | ||
| 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
| 11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
| 12 | * more details. | ||
| 13 | */ | ||
| 14 | |||
| 15 | /* This file is machine-generated; DO NOT EDIT! */ | ||
| 16 | #include "gxio/iorpc_mpipe.h" | ||
| 17 | |||
| 18 | struct alloc_buffer_stacks_param { | ||
| 19 | unsigned int count; | ||
| 20 | unsigned int first; | ||
| 21 | unsigned int flags; | ||
| 22 | }; | ||
| 23 | |||
| 24 | int gxio_mpipe_alloc_buffer_stacks(gxio_mpipe_context_t * context, | ||
| 25 | unsigned int count, unsigned int first, | ||
| 26 | unsigned int flags) | ||
| 27 | { | ||
| 28 | struct alloc_buffer_stacks_param temp; | ||
| 29 | struct alloc_buffer_stacks_param *params = &temp; | ||
| 30 | |||
| 31 | params->count = count; | ||
| 32 | params->first = first; | ||
| 33 | params->flags = flags; | ||
| 34 | |||
| 35 | return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params, | ||
| 36 | sizeof(*params), | ||
| 37 | GXIO_MPIPE_OP_ALLOC_BUFFER_STACKS); | ||
| 38 | } | ||
| 39 | |||
| 40 | EXPORT_SYMBOL(gxio_mpipe_alloc_buffer_stacks); | ||
| 41 | |||
| 42 | struct init_buffer_stack_aux_param { | ||
| 43 | union iorpc_mem_buffer buffer; | ||
| 44 | unsigned int stack; | ||
| 45 | unsigned int buffer_size_enum; | ||
| 46 | }; | ||
| 47 | |||
| 48 | int gxio_mpipe_init_buffer_stack_aux(gxio_mpipe_context_t * context, | ||
| 49 | void *mem_va, size_t mem_size, | ||
| 50 | unsigned int mem_flags, unsigned int stack, | ||
| 51 | unsigned int buffer_size_enum) | ||
| 52 | { | ||
| 53 | int __result; | ||
| 54 | unsigned long long __cpa; | ||
| 55 | pte_t __pte; | ||
| 56 | struct init_buffer_stack_aux_param temp; | ||
| 57 | struct init_buffer_stack_aux_param *params = &temp; | ||
| 58 | |||
| 59 | __result = va_to_cpa_and_pte(mem_va, &__cpa, &__pte); | ||
| 60 | if (__result != 0) | ||
| 61 | return __result; | ||
| 62 | params->buffer.kernel.cpa = __cpa; | ||
| 63 | params->buffer.kernel.size = mem_size; | ||
| 64 | params->buffer.kernel.pte = __pte; | ||
| 65 | params->buffer.kernel.flags = mem_flags; | ||
| 66 | params->stack = stack; | ||
| 67 | params->buffer_size_enum = buffer_size_enum; | ||
| 68 | |||
| 69 | return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params, | ||
| 70 | sizeof(*params), | ||
| 71 | GXIO_MPIPE_OP_INIT_BUFFER_STACK_AUX); | ||
| 72 | } | ||
| 73 | |||
| 74 | EXPORT_SYMBOL(gxio_mpipe_init_buffer_stack_aux); | ||
| 75 | |||
| 76 | |||
| 77 | struct alloc_notif_rings_param { | ||
| 78 | unsigned int count; | ||
| 79 | unsigned int first; | ||
| 80 | unsigned int flags; | ||
| 81 | }; | ||
| 82 | |||
| 83 | int gxio_mpipe_alloc_notif_rings(gxio_mpipe_context_t * context, | ||
| 84 | unsigned int count, unsigned int first, | ||
| 85 | unsigned int flags) | ||
| 86 | { | ||
| 87 | struct alloc_notif_rings_param temp; | ||
| 88 | struct alloc_notif_rings_param *params = &temp; | ||
| 89 | |||
| 90 | params->count = count; | ||
| 91 | params->first = first; | ||
| 92 | params->flags = flags; | ||
| 93 | |||
| 94 | return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params, | ||
| 95 | sizeof(*params), GXIO_MPIPE_OP_ALLOC_NOTIF_RINGS); | ||
| 96 | } | ||
| 97 | |||
| 98 | EXPORT_SYMBOL(gxio_mpipe_alloc_notif_rings); | ||
| 99 | |||
| 100 | struct init_notif_ring_aux_param { | ||
| 101 | union iorpc_mem_buffer buffer; | ||
| 102 | unsigned int ring; | ||
| 103 | }; | ||
| 104 | |||
| 105 | int gxio_mpipe_init_notif_ring_aux(gxio_mpipe_context_t * context, void *mem_va, | ||
| 106 | size_t mem_size, unsigned int mem_flags, | ||
| 107 | unsigned int ring) | ||
| 108 | { | ||
| 109 | int __result; | ||
| 110 | unsigned long long __cpa; | ||
| 111 | pte_t __pte; | ||
| 112 | struct init_notif_ring_aux_param temp; | ||
| 113 | struct init_notif_ring_aux_param *params = &temp; | ||
| 114 | |||
| 115 | __result = va_to_cpa_and_pte(mem_va, &__cpa, &__pte); | ||
| 116 | if (__result != 0) | ||
| 117 | return __result; | ||
| 118 | params->buffer.kernel.cpa = __cpa; | ||
| 119 | params->buffer.kernel.size = mem_size; | ||
| 120 | params->buffer.kernel.pte = __pte; | ||
| 121 | params->buffer.kernel.flags = mem_flags; | ||
| 122 | params->ring = ring; | ||
| 123 | |||
| 124 | return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params, | ||
| 125 | sizeof(*params), | ||
| 126 | GXIO_MPIPE_OP_INIT_NOTIF_RING_AUX); | ||
| 127 | } | ||
| 128 | |||
| 129 | EXPORT_SYMBOL(gxio_mpipe_init_notif_ring_aux); | ||
| 130 | |||
| 131 | struct request_notif_ring_interrupt_param { | ||
| 132 | union iorpc_interrupt interrupt; | ||
| 133 | unsigned int ring; | ||
| 134 | }; | ||
| 135 | |||
| 136 | int gxio_mpipe_request_notif_ring_interrupt(gxio_mpipe_context_t * context, | ||
| 137 | int inter_x, int inter_y, | ||
| 138 | int inter_ipi, int inter_event, | ||
| 139 | unsigned int ring) | ||
| 140 | { | ||
| 141 | struct request_notif_ring_interrupt_param temp; | ||
| 142 | struct request_notif_ring_interrupt_param *params = &temp; | ||
| 143 | |||
| 144 | params->interrupt.kernel.x = inter_x; | ||
| 145 | params->interrupt.kernel.y = inter_y; | ||
| 146 | params->interrupt.kernel.ipi = inter_ipi; | ||
| 147 | params->interrupt.kernel.event = inter_event; | ||
| 148 | params->ring = ring; | ||
| 149 | |||
| 150 | return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params, | ||
| 151 | sizeof(*params), | ||
| 152 | GXIO_MPIPE_OP_REQUEST_NOTIF_RING_INTERRUPT); | ||
| 153 | } | ||
| 154 | |||
| 155 | EXPORT_SYMBOL(gxio_mpipe_request_notif_ring_interrupt); | ||
| 156 | |||
| 157 | struct enable_notif_ring_interrupt_param { | ||
| 158 | unsigned int ring; | ||
| 159 | }; | ||
| 160 | |||
| < | |||
