forked from LinuxCNC/mesaflash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pci_boards.c
1329 lines (1186 loc) · 52.2 KB
/
pci_boards.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//
// Copyright (C) 2013-2014 Michael Geszkiewicz
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
#ifdef __linux__
#include <sys/mman.h>
#include <sys/io.h>
#include <pci/pci.h>
#elif _WIN32
#include <windows.h>
#include "libpci/pci.h"
#endif
#include <assert.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "types.h"
#include "common.h"
#include "eeprom.h"
#include "eeprom_local.h"
#include "bitfile.h"
#include "pci_boards.h"
extern board_t boards[MAX_BOARDS];
extern int boards_count;
static int memfd = -1;
struct pci_access *pacc;
static u8 file_buffer[SECTOR_SIZE];
u16 setup_eeprom_5i20[256] = {
0x9030, // DEVICE ID
0x10B5, // VENDOR ID
0x0290, // PCI STATUS
0x0000, // PCI COMMAND
0x1180, // CLASS CODE (Changed to Data Acq to fool some BIOSs)
0x0000, // CLASS CODE / REV
0x3131, // SUBSYSTEM ID
0x10B5, // SUBSYSTEM VENDOR ID
0x0000, // MSB NEW CAPABILITY POINTER
0x0040, // LSB NEW CAPABILITY POINTER
0x0000, // RESERVED
0x0100, // INTERRUPT PIN
0x0000, // MSW OF POWER MANAGEMENT CAPABILITIES
0x0000, // LSW OF POWER MANAGEMANT CAPABILITIES
0x0000, // MSW OF POWER MANAGEMENT DATA / PMCSR BRIDGE SUPPORT EXTENSION
0x0000, // LSW OF POWER MANAGEMENT CONTROL STATUS
0x0000, // MSW OF HOT SWAP CONTROL / STATUS
0x0000, // LSW OF HOTSWAP NEXT CAPABILITY POINTER / HOT SWAP CONTROL
0x0000, // PCI VITAL PRODUCT DATA ADDRESS
0x0000, // PCI VITAL PRODUCT NEXT CAPABILITY POINTER / PCI VITAL PRODUCT DATA CONTROL
0x0FFF, // MSW OF LOCAL ADDRESS SPACE 0 RANGE
0xFF01, // LSW OF LOCAL ADDRESS SPACE 0 RANGE
0x0FFF, // MSW OF LOCAL ADDRESS SPACE 1 RANGE
0xFF01, // LSW OF LOCAL ADDRESS SPACE 1 RANGE
0x0FFF, // MSW OF LOCAL ADDRESS SPACE 2 RANGE
0x0000, // LSW OF LOCAL ADDRESS SPACE 2 RANGE
0x0FFF, // MSW OF LOCAL ADDRESS SPACE 3 RANGE
0x0000, // LSW OF LOCAL ADDRESS SPACE 3 RANGE
0x0000, // MSW OF EXPANSION ROM RANGE
0x0000, // LSW OF EXPANSION ROM RANGE
0x0000, // MSW OF LOCAL ADDRESS SPACE 0 LOCAL BASE ADDRESS (REMAP)
0x0001, // LSW OF LOCAL ADDRESS SPACE 0 LOCAL BASE ADDRESS (REMAP)
0x0000, // MSW OF LOCAL ADDRESS SPACE 1 LOCAL BASE ADDRESS (REMAP)
0x0001, // LSW OF LOCAL ADDRESS SPACE 1 LOCAL BASE ADDRESS (REMAP)
0x0000, // MSW OF LOCAL ADDRESS SPACE 2 LOCAL BASE ADDRESS (REMAP)
0x0001, // LSW OF LOCAL ADDRESS SPACE 2 LOCAL BASE ADDRESS (REMAP)
0x0000, // MSW OF LOCAL ADDRESS SPACE 3 LOCAL BASE ADDRESS (REMAP)
0x0001, // LSW OF LOCAL ADDRESS SPACE 3 LOCAL BASE ADDRESS (REMAP)
0x0000, // MSW OF EXPANSION ROM LOCAL BASE ADDRESS (REMAP)
0x0000, // LSW OF EXPANSION ROM LOCAL BASE ADDRESS (REMAP)
0x0040, // MSW OF LOCAL ADDRESS SPACE 0 BUS DESCRIPTOR
0x0002, // LSW OF LOCAL ADDRESS SPACE 0 BUS DESCRIPTOR
0x0080, // MSW OF LOCAL ADDRESS SPACE 1 BUS DESCRIPTOR
0x0002, // LSW OF LOCAL ADDRESS SPACE 1 BUS DESCRIPTOR
0x0040, // MSW OF LOCAL ADDRESS SPACE 2 BUS DESCRIPTOR
0x0002, // LSW OF LOCAL ADDRESS SPACE 2 BUS DESCRIPTOR
0x0080, // MSW OF LOCAL ADDRESS SPACE 3 BUS DESCRIPTOR
0x0002, // LSW OF LOCAL ADDRESS SPACE 3 BUS DESCRIPTOR
0x0000, // MSW OF EXPANSION ROM BUS DESCRIPTOR
0x0002, // LSW OF EXPANSION ROM BUS DESCRIPTOR
0x0000, // MSW OF CHIP SELECT 0 BASE ADDRESS
0x0000, // LSW OF CHIP SELECT 0 BASE ADDRESS
0x0000, // MSW OF CHIP SELECT 1 BASE ADDRESS
0x0000, // LSW OF CHIP SELECT 1 BASE ADDRESS
0x0000, // MSW OF CHIP SELECT 2 BASE ADDRESS
0x0000, // LSW OF CHIP SELECT 2 BASE ADDRESS
0x0000, // MSW OF CHIP SELECT 3 BASE ADDRESS
0x0000, // LSW OF CHIP SELECT 3 BASE ADDRESS
0x0000, // SERIAL EEPROM WRITE PROTECTED ADDRESS BOUNDARY
0x0041, // LSW OF INTERRUPT CONTROL / STATUS
0x0878, // MSW OF PCI TARGET RESPONSE, SERIAL EEPROM, AND INITIALIZATION CONTROL
0x0000, // LSW OF PCI TARGET RESPONSE, SERIAL EEPROM, AND INITIALIZATION CONTROL
0x024B, // MSW OF GENERAL PURPOSE I/O CONTROL
0x009B, // LSW OF GENERAL PURPOSE I/O CONTROL
};
u16 setup_eeprom_3x20_10[256] = {
0x9056, // DEVICE ID PCIIDR[31:16]
0x10B5, // VENDOR ID PCIIDR[15:0]
0x0680, // CLASS CODE PCICCR[23:8]
0x0000, // CLASS CODE/REVISION PCICCR[7:0]/PCIREV[7:0]
0x0000, // MAXIMUM LATENCY/MINIMUM GRANT PCIMLR[7:0]/PCIMGR[7:0]
0x0100, // INTERRUPT PIN/INTERRUPT PIN ROUTING PCIIPR[7:0]/PCIIL[7:0]
0x0000, // MSW OF MAILBOX0 MBOX0[31:16]
0x0000, // LSW OF MAILBOX0 MBOX0[15:0]
0x0000, // MSW OF MAILBOX1 MBOX1[31:16]
0x0000, // LSW OF MAILBOX1 MBOX1[15:0]
0xFFFF, // MSW OF PCI-LOCAL RANGE0 LAS0RR[31:16]
0xFF01, // LSW OF PCI-LOCAL RANGE0 LAS0RR[15:0]
0x0000, // MSW OF PCI-LOCAL REMAP0 LAS0BA[31:16]
0x0001, // LSW OF PCI-LOCAL REMAP0 LAS0BA[15:0]
0x0200, // MSW OF DMA ARBITRATION REGISTER MARBR[31:16]
0x0000, // LSW OF DMA ARBITRATION REGISTER MARBR[15:0]
0x0030, // MSW OF SERIAL EEPROM WP ADDRESS PROT_AREA[15:0]
0x0500, // LSW OF MISC CONT REG/LSW OF BIG/LITTLE REG LMISC[7:0]/BIGEND[7:0]
0xFFFF, // MSW OF PCI EXPANSION ROM RANGE EROMRR[31:16]
0x0000, // LSW OF PCI EXPANSION ROM RANGE EROMRR[15:0]
0x0000, // MSW OF PCI EXPANSION ROM REMAP EROMBA[31:16]
0x0000, // LSW OF PCI EXPANSION ROM REMAP EROMBA[15:0]
0x4243, // MSW OF BUS DESCRIPTORS FOR LOCAL SPACE 0 LBRD0[31:16]
0x0043, // LSW OF BUS DESCRIPTORS FOR LOCAL SPACE 0 LBRD0[15:0]
0x0000, // MSW OF PCI INITIATOR - PCI RANGE DMRR[31:16]
0x0000, // LSW OF PCI INITIATOR - PCI RANGE DMRR[15:0]
0x0000, // MSW OF PCI INITIATOR - PCI LOCAL BASE ADD DMLBAM[31:16]
0x0000, // LSW OF PCI INITIATOR - PCI LOCAL BASE ADD DMLBAM[15:0]
0x0000, // MSW OF PCI INITIATOR - PCI LBA I/O CONF DMLBA[31:16]
0x0000, // LSW OF PCI INITIATOR - PCI LBA I/O CONF DMLBA[15:0]
0x0000, // MSW OF PCI INITIATOR - PCI BASE ADDRESS DMPBAM[31:16]
0x0000, // LSW OF PCI INITIATOR - PCI BASE ADDRESS DMPBAM[15:0]
0x0000, // MSW OF PCI INITIATOR PCI CONF ADD DMCFGA[31:16]
0x0000, // LSW OF PCI INITIATOR PCI CONF ADD DMCFGA[15:0]
0x3427, // SUBSYSTEM ID PCISID[15:0]
0x10B5, // SUBSYSTEM VENDOR ID PCISVID[15:0]
0xFFFF, // MSW OF PCI-LOCAL RANGE1 LAS1RR[31:16]
0x0000, // LSW OF PCI-LOCAL RANGE1 LAS1RR[15:0]
0x0000, // MSW OF PCI-LOCAL REMAP1 LAS1BA[31:16]
0x0001, // LSW OF PCI-LOCAL REMAP1 LAS1BA[15:0]
0x0000, // MSW OF BUS DESCRIPTORS FOR LOCAL SPACE 1 LBRD1[31:16]
0x0043, // LSW OF BUS DESCRIPTORS FOR LOCAL SPACE 1 LBRD1[15:0]
0x0000, // MSW OF HOT-SWAP CONTROL RESERVED
0x4C06, // LSW OF HS NEXT-CAP POINTER/HS CONT HS_NEXT/HS_CNTL[7:0]
};
u16 setup_eeprom_3x20_15[256] = {
0x9056, // DEVICE ID PCIIDR[31:16]
0x10B5, // VENDOR ID PCIIDR[15:0]
0x0680, // CLASS CODE PCICCR[23:8]
0x0000, // CLASS CODE/REVISION PCICCR[7:0]/PCIREV[7:0]
0x0000, // MAXIMUM LATENCY/MINIMUM GRANT PCIMLR[7:0]/PCIMGR[7:0]
0x0100, // INTERRUPT PIN/INTERRUPT PIN ROUTING PCIIPR[7:0]/PCIIL[7:0]
0x0000, // MSW OF MAILBOX0 MBOX0[31:16]
0x0000, // LSW OF MAILBOX0 MBOX0[15:0]
0x0000, // MSW OF MAILBOX1 MBOX1[31:16]
0x0000, // LSW OF MAILBOX1 MBOX1[15:0]
0xFFFF, // MSW OF PCI-LOCAL RANGE0 LAS0RR[31:16]
0xFF01, // LSW OF PCI-LOCAL RANGE0 LAS0RR[15:0]
0x0000, // MSW OF PCI-LOCAL REMAP0 LAS0BA[31:16]
0x0001, // LSW OF PCI-LOCAL REMAP0 LAS0BA[15:0]
0x0200, // MSW OF DMA ARBITRATION REGISTER MARBR[31:16]
0x0000, // LSW OF DMA ARBITRATION REGISTER MARBR[15:0]
0x0030, // MSW OF SERIAL EEPROM WP ADDRESS PROT_AREA[15:0]
0x0500, // LSW OF MISC CONT REG/LSW OF BIG/LITTLE REG LMISC[7:0]/BIGEND[7:0]
0xFFFF, // MSW OF PCI EXPANSION ROM RANGE EROMRR[31:16]
0x0000, // LSW OF PCI EXPANSION ROM RANGE EROMRR[15:0]
0x0000, // MSW OF PCI EXPANSION ROM REMAP EROMBA[31:16]
0x0000, // LSW OF PCI EXPANSION ROM REMAP EROMBA[15:0]
0x4243, // MSW OF BUS DESCRIPTORS FOR LOCAL SPACE 0 LBRD0[31:16]
0x0043, // LSW OF BUS DESCRIPTORS FOR LOCAL SPACE 0 LBRD0[15:0]
0x0000, // MSW OF PCI INITIATOR - PCI RANGE DMRR[31:16]
0x0000, // LSW OF PCI INITIATOR - PCI RANGE DMRR[15:0]
0x0000, // MSW OF PCI INITIATOR - PCI LOCAL BASE ADD DMLBAM[31:16]
0x0000, // LSW OF PCI INITIATOR - PCI LOCAL BASE ADD DMLBAM[15:0]
0x0000, // MSW OF PCI INITIATOR - PCI LBA I/O CONF DMLBA[31:16]
0x0000, // LSW OF PCI INITIATOR - PCI LBA I/O CONF DMLBA[15:0]
0x0000, // MSW OF PCI INITIATOR - PCI BASE ADDRESS DMPBAM[31:16]
0x0000, // LSW OF PCI INITIATOR - PCI BASE ADDRESS DMPBAM[15:0]
0x0000, // MSW OF PCI INITIATOR PCI CONF ADD DMCFGA[31:16]
0x0000, // LSW OF PCI INITIATOR PCI CONF ADD DMCFGA[15:0]
0x3428, // SUBSYSTEM ID PCISID[15:0]
0x10B5, // SUBSYSTEM VENDOR ID PCISVID[15:0]
0xFFFF, // MSW OF PCI-LOCAL RANGE1 LAS1RR[31:16]
0x0000, // LSW OF PCI-LOCAL RANGE1 LAS1RR[15:0]
0x0000, // MSW OF PCI-LOCAL REMAP1 LAS1BA[31:16]
0x0001, // LSW OF PCI-LOCAL REMAP1 LAS1BA[15:0]
0x0000, // MSW OF BUS DESCRIPTORS FOR LOCAL SPACE 1 LBRD1[31:16]
0x0043, // LSW OF BUS DESCRIPTORS FOR LOCAL SPACE 1 LBRD1[15:0]
0x0000, // MSW OF HOT-SWAP CONTROL RESERVED
0x4C06, // LSW OF HS NEXT-CAP POINTER/HS CONT HS_NEXT/HS_CNTL[7:0]
};
u16 setup_eeprom_3x20_20[256] = {
0x9056, // DEVICE ID PCIIDR[31:16]
0x10B5, // VENDOR ID PCIIDR[15:0]
0x0680, // CLASS CODE PCICCR[23:8]
0x0000, // CLASS CODE/REVISION PCICCR[7:0]/PCIREV[7:0]
0x0000, // MAXIMUM LATENCY/MINIMUM GRANT PCIMLR[7:0]/PCIMGR[7:0]
0x0100, // INTERRUPT PIN/INTERRUPT PIN ROUTING PCIIPR[7:0]/PCIIL[7:0]
0x0000, // MSW OF MAILBOX0 MBOX0[31:16]
0x0000, // LSW OF MAILBOX0 MBOX0[15:0]
0x0000, // MSW OF MAILBOX1 MBOX1[31:16]
0x0000, // LSW OF MAILBOX1 MBOX1[15:0]
0xFFFF, // MSW OF PCI-LOCAL RANGE0 LAS0RR[31:16]
0xFF01, // LSW OF PCI-LOCAL RANGE0 LAS0RR[15:0]
0x0000, // MSW OF PCI-LOCAL REMAP0 LAS0BA[31:16]
0x0001, // LSW OF PCI-LOCAL REMAP0 LAS0BA[15:0]
0x0200, // MSW OF DMA ARBITRATION REGISTER MARBR[31:16]
0x0000, // LSW OF DMA ARBITRATION REGISTER MARBR[15:0]
0x0030, // MSW OF SERIAL EEPROM WP ADDRESS PROT_AREA[15:0]
0x0500, // LSW OF MISC CONT REG/LSW OF BIG/LITTLE REG LMISC[7:0]/BIGEND[7:0]
0xFFFF, // MSW OF PCI EXPANSION ROM RANGE EROMRR[31:16]
0x0000, // LSW OF PCI EXPANSION ROM RANGE EROMRR[15:0]
0x0000, // MSW OF PCI EXPANSION ROM REMAP EROMBA[31:16]
0x0000, // LSW OF PCI EXPANSION ROM REMAP EROMBA[15:0]
0x4243, // MSW OF BUS DESCRIPTORS FOR LOCAL SPACE 0 LBRD0[31:16]
0x0043, // LSW OF BUS DESCRIPTORS FOR LOCAL SPACE 0 LBRD0[15:0]
0x0000, // MSW OF PCI INITIATOR - PCI RANGE DMRR[31:16]
0x0000, // LSW OF PCI INITIATOR - PCI RANGE DMRR[15:0]
0x0000, // MSW OF PCI INITIATOR - PCI LOCAL BASE ADD DMLBAM[31:16]
0x0000, // LSW OF PCI INITIATOR - PCI LOCAL BASE ADD DMLBAM[15:0]
0x0000, // MSW OF PCI INITIATOR - PCI LBA I/O CONF DMLBA[31:16]
0x0000, // LSW OF PCI INITIATOR - PCI LBA I/O CONF DMLBA[15:0]
0x0000, // MSW OF PCI INITIATOR - PCI BASE ADDRESS DMPBAM[31:16]
0x0000, // LSW OF PCI INITIATOR - PCI BASE ADDRESS DMPBAM[15:0]
0x0000, // MSW OF PCI INITIATOR PCI CONF ADD DMCFGA[31:16]
0x0000, // LSW OF PCI INITIATOR PCI CONF ADD DMCFGA[15:0]
0x3429, // SUBSYSTEM ID PCISID[15:0]
0x10B5, // SUBSYSTEM VENDOR ID PCISVID[15:0]
0xFFFF, // MSW OF PCI-LOCAL RANGE1 LAS1RR[31:16]
0x0000, // LSW OF PCI-LOCAL RANGE1 LAS1RR[15:0]
0x0000, // MSW OF PCI-LOCAL REMAP1 LAS1BA[31:16]
0x0001, // LSW OF PCI-LOCAL REMAP1 LAS1BA[15:0]
0x0000, // MSW OF BUS DESCRIPTORS FOR LOCAL SPACE 1 LBRD1[31:16]
0x0043, // LSW OF BUS DESCRIPTORS FOR LOCAL SPACE 1 LBRD1[15:0]
0x0000, // MSW OF HOT-SWAP CONTROL RESERVED
0x4C06, // LSW OF HS NEXT-CAP POINTER/HS CONT HS_NEXT/HS_CNTL[7:0]
};
static void plx9030_SetCSHigh(board_t *board) {
u16 data = inw(board->ctrl_base_addr + PLX9030_CTRL_INIT_OFFSET);
data = data | PLX9030_EECS_MASK;
outw(data, board->ctrl_base_addr + PLX9030_CTRL_INIT_OFFSET);
sleep_ns(4000);
}
static void plx9030_SetCSLow(board_t *board) {
u16 data = inw(board->ctrl_base_addr + PLX9030_CTRL_INIT_OFFSET);
data = data & (~PLX9030_EECS_MASK);
outw(data, board->ctrl_base_addr + PLX9030_CTRL_INIT_OFFSET);
sleep_ns(4000);
}
static void plx9030_SetDinHigh(board_t *board) {
u16 data = inw(board->ctrl_base_addr + PLX9030_CTRL_INIT_OFFSET);
data = data | PLX9030_EEDI_MASK;
outw(data, board->ctrl_base_addr + PLX9030_CTRL_INIT_OFFSET);
sleep_ns(4000);
}
static void plx9030_SetDinLow(board_t *board) {
u16 data = inw(board->ctrl_base_addr + PLX9030_CTRL_INIT_OFFSET);
data = data & (~PLX9030_EEDI_MASK);
outw(data, board->ctrl_base_addr + PLX9030_CTRL_INIT_OFFSET);
sleep_ns(4000);
}
static void plx9030_SetClockHigh(board_t *board) {
u16 data = inw(board->ctrl_base_addr + PLX9030_CTRL_INIT_OFFSET);
data = data | PLX9030_EECLK_MASK;
outw(data, board->ctrl_base_addr + PLX9030_CTRL_INIT_OFFSET);
sleep_ns(4000);
}
static void plx9030_SetClockLow(board_t *board) {
u16 data = inw(board->ctrl_base_addr + PLX9030_CTRL_INIT_OFFSET);
data = data & (~PLX9030_EECLK_MASK);
outw(data, board->ctrl_base_addr + PLX9030_CTRL_INIT_OFFSET);
sleep_ns(4000);
}
static int plx9030_DataHighQ(board_t *board) {
u16 data = inw(board->ctrl_base_addr + PLX9030_CTRL_INIT_OFFSET);
sleep_ns(4000);
if ((data & PLX9030_EEDO_MASK) != 0)
return 1;
else
return 0;
}
static u16 plx9030_read_eeprom_word(board_t *board, u8 reg) {
u8 bit;
u16 mask;
u16 tdata;
plx9030_SetCSLow(board);
plx9030_SetDinLow(board);
plx9030_SetClockLow(board);
plx9030_SetCSHigh(board);
// send command first
mask = EEPROM_93C66_CMD_MASK;
for (bit = 0; bit < EEPROM_93C66_CMD_LEN; bit++) {
if ((mask & EEPROM_93C66_CMD_READ) == 0)
plx9030_SetDinLow(board);
else
plx9030_SetDinHigh(board);
mask = mask >> 1;
plx9030_SetClockLow(board);
plx9030_SetClockHigh(board);
}
// then send address
mask = EEPROM_93C66_ADDR_MASK;
for (bit = 0; bit < EEPROM_93C66_ADDR_LEN; bit++) {
if ((mask & reg) == 0)
plx9030_SetDinLow(board);
else
plx9030_SetDinHigh(board);
mask = mask >> 1;
plx9030_SetClockLow(board);
plx9030_SetClockHigh(board);
}
// read dummy 0 bit, if zero assume ok
if (plx9030_DataHighQ(board) == 1)
return 0;
mask = EEPROM_93C66_DATA_MASK;
tdata = 0;
for (bit = 0; bit < EEPROM_93C66_DATA_LEN; bit++) {
plx9030_SetClockLow(board);
plx9030_SetClockHigh(board);
if (plx9030_DataHighQ(board) == 1)
tdata = tdata | mask;
mask = mask >> 1;
}
plx9030_SetCSLow(board);
plx9030_SetDinLow(board);
plx9030_SetClockLow(board);
return tdata;
}
void pci_plx9030_bridge_eeprom_setup_read(board_t *board) {
int i;
char *bridge_name = "Unknown";
if (board->dev->device_id == DEVICEID_PLX9030)
bridge_name = "PLX9030";
else if (board->dev->device_id == DEVICEID_PLX9054)
bridge_name = "PLX9054";
else if (board->dev->device_id == DEVICEID_PLX9056)
bridge_name = "PLX9056";
printf("%s PCI bridge setup EEPROM:\n", bridge_name);
for (i = 0; i < EEPROM_93C66_SIZE; i++) {
if ((i > 0) && ((i % 16) == 0))
printf("\n");
if ((i % 16) == 0)
printf(" %02X: ", i);
printf("%04X ", plx9030_read_eeprom_word(board, i));
}
printf("\n");
}
static int plx9030_program_fpga(llio_t *self, char *bitfile_name) {
board_t *board = self->board;
int bindex, bytesread;
u32 status, control;
char part_name[32];
struct stat file_stat;
FILE *fp;
struct timeval tv1, tv2;
if (stat(bitfile_name, &file_stat) != 0) {
printf("Can't find file %s\n", bitfile_name);
return -1;
}
fp = fopen(bitfile_name, "rb");
if (fp == NULL) {
printf("Can't open file %s: %s\n", bitfile_name, strerror(errno));
return -1;
}
if (print_bitfile_header(fp, (char*) &part_name, board->llio.verbose) == -1) {
fclose(fp);
return -1;
}
// set /WRITE low for data transfer, and turn on LED
status = inl(board->ctrl_base_addr + PLX9030_CTRL_STAT_OFFSET);
control = status & ~PLX9030_WRITE_MASK & ~PLX9030_LED_MASK;
outl(control, board->ctrl_base_addr + PLX9030_CTRL_STAT_OFFSET);
printf("Programming FPGA...\n");
printf(" |");
fflush(stdout);
gettimeofday(&tv1, NULL);
// program the FPGA
while (!feof(fp)) {
bytesread = fread(&file_buffer, 1, 8192, fp);
bindex = 0;
while (bindex < bytesread) {
outb(bitfile_reverse_bits(file_buffer[bindex]), board->data_base_addr);
bindex++;
}
printf("W");
fflush(stdout);
}
fclose(fp);
printf("\n");
if (board->llio.verbose == 1) {
gettimeofday(&tv2, NULL);
printf(" Programming time: %.2f seconds\n", (double) (tv2.tv_usec - tv1.tv_usec) / 1000000 +
(double) (tv2.tv_sec - tv1.tv_sec));
}
// all bytes transferred, make sure FPGA is all set up now
status = inl(board->ctrl_base_addr + PLX9030_CTRL_STAT_OFFSET);
if (!(status & PLX9030_INIT_MASK)) {
// /INIT goes low on CRC error
printf("FPGA asserted /INIT: CRC error\n");
goto fail;
}
if (!(status & PLX9030_DONE_MASK)) {
printf("FPGA did not assert DONE\n");
goto fail;
}
// turn off write enable and LED
control = status | PLX9030_WRITE_MASK | PLX9030_LED_MASK;
outl(control, board->ctrl_base_addr + PLX9030_CTRL_STAT_OFFSET);
if (board->llio.verbose == 1) {
gettimeofday(&tv2, NULL);
printf("\n Programming time: %.3f seconds", (double) (tv2.tv_usec - tv1.tv_usec) / 1000000 +
(double) (tv2.tv_sec - tv1.tv_sec));
}
printf("\nBoard FPGA programmed successfully.\n");
return 0;
fail:
// set /PROGRAM low (reset device), /WRITE high and LED off
status = inl(board->ctrl_base_addr + PLX9030_CTRL_STAT_OFFSET);
control = status & ~PLX9030_PROGRAM_MASK;
control |= PLX9030_WRITE_MASK | PLX9030_LED_MASK;
outl(control, board->ctrl_base_addr + PLX9030_CTRL_STAT_OFFSET);
return -EIO;
}
static int plx9030_reset(llio_t *self) {
board_t *board = self->board;
u32 status;
u32 control;
printf("Resetting FPGA... ");
status = inl(board->ctrl_base_addr + PLX9030_CTRL_STAT_OFFSET);
// set /PROGRAM bit low to reset the FPGA
control = status & ~PLX9030_PROGRAM_MASK;
// set /WRITE and /LED high (idle state)
control |= PLX9030_WRITE_MASK | PLX9030_LED_MASK;
// and write it back
outl(control, board->ctrl_base_addr + PLX9030_CTRL_STAT_OFFSET);
// verify that /INIT and DONE went low
status = inl(board->ctrl_base_addr + PLX9030_CTRL_STAT_OFFSET);
if (status & (PLX9030_DONE_MASK | PLX9030_INIT_MASK)) {
printf("FPGA did not reset: /INIT = %d, DONE = %d\n",
(status & PLX9030_INIT_MASK ? 1 : 0),
(status & PLX9030_DONE_MASK ? 1 : 0)
);
return -EIO;
}
// set /PROGRAM high, let FPGA come out of reset
control = status | PLX9030_PROGRAM_MASK;
outl(control, board->ctrl_base_addr + PLX9030_CTRL_STAT_OFFSET);
// wait for /INIT to go high when it finishes clearing memory
// This should take no more than 100uS. If we assume each PCI read
// takes 30nS (one PCI clock), that is 3300 reads. Reads actually
// take several clocks, but even at a microsecond each, 3.3mS is not
// an excessive timeout value
{
int count = 3300;
do {
status = inl(board->ctrl_base_addr + PLX9030_CTRL_STAT_OFFSET);
if (status & PLX9030_INIT_MASK) break;
} while (count-- > 0);
if (count == 0) {
printf("FPGA did not come out of /INIT\n");
return -EIO;
}
}
printf("OK\n");
return 0;
}
static void plx9030_fixup_LASxBRD_READY(llio_t *self) {
board_t *board = self->board;
int offsets[] = {PLX9030_LAS0BRD_OFFSET, PLX9030_LAS1BRD_OFFSET, PLX9030_LAS2BRD_OFFSET, PLX9030_LAS3BRD_OFFSET};
int i;
for (i = 0; i < 4; i ++) {
u32 val;
int addr = board->ctrl_base_addr + offsets[i];
val = inl(addr);
if (!(val & PLX9030_LASxBRD_READY)) {
printf("LAS%dBRD #READY is off, enabling now\n", i);
val |= PLX9030_LASxBRD_READY;
outl(val, addr);
}
}
}
static int plx905x_program_fpga(llio_t *self, char *bitfile_name) {
board_t *board = self->board;
int bindex, bytesread, i;
u32 status;
char part_name[32];
struct stat file_stat;
FILE *fp;
struct timeval tv1, tv2;
if (stat(bitfile_name, &file_stat) != 0) {
printf("Can't find file %s\n", bitfile_name);
return -1;
}
fp = fopen(bitfile_name, "rb");
if (fp == NULL) {
printf("Can't open file %s: %s\n", bitfile_name, strerror(errno));
return -1;
}
if (print_bitfile_header(fp, (char*) &part_name, board->llio.verbose) == -1) {
fclose(fp);
return -1;
}
printf("Programming FPGA...\n");
printf(" |");
fflush(stdout);
gettimeofday(&tv1, NULL);
// program the FPGA
while (!feof(fp)) {
bytesread = fread(&file_buffer, 1, 8192, fp);
bindex = 0;
while (bindex < bytesread) {
outb(bitfile_reverse_bits(file_buffer[bindex]), board->data_base_addr);
bindex++;
}
printf("W");
fflush(stdout);
}
fclose(fp);
printf("\n");
if (board->llio.verbose == 1) {
gettimeofday(&tv2, NULL);
printf(" Programming time: %.2f seconds\n", (double) (tv2.tv_usec - tv1.tv_usec) / 1000000 +
(double) (tv2.tv_sec - tv1.tv_sec));
}
// all bytes transferred, make sure FPGA is all set up now
for (i = 0; i < PLX905X_DONE_WAIT; i++) {
status = inl(board->ctrl_base_addr + PLX905X_CTRL_STAT_OFFSET);
if (status & PLX905X_DONE_MASK) break;
}
if (i >= PLX905X_DONE_WAIT) {
printf("Error: Not /DONE; programming not completed.\n");
return -EIO;
}
if (board->llio.verbose == 1) {
gettimeofday(&tv2, NULL);
printf("\n Programming time: %.3f seconds", (double) (tv2.tv_usec - tv1.tv_usec) / 1000000 +
(double) (tv2.tv_sec - tv1.tv_sec));
}
printf("\nBoard FPGA programmed successfully.\n");
return 0;
}
static int plx905x_reset(llio_t *self) {
board_t *board = self->board;
int i;
u32 status, control;
printf("Resetting FPGA... ");
// set GPIO bits to GPIO function
status = inl(board->ctrl_base_addr + PLX905X_CTRL_STAT_OFFSET);
control = status | PLX905X_DONE_ENABLE | PLX905X_PROG_ENABLE;
outl(control, board->ctrl_base_addr + PLX905X_CTRL_STAT_OFFSET);
// Turn off /PROGRAM bit and insure that DONE isn't asserted
outl(control & ~PLX905X_PROGRAM_MASK, board->ctrl_base_addr + PLX905X_CTRL_STAT_OFFSET);
status = inl(board->ctrl_base_addr + PLX905X_CTRL_STAT_OFFSET);
if (status & PLX905X_DONE_MASK) {
// Note that if we see DONE at the start of programming, it's most
// likely due to an attempt to access the FPGA at the wrong I/O
// location.
printf("/DONE status bit indicates busy at start of programming\n");
return -EIO;
}
// turn on /PROGRAM output bit
outl(control | PLX905X_PROGRAM_MASK, board->ctrl_base_addr + PLX905X_CTRL_STAT_OFFSET);
// Delay for at least 100 uS. to allow the FPGA to finish its reset
// sequencing. 3300 reads is at least 100 us, could be as long as a
// few ms
for (i = 0; i < 3300; i++) {
status = inl(board->ctrl_base_addr + PLX905X_CTRL_STAT_OFFSET);
}
printf("OK\n");
return 0;
}
void memcpy32(void *vdest, void *vsrc, int size) {
volatile u32 *dest = (volatile u32*)vdest;
volatile u32 *src = (volatile u32*)vsrc;
while(size) {
*dest = *src;
dest++;
src++;
size --;
}
}
int pci_read(llio_t *self, u32 addr, void *buffer, int size) {
board_t *board = self->board;
assert(size % 4 == 0);
memcpy32(buffer, board->base + addr, size/4);
return 0;
}
int pci_write(llio_t *self, u32 addr, void *buffer, int size) {
board_t *board = self->board;
assert(size % 4 == 0);
memcpy32(board->base + addr, buffer, size/4);
return 0;
}
static int pci_board_reload(llio_t *self, int fallback_flag) {
board_t *board = self->board;
int i;
u32 boot_addr, bar0_reg, cookie;
u16 cmd_reg;
pci_read(&(board->llio), HM2_ICAP_REG, &cookie, sizeof(u32));
if (cookie != HM2_ICAP_COOKIE) {
printf("ERROR: Active firmware too old to support --reload\n");
return -1;
}
if (fallback_flag == 1) {
boot_addr = 0x10000;
} else {
boot_addr = 0x0;
}
boot_addr |= 0x0B000000; // plus read command in high byte
u32 data[14] = {
0xFFFF, // dummy
0xFFFF, // dummy
0xAA99, // sync
0x5566, // sync
0x3261, // load low flash start address
boot_addr & 0xFFFF, // start addr
0x3281, // load high start address + read command
boot_addr >> 16, // start addr (plus read command in high byte)
0x30A1, // load command register
0x000E, // IPROG command
0x2000, // NOP
0x2000, // NOP
0x2000, // NOP
0x2000 // NOP
};
cmd_reg = pci_read_word(board->dev, PCI_COMMAND);
bar0_reg = pci_read_long(board->dev, PCI_BASE_ADDRESS_0);
for (i = 0; i < 14; i++) {
pci_write(&(board->llio), HM2_ICAP_REG, &data[i], sizeof(u32));
usleep(1000);
}
printf("Waiting for FPGA configuration...");
sleep(2);
printf("OK\n");
pci_write_word(board->dev, PCI_COMMAND, cmd_reg);
pci_write_long(board->dev, PCI_BASE_ADDRESS_0, bar0_reg);
return 0;
}
static void pci_fix_bar_lengths(struct pci_dev *dev) {
#ifdef _WIN32
int i;
for (i = 0; i < 6; i++) {
u32 saved_bar, size;
if (dev->base_addr == 0)
continue;
saved_bar = pci_read_long(dev, PCI_BASE_ADDRESS_0 + i*4);
pci_write_long(dev, PCI_BASE_ADDRESS_0 + i*4, 0xFFFFFFFF);
size = pci_read_long(dev, PCI_BASE_ADDRESS_0 + i*4);
if (size & PCI_BASE_ADDRESS_SPACE_IO)
size = ~(size & PCI_BASE_ADDRESS_IO_MASK) & 0xFF;
else
size = ~(size & PCI_BASE_ADDRESS_MEM_MASK);
pci_write_long(dev, PCI_BASE_ADDRESS_0 + i*4, saved_bar);
dev->size[i] = size + 1;
}
#endif
}
static int pci_board_open(board_t *board) {
if (board->mem_base != 0) {
#ifdef __linux__
board->base = mmap(0, board->len, PROT_READ | PROT_WRITE, MAP_SHARED, memfd, board->mem_base);
#elif _WIN32
board->base = map_memory(board->mem_base, board->len, &(board->mem_handle));
#endif
}
if (board->flash != BOARD_FLASH_NONE) {
eeprom_init(&(board->llio));
board->flash_id = read_flash_id(&(board->llio));
if (board->fallback_support == 1) {
eeprom_prepare_boot_block(board->flash_id);
board->flash_start_address = eeprom_calc_user_space(board->flash_id);
} else {
board->flash_start_address = 0;
}
}
return 0;
}
static int pci_board_close(board_t *board) {
if (board->base) {
#ifdef __linux__
munmap(board->base, board->len);
#elif _WIN32
unmap_memory(&(board->mem_handle));
#endif
}
eeprom_cleanup(&(board->llio));
return 0;
}
int pci_boards_init(board_access_t *access) {
int eno;
#ifdef __linux__
if (seteuid(0) != 0) {
printf("You need root privileges (or setuid root) to access PCI hardware\n");
return -1;
}
pacc = pci_alloc();
pci_init(pacc); // inicjowanie biblioteki libpci
memfd = open("/dev/mem", O_RDWR);
eno = errno;
seteuid(getuid());
if (memfd < 0) {
printf("%s can't open /dev/mem: %s", __func__, strerror(eno));
return -1;
}
iopl(3);
#elif _WIN32
init_io_library();
#endif
return 0;
}
void pci_boards_cleanup(board_access_t *access) {
#ifdef __linux__
close(memfd);
#elif _WIN32
release_io_library();
#endif
pci_cleanup(pacc);
}
void pci_boards_scan(board_access_t *access) {
struct pci_dev *dev;
board_t *board;
pci_scan_bus(pacc);
for (dev = pacc->devices; dev != NULL; dev = dev->next)
// first run - fill data struct
pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES | PCI_FILL_CLASS);
if (access->recover == 1) {
for (dev = pacc->devices; dev != NULL; dev = dev->next) {
board = &boards[boards_count];
board_init_struct(board);
if ((dev->vendor_id == VENDORID_XIO2001) && (dev->device_id == DEVICEID_XIO2001)) {
board->type = BOARD_PCI;
strncpy(board->llio.board_name, "6I25 (RECOVER)", 14);
board->llio.num_ioport_connectors = 2;
board->llio.pins_per_connector = 17;
board->llio.ioport_connector_name[0] = "P3";
board->llio.ioport_connector_name[1] = "P2";
board->llio.fpga_part_number = "6slx9tqg144";
board->llio.num_leds = 2;
board->llio.write_flash = &local_write_flash;
board->llio.verify_flash = &local_verify_flash;
board->open = &pci_board_open;
board->close = &pci_board_close;
board->print_info = &pci_print_info;
board->mem_base = 0;
board->dev = dev;
board->flash = BOARD_FLASH_GPIO;
board->fallback_support = 1;
board->recover = 1;
board->llio.verbose = access->verbose;
boards_count++;
break;
}
}
return;
}
for (dev = pacc->devices; dev != NULL; dev = dev->next) {
board = &boards[boards_count];
board_init_struct(board);
if (dev->vendor_id == VENDORID_MESAPCI) {
if (dev->device_id == DEVICEID_MESA4I74) {
board->type = BOARD_PCI;
strncpy((char *) board->llio.board_name, "4I74", 4);
board->llio.num_ioport_connectors = 3;
board->llio.pins_per_connector = 24;
board->llio.ioport_connector_name[0] = "P1";
board->llio.ioport_connector_name[1] = "P3";
board->llio.ioport_connector_name[2] = "P4";
board->llio.fpga_part_number = "6slx9tqg144";
board->llio.num_leds = 0;
board->llio.read = &pci_read;
board->llio.write = &pci_write;
board->llio.write_flash = &local_write_flash;
board->llio.verify_flash = &local_verify_flash;
board->open = &pci_board_open;
board->close = &pci_board_close;
board->print_info = &pci_print_info;
pci_fix_bar_lengths(dev);
board->mem_base = dev->base_addr[0] & PCI_ADDR_MEM_MASK;
board->len = dev->size[0];
board->dev = dev;
board->flash = BOARD_FLASH_HM2;
board->fallback_support = 1;
board->llio.verbose = access->verbose;
boards_count++;
} else if (dev->device_id == DEVICEID_MESA5I24) {
board->type = BOARD_PCI;
strncpy((char *) board->llio.board_name, "5I24", 4);
board->llio.num_ioport_connectors = 3;
board->llio.pins_per_connector = 24;
board->llio.ioport_connector_name[0] = "P4";
board->llio.ioport_connector_name[1] = "P3";
board->llio.ioport_connector_name[2] = "P2";
board->llio.fpga_part_number = "6slx16ftg256 | 6slx25ftg256";
board->llio.num_leds = 4;
board->llio.read = &pci_read;
board->llio.write = &pci_write;
board->llio.write_flash = &local_write_flash;
board->llio.verify_flash = &local_verify_flash;
board->llio.reload = &pci_board_reload;
board->open = &pci_board_open;
board->close = &pci_board_close;
board->print_info = &pci_print_info;
pci_fix_bar_lengths(dev);
board->mem_base = dev->base_addr[0] & PCI_ADDR_MEM_MASK;
board->len = dev->size[0];
board->dev = dev;
board->flash = BOARD_FLASH_HM2;
board->fallback_support = 1;
board->llio.verbose = access->verbose;
boards_count++;
} else if (dev->device_id == DEVICEID_MESA5I25) {
board->type = BOARD_PCI;
strncpy((char *) board->llio.board_name, "5I25", 4);
board->llio.num_ioport_connectors = 2;
board->llio.pins_per_connector = 17;
board->llio.ioport_connector_name[0] = "P3";
board->llio.ioport_connector_name[1] = "P2";
board->llio.fpga_part_number = "6slx9tqg144";
board->llio.num_leds = 2;
board->llio.read = &pci_read;
board->llio.write = &pci_write;
board->llio.write_flash = &local_write_flash;
board->llio.verify_flash = &local_verify_flash;
board->llio.reload = &pci_board_reload;
board->open = &pci_board_open;
board->close = &pci_board_close;
board->print_info = &pci_print_info;
pci_fix_bar_lengths(dev);
board->mem_base = dev->base_addr[0] & PCI_ADDR_MEM_MASK;
board->len = dev->size[0];
board->dev = dev;
board->flash = BOARD_FLASH_HM2;
board->fallback_support = 1;
board->llio.verbose = access->verbose;
boards_count++;
} else if (dev->device_id == DEVICEID_MESA6I24) {
board->type = BOARD_PCI;
strncpy((char *) board->llio.board_name, "6I24", 4);
board->llio.num_ioport_connectors = 3;
board->llio.pins_per_connector = 24;
board->llio.ioport_connector_name[0] = "P4";
board->llio.ioport_connector_name[1] = "P3";
board->llio.ioport_connector_name[2] = "P2";
board->llio.fpga_part_number = "6slx16ftg256 | 6slx25ftg256";
board->llio.num_leds = 4;
board->llio.read = &pci_read;
board->llio.write = &pci_write;
board->llio.write_flash = &local_write_flash;
board->llio.verify_flash = &local_verify_flash;
board->llio.reload = &pci_board_reload;
board->open = &pci_board_open;
board->close = &pci_board_close;
board->print_info = &pci_print_info;
pci_fix_bar_lengths(dev);
board->mem_base = dev->base_addr[0] & PCI_ADDR_MEM_MASK;
board->len = dev->size[0];
board->dev = dev;
board->flash = BOARD_FLASH_HM2;
board->fallback_support = 1;
board->llio.verbose = access->verbose;
boards_count++;
} else if (dev->device_id == DEVICEID_MESA6I25) {
board->type = BOARD_PCI;
strncpy(board->llio.board_name, "6I25", 4);
board->llio.num_ioport_connectors = 2;
board->llio.pins_per_connector = 17;
board->llio.ioport_connector_name[0] = "P3";
board->llio.ioport_connector_name[1] = "P2";
board->llio.fpga_part_number = "6slx9tqg144";