Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #ifndef __RMT_STORAGE_SERVER_H |
| 15 | #define __RMT_STORAGE_SERVER_H |
| 16 | |
| 17 | #include <linux/types.h> |
| 18 | #include <linux/ioctl.h> |
| 19 | |
| 20 | #define RMT_STORAGE_OPEN 0 |
| 21 | #define RMT_STORAGE_WRITE 1 |
| 22 | #define RMT_STORAGE_CLOSE 2 |
| 23 | #define RMT_STORAGE_SEND_USER_DATA 3 |
| 24 | #define RMT_STORAGE_READ 4 |
| 25 | #define RMT_STORAGE_NOOP 255 |
| 26 | |
| 27 | #define RMT_STORAGE_MAX_IOVEC_XFR_CNT 5 |
| 28 | #define MAX_NUM_CLIENTS 10 |
| 29 | #define MAX_RAMFS_TBL_ENTRIES 3 |
| 30 | #define RAMFS_BLOCK_SIZE 512 |
| 31 | |
| 32 | |
| 33 | enum { |
| 34 | RMT_STORAGE_NO_ERROR = 0, /* Success */ |
| 35 | RMT_STORAGE_ERROR_PARAM, /* Invalid parameters */ |
| 36 | RMT_STORAGE_ERROR_PIPE, /* RPC pipe failure */ |
| 37 | RMT_STORAGE_ERROR_UNINIT, /* Server is not initalized */ |
| 38 | RMT_STORAGE_ERROR_BUSY, /* Device busy */ |
| 39 | RMT_STORAGE_ERROR_DEVICE /* Remote storage device */ |
| 40 | } rmt_storage_status; |
| 41 | |
| 42 | struct rmt_storage_iovec_desc { |
| 43 | uint32_t sector_addr; |
| 44 | uint32_t data_phy_addr; |
| 45 | uint32_t num_sector; |
| 46 | }; |
| 47 | |
| 48 | #define MAX_PATH_NAME 32 |
| 49 | struct rmt_storage_event { |
| 50 | uint32_t id; /* Event ID */ |
| 51 | uint32_t sid; /* Storage ID */ |
| 52 | uint32_t handle; /* Client handle */ |
| 53 | char path[MAX_PATH_NAME]; |
| 54 | struct rmt_storage_iovec_desc xfer_desc[RMT_STORAGE_MAX_IOVEC_XFR_CNT]; |
| 55 | uint32_t xfer_cnt; |
| 56 | uint32_t usr_data; |
| 57 | }; |
| 58 | |
| 59 | struct rmt_storage_send_sts { |
| 60 | uint32_t err_code; |
| 61 | uint32_t data; |
| 62 | uint32_t handle; |
| 63 | uint32_t xfer_dir; |
| 64 | }; |
| 65 | |
| 66 | struct rmt_shrd_mem_param { |
| 67 | uint32_t sid; /* Storage ID */ |
| 68 | uint32_t start; /* Physical memory address */ |
| 69 | uint32_t size; /* Physical memory size */ |
| 70 | void *base; /* Virtual user-space memory address */ |
| 71 | }; |
| 72 | |
| 73 | #define RMT_STORAGE_IOCTL_MAGIC (0xC2) |
| 74 | |
| 75 | #define RMT_STORAGE_SHRD_MEM_PARAM \ |
| 76 | _IOWR(RMT_STORAGE_IOCTL_MAGIC, 0, struct rmt_shrd_mem_param) |
| 77 | |
| 78 | #define RMT_STORAGE_WAIT_FOR_REQ \ |
| 79 | _IOR(RMT_STORAGE_IOCTL_MAGIC, 1, struct rmt_storage_event) |
| 80 | |
| 81 | #define RMT_STORAGE_SEND_STATUS \ |
| 82 | _IOW(RMT_STORAGE_IOCTL_MAGIC, 2, struct rmt_storage_send_sts) |
| 83 | #endif |