![]() |
|
|||
0001 /* 0002 * Copyright (c) 2004 Topspin Communications. All rights reserved. 0003 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. 0004 * Copyright (c) 2005 Mellanox Technologies. All rights reserved. 0005 * 0006 * This software is available to you under a choice of one of two 0007 * licenses. You may choose to be licensed under the terms of the GNU 0008 * General Public License (GPL) Version 2, available from the file 0009 * COPYING in the main directory of this source tree, or the 0010 * OpenIB.org BSD license below: 0011 * 0012 * Redistribution and use in source and binary forms, with or 0013 * without modification, are permitted provided that the following 0014 * conditions are met: 0015 * 0016 * - Redistributions of source code must retain the above 0017 * copyright notice, this list of conditions and the following 0018 * disclaimer. 0019 * 0020 * - Redistributions in binary form must reproduce the above 0021 * copyright notice, this list of conditions and the following 0022 * disclaimer in the documentation and/or other materials 0023 * provided with the distribution. 0024 * 0025 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 0026 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 0027 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 0028 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 0029 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 0030 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 0031 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 0032 * SOFTWARE. 0033 */ 0034 0035 #ifndef MLX4_DOORBELL_H 0036 #define MLX4_DOORBELL_H 0037 0038 #include <linux/types.h> 0039 #include <linux/io.h> 0040 0041 #define MLX4_SEND_DOORBELL 0x14 0042 #define MLX4_CQ_DOORBELL 0x20 0043 0044 #if BITS_PER_LONG == 64 0045 /* 0046 * Assume that we can just write a 64-bit doorbell atomically. s390 0047 * actually doesn't have writeq() but S/390 systems don't even have 0048 * PCI so we won't worry about it. 0049 */ 0050 0051 #define MLX4_DECLARE_DOORBELL_LOCK(name) 0052 #define MLX4_INIT_DOORBELL_LOCK(ptr) do { } while (0) 0053 #define MLX4_GET_DOORBELL_LOCK(ptr) (NULL) 0054 0055 static inline void mlx4_write64(__be32 val[2], void __iomem *dest, 0056 spinlock_t *doorbell_lock) 0057 { 0058 __raw_writeq(*(u64 *) val, dest); 0059 } 0060 0061 #else 0062 0063 /* 0064 * Just fall back to a spinlock to protect the doorbell if 0065 * BITS_PER_LONG is 32 -- there's no portable way to do atomic 64-bit 0066 * MMIO writes. 0067 */ 0068 0069 #define MLX4_DECLARE_DOORBELL_LOCK(name) spinlock_t name; 0070 #define MLX4_INIT_DOORBELL_LOCK(ptr) spin_lock_init(ptr) 0071 #define MLX4_GET_DOORBELL_LOCK(ptr) (ptr) 0072 0073 static inline void mlx4_write64(__be32 val[2], void __iomem *dest, 0074 spinlock_t *doorbell_lock) 0075 { 0076 unsigned long flags; 0077 0078 spin_lock_irqsave(doorbell_lock, flags); 0079 __raw_writel((__force u32) val[0], dest); 0080 __raw_writel((__force u32) val[1], dest + 4); 0081 spin_unlock_irqrestore(doorbell_lock, flags); 0082 } 0083 0084 #endif 0085 0086 #endif /* MLX4_DOORBELL_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |