aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/w100fb.h
blob: fffae7b4f6e98cc790552560f336db8c59644170 (plain) (blame)
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
/*
 * linux/drivers/video/w100fb.h
 *
 * Frame Buffer Device for ATI w100 (Wallaby)
 *
 * Copyright (C) 2002, ATI Corp.
 * Copyright (C) 2004-2005 Richard Purdie
 * Copyright (c) 2005 Ian Molton <spyro@f2s.com>
 *
 * Modified to work with 2.6 by Richard Purdie <rpurdie@rpsys.net>
 *
 * w32xx support by Ian Molton
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 */

#if !defined (_W100FB_H)
#define _W100FB_H

/* Block CIF Start: */
#define mmCHIP_ID           0x0000
#define mmREVISION_ID       0x0004
#define mmWRAP_BUF_A        0x0008
#define mmWRAP_BUF_B        0x000C
#define mmWRAP_TOP_DIR      0x0010
#define mmWRAP_START_DIR    0x0014
#define mmCIF_CNTL          0x0018
#define mmCFGREG_BASE       0x001C
#define mmCIF_IO            0x0020
#define mmCIF_READ_DBG      0x0024
#define mmCIF_WRITE_DBG     0x0028
#define cfgIND_ADDR_A_0     0x0000
#define cfgIND_ADDR_A_1     0x0001
#define cfgIND_ADDR_A_2     0x0002
#define cfgIND_DATA_A       0x0003
#define cfgREG_BASE         0x0004
#define cfgINTF_CNTL        0x0005
#define cfgSTATUS           0x0006
#define cfgCPU_DEFAULTS     0x0007
#define cfgIND_ADDR_B_0     0x0008
#define cfgIND_ADDR_B_1     0x0009
#define cfgIND_ADDR_B_2     0x000A
#define cfgIND_DATA_B       0x000B
#define cfgPM4_RPTR         0x000C
#define cfgSCRATCH          0x000D
#define cfgPM4_WRPTR_0      0x000E
#define cfgPM4_WRPTR_1      0x000F
/* Block CIF End: */

/* Block CP Start: */
#define mmSCRATCH_UMSK      0x0280
#define mmSCRATCH_ADDR      0x0284
#define mmGEN_INT_CNTL      0x0200
#define mmGEN_INT_STATUS    0x0204
/* Block CP End: */

/* Block DISPLAY Start: */
#define mmLCD_FORMAT        0x0410
#define mmGRAPHIC_CTRL      0x0414
#define mmGRAPHIC_OFFSET    0x0418
#define mmGRAPHIC_PITCH     0x041C
#define mmCRTC_TOTAL        0x0420
#define mmACTIVE_H_DISP     0x0424
#define mmACTIVE_V_DISP     0x0428
#define mmGRAPHIC_H_DISP    0x042C
#define mmGRAPHIC_V_DISP    0x0430
#define mmVIDEO_CTRL        0x0434
#define mmGRAPHIC_KEY       0x0438
#define mmBRIGHTNESS_CNTL   0x045C
#define mmDISP_INT_CNTL     0x0488
#define mmCRTC_SS           0x048C
#define mmCRTC_LS           0x0490
#define mmCRTC_REV          0x0494
#define mmCRTC_DCLK         0x049C
#define mmCRTC_GS           0x04A0
#define mmCRTC_VPOS_GS      0x04A4
#define mmCRTC_GCLK         0x04A8
#define mmCRTC_GOE          0x04AC
#define mmCRTC_FRAME        0x04B0
#define mmCRTC_FRAME_VPOS   0x04B4
#define mmGPIO_DATA         0x04B8
#define mmGPIO_CNTL1        0x04BC
#define mmGPIO_CNTL2        0x04C0
#define mmLCDD_CNTL1        0x04C4
#define mmLCDD_CNTL2        0x04C8
#define mmGENLCD_CNTL1      0x04CC
#define mmGENLCD_CNTL2      0x04D0
#define mmDISP_DEBUG        0x04D4
#define mmDISP_DB_BUF_CNTL  0x04D8
#define mmDISP_CRC_SIG      0x04DC
#define mmCRTC_DEFAULT_COUNT    0x04E0
#define mmLCD_BACKGROUND_COLOR  0x04E4
#define mmCRTC_PS2          0x04E8
#define mmCRTC_PS2_VPOS     0x04EC
#define mmCRTC_PS1_ACTIVE   0x04F0
#define mmCRTC_PS1_NACTIVE  0x04F4
#define mmCRTC_GCLK_EXT     0x04F8
#define mmCRTC_ALW          0x04FC
#define mmCRTC_ALW_VPOS     0x0500
#define mmCRTC_PSK          0x0504
#define mmCRTC_PSK_HPOS     0x0508
#define mmCRTC_CV4_START    0x050C
#define mmCRTC_CV4_END      0x0510
#define mmCRTC_CV4_HPOS     0x0514
#define mmCRTC_ECK          0x051C
#define mmREFRESH_CNTL      0x0520
#define mmGENLCD_CNTL3      0x0524
#define mmGPIO_DATA2        0x0528
#define mmGPIO_CNTL3        0x052C
#define mmGPIO_CNTL4        0x0530
#define mmCHIP_STRAP        0x0534
#define mmDISP_DEBUG2       0x0538
#define mmDEBUG_BUS_CNTL    0x053C
#define mmGAMMA_VALUE1      0x0540
#define mmGAMMA_VALUE2      0x0544
#define mmGAMMA_SLOPE       0x0548
#define mmGEN_STATUS        0x054C
#define mmHW_INT            0x0550
/* Block DISPLAY End: */

/* Block GFX Start: */
#define mmDST_OFFSET          0x1004
#define mmDST_PITCH           0x1008
#define mmDST_Y_X             0x1038
#define mmDST_WIDTH_HEIGHT    0x1198
#define mmDP_GUI_MASTER_CNTL  0x106C
#define mmBRUSH_OFFSET        0x108C
#define mmBRUSH_Y_X           0x1074
#define mmDP_BRUSH_FRGD_CLR   0x107C
#define mmSRC_OFFSET          0x11AC
#define mmSRC_PITCH           0x11B0
#define mmSRC_Y_X             0x1034
#define mmDEFAULT_PITCH_OFFSET      0x10A0
#define mmDEFAULT_SC_BOTTOM_RIGHT   0x10A8
#define mmDEFAULT2_SC_BOTTOM_RIGHT  0x10AC
#define mmSC_TOP_LEFT         0x11BC
#define mmSC_BOTTOM_RIGHT     0x11C0
#define mmSRC_SC_BOTTOM_RIGHT 0x11C4
#define mmGLOBAL_ALPHA        0x1210
#define mmFILTER_COEF         0x1214
#define mmMVC_CNTL_START      0x11E0
#define mmE2_ARITHMETIC_CNTL  0x1220
#define mmDP_CNTL             0x11C8
#define mmDP_CNTL_DST_DIR     0x11CC
#define mmDP_DATATYPE         0x12C4
#define mmDP_MIX              0x12C8
#define mmDP_WRITE_MSK        0x12CC
#define mmENG_CNTL            0x13E8
#define mmENG_PERF_CNT        0x13F0
/* Block GFX End: */

/* Block IDCT Start: */
#define mmIDCT_RUNS         0x0C00
#define mmIDCT_LEVELS       0x0C04
#define mmIDCT_CONTROL      0x0C3C
#define mmIDCT_AUTH_CONTROL 0x0C08
#define mmIDCT_AUTH         0x0C0C
/* Block IDCT End: */

/* Block MC Start: */
#define mmMEM_CNTL             0x0180
#define mmMEM_ARB              0x0184
#define mmMC_FB_LOCATION       0x0188
#define mmMEM_EXT_CNTL         0x018C
#define mmMC_EXT_MEM_LOCATION  0x0190
#define mmMEM_EXT_TIMING_CNTL  0x0194
#define mmMEM_SDRAM_MODE_REG   0x0198
#define mmMEM_IO_CNTL          0x019C
#define mmMC_DEBUG             0x01A0
#define mmMC_BIST_CTRL         0x01A4
#define mmMC_BIST_COLLAR_READ  0x01A8
#define mmTC_MISMATCH          0x01AC
#define mmMC_PERF_MON_CNTL     0x01B0
#define mmMC_PERF_COUNTERS     0x01B4
/* Block MC End: */

/* Block BM Start: */
#define mmBM_EXT_MEM_BANDWIDTH    0x0A00
#define mmBM_OFFSET               0x0A04
#define mmBM_MEM_EXT_TIMING_CNTL  0x0A08
#define mmBM_MEM_EXT_CNTL         0x0A0C
#define mmBM_MEM_MODE_REG         0x0A10
#define mmBM_MEM_IO_CNTL          0x0A18
#define mmBM_CONFIG               0x0A1C
#define mmBM_STATUS               0x0A20
#define mmBM_DEBUG                0x0A24
#define mmBM_PERF_MON_CNTL        0x0A28
#define mmBM_PERF_COUNTERS        0x0A2C
#define mmBM_PERF2_MON_CNTL       0x0A30
#define mmBM_PERF2_COUNTERS       0x0A34
/* Block BM End: */

/* Block RBBM Start: */
#define mmWAIT_UNTIL        0x1400
#define mmISYNC_CNTL        0x1404
#define mmRBBM_STATUS       0x0140
#define mmRBBM_CNTL         0x0144
#define mmNQWAIT_UNTIL      0x0150
/* Block RBBM End: */

/* Block CG Start: */
#define mmCLK_PIN_CNTL      0x0080
#define mmPLL_REF_FB_DIV    0x0084
#define mmPLL_CNTL          0x0088
#define mmSCLK_CNTL         0x008C
#define mmPCLK_CNTL         0x0090
#define mmCLK_TEST_CNTL     0x0094
#define mmPWRMGT_CNTL       0x0098
#define mmPWRMGT_STATUS     0x009C
/* Block CG End: */

/* default value definitions */
#define defWRAP_TOP_DIR        0x00000000
#define defWRAP_START_DIR      0x00000000
#define defCFGREG_BASE         0x00000000
#define defCIF_IO              0x000C0902
#define defINTF_CNTL           0x00000011
#define defCPU_DEFAULTS        0x00000006
#define defHW_INT              0x00000000
#define defMC_EXT_MEM_LOCATION 0x07ff0000
#define defTC_MISMATCH         0x00000000

#define W100_CFG_BASE          0x0
#define W100_CFG_LEN           0x10
#define W100_REG_BASE          0x10000
#define W100_REG_LEN           0x2000
#define MEM_INT_BASE_VALUE     0x100000
#define MEM_EXT_BASE_VALUE     0x800000
#define MEM_INT_SIZE           0x05ffff
#define MEM_WINDOW_BASE        0x100000
#define MEM_WINDOW_SIZE        0xf00000

#define WRAP_BUF_BASE_VALUE    0x80000
#define WRAP_BUF_TOP_VALUE     0xbffff

#define CHIP_ID_W100           0x57411002
#define CHIP_ID_W3200          0x56441002
#define CHIP_ID_W3220          0x57441002

/* Register structure definitions */

struct wrap_top_dir_t {
	u32 top_addr  : 23;
	u32           : 9;
} __attribute__((packed));

union wrap_top_dir_u {
	u32 val : 32;
	struct wrap_top_dir_t f;
} __attribute__((packed));

struct wrap_start_dir_t {
	u32 start_addr : 23;
	u32            : 9;
} __attribute__((packed));

union wrap_start_dir_u {
	u32 val : 32;
	struct wrap_start_dir_t f;
} __attribute__((packed));

struct cif_cntl_t {
	u32 swap_reg                 : 2;
	u32 swap_fbuf_1              : 2;
	u32 swap_fbuf_2              : 2;
	u32 swap_fbuf_3              : 2;
	u32 pmi_int_disable          : 1;
	u32 pmi_schmen_disable       : 1;
	u32 intb_oe                  : 1;
	u32 en_wait_to_compensate_dq_prop_dly  : 1;
	u32 compensate_wait_rd_size  : 2;
	u32 wait_asserted_timeout_val  : 2;
	u32 wait_masked_val          : 2;
	u32 en_wait_timeout          : 1;
	u32 en_one_clk_setup_before_wait  : 1;
	u32 interrupt_active_high    : 1;
	u32 en_overwrite_straps      : 1;
	u32 strap_wait_active_hi     : 1;
	u32 lat_busy_count           : 2;
	u32 lat_rd_pm4_sclk_busy     : 1;
	u32 dis_system_bits          : 1;
	u32 dis_mr                   : 1;
	u32 cif_spare_1              : 4;
} __attribute__((packed));

union cif_cntl_u {
	u32 val : 32;
	struct cif_cntl_t f;
} __attribute__((packed));

struct cfgreg_base_t {
	u32 cfgreg_base  : 24;
	u32              : 8;
} __attribute__((packed));

union cfgreg_base_u {
	u32 val : 32;
	struct cfgreg_base_t f;
} __attribute__((packed));

struct cif_io_t {
	u32 dq_srp     : 1;
	u32 dq_srn     : 1;
	u32 dq_sp      : 4;
	u32 dq_sn      : 4;
	u32 waitb_srp  : 1;
	u32 waitb_srn  : 1;
	u32 waitb_sp   : 4;
	u32 waitb_sn   : 4;
	u32 intb_srp   : 1;
	u32 intb_srn   : 1;
	u32 intb_sp    : 4;
	u32 intb_sn    : 4;
	u32            : 2;
} __attribute__((packed));

union cif_io_u {
	u32 val : 32;
	struct cif_io_t f;
} __attribute__((packed));

struct cif_read_dbg_t {
	u32 unpacker_pre_fetch_trig_gen  : 2;
	u32 dly_second_rd_fetch_trig     : 1;
	u32 rst_rd_burst_id              : 1;
	u32 dis_rd_burst_id              : 1;
	u32 en_block_rd_when_packer_is_not_emp : 1;
	u32 dis_pre_fetch_cntl_sm        : 1;
	u32 rbbm_chrncy_dis              : 1;
	u32 rbbm_rd_after_wr_lat         : 2;
	u32 dis_be_during_rd             : 1;
	u32 one_clk_invalidate_pulse     : 1;
	u32 dis_chnl_priority            : 1;
	u32 rst_read_path_a_pls          : 1;
	u32 rst_read_path_b_pls          : 1;
	u32 dis_reg_rd_fetch_trig        : 1;
	u32 dis_rd_fetch_trig_from_ind_addr : 1;
	u32 dis_rd_same_byte_to_trig_fetch : 1;
	u32 dis_dir_wrap                 : 1;
	u32 dis_ring_buf_to_force_dec    : 1;
	u32 dis_addr_comp_in_16bit       : 1;
	u32 clr_w                        : 1;
	u32 err_rd_tag_is_3              : 1;
	u32 err_load_when_ful_a          : 1;
	u32 err_load_when_ful_b          : 1;
	u32                              : 7;
} __attribute__((packed));

union cif_read_dbg_u {
	u32 val : 32;
	struct cif_read_dbg_t f;
} __attribute__((packed));

struct cif_write_dbg_t {
	u32 packer_timeout_count          : 2;
	u32 en_upper_load_cond            : 1;
	u32 en_chnl_change_cond           : 1;
	u32 dis_addr_comp_cond            : 1;
	u32 dis_load_same_byte_addr_cond  : 1;
	u32 dis_timeout_cond              : 1;
	u32 dis_timeout_during_rbbm       : 1;
	u32 dis_packer_ful_during_rbbm_timeout : 1;
	u32 en_dword_split_to_rbbm        : 1;
	u32 en_dummy_val                  : 1;
	u32 dummy_val_sel                 : 1;
	u32 mask_pm4_wrptr_dec            : 1;
	u32 dis_mc_clean_cond             : 1;
	u32 err_two_reqi_during_ful       : 1;
	u32 err_reqi_during_idle_clk      : 1;
	u32 err_global                    : 1;
	u32 en_wr_buf_dbg_load            : 1;
	u32 en_wr_buf_dbg_path            : 1;
	u32 sel_wr_buf_byte               : 3;
	u32 dis_rd_flush_wr               : 1;
	u32 dis_packer_ful_cond           : 1;
	u32 dis_invalidate_by_ops_chnl    : 1;
	u32 en_halt_when_reqi_err         : 1;
	u32 cif_spare_2                   : 5;
	u32                               : 1;
} __attribute__((packed));

union cif_write_dbg_u {
	u32 val : 32;
	struct cif_write_dbg_t f;
} __attribute__((packed));


struct intf_cntl_t {
	unsigned char ad_inc_a            : 1;
	unsigned char ring_buf_a          : 1;
	unsigned char rd_fetch_trigger_a  : 1;
	unsigned char rd_data_rdy_a       : 1;
	unsigned char ad_inc_b            : 1;
	unsigned char ring_buf_b          : 1;
	unsigned char rd_fetch_trigger_b  : 1;
	unsigned char rd_data_rdy_b       : 1;
} __attribute__((packed));

union intf_cntl_u {
	unsigned char val : 8;
	struct intf_cntl_t f;
} __attribute__((packed));

struct cpu_defaults_t {
	unsigned char unpack_rd_data     : 1;
	unsigned char access_ind_addr_a  : 1;
	unsigned char access_ind_addr_b  : 1;
	unsigned char access_scratch_reg : 1;
	unsigned char pack_wr_data       : 1;
	unsigned char transition_size    : 1;
	unsigned char en_read_buf_mode   : 1;
	unsigned char rd_fetch_scratch   : 1;
} __attribute__((packed));

union cpu_defaults_u {
	unsigned char val : 8;
	struct cpu_defaults_t f;
} __attribute__((packed));

struct crtc_total_t {
	u32 crtc_h_total : 10;
	u32              : 6;
	u32 crtc_v_total : 10;
	u32              : 6;
} __attribute__((packed));

union crtc_total_u {
	u32 val : 32;
	struct crtc_total_t f;
} __attribute__((packed));

struct crtc_ss_t {
	u32 ss_start    : 10;
	u32             : 6;
	u32 ss_end      : 10;
	u32             : 2;
	u32 ss_align    : 1;
	u32 ss_pol      : 1;
	u32 ss_run_mode : 1;
	u32 ss_en       : 1;
} __attribute__((packed));

union crtc_ss_u {
	u32 val : 32;
	struct crtc_ss_t f;
} __attribute__((packed));

struct active_h_disp_t {
	u32 active_h_start  : 10;
	u32                 : 6;
	u32 active_h_end    : 10;
	u32                 : 6;
} __attribute__((packed));

union active_h_disp_u {
	u32 val : 32;
	struct active_h_disp_t f;
} __attribute__((packed));

struct active_v_disp_t {
	u32 active_v_start  : 10;
	u32                 : 6;
	u32 active_v_end    : 10;
	u32                 : 6;
} __attribute__((packed));

union active_v_disp_u {
	u32 val : 32;
	struct active_v_disp_t f;
} __attribute__((packed));

struct graphic_h_disp_t {
	u32 graphic_h_start : 10;
	u32                 : 6;
	u32 graphic_h_end   : 10;
	u32                 : 6;
} __attribute__((packed));

union graphic_h_disp_u {
	u32 val : 32;
	struct graphic_h_disp_t f;
} __attribute__((packed));

struct graphic_v_disp_t {
	u32 graphic_v_start : 10;
	u32                 : 6;
	u32 graphic_v_end   : 10;
	u32                 : 6;
} __attribute__((packed));

union graphic_v_disp_u{
	u32 val : 32;
	struct graphic_v_disp_t f;
} __attribute__((packed));

struct graphic_ctrl_t_w100 {
	u32 color_depth       : 3;
	u32 portrait_mode     : 2;
	u32 low_power_on      : 1;
	u32 req_freq          : 4;
	u32 en_crtc           : 1;
	u32 en_graphic_req    : 1;
	u32 en_graphic_crtc   : 1;
	u32 total_req_graphic : 9;
	u32 lcd_pclk_on       : 1;
	u32 lcd_sclk_on       : 1;
	u32 pclk_running      : 1;
	u32 sclk_running      : 1;
	u32                   : 6;
} __attribute__((packed));

struct graphic_ctrl_t_w32xx {
	u32 color_depth       : 3;
	u32 portrait_mode     : 2;
	u32 low_power_on      : 1;
	u32 req_freq          : 4;
	u32 en_crtc           : 1;
	u32 en_graphic_req    : 1;
	u32 en_graphic_crtc   : 1;
	u32 total_req_graphic : 10;
	u32 lcd_pclk_on       : 1;
	u32 lcd_sclk_on       : 1;
	u32 pclk_running      : 1;
	u32 sclk_running      : 1;
	u32                   : 5;
} __attribute__((packed));

union graphic_ctrl_u {
	u32 val : 32;
	struct graphic_ctrl_t_w100 f_w100;
	struct graphic_ctrl_t_w32xx f_w32xx;
} __attribute__((packed));

struct video_ctrl_t {
	u32 video_mode       : 1;
	u32 keyer_en         : 1;
	u32 en_video_req     : 1;
	u32 en_graphic_req_video  : 1;
	u32 en_video_crtc    : 1;
	u32 video_hor_exp    : 2;
	u32 video_ver_exp    : 2;
	u32 uv_combine       : 1;
	u32 total_req_video  : 9;
	u32 video_ch_sel     : 1;
	u32 video_portrait   : 2;
	u32 yuv2rgb_en       : 1;
	u32 yuv2rgb_option   : 1;
	u32 video_inv_hor    : 1;
	u32 video_inv_ver    : 1;
	u32 gamma_sel        : 2;
	u32 dis_limit        : 1;
	u32 en_uv_hblend     : 1;
	u32 rgb_gamma_sel    : 2;
} __attribute__((packed));

union video_ctrl_u {
	u32 val : 32;
	struct video_ctrl_t f;
} __attribute__((packed));

struct disp_db_buf_cntl_rd_t {
	u32 en_db_buf           : 1;
	u32 update_db_buf_done  : 1;
	u32 db_buf_cntl         : 6;
	u32                     : 24;
} __attribute__((packed));

union disp_db_buf_cntl_rd_u {
	u32 val : 32;
	struct disp_db_buf_cntl_rd_t f;
} __attribute__((packed));

struct disp_db_buf_cntl_wr_t {
	u32 en_db_buf      : 1;
	u32 update_db_buf  : 1;
	u32 db_buf_cntl    : 6;
	u32                : 24;
} __attribute__((packed));

union disp_db_buf_cntl_wr_u {
	u32 val : 32;
	struct disp_db_buf_cntl_wr_t f;
} __attribute__((packed));

struct gamma_value1_t {
	u32 gamma1   : 8;
	u32 gamma2   : 8;
	u32 gamma3   : 8;
	u32 gamma4   : 8;
} __attribute__((packed));

union gamma_value1_u {
	u32 val : 32;
	struct gamma_value1_t f;
} __attribute__((packed));

struct gamma_value2_t {
	u32 gamma5   : 8;
	u32 gamma6   : 8;
	u32 gamma7   : 8;
	u32 gamma8   : 8;
} __attribute__((packed));

union gamma_value2_u {
	u32 val : 32;
	struct gamma_value2_t f;
} __attribute__((packed));

struct gamma_slope_t {
	u32 slope1   : 3;
	u32 slope2   : 3;
	u32 slope3   : 3;
	u32 slope4   : 3;
	u32 slope5   : 3;
	u32 slope6   : 3;
	u32 slope7   : 3;
	u32 slope8   : 3;
	u32          : 8;
} __attribute__((packed));

union gamma_slope_u {
	u32 val : 32;
	struct gamma_slope_t f;
} __attribute__((packed));

struct mc_ext_mem_location_t {
	u32 mc_ext_mem_start : 16;
	u32 mc_ext_mem_top   : 16;
} __attribute__((packed));

union mc_ext_mem_location_u {
	u32 val : 32;
	struct mc_ext_mem_location_t f;
} __attribute__((packed));

struct mc_fb_location_t {
	u32 mc_fb_start      : 16;
	u32 mc_fb_top        : 16;
} __attribute__((packed));

union mc_fb_location_u {
	u32 val : 32;
	struct mc_fb_location_t f;
} __attribute__((packed));

struct clk_pin_cntl_t {
	u32 osc_en           : 1;
	u32 osc_gain         : 5;
	u32 dont_use_xtalin  : 1;
	u32 xtalin_pm_en     : 1;
	u32 xtalin_dbl_en    : 1;
	u32                  : 7;
	u32 cg_debug         : 16;
} __attribute__((packed));

union clk_pin_cntl_u {
	u32 val : 32;
	struct clk_pin_cntl_t f;
} __attribute__((packed));

struct pll_ref_fb_div_t {
	u32 pll_ref_div      : 4;
	u32                  : 4;
	u32 pll_fb_div_int   : 6;
	u32                  : 2;
	u32 pll_fb_div_frac  : 3;
	u32                  : 1;
	u32 pll_reset_time   : 4;
	u32 pll_lock_time    : 8;
} __attribute__((packed));

union pll_ref_fb_div_u {
	u32 val : 32;
	struct pll_ref_fb_div_t f;
} __attribute__((packed));

struct pll_cntl_t {
	u32 pll_pwdn        : 1;
	u32 pll_reset       : 1;
	u32 pll_pm_en       : 1;
	u32 pll_mode        : 1;
	u32 pll_refclk_sel  : 1;
	u32 pll_fbclk_sel   : 1;
	u32 pll_tcpoff      : 1;
	u32 pll_pcp         : 3;
	u32 pll_pvg         : 3;
	u32 pll_vcofr       : 1;
	u32 pll_ioffset     : 2;
	u32 pll_pecc_mode   : 2;
	u32 pll_pecc_scon   : 2;
	u32 pll_dactal      : 4;
	u32 pll_cp_clip     : 2;
	u32 pll_conf        : 3;
	u32 pll_mbctrl      : 2;
	u32 pll_ring_off    : 1;
} __attribute__((packed));

union pll_cntl_u {
	u32 val : 32;
	struct pll_cntl_t f;
} __attribute__((packed));

struct sclk_cntl_t {
	u32 sclk_src_sel         : 2;
	u32                      : 2;
	u32 sclk_post_div_fast   : 4;
	u32 sclk_clkon_hys       : 3;
	u32 sclk_post_div_slow   : 4;
	u32 disp_cg_ok2switch_en : 1;
	u32 sclk_force_reg       : 1;
	u32 sclk_force_disp      : 1;
	u32 sclk_force_mc        : 1;
	u32 sclk_force_extmc     : 1;
	u32 sclk_force_cp        : 1;
	u32 sclk_force_e2        : 1;
	u32 sclk_force_e3        : 1;
	u32 sclk_force_idct      : 1;
	u32 sclk_force_bist      : 1;
	u32 busy_extend_cp       : 1;
	u32 busy_extend_e2       : 1;
	u32 busy_extend_e3       : 1;
	u32 busy_extend_idct     : 1;
	u32                      : 3;
} __attribute__((packed));

union sclk_cntl_u {
	u32 val : 32;
	struct sclk_cntl_t f;
} __attribute__((packed));

struct pclk_cntl_t {
	u32 pclk_src_sel     : 2;
	u32                  : 2;
	u32 pclk_post_div    : 4;
	u32                  : 8;
	u32 pclk_force_disp  : 1;
	u32                  : 15;
} __attribute__((packed));

union pclk_cntl_u {
	u32 val : 32;
	struct pclk_cntl_t f;
} __attribute__((packed));


#define TESTCLK_SRC_PLL   0x01
#define TESTCLK_SRC_SCLK  0x02
#define TESTCLK_SRC_PCLK  0x03
/* 4 and 5 seem to by XTAL/M */
#define TESTCLK_SRC_XTAL  0x06

struct clk_test_cntl_t {
	u32 testclk_sel      : 4;
	u32                  : 3;
	u32 start_check_freq : 1;
	u32 tstcount_rst     : 1;
	u32                  : 15;
	u32 test_count       : 8;
} __attribute__((packed));

union clk_test_cntl_u {
	u32 val : 32;
	struct clk_test_cntl_t f;
} __attribute__((packed));

struct pwrmgt_cntl_t {
	u32 pwm_enable           : 1;
	u32                      : 1;
	u32 pwm_mode_req         : 2;
	u32 pwm_wakeup_cond      : 2;
	u32 pwm_fast_noml_hw_en  : 1;
	u32 pwm_noml_fast_hw_en  : 1;
	u32 pwm_fast_noml_cond   : 4;
	u32 pwm_noml_fast_cond   : 4;
	u32 pwm_idle_timer       : 8;
	u32 pwm_busy_timer       : 8;
} __attribute__((packed));

union pwrmgt_cntl_u {
	u32 val : 32;
	struct pwrmgt_cntl_t f;
} __attribute__((packed));

#define SRC_DATATYPE_EQU_DST	3

#define ROP3_SRCCOPY	0xcc
#define ROP3_PATCOPY	0xf0

#define GMC_BRUSH_SOLID_COLOR	13
#define GMC_BRUSH_NONE			15

#define DP_SRC_MEM_RECTANGULAR	2

#define DP_OP_ROP	0

struct dp_gui_master_cntl_t {
	u32 gmc_src_pitch_offset_cntl : 1;
	u32 gmc_dst_pitch_offset_cntl : 1;
	u32 gmc_src_clipping          : 1;
	u32 gmc_dst_clipping          : 1;
	u32 gmc_brush_datatype        : 4;
	u32 gmc_dst_datatype          : 4;
	u32 gmc_src_datatype          : 3;
	u32 gmc_byte_pix_order        : 1;
	u32 gmc_default_sel           : 1;
	u32 gmc_rop3                  : 8;
	u32 gmc_dp_src_source         : 3;
	u32 gmc_clr_cmp_fcn_dis       : 1;
	u32                           : 1;
	u32 gmc_wr_msk_dis            : 1;
	u32 gmc_dp_op                 : 1;
} __attribute__((packed));

union dp_gui_master_cntl_u {
	u32 val : 32;
	struct dp_gui_master_cntl_t f;
} __attribute__((packed));

struct rbbm_status_t {
	u32 cmdfifo_avail   : 7;
	u32                 : 1;
	u32 hirq_on_rbb     : 1;
	u32 cprq_on_rbb     : 1;
	u32 cfrq_on_rbb     : 1;
	u32 hirq_in_rtbuf   : 1;
	u32 cprq_in_rtbuf   : 1;
	u32 cfrq_in_rtbuf   : 1;
	u32 cf_pipe_busy    : 1;
	u32 eng_ev_busy     : 1;
	u32 cp_cmdstrm_busy : 1;
	u32 e2_busy         : 1;
	u32 rb2d_busy       : 1;
	u32 rb3d_busy       : 1;
	u32 se_busy         : 1;
	u32 re_busy         : 1;
	u32 tam_busy        : 1;
	u32 tdm_busy        : 1;
	u32 pb_busy         : 1;
	u32                 : 6;
	u32 gui_active      : 1;
} __attribute__((packed));

union rbbm_status_u {
	u32 val : 32;
	struct rbbm_status_t f;
} __attribute__((packed));

struct dp_datatype_t {
	u32 dp_dst_datatype   : 4;
	u32                   : 4;
	u32 dp_brush_datatype : 4;
	u32 dp_src2_type      : 1;
	u32 dp_src2_datatype  : 3;
	u32 dp_src_datatype   : 3;
	u32                   : 11;
	u32 dp_byte_pix_order : 1;
	u32                   : 1;
} __attribute__((packed));

union dp_datatype_u {
	u32 val : 32;
	struct dp_datatype_t f;
} __attribute__((packed));

struct dp_mix_t {
	u32                : 8;
	u32 dp_src_source  : 3;
	u32 dp_src2_source : 3;
	u32                : 2;
	u32 dp_rop3        : 8;
	u32 dp_op          : 1;
	u32                : 7;
} __attribute__((packed));

union dp_mix_u {
	u32 val : 32;
	struct dp_mix_t f;
} __attribute__((packed));

struct eng_cntl_t {
	u32 erc_reg_rd_ws            : 1;
	u32 erc_reg_wr_ws            : 1;
	u32 erc_idle_reg_wr          : 1;
	u32 dis_engine_triggers      : 1;
	u32 dis_rop_src_uses_dst_w_h : 1;
	u32 dis_src_uses_dst_dirmaj  : 1;
	u32                          : 6;
	u32 force_3dclk_when_2dclk   : 1;
	u32                          : 19;
} __attribute__((packed));

union eng_cntl_u {
	u32 val : 32;
	struct eng_cntl_t f;
} __attribute__((packed));

struct dp_cntl_t {
	u32 dst_x_dir   : 1;
	u32 dst_y_dir   : 1;
	u32 src_x_dir   : 1;
	u32 src_y_dir   : 1;
	u32 dst_major_x : 1;
	u32 src_major_x : 1;
	u32             : 26;
} __attribute__((packed));

union dp_cntl_u {
	u32 val : 32;
	struct dp_cntl_t f;
} __attribute__((packed));

struct dp_cntl_dst_dir_t {
	u32           : 15;
	u32 dst_y_dir : 1;
	u32           : 15;
	u32 dst_x_dir : 1;
} __attribute__((packed));

union dp_cntl_dst_dir_u {
	u32 val : 32;
	struct dp_cntl_dst_dir_t f;
} __attribute__((packed));

#endif

opt">*parent, struct qstr *qstr); static int isofs_dentry_cmpi(struct dentry *dentry, struct qstr *a, struct qstr *b); static int isofs_dentry_cmp(struct dentry *dentry, struct qstr *a, struct qstr *b); #ifdef CONFIG_JOLIET static int isofs_hashi_ms(struct dentry *parent, struct qstr *qstr); static int isofs_hash_ms(struct dentry *parent, struct qstr *qstr); static int isofs_dentry_cmpi_ms(struct dentry *dentry, struct qstr *a, struct qstr *b); static int isofs_dentry_cmp_ms(struct dentry *dentry, struct qstr *a, struct qstr *b); #endif static void isofs_put_super(struct super_block *sb) { struct isofs_sb_info *sbi = ISOFS_SB(sb); #ifdef CONFIG_JOLIET if (sbi->s_nls_iocharset) { unload_nls(sbi->s_nls_iocharset); sbi->s_nls_iocharset = NULL; } #endif kfree(sbi); sb->s_fs_info = NULL; return; } static void isofs_read_inode(struct inode *); static int isofs_statfs (struct dentry *, struct kstatfs *); static kmem_cache_t *isofs_inode_cachep; static struct inode *isofs_alloc_inode(struct super_block *sb) { struct iso_inode_info *ei; ei = kmem_cache_alloc(isofs_inode_cachep, GFP_KERNEL); if (!ei) return NULL; return &ei->vfs_inode; } static void isofs_destroy_inode(struct inode *inode) { kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode)); } static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags) { struct iso_inode_info *ei = foo; if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == SLAB_CTOR_CONSTRUCTOR) inode_init_once(&ei->vfs_inode); } static int init_inodecache(void) { isofs_inode_cachep = kmem_cache_create("isofs_inode_cache", sizeof(struct iso_inode_info), 0, (SLAB_RECLAIM_ACCOUNT| SLAB_MEM_SPREAD), init_once, NULL); if (isofs_inode_cachep == NULL) return -ENOMEM; return 0; } static void destroy_inodecache(void) { kmem_cache_destroy(isofs_inode_cachep); } static int isofs_remount(struct super_block *sb, int *flags, char *data) { /* we probably want a lot more here */ *flags |= MS_RDONLY; return 0; } static struct super_operations isofs_sops = { .alloc_inode = isofs_alloc_inode, .destroy_inode = isofs_destroy_inode, .read_inode = isofs_read_inode, .put_super = isofs_put_super, .statfs = isofs_statfs, .remount_fs = isofs_remount, }; static struct dentry_operations isofs_dentry_ops[] = { { .d_hash = isofs_hash, .d_compare = isofs_dentry_cmp, }, { .d_hash = isofs_hashi, .d_compare = isofs_dentry_cmpi, }, #ifdef CONFIG_JOLIET { .d_hash = isofs_hash_ms, .d_compare = isofs_dentry_cmp_ms, }, { .d_hash = isofs_hashi_ms, .d_compare = isofs_dentry_cmpi_ms, }, #endif }; struct iso9660_options{ char map; char rock; char joliet; char cruft; char hide; char showassoc; char nocompress; unsigned char check; unsigned int blocksize; mode_t mode; gid_t gid; uid_t uid; char *iocharset; unsigned char utf8; /* LVE */ s32 session; s32 sbsector; }; /* * Compute the hash for the isofs name corresponding to the dentry. */ static int isofs_hash_common(struct dentry *dentry, struct qstr *qstr, int ms) { const char *name; int len; len = qstr->len; name = qstr->name; if (ms) { while (len && name[len-1] == '.') len--; } qstr->hash = full_name_hash(name, len); return 0; } /* * Compute the hash for the isofs name corresponding to the dentry. */ static int isofs_hashi_common(struct dentry *dentry, struct qstr *qstr, int ms) { const char *name; int len; char c; unsigned long hash; len = qstr->len; name = qstr->name; if (ms) { while (len && name[len-1] == '.') len--; } hash = init_name_hash(); while (len--) { c = tolower(*name++); hash = partial_name_hash(tolower(c), hash); } qstr->hash = end_name_hash(hash); return 0; } /* * Case insensitive compare of two isofs names. */ static int isofs_dentry_cmpi_common(struct dentry *dentry, struct qstr *a, struct qstr *b, int ms) { int alen, blen; /* A filename cannot end in '.' or we treat it like it has none */ alen = a->len; blen = b->len; if (ms) { while (alen && a->name[alen-1] == '.') alen--; while (blen && b->name[blen-1] == '.') blen--; } if (alen == blen) { if (strnicmp(a->name, b->name, alen) == 0) return 0; } return 1; } /* * Case sensitive compare of two isofs names. */ static int isofs_dentry_cmp_common(struct dentry *dentry, struct qstr *a, struct qstr *b, int ms) { int alen, blen; /* A filename cannot end in '.' or we treat it like it has none */ alen = a->len; blen = b->len; if (ms) { while (alen && a->name[alen-1] == '.') alen--; while (blen && b->name[blen-1] == '.') blen--; } if (alen == blen) { if (strncmp(a->name, b->name, alen) == 0) return 0; } return 1; } static int isofs_hash(struct dentry *dentry, struct qstr *qstr) { return isofs_hash_common(dentry, qstr, 0); } static int isofs_hashi(struct dentry *dentry, struct qstr *qstr) { return isofs_hashi_common(dentry, qstr, 0); } static int isofs_dentry_cmp(struct dentry *dentry,struct qstr *a,struct qstr *b) { return isofs_dentry_cmp_common(dentry, a, b, 0); } static int isofs_dentry_cmpi(struct dentry *dentry,struct qstr *a,struct qstr *b) { return isofs_dentry_cmpi_common(dentry, a, b, 0); } #ifdef CONFIG_JOLIET static int isofs_hash_ms(struct dentry *dentry, struct qstr *qstr) { return isofs_hash_common(dentry, qstr, 1); } static int isofs_hashi_ms(struct dentry *dentry, struct qstr *qstr) { return isofs_hashi_common(dentry, qstr, 1); } static int isofs_dentry_cmp_ms(struct dentry *dentry,struct qstr *a,struct qstr *b) { return isofs_dentry_cmp_common(dentry, a, b, 1); } static int isofs_dentry_cmpi_ms(struct dentry *dentry,struct qstr *a,struct qstr *b) { return isofs_dentry_cmpi_common(dentry, a, b, 1); } #endif enum { Opt_block, Opt_check_r, Opt_check_s, Opt_cruft, Opt_gid, Opt_ignore, Opt_iocharset, Opt_map_a, Opt_map_n, Opt_map_o, Opt_mode, Opt_nojoliet, Opt_norock, Opt_sb, Opt_session, Opt_uid, Opt_unhide, Opt_utf8, Opt_err, Opt_nocompress, Opt_hide, Opt_showassoc, }; static match_table_t tokens = { {Opt_norock, "norock"}, {Opt_nojoliet, "nojoliet"}, {Opt_unhide, "unhide"}, {Opt_hide, "hide"}, {Opt_showassoc, "showassoc"}, {Opt_cruft, "cruft"}, {Opt_utf8, "utf8"}, {Opt_iocharset, "iocharset=%s"}, {Opt_map_a, "map=acorn"}, {Opt_map_a, "map=a"}, {Opt_map_n, "map=normal"}, {Opt_map_n, "map=n"}, {Opt_map_o, "map=off"}, {Opt_map_o, "map=o"}, {Opt_session, "session=%u"}, {Opt_sb, "sbsector=%u"}, {Opt_check_r, "check=relaxed"}, {Opt_check_r, "check=r"}, {Opt_check_s, "check=strict"}, {Opt_check_s, "check=s"}, {Opt_uid, "uid=%u"}, {Opt_gid, "gid=%u"}, {Opt_mode, "mode=%u"}, {Opt_block, "block=%u"}, {Opt_ignore, "conv=binary"}, {Opt_ignore, "conv=b"}, {Opt_ignore, "conv=text"}, {Opt_ignore, "conv=t"}, {Opt_ignore, "conv=mtext"}, {Opt_ignore, "conv=m"}, {Opt_ignore, "conv=auto"}, {Opt_ignore, "conv=a"}, {Opt_nocompress, "nocompress"}, {Opt_err, NULL} }; static int parse_options(char *options, struct iso9660_options *popt) { char *p; int option; popt->map = 'n'; popt->rock = 'y'; popt->joliet = 'y'; popt->cruft = 'n'; popt->hide = 'n'; popt->showassoc = 'n'; popt->check = 'u'; /* unset */ popt->nocompress = 0; popt->blocksize = 1024; popt->mode = S_IRUGO | S_IXUGO; /* r-x for all. The disc could be shared with DOS machines so virtually anything could be a valid executable. */ popt->gid = 0; popt->uid = 0; popt->iocharset = NULL; popt->utf8 = 0; popt->session=-1; popt->sbsector=-1; if (!options) return 1; while ((p = strsep(&options, ",")) != NULL) { int token; substring_t args[MAX_OPT_ARGS]; unsigned n; if (!*p) continue; token = match_token(p, tokens, args); switch (token) { case Opt_norock: popt->rock = 'n'; break; case Opt_nojoliet: popt->joliet = 'n'; break; case Opt_hide: popt->hide = 'y'; break; case Opt_unhide: case Opt_showassoc: popt->showassoc = 'y'; break; case Opt_cruft: popt->cruft = 'y'; break; case Opt_utf8: popt->utf8 = 1; break; #ifdef CONFIG_JOLIET case Opt_iocharset: popt->iocharset = match_strdup(&args[0]); break; #endif case Opt_map_a: popt->map = 'a'; break; case Opt_map_o: popt->map = 'o'; break; case Opt_map_n: popt->map = 'n'; break; case Opt_session: if (match_int(&args[0], &option)) return 0; n = option; if (n > 99) return 0; popt->session = n + 1; break; case Opt_sb: if (match_int(&args[0], &option)) return 0; popt->sbsector = option; break; case Opt_check_r: popt->check = 'r'; break; case Opt_check_s: popt->check = 's'; break; case Opt_ignore: break; case Opt_uid: if (match_int(&args[0], &option)) return 0; popt->uid = option; break; case Opt_gid: if (match_int(&args[0], &option)) return 0; popt->gid = option; break; case Opt_mode: if (match_int(&args[0], &option)) return 0; popt->mode = option; break; case Opt_block: if (match_int(&args[0], &option)) return 0; n = option; if (n != 512 && n != 1024 && n != 2048) return 0; popt->blocksize = n; break; case Opt_nocompress: popt->nocompress = 1; break; default: return 0; } } return 1; } /* * look if the driver can tell the multi session redirection value * * don't change this if you don't know what you do, please! * Multisession is legal only with XA disks. * A non-XA disk with more than one volume descriptor may do it right, but * usually is written in a nowhere standardized "multi-partition" manner. * Multisession uses absolute addressing (solely the first frame of the whole * track is #0), multi-partition uses relative addressing (each first frame of * each track is #0), and a track is not a session. * * A broken CDwriter software or drive firmware does not set new standards, * at least not if conflicting with the existing ones. * * emoenke@gwdg.de */ #define WE_OBEY_THE_WRITTEN_STANDARDS 1 static unsigned int isofs_get_last_session(struct super_block *sb, s32 session) { struct cdrom_multisession ms_info; unsigned int vol_desc_start; struct block_device *bdev = sb->s_bdev; int i; vol_desc_start=0; ms_info.addr_format=CDROM_LBA; if(session >= 0 && session <= 99) { struct cdrom_tocentry Te; Te.cdte_track=session; Te.cdte_format=CDROM_LBA; i = ioctl_by_bdev(bdev, CDROMREADTOCENTRY, (unsigned long) &Te); if (!i) { printk(KERN_DEBUG "Session %d start %d type %d\n", session, Te.cdte_addr.lba, Te.cdte_ctrl&CDROM_DATA_TRACK); if ((Te.cdte_ctrl&CDROM_DATA_TRACK) == 4) return Te.cdte_addr.lba; } printk(KERN_ERR "Invalid session number or type of track\n"); } i = ioctl_by_bdev(bdev, CDROMMULTISESSION, (unsigned long) &ms_info); if (session > 0) printk(KERN_ERR "Invalid session number\n"); #if 0 printk("isofs.inode: CDROMMULTISESSION: rc=%d\n",i); if (i==0) { printk("isofs.inode: XA disk: %s\n",ms_info.xa_flag?"yes":"no"); printk("isofs.inode: vol_desc_start = %d\n", ms_info.addr.lba); } #endif if (i==0) #if WE_OBEY_THE_WRITTEN_STANDARDS if (ms_info.xa_flag) /* necessary for a valid ms_info.addr */ #endif vol_desc_start=ms_info.addr.lba; return vol_desc_start; } /* * Initialize the superblock and read the root inode. * * Note: a check_disk_change() has been done immediately prior * to this call, so we don't need to check again. */ static int isofs_fill_super(struct super_block *s, void *data, int silent) { struct buffer_head * bh = NULL, *pri_bh = NULL; struct hs_primary_descriptor * h_pri = NULL; struct iso_primary_descriptor * pri = NULL; struct iso_supplementary_descriptor *sec = NULL; struct iso_directory_record * rootp; int joliet_level = 0; int iso_blknum, block; int orig_zonesize; int table; unsigned int vol_desc_start; unsigned long first_data_zone; struct inode * inode; struct iso9660_options opt; struct isofs_sb_info * sbi; sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); if (!sbi) return -ENOMEM; s->s_fs_info = sbi; if (!parse_options((char *)data, &opt)) goto out_freesbi; /* * First of all, get the hardware blocksize for this device. * If we don't know what it is, or the hardware blocksize is * larger than the blocksize the user specified, then use * that value. */ /* * What if bugger tells us to go beyond page size? */ opt.blocksize = sb_min_blocksize(s, opt.blocksize); sbi->s_high_sierra = 0; /* default is iso9660 */ vol_desc_start = (opt.sbsector != -1) ? opt.sbsector : isofs_get_last_session(s,opt.session); for (iso_blknum = vol_desc_start+16; iso_blknum < vol_desc_start+100; iso_blknum++) { struct hs_volume_descriptor * hdp; struct iso_volume_descriptor * vdp; block = iso_blknum << (ISOFS_BLOCK_BITS - s->s_blocksize_bits); if (!(bh = sb_bread(s, block))) goto out_no_read; vdp = (struct iso_volume_descriptor *)bh->b_data; hdp = (struct hs_volume_descriptor *)bh->b_data; /* Due to the overlapping physical location of the descriptors, * ISO CDs can match hdp->id==HS_STANDARD_ID as well. To ensure * proper identification in this case, we first check for ISO. */ if (strncmp (vdp->id, ISO_STANDARD_ID, sizeof vdp->id) == 0) { if (isonum_711 (vdp->type) == ISO_VD_END) break; if (isonum_711 (vdp->type) == ISO_VD_PRIMARY) { if (pri == NULL) { pri = (struct iso_primary_descriptor *)vdp; /* Save the buffer in case we need it ... */ pri_bh = bh; bh = NULL; } } #ifdef CONFIG_JOLIET else if (isonum_711 (vdp->type) == ISO_VD_SUPPLEMENTARY) { sec = (struct iso_supplementary_descriptor *)vdp; if (sec->escape[0] == 0x25 && sec->escape[1] == 0x2f) { if (opt.joliet == 'y') { if (sec->escape[2] == 0x40) { joliet_level = 1; } else if (sec->escape[2] == 0x43) { joliet_level = 2; } else if (sec->escape[2] == 0x45) { joliet_level = 3; } printk(KERN_DEBUG"ISO 9660 Extensions: Microsoft Joliet Level %d\n", joliet_level); } goto root_found; } else { /* Unknown supplementary volume descriptor */ sec = NULL; } } #endif } else { if (strncmp (hdp->id, HS_STANDARD_ID, sizeof hdp->id) == 0) { if (isonum_711 (hdp->type) != ISO_VD_PRIMARY) goto out_freebh; sbi->s_high_sierra = 1; opt.rock = 'n'; h_pri = (struct hs_primary_descriptor *)vdp; goto root_found; } } /* Just skip any volume descriptors we don't recognize */ brelse(bh); bh = NULL; } /* * If we fall through, either no volume descriptor was found, * or else we passed a primary descriptor looking for others. */ if (!pri) goto out_unknown_format; brelse(bh); bh = pri_bh; pri_bh = NULL; root_found: if (joliet_level && (pri == NULL || opt.rock == 'n')) { /* This is the case of Joliet with the norock mount flag. * A disc with both Joliet and Rock Ridge is handled later */ pri = (struct iso_primary_descriptor *) sec; } if(sbi->s_high_sierra){ rootp = (struct iso_directory_record *) h_pri->root_directory_record; sbi->s_nzones = isonum_733 (h_pri->volume_space_size); sbi->s_log_zone_size = isonum_723 (h_pri->logical_block_size); sbi->s_max_size = isonum_733(h_pri->volume_space_size); } else { if (!pri) goto out_freebh; rootp = (struct iso_directory_record *) pri->root_directory_record; sbi->s_nzones = isonum_733 (pri->volume_space_size); sbi->s_log_zone_size = isonum_723 (pri->logical_block_size); sbi->s_max_size = isonum_733(pri->volume_space_size); } sbi->s_ninodes = 0; /* No way to figure this out easily */ orig_zonesize = sbi->s_log_zone_size; /* * If the zone size is smaller than the hardware sector size, * this is a fatal error. This would occur if the disc drive * had sectors that were 2048 bytes, but the filesystem had * blocks that were 512 bytes (which should only very rarely * happen.) */ if(orig_zonesize < opt.blocksize) goto out_bad_size; /* RDE: convert log zone size to bit shift */ switch (sbi->s_log_zone_size) { case 512: sbi->s_log_zone_size = 9; break; case 1024: sbi->s_log_zone_size = 10; break; case 2048: sbi->s_log_zone_size = 11; break; default: goto out_bad_zone_size; } s->s_magic = ISOFS_SUPER_MAGIC; s->s_maxbytes = 0xffffffff; /* We can handle files up to 4 GB */ /* The CDROM is read-only, has no nodes (devices) on it, and since all of the files appear to be owned by root, we really do not want to allow suid. (suid or devices will not show up unless we have Rock Ridge extensions) */ s->s_flags |= MS_RDONLY /* | MS_NODEV | MS_NOSUID */; /* Set this for reference. Its not currently used except on write which we don't have .. */ first_data_zone = isonum_733 (rootp->extent) + isonum_711 (rootp->ext_attr_length); sbi->s_firstdatazone = first_data_zone; #ifndef BEQUIET printk(KERN_DEBUG "Max size:%ld Log zone size:%ld\n", sbi->s_max_size, 1UL << sbi->s_log_zone_size); printk(KERN_DEBUG "First datazone:%ld\n", sbi->s_firstdatazone); if(sbi->s_high_sierra) printk(KERN_DEBUG "Disc in High Sierra format.\n"); #endif /* * If the Joliet level is set, we _may_ decide to use the * secondary descriptor, but can't be sure until after we * read the root inode. But before reading the root inode * we may need to change the device blocksize, and would * rather release the old buffer first. So, we cache the * first_data_zone value from the secondary descriptor. */ if (joliet_level) { pri = (struct iso_primary_descriptor *) sec; rootp = (struct iso_directory_record *) pri->root_directory_record; first_data_zone = isonum_733 (rootp->extent) + isonum_711 (rootp->ext_attr_length); } /* * We're all done using the volume descriptor, and may need * to change the device blocksize, so release the buffer now. */ brelse(pri_bh); brelse(bh); /* * Force the blocksize to 512 for 512 byte sectors. The file * read primitives really get it wrong in a bad way if we don't * do this. * * Note - we should never be setting the blocksize to something * less than the hardware sector size for the device. If we * do, we would end up having to read larger buffers and split * out portions to satisfy requests. * * Note2- the idea here is that we want to deal with the optimal * zonesize in the filesystem. If we have it set to something less, * then we have horrible problems with trying to piece together * bits of adjacent blocks in order to properly read directory * entries. By forcing the blocksize in this way, we ensure * that we will never be required to do this. */ sb_set_blocksize(s, orig_zonesize); sbi->s_nls_iocharset = NULL; #ifdef CONFIG_JOLIET if (joliet_level && opt.utf8 == 0) { char * p = opt.iocharset ? opt.iocharset : CONFIG_NLS_DEFAULT; sbi->s_nls_iocharset = load_nls(p); if (! sbi->s_nls_iocharset) { /* Fail only if explicit charset specified */ if (opt.iocharset) goto out_freesbi; sbi->s_nls_iocharset = load_nls_default(); } } #endif s->s_op = &isofs_sops; s->s_export_op = &isofs_export_ops; sbi->s_mapping = opt.map; sbi->s_rock = (opt.rock == 'y' ? 2 : 0); sbi->s_rock_offset = -1; /* initial offset, will guess until SP is found*/ sbi->s_cruft = opt.cruft; sbi->s_hide = opt.hide; sbi->s_showassoc = opt.showassoc; sbi->s_uid = opt.uid; sbi->s_gid = opt.gid; sbi->s_utf8 = opt.utf8; sbi->s_nocompress = opt.nocompress; /* * It would be incredibly stupid to allow people to mark every file * on the disk as suid, so we merely allow them to set the default * permissions. */ sbi->s_mode = opt.mode & 0777; /* * Read the root inode, which _may_ result in changing * the s_rock flag. Once we have the final s_rock value, * we then decide whether to use the Joliet descriptor. */ inode = isofs_iget(s, sbi->s_firstdatazone, 0); /* * If this disk has both Rock Ridge and Joliet on it, then we * want to use Rock Ridge by default. This can be overridden * by using the norock mount option. There is still one other * possibility that is not taken into account: a Rock Ridge * CD with Unicode names. Until someone sees such a beast, it * will not be supported. */ if (sbi->s_rock == 1) { joliet_level = 0; } else if (joliet_level) { sbi->s_rock = 0; if (sbi->s_firstdatazone != first_data_zone) { sbi->s_firstdatazone = first_data_zone; printk(KERN_DEBUG "ISOFS: changing to secondary root\n"); iput(inode); inode = isofs_iget(s, sbi->s_firstdatazone, 0); } } if (opt.check == 'u') { /* Only Joliet is case insensitive by default */ if (joliet_level) opt.check = 'r'; else opt.check = 's'; } sbi->s_joliet_level = joliet_level; /* check the root inode */ if (!inode) goto out_no_root; if (!inode->i_op) goto out_bad_root; /* get the root dentry */ s->s_root = d_alloc_root(inode); if (!(s->s_root)) goto out_no_root; table = 0; if (joliet_level) table += 2; if (opt.check == 'r') table++; s->s_root->d_op = &isofs_dentry_ops[table]; kfree(opt.iocharset); return 0; /* * Display error messages and free resources. */ out_bad_root: printk(KERN_WARNING "isofs_fill_super: root inode not initialized\n"); goto out_iput; out_no_root: printk(KERN_WARNING "isofs_fill_super: get root inode failed\n"); out_iput: iput(inode); #ifdef CONFIG_JOLIET if (sbi->s_nls_iocharset) unload_nls(sbi->s_nls_iocharset); #endif goto out_freesbi; out_no_read: printk(KERN_WARNING "isofs_fill_super: " "bread failed, dev=%s, iso_blknum=%d, block=%d\n", s->s_id, iso_blknum, block); goto out_freesbi; out_bad_zone_size: printk(KERN_WARNING "Bad logical zone size %ld\n", sbi->s_log_zone_size); goto out_freebh; out_bad_size: printk(KERN_WARNING "Logical zone size(%d) < hardware blocksize(%u)\n", orig_zonesize, opt.blocksize); goto out_freebh; out_unknown_format: if (!silent) printk(KERN_WARNING "Unable to identify CD-ROM format.\n"); out_freebh: brelse(bh); out_freesbi: kfree(opt.iocharset); kfree(sbi); s->s_fs_info = NULL; return -EINVAL; } static int isofs_statfs (struct dentry *dentry, struct kstatfs *buf) { struct super_block *sb = dentry->d_sb; buf->f_type = ISOFS_SUPER_MAGIC; buf->f_bsize = sb->s_blocksize; buf->f_blocks = (ISOFS_SB(sb)->s_nzones << (ISOFS_SB(sb)->s_log_zone_size - sb->s_blocksize_bits)); buf->f_bfree = 0; buf->f_bavail = 0; buf->f_files = ISOFS_SB(sb)->s_ninodes; buf->f_ffree = 0; buf->f_namelen = NAME_MAX; return 0; } /* * Get a set of blocks; filling in buffer_heads if already allocated * or getblk() if they are not. Returns the number of blocks inserted * (0 == error.) */ int isofs_get_blocks(struct inode *inode, sector_t iblock_s, struct buffer_head **bh, unsigned long nblocks) { unsigned long b_off; unsigned offset, sect_size; unsigned int firstext; unsigned long nextblk, nextoff; long iblock = (long)iblock_s; int section, rv; struct iso_inode_info *ei = ISOFS_I(inode); lock_kernel(); rv = 0; if (iblock < 0 || iblock != iblock_s) { printk("isofs_get_blocks: block number too large\n"); goto abort; } b_off = iblock; offset = 0; firstext = ei->i_first_extent; sect_size = ei->i_section_size >> ISOFS_BUFFER_BITS(inode); nextblk = ei->i_next_section_block; nextoff = ei->i_next_section_offset; section = 0; while ( nblocks ) { /* If we are *way* beyond the end of the file, print a message. * Access beyond the end of the file up to the next page boundary * is normal, however because of the way the page cache works. * In this case, we just return 0 so that we can properly fill * the page with useless information without generating any * I/O errors. */ if (b_off > ((inode->i_size + PAGE_CACHE_SIZE - 1) >> ISOFS_BUFFER_BITS(inode))) { printk("isofs_get_blocks: block >= EOF (%ld, %ld)\n", iblock, (unsigned long) inode->i_size); goto abort; } /* On the last section, nextblk == 0, section size is likely to * exceed sect_size by a partial block, and access beyond the * end of the file will reach beyond the section size, too. */ while (nextblk && (b_off >= (offset + sect_size))) { struct inode *ninode; offset += sect_size; ninode = isofs_iget(inode->i_sb, nextblk, nextoff); if (!ninode) goto abort; firstext = ISOFS_I(ninode)->i_first_extent; sect_size = ISOFS_I(ninode)->i_section_size >> ISOFS_BUFFER_BITS(ninode); nextblk = ISOFS_I(ninode)->i_next_section_block; nextoff = ISOFS_I(ninode)->i_next_section_offset; iput(ninode); if (++section > 100) { printk("isofs_get_blocks: More than 100 file sections ?!?, aborting...\n"); printk("isofs_get_blocks: block=%ld firstext=%u sect_size=%u " "nextblk=%lu nextoff=%lu\n", iblock, firstext, (unsigned) sect_size, nextblk, nextoff); goto abort; } } if ( *bh ) { map_bh(*bh, inode->i_sb, firstext + b_off - offset); } else { *bh = sb_getblk(inode->i_sb, firstext+b_off-offset); if ( !*bh ) goto abort; } bh++; /* Next buffer head */ b_off++; /* Next buffer offset */ nblocks--; rv++; } abort: unlock_kernel(); return rv; } /* * Used by the standard interfaces. */ static int isofs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) { if (create) { printk("isofs_get_block: Kernel tries to allocate a block\n"); return -EROFS; } return isofs_get_blocks(inode, iblock, &bh_result, 1) ? 0 : -EIO; } static int isofs_bmap(struct inode *inode, sector_t block) { struct buffer_head dummy; int error; dummy.b_state = 0; dummy.b_blocknr = -1000; error = isofs_get_block(inode, block, &dummy, 0); if (!error) return dummy.b_blocknr; return 0; } struct buffer_head *isofs_bread(struct inode *inode, sector_t block) { sector_t blknr = isofs_bmap(inode, block); if (!blknr) return NULL; return sb_bread(inode->i_sb, blknr); } static int isofs_readpage(struct file *file, struct page *page) { return block_read_full_page(page,isofs_get_block); } static sector_t _isofs_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,isofs_get_block); } static const struct address_space_operations isofs_aops = { .readpage = isofs_readpage, .sync_page = block_sync_page, .bmap = _isofs_bmap }; static inline void test_and_set_uid(uid_t *p, uid_t value) { if (value) *p = value; } static inline void test_and_set_gid(gid_t *p, gid_t value) { if (value) *p = value; } static int isofs_read_level3_size(struct inode *inode) { unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); int high_sierra = ISOFS_SB(inode->i_sb)->s_high_sierra; struct buffer_head * bh = NULL; unsigned long block, offset, block_saved, offset_saved; int i = 0; int more_entries = 0; struct iso_directory_record * tmpde = NULL; struct iso_inode_info *ei = ISOFS_I(inode); inode->i_size = 0; /* The first 16 blocks are reserved as the System Area. Thus, * no inodes can appear in block 0. We use this to flag that * this is the last section. */ ei->i_next_section_block = 0; ei->i_next_section_offset = 0; block = ei->i_iget5_block; offset = ei->i_iget5_offset; do { struct iso_directory_record * de; unsigned int de_len; if (!bh) { bh = sb_bread(inode->i_sb, block); if (!bh) goto out_noread; } de = (struct iso_directory_record *) (bh->b_data + offset); de_len = *(unsigned char *) de; if (de_len == 0) { brelse(bh); bh = NULL; ++block; offset = 0; continue; } block_saved = block; offset_saved = offset; offset += de_len; /* Make sure we have a full directory entry */ if (offset >= bufsize) { int slop = bufsize - offset + de_len; if (!tmpde) { tmpde = kmalloc(256, GFP_KERNEL); if (!tmpde) goto out_nomem; } memcpy(tmpde, de, slop); offset &= bufsize - 1; block++; brelse(bh); bh = NULL; if (offset) { bh = sb_bread(inode->i_sb, block); if (!bh) goto out_noread; memcpy((void *)tmpde+slop, bh->b_data, offset); } de = tmpde; } inode->i_size += isonum_733(de->size); if (i == 1) { ei->i_next_section_block = block_saved; ei->i_next_section_offset = offset_saved; } more_entries = de->flags[-high_sierra] & 0x80; i++; if (i > 100) goto out_toomany; } while (more_entries); out: kfree(tmpde); if (bh) brelse(bh); return 0; out_nomem: if (bh) brelse(bh); return -ENOMEM; out_noread: printk(KERN_INFO "ISOFS: unable to read i-node block %lu\n", block); kfree(tmpde); return -EIO; out_toomany: printk(KERN_INFO "isofs_read_level3_size: " "More than 100 file sections ?!?, aborting...\n" "isofs_read_level3_size: inode=%lu\n", inode->i_ino); goto out; } static void isofs_read_inode(struct inode *inode) { struct super_block *sb = inode->i_sb; struct isofs_sb_info *sbi = ISOFS_SB(sb); unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); unsigned long block; int high_sierra = sbi->s_high_sierra; struct buffer_head * bh = NULL; struct iso_directory_record * de; struct iso_directory_record * tmpde = NULL; unsigned int de_len; unsigned long offset; struct iso_inode_info *ei = ISOFS_I(inode); block = ei->i_iget5_block; bh = sb_bread(inode->i_sb, block); if (!bh) goto out_badread; offset = ei->i_iget5_offset; de = (struct iso_directory_record *) (bh->b_data + offset); de_len = *(unsigned char *) de; if (offset + de_len > bufsize) { int frag1 = bufsize - offset; tmpde = kmalloc(de_len, GFP_KERNEL); if (tmpde == NULL) { printk(KERN_INFO "isofs_read_inode: out of memory\n"); goto fail; } memcpy(tmpde, bh->b_data + offset, frag1); brelse(bh); bh = sb_bread(inode->i_sb, ++block); if (!bh) goto out_badread; memcpy((char *)tmpde+frag1, bh->b_data, de_len - frag1); de = tmpde; } inode->i_ino = isofs_get_ino(ei->i_iget5_block, ei->i_iget5_offset, ISOFS_BUFFER_BITS(inode)); /* Assume it is a normal-format file unless told otherwise */ ei->i_file_format = isofs_file_normal; if (de->flags[-high_sierra] & 2) { inode->i_mode = S_IRUGO | S_IXUGO | S_IFDIR; inode->i_nlink = 1; /* Set to 1. We know there are 2, but the find utility tries to optimize if it is 2, and it screws up. It is easier to give 1 which tells find to do it the hard way. */ } else { /* Everybody gets to read the file. */ inode->i_mode = sbi->s_mode; inode->i_nlink = 1; inode->i_mode |= S_IFREG; } inode->i_uid = sbi->s_uid; inode->i_gid = sbi->s_gid; inode->i_blocks = 0; ei->i_format_parm[0] = 0; ei->i_format_parm[1] = 0; ei->i_format_parm[2] = 0; ei->i_section_size = isonum_733 (de->size); if (de->flags[-high_sierra] & 0x80) { if(isofs_read_level3_size(inode)) goto fail; } else { ei->i_next_section_block = 0; ei->i_next_section_offset = 0; inode->i_size = isonum_733 (de->size); } /* * Some dipshit decided to store some other bit of information * in the high byte of the file length. Truncate size in case * this CDROM was mounted with the cruft option. */ if (sbi->s_cruft == 'y') inode->i_size &= 0x00ffffff; if (de->interleave[0]) { printk("Interleaved files not (yet) supported.\n"); inode->i_size = 0; } /* I have no idea what file_unit_size is used for, so we will flag it for now */ if (de->file_unit_size[0] != 0) { printk("File unit size != 0 for ISO file (%ld).\n", inode->i_ino); } /* I have no idea what other flag bits are used for, so we will flag it for now */ #ifdef DEBUG if((de->flags[-high_sierra] & ~2)!= 0){ printk("Unusual flag settings for ISO file (%ld %x).\n", inode->i_ino, de->flags[-high_sierra]); } #endif inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode->i_ctime.tv_sec = iso_date(de->date, high_sierra); inode->i_mtime.tv_nsec = inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec = 0; ei->i_first_extent = (isonum_733 (de->extent) + isonum_711 (de->ext_attr_length)); /* Set the number of blocks for stat() - should be done before RR */ inode->i_blocks = (inode->i_size + 511) >> 9; /* * Now test for possible Rock Ridge extensions which will override * some of these numbers in the inode structure. */ if (!high_sierra) { parse_rock_ridge_inode(de, inode); /* if we want uid/gid set, override the rock ridge setting */ test_and_set_uid(&inode->i_uid, sbi->s_uid); test_and_set_gid(&inode->i_gid, sbi->s_gid); } /* Install the inode operations vector */ if (S_ISREG(inode->i_mode)) { inode->i_fop = &generic_ro_fops; switch ( ei->i_file_format ) { #ifdef CONFIG_ZISOFS case isofs_file_compressed: inode->i_data.a_ops = &zisofs_aops; break; #endif default: inode->i_data.a_ops = &isofs_aops; break; } } else if (S_ISDIR(inode->i_mode)) { inode->i_op = &isofs_dir_inode_operations; inode->i_fop = &isofs_dir_operations; } else if (S_ISLNK(inode->i_mode)) { inode->i_op = &page_symlink_inode_operations; inode->i_data.a_ops = &isofs_symlink_aops; } else /* XXX - parse_rock_ridge_inode() had already set i_rdev. */ init_special_inode(inode, inode->i_mode, inode->i_rdev); out: kfree(tmpde); if (bh) brelse(bh); return; out_badread: printk(KERN_WARNING "ISOFS: unable to read i-node block\n"); fail: make_bad_inode(inode); goto out; } struct isofs_iget5_callback_data { unsigned long block; unsigned long offset; }; static int isofs_iget5_test(struct inode *ino, void *data) { struct iso_inode_info *i = ISOFS_I(ino); struct isofs_iget5_callback_data *d = (struct isofs_iget5_callback_data*)data; return (i->i_iget5_block == d->block) && (i->i_iget5_offset == d->offset); } static int isofs_iget5_set(struct inode *ino, void *data) { struct iso_inode_info *i = ISOFS_I(ino); struct isofs_iget5_callback_data *d = (struct isofs_iget5_callback_data*)data; i->i_iget5_block = d->block; i->i_iget5_offset = d->offset; return 0; } /* Store, in the inode's containing structure, the block and block * offset that point to the underlying meta-data for the inode. The * code below is otherwise similar to the iget() code in * include/linux/fs.h */ struct inode *isofs_iget(struct super_block *sb, unsigned long block, unsigned long offset) { unsigned long hashval; struct inode *inode; struct isofs_iget5_callback_data data; if (offset >= 1ul << sb->s_blocksize_bits) return NULL; data.block = block; data.offset = offset; hashval = (block << sb->s_blocksize_bits) | offset; inode = iget5_locked(sb, hashval, &isofs_iget5_test, &isofs_iget5_set, &data); if (inode && (inode->i_state & I_NEW)) { sb->s_op->read_inode(inode); unlock_new_inode(inode); } return inode; } static int isofs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data, struct vfsmount *mnt) { return get_sb_bdev(fs_type, flags, dev_name, data, isofs_fill_super, mnt); } static struct file_system_type iso9660_fs_type = { .owner = THIS_MODULE, .name = "iso9660", .get_sb = isofs_get_sb, .kill_sb = kill_block_super, .fs_flags = FS_REQUIRES_DEV, }; static int __init init_iso9660_fs(void) { int err = init_inodecache(); if (err) goto out; #ifdef CONFIG_ZISOFS err = zisofs_init(); if (err) goto out1; #endif err = register_filesystem(&iso9660_fs_type); if (err) goto out2; return 0; out2: #ifdef CONFIG_ZISOFS zisofs_cleanup(); out1: #endif destroy_inodecache(); out: return err; } static void __exit exit_iso9660_fs(void) { unregister_filesystem(&iso9660_fs_type); #ifdef CONFIG_ZISOFS zisofs_cleanup(); #endif destroy_inodecache(); } module_init(init_iso9660_fs) module_exit(exit_iso9660_fs) MODULE_LICENSE("GPL"); /* Actual filesystem name is iso9660, as requested in filesystems.c */ MODULE_ALIAS("iso9660");