io-mapping.h revision 271127
1139825Simp/*-
21541Srgrimes * Copyright (c) 2010 Isilon Systems, Inc.
3174167Srwatson * Copyright (c) 2010 iX Systems, Inc.
4174167Srwatson * Copyright (c) 2010 Panasas, Inc.
5174167Srwatson * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd.
61541Srgrimes * All rights reserved.
71541Srgrimes *
81541Srgrimes * Redistribution and use in source and binary forms, with or without
91541Srgrimes * modification, are permitted provided that the following conditions
101541Srgrimes * are met:
111541Srgrimes * 1. Redistributions of source code must retain the above copyright
121541Srgrimes *    notice unmodified, this list of conditions, and the following
131541Srgrimes *    disclaimer.
141541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
151541Srgrimes *    notice, this list of conditions and the following disclaimer in the
161541Srgrimes *    documentation and/or other materials provided with the distribution.
171541Srgrimes *
181541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
191541Srgrimes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
201541Srgrimes * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
211541Srgrimes * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
221541Srgrimes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
231541Srgrimes * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
241541Srgrimes * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
251541Srgrimes * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
261541Srgrimes * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
271541Srgrimes * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
281541Srgrimes */
291541Srgrimes
301541Srgrimes#ifndef	_LINUX_IO_MAPPING_H_
311541Srgrimes#define	_LINUX_IO_MAPPING_H_
3250477Speter
331541Srgrimes#include <linux/types.h>
341541Srgrimes#include <linux/io.h>
352165Spaul
362165Spaulstruct io_mapping;
372165Spaul
381541Srgrimesstatic inline struct io_mapping *
3955205Speterio_mapping_create_wc(resource_size_t base, unsigned long size)
401541Srgrimes{
4118207Sbde
421541Srgrimes	return ioremap_wc(base, size);
431541Srgrimes}
441541Srgrimes
451541Srgrimesstatic inline void
4692047Sddio_mapping_free(struct io_mapping *mapping)
4781202Sjhb{
4876166Smarkm
4911913Sphk	iounmap(mapping);
5012685Speter}
5112685Speter
5212685Speterstatic inline void *
5312685Speterio_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset)
5455205Speter{
5534924Sbde
561541Srgrimes	return (((char *)mapping) + offset);
5734924Sbde}
5834924Sbde
591541Srgrimesstatic inline void
6034924Sbdeio_mapping_unmap_atomic(void *vaddr)
61174167Srwatson{
62174167Srwatson
63174167Srwatson}
641541Srgrimes
651541Srgrimesstatic inline void *
6669896Smckusickio_mapping_map_wc(struct io_mapping *mapping, unsigned long offset)
6769896Smckusick{
68147188Sgad
69147188Sgad	return (((char *) mapping) + offset);
70147188Sgad}
71147188Sgad
72147188Sgadstatic inline void
73147188Sgadio_mapping_unmap(void *vaddr)
74147188Sgad{
75147188Sgad
76130825Sgad}
77147188Sgad
78147188Sgad#endif	/* _LINUX_IO_MAPPING_H_ */
79147188Sgad