~ubuntu-branches/ubuntu/maverick/vice/maverick

« back to all changes in this revision

Viewing changes to src/c64/tfe.c

  • Committer: Bazaar Package Importer
  • Author(s): Zed Pobre
  • Date: 2005-02-01 11:30:26 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050201113026-3eyakzsmmheclvjg
Tags: 1.16-1
* New upstream version
* Fixes crash on 64-bit architectures (closes: #287640)
* x128 working again (closes: #286767)
* Works fine with /dev/dsp in use (not in the main changelog, but tested
  on my local machine as working).  Presumably, this also takes care of
  the issue with dsp being held.  I'm not sure if this is because I'm
  testing it on a 2.6 kernel now -- if you are still having problems
  with /dev/dsp, please reopen the bugs. (closes: #152952, #207942)
* Don't kill Makefile.in on clean

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * tfe.c - TFE ("The final ethernet" emulation.
 
2
 * tfe.c - TFE ("The final ethernet") emulation.
3
3
 *
4
4
 * Written by
5
 
 *  Spiro Trikaliotis <trik-news@gmx.de>
 
5
 *  Spiro Trikaliotis <Spiro.Trikaliotis@gmx.de>
6
6
 * 
7
7
 * This file is part of VICE, the Versatile Commodore Emulator.
8
8
 * See README for copyright notice.
33
33
#include <stdlib.h>
34
34
#include <string.h>
35
35
 
 
36
#include "archdep.h"
 
37
#include "c64export.h"
36
38
#include "cmdline.h"
 
39
#include "crc32.h"
37
40
#include "lib.h"
38
41
#include "log.h"
39
42
#include "resources.h"
 
43
#include "snapshot.h"
40
44
#include "tfe.h"
41
45
#include "tfearch.h"
42
46
#include "snapshot.h"
46
50
/**/
47
51
/** #define TFE_DEBUG_DUMP 1 **/
48
52
 
 
53
/* #define TFE_DEBUG_FRAMES - might be defined in TFE.H! */
 
54
 
49
55
#define TFE_DEBUG_WARN 1 /* this should not be deactivated */
50
56
/** #define TFE_DEBUG_INIT 1 **/
51
57
/** #define TFE_DEBUG_LOAD 1 **/
55
61
/* ------------------------------------------------------------------------- */
56
62
/*    variables needed                                                       */
57
63
 
 
64
/*
 
65
 This variable is used when we need to postpone the initialization
 
66
 because tfe_init() is not yet called
 
67
*/
 
68
static int should_activate = 0;
 
69
 
 
70
 
58
71
static log_t tfe_log = LOG_ERR;
59
72
 
60
73
/* status which received packages to accept 
83
96
static int tfe_cannot_use = 0;
84
97
 
85
98
/* Flag: Do we have the TFE enabled?  */
86
 
int tfe_enabled;
 
99
int tfe_enabled = 0;
87
100
 
88
101
/* Flag: Do we use the "original" memory map or the memory map of the RR-Net? */
89
102
static int tfe_as_rr_net = 0;
280
293
 
281
294
/* ------------------------------------------------------------------------- */
282
295
/*    debugging functions                                                    */
 
296
 
 
297
#ifdef TFE_DEBUG_FRAMES
 
298
 
 
299
static int TfeDebugMaxFrameLengthToDump = 150;
 
300
 
 
301
char *debug_outbuffer(const int length, const unsigned char * const buffer)
 
302
{
 
303
#define MAXLEN_DEBUG 1600
 
304
 
 
305
    int i;
 
306
    static char outbuffer[MAXLEN_DEBUG*4+1];
 
307
    char *p = outbuffer;
 
308
 
 
309
    assert( TfeDebugMaxFrameLengthToDump <= MAXLEN_DEBUG );
 
310
    
 
311
    *p = 0;
 
312
 
 
313
    for (i=0; i<TfeDebugMaxFrameLengthToDump; i++) {
 
314
        if (i>=length)
 
315
            break;
 
316
    
 
317
        sprintf( p, "%02X%c", buffer[i], ((i+1)%16==0)?'*':(((i+1)%8==0)?'-':' '));
 
318
        p+=3;
 
319
    }
 
320
 
 
321
    return outbuffer;
 
322
}
 
323
 
 
324
#endif
 
325
 
 
326
 
283
327
#ifdef TFE_DEBUG_DUMP
284
328
 
285
329
#define NUMBER_PER_LINE 8
349
393
/* ------------------------------------------------------------------------- */
350
394
/*    initialization and deinitialization functions                          */
351
395
 
352
 
void tfe_init(void)
353
 
{
354
 
    tfe_log = log_open("TFE");
355
 
 
356
 
    if (!tfe_arch_init()) {
357
 
        tfe_enabled = 0;
358
 
        tfe_cannot_use = 1;
359
 
    }
360
 
}
361
 
 
362
396
void tfe_reset(void)
363
397
{
364
 
    if (tfe_enabled)
 
398
    if (tfe_enabled && !should_activate)
365
399
    {
366
400
        assert( tfe );
367
401
        assert( tfe_packetpage );
420
454
}
421
455
 
422
456
static
423
 
int tfe_activate(void)
 
457
int tfe_activate_i(void)
424
458
{
425
459
    assert( tfe == NULL );
426
460
    assert( tfe_packetpage == NULL );
427
461
 
 
462
#ifdef TFE_DEBUG
 
463
    log_message( tfe_log, "tfe_activate_i()." );
 
464
#endif
 
465
 
428
466
    /* allocate memory for visible IO register */
429
467
    tfe = lib_malloc( TFE_COUNT_IO_REGISTER );
430
468
    if (tfe==NULL)
431
469
    {
432
470
#ifdef TFE_DEBUG_INIT
433
 
        log_message(tfe_log, "tfe_activate: Allocating tfe failed.");
 
471
        log_message(tfe_log, "tfe_activate_i: Allocating tfe failed.");
434
472
#endif
435
473
        tfe_enabled = 0;
436
474
        return 0;
451
489
 
452
490
#ifdef TFE_DEBUG_INIT
453
491
    log_message(tfe_log, "tfe_activate: Allocated memory successfully.");
454
 
    log_message(tfe_log, "\ttfe at 0x%08X, tfe_packetpage at 0x%08X", tfe, tfe_packetpage );
 
492
    log_message(tfe_log, "\ttfe at $%08X, tfe_packetpage at $%08X", tfe, tfe_packetpage );
455
493
#endif
456
494
 
457
495
    if (!tfe_arch_activate(tfe_interface)) {
464
502
        return 0;
465
503
    }
466
504
 
467
 
        return 0;
 
505
    /* virtually reset the LAN chip */
 
506
    tfe_reset();
 
507
 
 
508
    return 0;
468
509
}
469
510
 
470
511
static
471
 
int tfe_deactivate(void)
 
512
int tfe_deactivate_i(void)
472
513
{
 
514
#ifdef TFE_DEBUG
 
515
    log_message( tfe_log, "tfe_deactivate_i()." );
 
516
#endif
 
517
 
473
518
    assert(tfe && tfe_packetpage);
474
519
 
475
520
    tfe_arch_deactivate();
481
526
        return 0;
482
527
}
483
528
 
 
529
static
 
530
int tfe_activate(void) {
 
531
#ifdef TFE_DEBUG
 
532
    log_message( tfe_log, "tfe_activate()." );
 
533
#endif
 
534
 
 
535
    if (tfe_log != LOG_ERR) {
 
536
        return tfe_activate_i();
 
537
    }
 
538
    else {
 
539
        should_activate = 1;
 
540
    }
 
541
    return 0;
 
542
}
 
543
 
 
544
static
 
545
int tfe_deactivate(void) {
 
546
#ifdef TFE_DEBUG
 
547
    log_message( tfe_log, "tfe_deactivate()." );
 
548
#endif
 
549
 
 
550
    if (should_activate)
 
551
        should_activate = 0;
 
552
    else {
 
553
        if (tfe_log != LOG_ERR)
 
554
            return tfe_deactivate_i();
 
555
    }
 
556
 
 
557
    return 0;
 
558
}
 
559
 
 
560
void tfe_init(void)
 
561
{
 
562
    tfe_log = log_open("TFE");
 
563
 
 
564
    if (!tfe_arch_init()) {
 
565
        tfe_enabled = 0;
 
566
        tfe_cannot_use = 1;
 
567
    }
 
568
 
 
569
    if (should_activate) {
 
570
        should_activate = 0;
 
571
        if (tfe_activate() < 0) {
 
572
            tfe_enabled = 0;
 
573
            tfe_cannot_use = 1;
 
574
        }
 
575
    }
 
576
}
 
577
 
484
578
void tfe_shutdown(void)
485
579
{
486
580
    assert( (tfe && tfe_packetpage) || (!tfe && !tfe_packetpage));
487
581
 
488
582
    if (tfe)
489
583
        tfe_deactivate();
 
584
 
 
585
    if (tfe_interface != NULL)
 
586
        lib_free(tfe_interface);
490
587
}
491
588
 
492
589
 
509
606
*/
510
607
 
511
608
 
512
 
/* This is a helper for tfe_should_accept(), since that one 
513
 
   needs a CRC32 value 
514
 
*/
515
 
static
516
 
unsigned long crc32(const char *buffer, unsigned int len) 
517
 
{
518
 
    unsigned int i;
519
 
    unsigned long crc;
520
 
    unsigned long crc_result;
521
 
 
522
 
    const char *pbuffer = buffer;
523
 
 
524
 
    crc = 0xFFFFFFFF;
525
 
 
526
 
    /* perform on every byte of the buffer */
527
 
    for (i=0; i<len; i++ )
528
 
    {
529
 
        int act_byte = *pbuffer++;
530
 
        unsigned int j;
531
 
 
532
 
        /* now, perform on every bit of this byte */
533
 
        for (j=8; j; j-- ) {
534
 
 
535
 
            int highest_bit = crc >> 31;
536
 
            crc <<= 1;
537
 
 
538
 
            if (highest_bit ^ (act_byte & 1)) {
539
 
                crc ^= 0x04C11DB6;
540
 
                crc |= 1;
541
 
            }
542
 
 
543
 
            act_byte >>= 1;
544
 
        }
545
 
    }
546
 
 
547
 
    /* Unfortunately, our CRC has wrong order. Reverse it */
548
 
    crc_result = 0;
549
 
 
550
 
    for (i=0; i<32; i++) {
551
 
        crc_result = (crc_result << 1) | (crc & 1);
552
 
        crc >>= 1;
553
 
    }
554
 
 
555
 
    return crc_result;
556
 
}
557
 
 
 
609
#ifdef TFE_DEBUG_FRAMES
 
610
    #define return( _x_ ) \
 
611
    { \
 
612
        int retval = _x_; \
 
613
        \
 
614
        log_message(tfe_log, "%s correct_mac=%u, broadcast=%u, multicast=%u, hashed=%u, hash_index=%u", (retval? "+++ ACCEPTED":"--- rejected"), *pcorrect_mac, *pbroadcast, *pmulticast, *phashed, *phash_index); \
 
615
        \
 
616
        return retval; \
 
617
    }
 
618
 
 
619
#endif
558
620
/*
559
621
 This is a helper for tfe_receive() to determine if the received frame should be accepted
560
622
 according to the settings.
571
633
 
572
634
    /* first of all, delete any status */
573
635
    *phashed      = 0;
 
636
    *phash_index  = 0;
574
637
    *pcorrect_mac = 0;
575
638
    *pbroadcast   = 0;
 
639
    *pmulticast   = 0;
 
640
 
 
641
#ifdef TFE_DEBUG_FRAMES
 
642
    log_message(tfe_log, "tfe_should_accept called with %02X:%02X:%02X:%02X:%02X:%02X, length=%4u and buffer %s", 
 
643
        tfe_ia_mac[0], tfe_ia_mac[1], tfe_ia_mac[2],
 
644
        tfe_ia_mac[3], tfe_ia_mac[4], tfe_ia_mac[5],
 
645
        length,
 
646
        debug_outbuffer(length, buffer)
 
647
        );
 
648
#endif
 
649
 
576
650
 
577
651
    if (   buffer[0]==tfe_ia_mac[0]
578
652
        && buffer[1]==tfe_ia_mac[1]
589
663
         * that this address fits the hash index 
590
664
         */
591
665
        if (tfe_recv_mac || tfe_recv_promiscuous) 
592
 
            return 1;
 
666
            return(1);
593
667
    }
594
668
 
595
669
    if (   buffer[0]==0xFF
603
677
        *pbroadcast = 1;
604
678
 
605
679
        /* broadcasts cannot be accepted by the hash filter */
606
 
        return (tfe_recv_broadcast || tfe_recv_promiscuous) ? 1 : 0;
 
680
            return((tfe_recv_broadcast || tfe_recv_promiscuous) ? 1 : 0);
607
681
    }
608
682
 
609
683
        /* now check if DA passes the hash filter */
610
 
    hashreg = (crc32(buffer,6) >> 26) & 0x3F;
 
684
    hashreg = (~crc32_buf(buffer,6) >> 26) & 0x3F;
611
685
 
612
686
    *phashed = (tfe_hash_mask[(hashreg>=32)?1:0] & (1 << (hashreg&0x1F))) ? 1 : 0;
613
687
    if (*phashed) {
622
696
             */
623
697
            *phashed = 0;
624
698
 
625
 
            return (tfe_recv_multicast || tfe_recv_promiscuous) ? 1 : 0;
 
699
            return((tfe_recv_multicast || tfe_recv_promiscuous) ? 1 : 0);
626
700
        }
627
 
        return (tfe_recv_hashfilter || tfe_recv_promiscuous) ? 1 : 0;
 
701
        return((tfe_recv_hashfilter || tfe_recv_promiscuous) ? 1 : 0);
628
702
    }
629
703
       
630
 
    return tfe_recv_promiscuous ? 1 : 0;
 
704
    return(tfe_recv_promiscuous ? 1 : 0);
631
705
}
632
706
 
 
707
#ifdef TFE_DEBUG_FRAMES
 
708
    #undef return
 
709
#endif
 
710
 
633
711
static 
634
712
WORD tfe_receive(void)
635
713
{
637
715
 
638
716
    BYTE buffer[MAX_RXLENGTH];
639
717
 
640
 
    int  len         = MAX_RXLENGTH;
 
718
    int  len;
641
719
    int  hashed;
642
720
    int  hash_index;
643
721
    int  rx_ok;
650
728
 
651
729
    int  ready;
652
730
 
 
731
#ifdef TFE_DEBUG_FRAMES
 
732
    log_message( tfe_log, "");
 
733
#endif
 
734
 
653
735
    do {
 
736
        len = MAX_RXLENGTH;
 
737
 
654
738
        ready = 1 ; /* assume we will find a good frame */
655
739
 
656
740
        newframe = tfe_arch_receive(
669
753
        if (newframe) {
670
754
            if (hashed || correct_mac || broadcast) {
671
755
                /* we already know the type of frame: Trust it! */
 
756
#ifdef TFE_DEBUG_FRAMES
 
757
                log_message( tfe_log, "+++ tfe_receive(): *** hashed=%u, correct_mac=%u, "
 
758
                    "broadcast=%u", hashed, correct_mac, broadcast);
 
759
#endif
672
760
            }
673
761
            else {
674
762
                /* determine ourself the type of frame */
728
816
        }
729
817
    } while (!ready);
730
818
 
 
819
#ifdef TFE_DEBUG_FRAMES
 
820
    if (ret_val != 0x0004)
 
821
        log_message( tfe_log, "+++ tfe_receive(): ret_val=%04X", ret_val);
 
822
#endif
 
823
 
731
824
    return ret_val;
732
825
}
733
826
 
755
848
            /* clear BusST */
756
849
            SET_PP_16(TFE_PP_ADDR_SE_BUSST, busst & ~0x180);
757
850
 
 
851
#ifdef TFE_DEBUG_FRAMES
 
852
            log_message(tfe_log, "tfe_arch_transmit() called with:                 "
 
853
                "length=%4u and buffer %s", txlen,
 
854
                debug_outbuffer(txlen, &tfe_packetpage[TFE_PP_ADDR_TX_FRAMELOC])
 
855
                );
 
856
#endif
 
857
 
758
858
            tfe_arch_transmit(
759
859
                txcmd & 0x0100 ? 1 : 0,   /* FORCE: Delete waiting frames in transmit buffer */
760
860
                txcmd & 0x0200 ? 1 : 0,   /* ONECOLL: Terminate after just one collision */
1056
1156
    case TFE_ADDR_PP_DATA+1:
1057
1157
        /* make sure the TFE register have the correct content */
1058
1158
        {
1059
 
            WORD ppaddress = tfe_packetpage_ptr;
1060
 
 
1061
 
            if (ppaddress >= MAX_PACKETPAGE_ARRAY)
1062
 
            {
1063
 
                /* FIXME: @SRT What is the real behaviour in such condition? */
1064
 
#ifdef TFE_DEBUG_WARN
1065
 
                log_message(tfe_log, 
1066
 
                "WARNING! Reading PacketPage beyond MAX_PACKETPAGE_ARRAY: %04X"
1067
 
                "Performing \"wrap around\".", ppaddress);
1068
 
#endif
1069
 
                        ppaddress &= MAX_PACKETPAGE_ARRAY-1;
1070
 
                }
 
1159
            WORD ppaddress = tfe_packetpage_ptr & (MAX_PACKETPAGE_ARRAY-1);
1071
1160
 
1072
1161
            /* perform side-effects the read may perform */
1073
1162
            tfe_sideeffects_read_pp( ppaddress );
1074
1163
 
1075
1164
            /* [3] make sure the data matches the real value - [1] assumes this! */
1076
 
            SET_TFE_16( TFE_ADDR_PP_DATA,    GET_PP_16(ppaddress) );
 
1165
            SET_TFE_16( TFE_ADDR_PP_DATA, GET_PP_16(ppaddress) );
1077
1166
        }
1078
1167
 
1079
1168
 
1080
1169
#ifdef TFE_DEBUG_LOAD
1081
 
        log_message(tfe_log, "reading PP Ptr: 0x%04X => 0x%04X.", 
 
1170
        log_message(tfe_log, "reading PP Ptr: $%04X => $%04X.", 
1082
1171
            tfe_packetpage_ptr, GET_PP_16(tfe_packetpage_ptr) );
1083
1172
#endif
1084
1173
 
1200
1289
        tfe_packetpage_ptr = GET_TFE_16(TFE_ADDR_PP_PTR);
1201
1290
 
1202
1291
#ifdef TFE_DEBUG_STORE
1203
 
        log_message(tfe_log, "set PP Ptr to 0x%04X.", tfe_packetpage_ptr);
 
1292
        log_message(tfe_log, "set PP Ptr to $%04X.", tfe_packetpage_ptr);
1204
1293
#endif
1205
1294
 
 
1295
        if ((tfe_packetpage_ptr & 1) != 0) {
 
1296
 
 
1297
#ifdef TFE_DEBUG_WARN
 
1298
            log_message(tfe_log,
 
1299
                "WARNING! PacketPage register set to odd address $%04X (not allowed!)",
 
1300
                tfe_packetpage_ptr );
 
1301
#endif /* #ifdef TFE_DEBUG_WARN */
 
1302
 
 
1303
            /* "correct" the address to the next lower address 
 
1304
             REMARK: I don't know how a real cs8900a will behave in this case,
 
1305
                     since it is not allowed. Nevertheless, this "correction"
 
1306
                     prevents assert()s to fail.
 
1307
            */
 
1308
            tfe_packetpage_ptr -= 1;
 
1309
        }
 
1310
 
1206
1311
        /*
1207
1312
         [1] The TFE_ADDR_PP_DATA does not need to be modified here,
1208
1313
         since it will be modified just before a read or store operation
1213
1318
 
1214
1319
    case TFE_ADDR_PP_DATA:
1215
1320
    case TFE_ADDR_PP_DATA+1:
 
1321
 
 
1322
        {
 
1323
            WORD ppaddress = tfe_packetpage_ptr & (MAX_PACKETPAGE_ARRAY-1);
 
1324
 
1216
1325
#ifdef TFE_DEBUG_STORE
1217
 
        log_message(tfe_log, "before writing to PP Ptr: 0x%04X <= 0x%04X.", 
1218
 
            tfe_packetpage_ptr, GET_PP_16(tfe_packetpage_ptr) );
1219
 
#endif
1220
 
 
1221
 
        {
1222
 
            WORD ppaddress = tfe_packetpage_ptr;
1223
 
 
1224
 
            if (ppaddress >= MAX_PACKETPAGE_ARRAY)
1225
 
            {
1226
 
                /* FIXME: @SRT What is the real behaviour in such condition? */
1227
 
#ifdef TFE_DEBUG_WARN
1228
 
                log_message(tfe_log, 
1229
 
                    "WARNING! Writing PacketPage beyond MAX_PACKETPAGE_ARRAY: %04X."
1230
 
                    "Performing \"wrap around\".", ppaddress);
1231
 
#endif
1232
 
                        ppaddress &= MAX_PACKETPAGE_ARRAY-1;
1233
 
                }
1234
 
 
 
1326
            log_message(tfe_log, "before writing to PP Ptr: $%04X <= $%04X.", 
 
1327
                ppaddress, GET_PP_16(ppaddress) );
 
1328
#endif
1235
1329
            {
1236
1330
                register WORD tmpIoAddr = ioaddress & ~1; /* word-align the address */
1237
 
                SET_PP_16(tfe_packetpage_ptr, GET_TFE_16(tmpIoAddr));
 
1331
                SET_PP_16(ppaddress, GET_TFE_16(tmpIoAddr));
1238
1332
            }
1239
1333
 
1240
1334
            /* perform side-effects the write may perform */
1241
1335
            /* the addresses are always aligned on the whole 16-bit-word */
1242
 
            tfe_sideeffects_write_pp(tfe_packetpage_ptr, ioaddress-TFE_ADDR_PP_DATA);
1243
 
        }
1244
 
 
 
1336
            tfe_sideeffects_write_pp(ppaddress, ioaddress-TFE_ADDR_PP_DATA);
1245
1337
 
1246
1338
#ifdef TFE_DEBUG_STORE
1247
 
        log_message(tfe_log, "after  writing to PP Ptr: 0x%04X <= 0x%04X.", 
1248
 
            tfe_packetpage_ptr, GET_PP_16(tfe_packetpage_ptr) );
 
1339
            log_message(tfe_log, "after  writing to PP Ptr: $%04X <= $%04X.", 
 
1340
                ppaddress, GET_PP_16(ppaddress) );
1249
1341
#endif
 
1342
        }
1250
1343
        break;
1251
1344
    }
1252
1345
 
1256
1349
 
1257
1350
/* ------------------------------------------------------------------------- */
1258
1351
/*    resources support functions                                            */
 
1352
static const c64export_resource_t export_res = {
 
1353
    "TFE", 1, 0, 0, 0
 
1354
};
1259
1355
 
1260
1356
static
1261
1357
int set_tfe_disabled(resource_value_t v, void *param)
1278
1374
        } else { 
1279
1375
            if (!tfe_as_rr_net) {
1280
1376
                tfe_as_rr_net = 1;
1281
 
                                tfe_enabled = 1;
 
1377
                tfe_enabled = 1;
1282
1378
            }
1283
1379
 
1284
1380
            /* virtually reset the LAN chip */
1285
 
            tfe_reset();
 
1381
            if (tfe) {
 
1382
                tfe_reset();
 
1383
            }
1286
1384
            return 0;
1287
1385
        }
1288
1386
 
1296
1394
    if (!tfe_cannot_use) {
1297
1395
 
1298
1396
        if (!(int)v) {
1299
 
                    /* TFE should be deactived */
 
1397
            /* TFE should be deactived */
1300
1398
            if (tfe_enabled) {
1301
1399
                tfe_enabled = 0;
1302
 
                                tfe_as_rr_net = 0;
 
1400
                c64export_remove(&export_res);
1303
1401
                if (tfe_deactivate() < 0) {
1304
1402
                    return -1;
1305
1403
                }
1307
1405
            return 0;
1308
1406
        } else { 
1309
1407
            if (!tfe_enabled) {
 
1408
                if (c64export_query(&export_res) < 0)
 
1409
                    return -1;
 
1410
 
1310
1411
                tfe_enabled = 1;
1311
1412
                if (tfe_activate() < 0) {
1312
1413
                    return -1;
1313
1414
                }
 
1415
 
 
1416
                if (c64export_add(&export_res) < 0)
 
1417
                    return -1;
 
1418
 
1314
1419
            }
1315
1420
 
1316
 
            /* virtually reset the LAN chip */
1317
 
            tfe_reset();
1318
1421
            return 0;
1319
1422
        }
1320
1423
 
1346
1449
        }
1347
1450
 
1348
1451
        /* virtually reset the LAN chip */
1349
 
        tfe_reset();
 
1452
        if (tfe) {
 
1453
            tfe_reset();
 
1454
        }
1350
1455
    }
1351
1456
    return 0;
1352
1457
}
1360
1465
      (void *)&tfe_enabled, set_tfe_enabled, NULL },
1361
1466
    { "ETHERNET_AS_RR", RES_INTEGER, (resource_value_t)0,
1362
1467
      (void *)&tfe_as_rr_net, set_tfe_rr_net, NULL },
1363
 
    { "ETHERNET_INTERFACE", RES_STRING, (resource_value_t)"",
 
1468
    { "ETHERNET_INTERFACE", RES_STRING,
 
1469
      (resource_value_t)ARCHDEP_ETHERNET_DEFAULT_DEVICE,
1364
1470
      (void *)&tfe_interface, set_tfe_interface, NULL },
1365
1471
    { NULL }
1366
1472
};