Sat Jun 20 20:18:33 2009 UTC ()
unifdef -U__DragonFlyBSD__ -U__FreeBSD__ -D__NetBSD__.

XXX Compiles, but untested.


(dyoung)
diff -r1.9 -r1.10 src/sys/dev/ieee1394/firewirereg.h

cvs diff -r1.9 -r1.10 src/sys/dev/ieee1394/firewirereg.h (expand / switch to unified diff)

--- src/sys/dev/ieee1394/firewirereg.h 2009/06/20 09:40:52 1.9
+++ src/sys/dev/ieee1394/firewirereg.h 2009/06/20 20:18:32 1.10
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: firewirereg.h,v 1.9 2009/06/20 09:40:52 cegger Exp $ */ 1/* $NetBSD: firewirereg.h,v 1.10 2009/06/20 20:18:32 dyoung Exp $ */
2/*- 2/*-
3 * Copyright (c) 2003 Hidetoshi Shimokawa 3 * Copyright (c) 2003 Hidetoshi Shimokawa
4 * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa 4 * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -53,44 +53,37 @@ struct fw_device{ @@ -53,44 +53,37 @@ struct fw_device{
53 uint32_t csrrom[CSRROMSIZE/4]; 53 uint32_t csrrom[CSRROMSIZE/4];
54 int rcnt; 54 int rcnt;
55 struct firewire_comm *fc; 55 struct firewire_comm *fc;
56 uint32_t status; 56 uint32_t status;
57#define FWDEVNEW 0 57#define FWDEVNEW 0
58#define FWDEVINIT 1 58#define FWDEVINIT 1
59#define FWDEVATTACHED 2 59#define FWDEVATTACHED 2
60#define FWDEVINVAL 3 60#define FWDEVINVAL 3
61 STAILQ_ENTRY(fw_device) link; 61 STAILQ_ENTRY(fw_device) link;
62 device_t sbp; 62 device_t sbp;
63}; 63};
64 64
65struct firewire_softc { 65struct firewire_softc {
66#if defined(__FreeBSD__) && __FreeBSD_version >= 500000 
67 fw_dev_t dev; 
68 device_t sbp_dev; 
69#elif defined(__NetBSD__) 
70 device_t dev; 66 device_t dev;
71 SLIST_HEAD(, firewire_dev_list) devlist; 67 SLIST_HEAD(, firewire_dev_list) devlist;
72 void *si_drv1; 68 void *si_drv1;
73 int si_iosize_max; 69 int si_iosize_max;
74#endif 
75 struct firewire_comm *fc; 70 struct firewire_comm *fc;
76}; 71};
77#if defined(__NetBSD__) 
78struct firewire_dev_list { 72struct firewire_dev_list {
79 SLIST_ENTRY(firewire_dev_list) link; 73 SLIST_ENTRY(firewire_dev_list) link;
80 device_t dev; 74 device_t dev;
81 struct fw_device *fwdev; 75 struct fw_device *fwdev;
82}; 76};
83#endif 
84 77
85#define FW_MAX_DMACH 0x20 78#define FW_MAX_DMACH 0x20
86#define FW_MAX_DEVCH FW_MAX_DMACH 79#define FW_MAX_DEVCH FW_MAX_DMACH
87#define FW_XFERTIMEOUT 1 80#define FW_XFERTIMEOUT 1
88 81
89struct firewire_dev_comm { 82struct firewire_dev_comm {
90 device_t dev; 83 device_t dev;
91 struct firewire_comm *fc; 84 struct firewire_comm *fc;
92 void (*post_busreset) (void *); 85 void (*post_busreset) (void *);
93 void (*post_explore) (void *); 86 void (*post_explore) (void *);
94}; 87};
95 88
96struct tcode_info { 89struct tcode_info {
@@ -287,54 +280,37 @@ int fw_asyreq (struct firewire_comm *, i @@ -287,54 +280,37 @@ int fw_asyreq (struct firewire_comm *, i
287void fw_busreset (struct firewire_comm *, uint32_t); 280void fw_busreset (struct firewire_comm *, uint32_t);
288uint16_t fw_crc16 (uint32_t *, uint32_t); 281uint16_t fw_crc16 (uint32_t *, uint32_t);
289void fw_xfer_timeout (void *); 282void fw_xfer_timeout (void *);
290void fw_xfer_done (struct fw_xfer *); 283void fw_xfer_done (struct fw_xfer *);
291void fw_xferwake (struct fw_xfer *); 284void fw_xferwake (struct fw_xfer *);
292int fw_xferwait (struct fw_xfer *); 285int fw_xferwait (struct fw_xfer *);
293void fw_asy_callback_free (struct fw_xfer *); 286void fw_asy_callback_free (struct fw_xfer *);
294struct fw_device *fw_noderesolve_nodeid (struct firewire_comm *, int); 287struct fw_device *fw_noderesolve_nodeid (struct firewire_comm *, int);
295struct fw_device *fw_noderesolve_eui64 (struct firewire_comm *, struct fw_eui64 *); 288struct fw_device *fw_noderesolve_eui64 (struct firewire_comm *, struct fw_eui64 *);
296struct fw_bind *fw_bindlookup (struct firewire_comm *, uint16_t, uint32_t); 289struct fw_bind *fw_bindlookup (struct firewire_comm *, uint16_t, uint32_t);
297void fw_drain_txq (struct firewire_comm *); 290void fw_drain_txq (struct firewire_comm *);
298int fwdev_makedev (struct firewire_softc *); 291int fwdev_makedev (struct firewire_softc *);
299int fwdev_destroydev (struct firewire_softc *); 292int fwdev_destroydev (struct firewire_softc *);
300#if defined(__FreeBSD__) && __FreeBSD_version >= 500000 
301void fwdev_clone (void *, struct ucred *, char *, int, fw_dev_t *); 
302#endif 
303int fw_open_isodma(struct firewire_comm *, int); 293int fw_open_isodma(struct firewire_comm *, int);
304 294
305extern int firewire_debug; 295extern int firewire_debug;
306#if defined(__FreeBSD__) 
307extern devclass_t firewire_devclass; 
308#elif defined(__NetBSD__) 
309extern struct cfdriver ieee1394if_cd; 296extern struct cfdriver ieee1394if_cd;
310#endif 
311extern int firewire_phydma_enable; 297extern int firewire_phydma_enable;
312 298
313#ifdef __DragonFly__ 
314#define FWPRI PCATCH 
315#else 
316#define FWPRI ((PZERO+8)|PCATCH) 299#define FWPRI ((PZERO+8)|PCATCH)
317#endif 
318 300
319#if defined(__DragonFly__) || __FreeBSD_version < 500000 || defined(__NetBSD__) 
320/* compatibility shim for 4.X */ 301/* compatibility shim for 4.X */
321#define bio buf 302#define bio buf
322#define bio_bcount b_bcount 303#define bio_bcount b_bcount
323#define bio_cmd b_flags 304#define bio_cmd b_flags
324#define bio_count b_count 305#define bio_count b_count
325#define bio_data b_data 306#define bio_data b_data
326#define bio_dev b_dev 307#define bio_dev b_dev
327#define bio_error b_error 308#define bio_error b_error
328#define bio_flags b_flags 309#define bio_flags b_flags
329#if defined(__FreeBSD__) 
330#define bio_offset b_offset 
331#elif defined(__NetBSD__) 
332#define bio_offset b_blkno 310#define bio_offset b_blkno
333#endif 
334#define bio_resid b_resid 311#define bio_resid b_resid
335#define BIO_READ B_READ 312#define BIO_READ B_READ
336#define BIO_WRITE B_WRITE 313#define BIO_WRITE B_WRITE
337#endif 
338 314
339MALLOC_DECLARE(M_FW); 315MALLOC_DECLARE(M_FW);
340MALLOC_DECLARE(M_FWXFER); 316MALLOC_DECLARE(M_FWXFER);