Deleted Added
full compact
36c36
< __FBSDID("$FreeBSD: head/sys/dev/firewire/firewire.c 271795 2014-09-18 17:28:21Z will $");
---
> __FBSDID("$FreeBSD: head/sys/dev/firewire/firewire.c 272214 2014-09-27 16:50:21Z kan $");
51d50
<
68c67
< int firewire_debug=0, try_bmr=1, hold_count=0;
---
> int firewire_debug = 0, try_bmr = 1, hold_count = 0;
84,88c83,87
< static void firewire_identify (driver_t *, device_t);
< static int firewire_probe (device_t);
< static int firewire_attach (device_t);
< static int firewire_detach (device_t);
< static int firewire_resume (device_t);
---
> static void firewire_identify(driver_t *, device_t);
> static int firewire_probe(device_t);
> static int firewire_attach(device_t);
> static int firewire_detach(device_t);
> static int firewire_resume(device_t);
91,96c90,95
< static void fw_try_bmr (void *);
< static void fw_try_bmr_callback (struct fw_xfer *);
< static void fw_asystart (struct fw_xfer *);
< static int fw_get_tlabel (struct firewire_comm *, struct fw_xfer *);
< static void fw_bus_probe (struct firewire_comm *);
< static void fw_attach_dev (struct firewire_comm *);
---
> static void fw_try_bmr(void *);
> static void fw_try_bmr_callback(struct fw_xfer *);
> static void fw_asystart(struct fw_xfer *);
> static int fw_get_tlabel(struct firewire_comm *, struct fw_xfer *);
> static void fw_bus_probe(void *);
> static void fw_attach_dev(struct firewire_comm *);
118a118
>
177,178c177,180
< if(fwdev == NULL) return NULL;
< if(fwdev->status == FWDEVINVAL) return NULL;
---
> if (fwdev == NULL)
> return NULL;
> if (fwdev->status == FWDEVINVAL)
> return NULL;
195,196c197,199
< if(xfer == NULL) return EINVAL;
< if(xfer->hand == NULL){
---
> if (xfer == NULL)
> return EINVAL;
> if (xfer->hand == NULL) {
234c237
< if (len != xfer->send.pay_len){
---
> if (len != xfer->send.pay_len) {
237c240
< return EINVAL;
---
> return EINVAL;
240c243
< if(xferq->start == NULL){
---
> if (xferq->start == NULL) {
244c247
< if(!(xferq->queued < xferq->maxq)){
---
> if (!(xferq->queued < xferq->maxq)) {
262a266
>
286,287c290,291
< if ((xfer->flag & FWXF_WAKE) == 0)
< err = msleep((void *)xfer, lock, PWAIT|PCATCH, "fw_xferwait", 0);
---
> while ((xfer->flag & FWXF_WAKE) == 0)
> err = msleep(xfer, lock, PWAIT|PCATCH, "fw_xferwait", 0);
300a305
>
307c312
< xfer->q->queued ++;
---
> xfer->q->queued++;
349c354
< for (i = 0; i < 0x40; i ++) {
---
> for (i = 0; i < 0x40; i++) {
358,359c363,364
< "split transaction timeout: "
< "tl=0x%x flag=0x%02x\n", i, xfer->flag);
---
> "split transaction timeout: tl=0x%x flag=0x%02x\n",
> i, xfer->flag);
372c377
< xfer->hand(xfer);
---
> xfer->hand(xfer);
382c387
< fc = (struct firewire_comm *)arg;
---
> fc = arg;
392c397
< watchdog_clock ++;
---
> watchdog_clock++;
395c400
< (void *)firewire_watchdog, (void *)fc);
---
> firewire_watchdog, fc);
409c414
< fc = (struct firewire_comm *)device_get_softc(pa);
---
> fc = device_get_softc(pa);
414c419,420
< if( fc->nisodma > FWMAXNDMA) fc->nisodma = FWMAXNDMA;
---
> if (fc->nisodma > FWMAXNDMA)
> fc->nisodma = FWMAXNDMA;
418,420c424,425
< fc->crom_src_buf = (struct crom_src_buf *)malloc(
< sizeof(struct crom_src_buf),
< M_FW, M_NOWAIT | M_ZERO);
---
> fc->crom_src_buf = malloc(sizeof(struct crom_src_buf),
> M_FW, M_NOWAIT | M_ZERO);
422c427,428
< device_printf(fc->dev, "%s: Malloc Failure crom src buff\n", __func__);
---
> device_printf(fc->dev,
> "%s: unable to allocate crom src buffer\n", __func__);
425,427c431,432
< fc->topology_map = (struct fw_topology_map *)malloc(
< sizeof(struct fw_topology_map),
< M_FW, M_NOWAIT | M_ZERO);
---
> fc->topology_map = malloc(sizeof(struct fw_topology_map),
> M_FW, M_NOWAIT | M_ZERO);
429c434,435
< device_printf(fc->dev, "%s: Malloc Failure topology map\n", __func__);
---
> device_printf(fc->dev, "%s: unable to allocate topology map\n",
> __func__);
433,435c439,440
< fc->speed_map = (struct fw_speed_map *)malloc(
< sizeof(struct fw_speed_map),
< M_FW, M_NOWAIT | M_ZERO);
---
> fc->speed_map = malloc(sizeof(struct fw_speed_map),
> M_FW, M_NOWAIT | M_ZERO);
437c442,443
< device_printf(fc->dev, "%s: Malloc Failure speed map\n", __func__);
---
> device_printf(fc->dev, "%s: unable to allocate speed map\n",
> __func__);
448c454
< TASK_INIT(&fc->task_timeout, 0, firewire_xfer_timeout, (void *)fc);
---
> TASK_INIT(&fc->task_timeout, 0, firewire_xfer_timeout, fc);
451c457
< (void *)firewire_watchdog, (void *)sc->fc);
---
> firewire_watchdog, sc->fc);
454,455c460,461
< kproc_create(fw_bus_probe_thread, (void *)fc, &fc->probe_thread,
< 0, 0, "fw%d_probe", unit);
---
> kproc_create(fw_bus_probe_thread, fc, &fc->probe_thread,
> 0, 0, "fw%d_probe", unit);
478c484
< device_t child;
---
> device_t child;
481c487
< sc = (struct firewire_softc *)device_get_softc(dev);
---
> sc = device_get_softc(dev);
496c502
< sc = (struct firewire_softc *)device_get_softc(dev);
---
> sc = device_get_softc(dev);
498c504
<
---
>
501c507
< return(0);
---
> return (0);
505c511
< * Dettach it.
---
> * Detach it.
515c521
< sc = (struct firewire_softc *)device_get_softc(dev);
---
> sc = device_get_softc(dev);
524c530
< if (fc->arq !=0 && fc->arq->maxq > 0)
---
> if (fc->arq != 0 && fc->arq->maxq > 0)
539c545
< fwdev = fwdev_next) {
---
> fwdev = fwdev_next) {
549c555
< return(0);
---
> return (0);
560c566
< xferq->queued --;
---
> xferq->queued--;
580c586
< for(i = 0; i < fc->nisodma; i++)
---
> for (i = 0; i < fc->nisodma; i++)
585c591
< for (i = 0; i < 0x40; i ++)
---
> for (i = 0; i < 0x40; i++)
597c603
< xfer->hand(xfer);
---
> xfer->hand(xfer);
606c612
< = 1 << 23 | 0 << 17 | 1 << 16 | 1 << 15 | 1 << 14 ;
---
> = 1 << 23 | 0 << 17 | 1 << 16 | 1 << 15 | 1 << 14;
615c621
< for(i = 2; i < 0x100/4 - 2 ; i++){
---
> for (i = 2; i < 0x100 / 4 - 2; i++) {
618c624
< CSRARC(fc, STATE_CLEAR) = 1 << 23 | 0 << 17 | 1 << 16 | 1 << 15 | 1 << 14 ;
---
> CSRARC(fc, STATE_CLEAR) = 1 << 23 | 0 << 17 | 1 << 16 | 1 << 15 | 1 << 14;
634c640
< 1 << 28 | 0xff << 16 | 0x09 << 8;
---
> 1 << 28 | 0xff << 16 | 0x09 << 8;
637,639c643,645
< /* DV depend CSRs see blue book */
< CSRARC(fc, oPCR) &= ~DV_BROADCAST_ON;
< CSRARC(fc, iPCR) &= ~DV_BROADCAST_ON;
---
> /* DV depend CSRs see blue book */
> CSRARC(fc, oPCR) &= ~DV_BROADCAST_ON;
> CSRARC(fc, iPCR) &= ~DV_BROADCAST_ON;
641c647
< CSRARC(fc, STATE_CLEAR) &= ~(1 << 23 | 1 << 15 | 1 << 14 );
---
> CSRARC(fc, STATE_CLEAR) &= ~(1 << 23 | 1 << 15 | 1 << 14);
697,700d702
< #ifdef __DragonFly__
< crom_add_simple_text(src, root, &buf->vendor, "DragonFly Project");
< crom_add_entry(root, CSRKEY_HW, __DragonFly_cc_version);
< #else
703d704
< #endif
734,735c735,736
< for( i = 0 ; i < devcnt ; i++)
< if (device_get_state(devlistp[i]) >= DS_ATTACHED) {
---
> for (i = 0; i < devcnt; i++)
> if (device_get_state(devlistp[i]) >= DS_ATTACHED) {
744,757c745,758
< /*
< * If the old config rom needs to be overwritten,
< * bump the businfo.generation indicator to
< * indicate that we need to be reprobed
< * See 1394a-2000 8.3.2.5.4 for more details.
< * generation starts at 2 and rolls over at 0xF
< * back to 2.
< *
< * A generation of 0 indicates a device
< * that is not 1394a-2000 compliant.
< * A generation of 1 indicates a device that
< * does not change it's Bus Info Block or
< * Configuration ROM.
< */
---
> /*
> * If the old config rom needs to be overwritten,
> * bump the businfo.generation indicator to
> * indicate that we need to be reprobed
> * See 1394a-2000 8.3.2.5.4 for more details.
> * generation starts at 2 and rolls over at 0xF
> * back to 2.
> *
> * A generation of 0 indicates a device
> * that is not 1394a-2000 compliant.
> * A generation of 1 indicates a device that
> * does not change it's Bus Info Block or
> * Configuration ROM.
> */
763c764
< if ( src->businfo.generation++ > FW_MAX_GENERATION )
---
> if (src->businfo.generation++ > FW_MAX_GENERATION)
765c766
< bcopy(newrom, (void *)fc->config_rom, CROMSIZE);
---
> bcopy(newrom, fc->config_rom, CROMSIZE);
768d768
<
798c798
< for( i = 0 ; i < fc->nisodma ; i ++ ){
---
> for (i = 0; i < fc->nisodma; i++) {
820c820
< for( i = 0 ; i < fc->nisodma ; i++){
---
> for (i = 0; i < fc->nisodma; i++) {
832c832
< /* Initialize Async handlers */
---
> /* Initialize Async handlers */
834c834
< for( i = 0 ; i < 0x40 ; i++){
---
> for (i = 0; i < 0x40; i++) {
842,843c842,843
< for(i = 4 ; i < 0x7c/4 ; i+=4){
< CSRARC(fc, i + oPCR) = 0x8000007a;
---
> for (i = 4; i < 0x7c/4; i += 4) {
> CSRARC(fc, i + oPCR) = 0x8000007a;
845c845
<
---
>
848,849c848,849
< for(i = 4 ; i < 0x7c/4 ; i+=4){
< CSRARC(fc, i + iPCR) = 0x0;
---
> for (i = 4; i < 0x7c/4; i += 4) {
> CSRARC(fc, i + iPCR) = 0x0;
857c857,858
< if(xfer == NULL) return;
---
> if (xfer == NULL)
> return;
859,860c860,861
< fwb = (struct fw_bind *)malloc(sizeof (struct fw_bind), M_FW, M_NOWAIT);
< if(fwb == NULL){
---
> fwb = malloc(sizeof(struct fw_bind), M_FW, M_NOWAIT);
> if (fwb == NULL) {
876,877c877,878
< #define BIND_CMP(addr, fwb) (((addr) < (fwb)->start)?-1:\
< ((fwb)->end < (addr))?1:0)
---
> #define BIND_CMP(addr, fwb) (((addr) < (fwb)->start)? -1 : \
> ((fwb)->end < (addr)) ? 1 : 0)
896c897
< return(r);
---
> return (r);
981c982
< return (n);
---
> return (i);
998,1001c999,1002
< next = STAILQ_NEXT(xfer, link);
< fw_xfer_free_buf(xfer);
< }
< STAILQ_INIT(q);
---
> next = STAILQ_NEXT(xfer, link);
> fw_xfer_free_buf(xfer);
> }
> STAILQ_INIT(q);
1034c1035
< if(txfer == xfer)
---
> if (txfer == xfer)
1067c1068
< if(xfer->send.hdr.mode.hdr.dst == node) {
---
> if (xfer->send.hdr.mode.hdr.dst == node) {
1078c1079
< return(NULL);
---
> return (NULL);
1080c1081
<
---
>
1083c1084
< return(xfer);
---
> return (xfer);
1089c1090
< return(NULL);
---
> return (NULL);
1116c1117
< return(NULL);
---
> return (NULL);
1123c1124
< return(NULL);
---
> return (NULL);
1132c1133
< return(NULL);
---
> return (NULL);
1135c1136
< return(xfer);
---
> return (xfer);
1157c1158
< fw_xfer_unload(struct fw_xfer* xfer)
---
> fw_xfer_unload(struct fw_xfer *xfer)
1161,1162c1162,1164
< if(xfer == NULL ) return;
< if(xfer->flag & FWXF_INQ){
---
> if (xfer == NULL)
> return;
> if (xfer->flag & FWXF_INQ) {
1168c1170
< xfer->q->queued --;
---
> xfer->q->queued--;
1180c1182
< if(xfer->flag & FWXF_START)
---
> if (xfer->flag & FWXF_START)
1191a1194
>
1193c1196
< * To free IEEE1394 XFER structure.
---
> * To free IEEE1394 XFER structure.
1196c1199
< fw_xfer_free_buf( struct fw_xfer* xfer)
---
> fw_xfer_free_buf(struct fw_xfer *xfer)
1203c1206
< if(xfer->send.payload != NULL){
---
> if (xfer->send.payload != NULL)
1205,1206c1208
< }
< if(xfer->recv.payload != NULL){
---
> if (xfer->recv.payload != NULL)
1208d1209
< }
1213c1214
< fw_xfer_free( struct fw_xfer* xfer)
---
> fw_xfer_free(struct fw_xfer *xfer)
1234c1235
< * To configure PHY.
---
> * To configure PHY.
1253c1254
< fp->mode.ld[1] |= (root_node & 0x3f) << 24 | 1 << 23;
---
> fp->mode.ld[1] |= (1 << 23) | (root_node & 0x3f) << 24;
1255c1256
< fp->mode.ld[1] |= 1 << 22 | (gap_count & 0x3f) << 16;
---
> fp->mode.ld[1] |= (1 << 22) | (gap_count & 0x3f) << 16;
1267c1268
< * Dump self ID.
---
> * Dump self ID.
1274,1275c1275,1276
< if ( s->p0.sequel ) {
< if ( s->p1.sequence_num == FW_SELF_ID_PAGE0 ) {
---
> if (s->p0.sequel) {
> if (s->p1.sequence_num == FW_SELF_ID_PAGE0) {
1277,1281c1278,1282
< "p8:%d p9:%d p10:%d\n",
< s->p1.phy_id, s->p1.port3, s->p1.port4,
< s->p1.port5, s->p1.port6, s->p1.port7,
< s->p1.port8, s->p1.port9, s->p1.port10);
< } else if (s->p2.sequence_num == FW_SELF_ID_PAGE1 ){
---
> "p8:%d p9:%d p10:%d\n",
> s->p1.phy_id, s->p1.port3, s->p1.port4,
> s->p1.port5, s->p1.port6, s->p1.port7,
> s->p1.port8, s->p1.port9, s->p1.port10);
> } else if (s->p2.sequence_num == FW_SELF_ID_PAGE1) {
1283,1284c1284,1285
< s->p2.phy_id, s->p2.port11, s->p2.port12,
< s->p2.port13, s->p2.port14, s->p2.port15);
---
> s->p2.phy_id, s->p2.port11, s->p2.port12,
> s->p2.port13, s->p2.port14, s->p2.port15);
1287c1288
< s->p1.phy_id, s->p1.sequence_num);
---
> s->p1.phy_id, s->p1.sequence_num);
1291,1295c1292,1296
< " p0:%d p1:%d p2:%d i:%d m:%d\n",
< s->p0.phy_id, s->p0.link_active, s->p0.gap_count,
< s->p0.phy_speed, s->p0.contender,
< s->p0.power_class, s->p0.port0, s->p0.port1,
< s->p0.port2, s->p0.initiated_reset, s->p0.more_packets);
---
> " p0:%d p1:%d p2:%d i:%d m:%d\n",
> s->p0.phy_id, s->p0.link_active, s->p0.gap_count,
> s->p0.phy_speed, s->p0.contender,
> s->p0.power_class, s->p0.port0, s->p0.port1,
> s->p0.port2, s->p0.initiated_reset, s->p0.more_packets);
1300c1301
< * To receive self ID.
---
> * To receive self ID.
1302c1303
< void fw_sidrcv(struct firewire_comm* fc, uint32_t *sid, u_int len)
---
> void fw_sidrcv(struct firewire_comm *fc, uint32_t *sid, u_int len)
1308c1309
< fc->sid_cnt = len /(sizeof(uint32_t) * 2);
---
> fc->sid_cnt = len / (sizeof(uint32_t) * 2);
1313c1314
< fc->topology_map->generation ++;
---
> fc->topology_map->generation++;
1315,1317c1316,1318
< fc->topology_map->node_count = 0;
< fc->speed_map->generation ++;
< fc->speed_map->crc_len = 1 + (64*64 + 3) / 4;
---
> fc->topology_map->node_count= 0;
> fc->speed_map->generation++;
> fc->speed_map->crc_len = 1 + (64 * 64 + 3) / 4;
1319c1320
< for(i = 0; i < fc->sid_cnt; i ++){
---
> for (i = 0; i < fc->sid_cnt; i++) {
1321,1322c1322,1323
< device_printf(fc->bdev, "%s: ERROR invalid self-id packet\n",
< __func__);
---
> device_printf(fc->bdev,
> "%s: ERROR invalid self-id packet\n", __func__);
1328,1329c1329,1330
< if(self_id->p0.sequel == 0){
< fc->topology_map->node_count ++;
---
> if (self_id->p0.sequel == 0) {
> fc->topology_map->node_count++;
1334c1335
< if(fc->max_node < node){
---
> if (fc->max_node < node)
1336d1336
< }
1338,1344c1338,1344
< fc->speed_map->speed[node][node]
< = self_id->p0.phy_speed;
< for (j = 0; j < node; j ++) {
< fc->speed_map->speed[j][node]
< = fc->speed_map->speed[node][j]
< = min(fc->speed_map->speed[j][j],
< self_id->p0.phy_speed);
---
> fc->speed_map->speed[node][node] =
> self_id->p0.phy_speed;
> for (j = 0; j < node; j++) {
> fc->speed_map->speed[j][node] =
> fc->speed_map->speed[node][j] =
> min(fc->speed_map->speed[j][j],
> self_id->p0.phy_speed);
1347c1347
< (self_id->p0.link_active && self_id->p0.contender)) {
---
> (self_id->p0.link_active && self_id->p0.contender))
1349,1350c1349
< }
< if(self_id->p0.port0 >= 0x2){
---
> if (self_id->p0.port0 >= 0x2)
1352,1353c1351
< }
< if(self_id->p0.port1 >= 0x2){
---
> if (self_id->p0.port1 >= 0x2)
1355,1356c1353
< }
< if(self_id->p0.port2 >= 0x2){
---
> if (self_id->p0.port2 >= 0x2)
1358d1354
< }
1360c1356
< if(c_port > 2){
---
> if (c_port > 2)
1362d1357
< }
1365c1360
< fc->topology_map->self_id_count ++;
---
> fc->topology_map->self_id_count++;
1369,1370c1364,1365
< (uint32_t *)&fc->topology_map->generation,
< fc->topology_map->crc_len * 4);
---
> (uint32_t *)&fc->topology_map->generation,
> fc->topology_map->crc_len * 4);
1372,1373c1367,1368
< (uint32_t *)&fc->speed_map->generation,
< fc->speed_map->crc_len * 4);
---
> (uint32_t *)&fc->speed_map->generation,
> fc->speed_map->crc_len * 4);
1382c1377
< bcopy(p, &CSRARC(fc, SPED_MAP + 8), (fc->speed_map->crc_len - 1)*4);
---
> bcopy(p, &CSRARC(fc, SPED_MAP + 8), (fc->speed_map->crc_len - 1) * 4);
1386,1389c1381,1383
< fc->max_node + 1, fc->max_hop,
< (fc->irm == -1) ? "Not IRM capable" : "cable IRM",
< fc->irm,
< (fc->irm == fc->nodeid) ? " (me) " : "");
---
> fc->max_node + 1, fc->max_hop,
> (fc->irm == -1) ? "Not IRM capable" : "cable IRM",
> fc->irm, (fc->irm == fc->nodeid) ? " (me) " : "");
1398,1399c1392,1393
< callout_reset(&fc->bmr_callout, hz/8,
< (void *)fw_try_bmr, (void *)fc);
---
> callout_reset(&fc->bmr_callout, hz / 8,
> fw_try_bmr, fc);
1404,1405c1398
< callout_reset(&fc->busprobe_callout, hz/4,
< (void *)fw_bus_probe, (void *)fc);
---
> callout_reset(&fc->busprobe_callout, hz / 4, fw_bus_probe, fc);
1409c1402
< * To probe devices on the IEEE1394 bus.
---
> * To probe devices on the IEEE1394 bus.
1412c1405
< fw_bus_probe(struct firewire_comm *fc)
---
> fw_bus_probe(void *arg)
1414c1407
< int s;
---
> struct firewire_comm *fc;
1415a1409
> int s;
1417a1412
> fc = arg;
1441c1436
< wakeup((void *)fc);
---
> wakeup(fc);
1452,1455c1447,1449
< for (i = 0; i < length; i ++, offset += sizeof(uint32_t)) {
< xfer = fwmem_read_quad(fwdev, NULL, -1,
< 0xffff, 0xf0000000 | offset, (void *)&tmp,
< fw_xferwake);
---
> for (i = 0; i < length; i++, offset += sizeof(uint32_t)) {
> xfer = fwmem_read_quad(fwdev, NULL, -1, 0xffff,
> 0xf0000000 | offset, &tmp, fw_xferwake);
1479c1473
< dir = (struct csrdirectory *)&fwdev->csrrom[offset/sizeof(uint32_t)];
---
> dir = (struct csrdirectory *)&fwdev->csrrom[offset / sizeof(uint32_t)];
1486c1480
< reg = (struct csrreg *)&fwdev->csrrom[offset/sizeof(uint32_t)];
---
> reg = (struct csrreg *)&fwdev->csrrom[offset / sizeof(uint32_t)];
1501c1495
< for (i = 0; i < dir->crc_len; i ++, offset += sizeof(uint32_t)) {
---
> for (i = 0; i < dir->crc_len; i++, offset += sizeof(uint32_t)) {
1512c1506
< return(-1);
---
> return (-1);
1545c1539,1540
< device_printf(fc->bdev, "%s: node%d: wrong bus info len(%d)\n",
---
> device_printf(fc->bdev,
> "%s: node%d: wrong bus info len(%d)\n",
1565,1572c1560,1567
< "irmc(%d) cmc(%d) isc(%d) bmc(%d) pmc(%d) "
< "cyc_clk_acc(%d) max_rec(%d) max_rom(%d) "
< "generation(%d) link_spd(%d)\n",
< __func__, node,
< binfo->irmc, binfo->cmc, binfo->isc,
< binfo->bmc, binfo->pmc, binfo->cyc_clk_acc,
< binfo->max_rec, binfo->max_rom,
< binfo->generation, binfo->link_spd);
---
> "irmc(%d) cmc(%d) isc(%d) bmc(%d) pmc(%d) "
> "cyc_clk_acc(%d) max_rec(%d) max_rom(%d) "
> "generation(%d) link_spd(%d)\n",
> __func__, node,
> binfo->irmc, binfo->cmc, binfo->isc,
> binfo->bmc, binfo->pmc, binfo->cyc_clk_acc,
> binfo->max_rec, binfo->max_rom,
> binfo->generation, binfo->link_spd);
1580c1575
< M_NOWAIT | M_ZERO);
---
> M_NOWAIT | M_ZERO);
1594c1589
< * the Bus Info block, so try and use the
---
> * the Bus Info block, so try and use the
1600c1595
< if ( binfo->link_spd == FWSPD_S100 /* 0 */) {
---
> if (binfo->link_spd == FWSPD_S100 /* 0 */) {
1602,1603c1597
< "Pre 1394a-2000 detected\n",
< __func__);
---
> "Pre 1394a-2000 detected\n", __func__);
1613c1607
< &speed_test, 1);
---
> &speed_test, 1);
1615,1618c1609,1611
< device_printf(fc->bdev, "%s: fwdev->speed(%s)"
< " decremented due to negotiation\n",
< __func__,
< linkspeed[fwdev->speed]);
---
> device_printf(fc->bdev,
> "%s: fwdev->speed(%s) decremented due to negotiation\n",
> __func__, linkspeed[fwdev->speed]);
1622c1615
<
---
>
1626c1619
< * If the fwdev is not found in the
---
> * If the fwdev is not found in the
1647c1640,1641
< device_printf(fc->dev, "node%d: crom unchanged\n", node);
---
> device_printf(fc->dev,
> "node%d: crom unchanged\n", node);
1705c1699
< for (node = 0; node <= fc->max_node; node ++) {
---
> for (node = 0; node <= fc->max_node; node++) {
1710,1711c1704,1705
< "found myself node(%d) fc->nodeid(%d) fc->max_node(%d)\n",
< __func__, node, fc->nodeid, fc->max_node);
---
> "found myself node(%d) fc->nodeid(%d) fc->max_node(%d)\n",
> __func__, node, fc->nodeid, fc->max_node);
1715,1716c1709,1710
< "node(%d) fc->max_node(%d) found\n",
< __func__, node, fc->max_node);
---
> "node(%d) fc->max_node(%d) found\n",
> __func__, node, fc->max_node);
1721,1722c1715,1717
< device_printf(fc->bdev, "%s: node%d: link down\n",
< __func__, node);
---
> device_printf(fc->bdev,
> "%s: node%d: link down\n",
> __func__, node);
1729c1724
< for (trys = 0; todo > 0 && trys < 3; trys ++) {
---
> for (trys = 0; todo > 0 && trys < 3; trys++) {
1731c1726
< for (i = 0; i < todo; i ++) {
---
> for (i = 0; i < todo; i++) {
1737,1738c1732,1734
< device_printf(fc->bdev, "%s: node %d, err = %d\n",
< __func__, node, err);
---
> device_printf(fc->bdev,
> "%s: node %d, err = %d\n",
> __func__, node, err);
1745d1740
<
1751c1746
< fc = (struct firewire_comm *)arg;
---
> fc = arg;
1787c1782
< fwdev->rcnt ++;
---
> fwdev->rcnt++;
1790,1791c1785,1786
< "fwdev->rcnt(%d), hold_count(%d)\n",
< __func__, fwdev->rcnt, hold_count);
---
> "fwdev->rcnt(%d), hold_count(%d)\n",
> __func__, fwdev->rcnt, hold_count);
1805,1807c1800,1802
< if( err == 0 ) {
< for( i = 0 ; i < devcnt ; i++){
< if (device_get_state(devlistp[i]) >= DS_ATTACHED) {
---
> if (err == 0) {
> for (i = 0; i < devcnt; i++) {
> if (device_get_state(devlistp[i]) >= DS_ATTACHED) {
1835,1836c1830,1831
< break;
< if(txfer == NULL) {
---
> break;
> if (txfer == NULL) {
1868c1863
< /* Copy header */
---
> /* Copy header */
1907d1901
<
1926c1920
< for( i = 0 ; i <= len && i < 32; i+= 4){
---
> for (i = 0; i <= len && i < 32; i+= 4) {
1928c1922
< if((i % 16) == 15) printf("\n");
---
> if ((i % 16) == 15) printf("\n");
1930c1924
< if((i % 16) != 15) printf("\n");
---
> if ((i % 16) != 15) printf("\n");
1942,1951c1936,1944
< if(rb->xfer == NULL) {
< device_printf(rb->fc->bdev, "%s: "
< "unknown response "
< "%s(%x) src=0x%x tl=0x%x rt=%d data=0x%x\n",
< __func__,
< tcode_str[tcode], tcode,
< fp->mode.hdr.src,
< fp->mode.hdr.tlrt >> 2,
< fp->mode.hdr.tlrt & 3,
< fp->mode.rresq.data);
---
> if (rb->xfer == NULL) {
> device_printf(rb->fc->bdev, "%s: unknown response "
> "%s(%x) src=0x%x tl=0x%x rt=%d data=0x%x\n",
> __func__,
> tcode_str[tcode], tcode,
> fp->mode.hdr.src,
> fp->mode.hdr.tlrt >> 2,
> fp->mode.hdr.tlrt & 3,
> fp->mode.rresq.data);
1955c1948
< (fp->mode.hdr.tlrt >> 2)^3);
---
> (fp->mode.hdr.tlrt >> 2)^3);
1984c1977,1978
< "unexpected flag 0x%02x\n", __func__, rb->xfer->flag);
---
> "unexpected flag 0x%02x\n", __func__,
> rb->xfer->flag);
1993,1994c1987,1988
< fp->mode.rreqq.dest_lo);
< if(bind == NULL){
---
> fp->mode.rreqq.dest_lo);
> if (bind == NULL) {
1996,2007c1990,1997
< "Unknown service addr 0x%04x:0x%08x %s(%x)"
< #if defined(__DragonFly__) || __FreeBSD_version < 500000
< " src=0x%x data=%lx\n",
< #else
< " src=0x%x data=%x\n",
< #endif
< __func__,
< fp->mode.wreqq.dest_hi,
< fp->mode.wreqq.dest_lo,
< tcode_str[tcode], tcode,
< fp->mode.hdr.src,
< ntohl(fp->mode.wreqq.data));
---
> "Unknown service addr 0x%04x:0x%08x %s(%x)"
> " src=0x%x data=%x\n",
> __func__,
> fp->mode.wreqq.dest_hi,
> fp->mode.wreqq.dest_lo,
> tcode_str[tcode], tcode,
> fp->mode.hdr.src,
> ntohl(fp->mode.wreqq.data));
2010,2011c2000,2002
< device_printf(rb->fc->bdev, "%s: cannot respond(bus reset)!\n",
< __func__);
---
> device_printf(rb->fc->bdev,
> "%s: cannot respond(bus reset)!\n",
> __func__);
2015c2006
< if(rb->xfer == NULL){
---
> if (rb->xfer == NULL) {
2046c2037
< if(fw_asyreq(rb->fc, -1, rb->xfer)){
---
> if (fw_asyreq(rb->fc, -1, rb->xfer))
2048,2050d2038
< return;
< }
< return;
2053c2041
< for (i = 0; i < rb->nvec; i ++)
---
> for (i = 0; i < rb->nvec; i++)
2058,2059c2046
< "Discard a packet for this bind.\n",
< __func__);
---
> "Discard a packet for this bind.\n", __func__);
2076c2063
< if(xferq->queued >= xferq->maxq) {
---
> if (xferq->queued >= xferq->maxq) {
2080c2067
< /* XXX get xfer from xfer queue, we don't need copy for
---
> /* XXX get xfer from xfer queue, we don't need copy for
2092,2094d2078
< #if defined(__DragonFly__) || __FreeBSD_version < 500000
< if (&xferq->rsel.si_pid != 0)
< #else
2096d2079
< #endif
2111c2094
< __func__, tcode);
---
> __func__, tcode);
2157c2140
< struct firewire_comm *fc = (struct firewire_comm *)arg;
---
> struct firewire_comm *fc = arg;
2162c2145
< if(xfer == NULL){
---
> if (xfer == NULL)
2164d2146
< }
2183c2165
< if(err){
---
> if (err) {
2193c2175
< * XXX:Too slow, usef for debug purpose only.
---
> * XXX:Too slow, useful for debug purpose only.
2196c2178,2179
< fw_vmaccess(struct fw_xfer *xfer){
---
> fw_vmaccess(struct fw_xfer *xfer)
> {
2201,2204c2184,2189
< xfer->spd, xfer->recv.len, ntohl(ld[0]), ntohl(ld[1]), ntohl(ld[2]), ntohl(ld[3]));
< printf("vmaccess data:%08x %08x %08x %08x\n", ntohl(ld[4]), ntohl(ld[5]), ntohl(ld[6]), ntohl(ld[7]));
< if(xfer->resp != 0){
< fw_xfer_free( xfer);
---
> xfer->spd, xfer->recv.len, ntohl(ld[0]), ntohl(ld[1]), ntohl(ld[2]),
> ntohl(ld[3]));
> printf("vmaccess data:%08x %08x %08x %08x\n", ntohl(ld[4]),
> ntohl(ld[5]), ntohl(ld[6]), ntohl(ld[7]));
> if (xfer->resp != 0) {
> fw_xfer_free(xfer);
2207,2208c2192,2193
< if(xfer->recv.buf == NULL){
< fw_xfer_free( xfer);
---
> if (xfer->recv.buf == NULL) {
> fw_xfer_free(xfer);
2212c2197
< switch(rfp->mode.hdr.tcode){
---
> switch (rfp->mode.hdr.tcode) {
2219c2204,2205
< (caddr_t)ntohl(rfp->mode.wreqb.dest_lo), ntohs(rfp->mode.wreqb.len));
---
> (caddr_t)ntohl(rfp->mode.wreqb.dest_lo),s
> ntohs(rfp->mode.wreqb.len));
2227c2213,2214
< *((uint32_t *)(ntohl(rfp->mode.wreqb.dest_lo))) = rfp->mode.wreqq.data;
---
> *((uint32_t *)(ntohl(rfp->mode.wreqb.dest_lo))) =
> rfp->mode.wreqq.data;
2231c2218,2219
< xfer->send.buf = malloc(16 + rfp->mode.rreqb.len, M_FW, M_NOWAIT);
---
> xfer->send.buf = malloc(16 + rfp->mode.rreqb.len,
> M_FW, M_NOWAIT);
2235c2223,2224
< sfp->mode.rresb.payload, (uint16_t)ntohs(rfp->mode.rreqb.len));
---
> sfp->mode.rresb.payload,
> ntohs(rfp->mode.rreqb.len));
2245c2234,2235
< sfp->mode.rresq.data = *(uint32_t *)(ntohl(rfp->mode.rreqq.dest_lo));
---
> sfp->mode.rresq.data =
> *(uint32_t *)(ntohl(rfp->mode.rreqq.dest_lo));
2250c2240
< fw_xfer_free( xfer);
---
> fw_xfer_free(xfer);
2264c2254
< #endif
---
> #endif
2270c2260,2261
< fw_crc16(uint32_t *ptr, uint32_t len){
---
> fw_crc16(uint32_t *ptr, uint32_t len)
> {
2274,2275c2265,2266
< for(i = 0 ; i < len ; i+= 4){
< for( shift = 28 ; shift >= 0 ; shift -= 4){
---
> for (i = 0; i < len; i += 4) {
> for (shift = 28; shift >= 0; shift -= 4) {
2277c2268
< crc = (crc << 4) ^ ( sum << 12 ) ^ ( sum << 5) ^ sum;
---
> crc = (crc << 4) ^ (sum << 12) ^ (sum << 5) ^ sum;
2281c2272
< return((uint16_t) crc);
---
> return ((uint16_t) crc);
2306c2297
< "root node is not cycle master capable\n");
---
> "root node is not cycle master capable\n");
2317c2308
< if(CSRARC(fc, BUS_MGR_ID) != fc->nodeid) {
---
> if (CSRARC(fc, BUS_MGR_ID) != fc->nodeid) {
2319c2310
< return(0);
---
> return (0);
2323c2314
< if(fc->max_hop <= MAX_GAPHOP )
---
> if (fc->max_hop <= MAX_GAPHOP)
2338c2329
< 0xffff, 0xf0000000 | STATE_SET, &quad, fw_asy_callback_free);
---
> 0xffff, 0xf0000000 | STATE_SET, &quad, fw_asy_callback_free);
2356c2347
< for (i = 0; i < fc->nisodma; i ++) {
---
> for (i = 0; i < fc->nisodma; i++) {
2375d2365
< #if defined(__FreeBSD__) && __FreeBSD_version >= 500000
2377d2366
< #endif
2381d2369
< #if defined(__FreeBSD__) && __FreeBSD_version >= 500000
2383,2384c2371
< fwdev_clone, 0, 1000);
< #endif
---
> fwdev_clone, 0, 1000);
2387d2373
< #if defined(__FreeBSD__) && __FreeBSD_version >= 500000
2390d2375
< #endif
2401,2404c2386,2387
< #ifdef __DragonFly__
< DECLARE_DUMMY_MODULE(firewire);
< #endif
< DRIVER_MODULE(firewire,fwohci,firewire_driver,firewire_devclass,fw_modevent,0);
---
> DRIVER_MODULE(firewire, fwohci, firewire_driver, firewire_devclass,
> fw_modevent,0);