![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 */ 0002 /* 0003 * Copyright (C) 2021 Intel Corporation 0004 * Author: johannes@sipsolutions.net 0005 */ 0006 #ifndef __LOGIC_IOMEM_H 0007 #define __LOGIC_IOMEM_H 0008 #include <linux/types.h> 0009 #include <linux/ioport.h> 0010 0011 /** 0012 * struct logic_iomem_ops - emulated IO memory ops 0013 * @read: read an 8, 16, 32 or 64 bit quantity from the given offset, 0014 * size is given in bytes (1, 2, 4 or 8) 0015 * (64-bit only necessary if CONFIG_64BIT is set) 0016 * @write: write an 8, 16 32 or 64 bit quantity to the given offset, 0017 * size is given in bytes (1, 2, 4 or 8) 0018 * (64-bit only necessary if CONFIG_64BIT is set) 0019 * @set: optional, for memset_io() 0020 * @copy_from: optional, for memcpy_fromio() 0021 * @copy_to: optional, for memcpy_toio() 0022 * @unmap: optional, this region is getting unmapped 0023 */ 0024 struct logic_iomem_ops { 0025 unsigned long (*read)(void *priv, unsigned int offset, int size); 0026 void (*write)(void *priv, unsigned int offset, int size, 0027 unsigned long val); 0028 0029 void (*set)(void *priv, unsigned int offset, u8 value, int size); 0030 void (*copy_from)(void *priv, void *buffer, unsigned int offset, 0031 int size); 0032 void (*copy_to)(void *priv, unsigned int offset, const void *buffer, 0033 int size); 0034 0035 void (*unmap)(void *priv); 0036 }; 0037 0038 /** 0039 * struct logic_iomem_region_ops - ops for an IO memory handler 0040 * @map: map a range in the registered IO memory region, must 0041 * fill *ops with the ops and may fill *priv to be passed 0042 * to the ops. The offset is given as the offset into the 0043 * registered resource region. 0044 * The return value is negative for errors, or >= 0 for 0045 * success. On success, the return value is added to the 0046 * offset for later ops, to allow for partial mappings. 0047 */ 0048 struct logic_iomem_region_ops { 0049 long (*map)(unsigned long offset, size_t size, 0050 const struct logic_iomem_ops **ops, 0051 void **priv); 0052 }; 0053 0054 /** 0055 * logic_iomem_add_region - register an IO memory region 0056 * @resource: the resource description for this region 0057 * @ops: the IO memory mapping ops for this resource 0058 */ 0059 int logic_iomem_add_region(struct resource *resource, 0060 const struct logic_iomem_region_ops *ops); 0061 0062 #endif /* __LOGIC_IOMEM_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |