2 #ifndef _IEEE1394_TYPES_H
3 #define _IEEE1394_TYPES_H
5 #include <linux/kernel.h>
6 #include <linux/types.h>
7 #include <linux/list.h>
8 #include <linux/init.h>
9 #include <linux/spinlock.h>
10 #include <linux/string.h>
12 #include <asm/semaphore.h>
13 #include <asm/byteorder.h>
16 /* Transaction Label handling */
17 struct hpsb_tlabel_pool {
18 DECLARE_BITMAP(pool, 64);
22 struct semaphore count;
25 #define HPSB_TPOOL_INIT(_tp) \
27 bitmap_zero((_tp)->pool, 64); \
28 spin_lock_init(&(_tp)->lock); \
30 (_tp)->allocations = 0; \
31 sema_init(&(_tp)->count, 63); \
35 typedef u32 quadlet_t;
40 typedef u64 nodeaddr_t;
41 typedef u16 arm_length_t;
43 #define BUS_MASK 0xffc0
45 #define NODE_MASK 0x003f
46 #define LOCAL_BUS 0xffc0
47 #define ALL_NODES 0x003f
49 #define NODEID_TO_BUS(nodeid) ((nodeid & BUS_MASK) >> BUS_SHIFT)
50 #define NODEID_TO_NODE(nodeid) (nodeid & NODE_MASK)
52 /* Can be used to consistently print a node/bus ID. */
53 #define NODE_BUS_FMT "%d-%02d:%04d"
54 #define NODE_BUS_ARGS(__host, __nodeid) \
55 __host->id, NODEID_TO_NODE(__nodeid), NODEID_TO_BUS(__nodeid)
57 #define HPSB_PRINT(level, fmt, args...) printk(level "ieee1394: " fmt "\n" , ## args)
59 #define HPSB_DEBUG(fmt, args...) HPSB_PRINT(KERN_DEBUG, fmt , ## args)
60 #define HPSB_INFO(fmt, args...) HPSB_PRINT(KERN_INFO, fmt , ## args)
61 #define HPSB_NOTICE(fmt, args...) HPSB_PRINT(KERN_NOTICE, fmt , ## args)
62 #define HPSB_WARN(fmt, args...) HPSB_PRINT(KERN_WARNING, fmt , ## args)
63 #define HPSB_ERR(fmt, args...) HPSB_PRINT(KERN_ERR, fmt , ## args)
65 #ifdef CONFIG_IEEE1394_VERBOSEDEBUG
66 #define HPSB_VERBOSE(fmt, args...) HPSB_PRINT(KERN_DEBUG, fmt , ## args)
68 #define HPSB_VERBOSE(fmt, args...)
71 #define HPSB_PANIC(fmt, args...) panic("ieee1394: " fmt "\n" , ## args)
73 #define HPSB_TRACE() HPSB_PRINT(KERN_INFO, "TRACE - %s, %s(), line %d", __FILE__, __FUNCTION__, __LINE__)
78 static __inline__ void *memcpy_le32(u32 *dest, const u32 *__src, size_t count)
81 u32 *src = (u32 *)__src;
86 *dest++ = swab32p(src++);
94 static __inline__ void *memcpy_le32(u32 *dest, const u32 *src, size_t count)
96 return memcpy(dest, src, count);
99 #endif /* __BIG_ENDIAN */
101 #endif /* _IEEE1394_TYPES_H */