mlx4_ib_wc.c revision 255932
1238438Sdteske/*
2238438Sdteske * Copyright (c) 2006-2007 Mellanox Technologies. All rights reserved.
3249746Sdteske *
4238438Sdteske * This software is available to you under a choice of one of two
5238438Sdteske * licenses.  You may choose to be licensed under the terms of the GNU
6238438Sdteske * General Public License (GPL) Version 2, available from the file
7238438Sdteske * COPYING in the main directory of this source tree, or the
8238438Sdteske * OpenIB.org BSD license below:
9238438Sdteske *
10238438Sdteske *     Redistribution and use in source and binary forms, with or
11238438Sdteske *     without modification, are permitted provided that the following
12238438Sdteske *     conditions are met:
13238438Sdteske *
14238438Sdteske *      - Redistributions of source code must retain the above
15238438Sdteske *        copyright notice, this list of conditions and the following
16238438Sdteske *        disclaimer.
17238438Sdteske *
18238438Sdteske *      - Redistributions in binary form must reproduce the above
19238438Sdteske *        copyright notice, this list of conditions and the following
20238438Sdteske *        disclaimer in the documentation and/or other materials
21238438Sdteske *        provided with the distribution.
22238438Sdteske *
23238438Sdteske * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24238438Sdteske * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25238438Sdteske * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26238438Sdteske * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27238438Sdteske * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28238438Sdteske * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29238438Sdteske * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30238438Sdteske * SOFTWARE.
31240684Sdteske */
32240684Sdteske
33244675Sdteske#include <linux/pci.h>
34240684Sdteske#include "wc.h"
35240684Sdteske
36240684Sdteske#if defined(__i386__) || defined(__x86_64__)
37238438Sdteske
38240684Sdteskepgprot_t pgprot_wc(pgprot_t _prot)
39238438Sdteske{
40238438Sdteske	return pgprot_writecombine(_prot);
41243112Sdteske}
42238438Sdteske
43238438Sdteskeint mlx4_wc_enabled(void)
44238438Sdteske{
45238438Sdteske	return 1;
46238438Sdteske}
47238438Sdteske
48238438Sdteske#elif defined(CONFIG_PPC64)
49238438Sdteske
50238438Sdteskepgprot_t pgprot_wc(pgprot_t _prot)
51238438Sdteske{
52238438Sdteske	return __pgprot((pgprot_val(_prot) | _PAGE_NO_CACHE) &
53251264Sdteske				     ~(pgprot_t)_PAGE_GUARDED);
54238438Sdteske}
55238438Sdteske
56238438Sdteskeint mlx4_wc_enabled(void)
57238438Sdteske{
58238438Sdteske	return 1;
59238438Sdteske}
60238438Sdteske
61251264Sdteske#else	/* !(defined(__i386__) || defined(__x86_64__)) */
62251264Sdteske
63238438Sdteskepgprot_t pgprot_wc(pgprot_t _prot)
64251190Sdteske{
65251190Sdteske	return pgprot_noncached(_prot);
66251190Sdteske}
67251190Sdteske
68251190Sdteskeint mlx4_wc_enabled(void)
69251190Sdteske{
70251190Sdteske	return 0;
71238438Sdteske}
72249751Sdteske
73249751Sdteske#endif
74249751Sdteske