Path: blob/master/arch/tile/include/asm/hv_driver.h
10819 views
/*1* Copyright 2010 Tilera Corporation. All Rights Reserved.2*3* This program is free software; you can redistribute it and/or4* modify it under the terms of the GNU General Public License5* as published by the Free Software Foundation, version 2.6*7* This program is distributed in the hope that it will be useful, but8* WITHOUT ANY WARRANTY; without even the implied warranty of9* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or10* NON INFRINGEMENT. See the GNU General Public License for11* more details.12*13* This header defines a wrapper interface for managing hypervisor14* device calls that will result in an interrupt at some later time.15* In particular, this provides wrappers for hv_preada() and16* hv_pwritea().17*/1819#ifndef _ASM_TILE_HV_DRIVER_H20#define _ASM_TILE_HV_DRIVER_H2122#include <hv/hypervisor.h>2324struct hv_driver_cb;2526/* A callback to be invoked when an operation completes. */27typedef void hv_driver_callback_t(struct hv_driver_cb *cb, __hv32 result);2829/*30* A structure to hold information about an outstanding call.31* The driver must allocate a separate structure for each call.32*/33struct hv_driver_cb {34hv_driver_callback_t *callback; /* Function to call on interrupt. */35void *dev; /* Driver-specific state variable. */36};3738/* Wrapper for invoking hv_dev_preada(). */39static inline int40tile_hv_dev_preada(int devhdl, __hv32 flags, __hv32 sgl_len,41HV_SGL sgl[/* sgl_len */], __hv64 offset,42struct hv_driver_cb *callback)43{44return hv_dev_preada(devhdl, flags, sgl_len, sgl,45offset, (HV_IntArg)callback);46}4748/* Wrapper for invoking hv_dev_pwritea(). */49static inline int50tile_hv_dev_pwritea(int devhdl, __hv32 flags, __hv32 sgl_len,51HV_SGL sgl[/* sgl_len */], __hv64 offset,52struct hv_driver_cb *callback)53{54return hv_dev_pwritea(devhdl, flags, sgl_len, sgl,55offset, (HV_IntArg)callback);56}575859#endif /* _ASM_TILE_HV_DRIVER_H */606162