Merge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-block.git] / drivers / staging / rar_register / rar_register.h
CommitLineData
9cedb392
MA
1/*
2 * Copyright (C) 2010 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 2 of the GNU General
6 * Public License as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be
9 * useful, but WITHOUT ANY WARRANTY; without even the implied
10 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public
13 * License along with this program; if not, write to the Free
14 * Software Foundation, Inc., 59 Temple Place - Suite 330,
15 * Boston, MA 02111-1307, USA.
16 * The full GNU General Public License is included in this
17 * distribution in the file called COPYING.
18 */
19
20
21#ifndef _RAR_REGISTER_H
22#define _RAR_REGISTER_H
23
24# include <linux/types.h>
25
26/* following are used both in drivers as well as user space apps */
27enum RAR_type {
28 RAR_TYPE_VIDEO = 0,
29 RAR_TYPE_AUDIO,
30 RAR_TYPE_IMAGE,
31 RAR_TYPE_DATA
542385ee
AC
32};
33
9cedb392
MA
34#ifdef __KERNEL__
35
36/* PCI device id for controller */
37#define PCI_RAR_DEVICE_ID 0x4110
38
39/* The register_rar function is to used by other device drivers
40 * to ensure that this driver is ready. As we cannot be sure of
41 * the compile/execute order of dirvers in ther kernel, it is
42 * best to give this driver a callback function to call when
43 * it is ready to give out addresses. The callback function
44 * would have those steps that continue the initialization of
45 * a driver that do require a valid RAR address. One of those
46 * steps would be to call get_rar_address()
47 * This function return 0 on success an -1 on failure.
48 */
49int register_rar(int (*callback)(void *yourparameter), void *yourparameter);
50
542385ee
AC
51/* The get_rar_address function is used by other device drivers
52 * to obtain RAR address information on a RAR. It takes two
53 * parameter:
54 *
55 * int rar_index
56 * The rar_index is an index to the rar for which you wish to retrieve
57 * the address information.
58 * Values can be 0,1, or 2.
59 *
60 * struct RAR_address_struct is a pointer to a place to which the function
61 * can return the address structure for the RAR.
62 *
63 * The function returns a 0 upon success or a -1 if there is no RAR
64 * facility on this system.
65 */
9cedb392
MA
66int rar_get_address(int rar_index,
67 dma_addr_t *start_address,
68 dma_addr_t *end_address);
542385ee 69
9cedb392 70/* The lock_rar function is ued by other device drivers to lock an RAR.
542385ee
AC
71 * once an RAR is locked, it stays locked until the next system reboot.
72 * The function takes one parameter:
73 *
74 * int rar_index
75 * The rar_index is an index to the rar that you want to lock.
76 * Values can be 0,1, or 2.
77 *
78 * The function returns a 0 upon success or a -1 if there is no RAR
79 * facility on this system.
80 */
9cedb392 81int rar_lock(int rar_index);
542385ee 82
9cedb392
MA
83#endif /* __KERNEL__ */
84#endif /* _RAR_REGISTER_H */