@@ -215,7 +215,7 @@ static int bcm2708_fb_debugfs_init(struct bcm2708_fb *fb)
215215static void set_display_num (struct bcm2708_fb * fb )
216216{
217217 if (fb && fb -> fbdev && fb -> fbdev -> firmware_supports_multifb ) {
218- u32 tmp = fb -> display_settings .display_num ;
218+ u32 tmp = cpu_to_le32 ( fb -> display_settings .display_num ) ;
219219
220220 if (rpi_firmware_property (fb -> fbdev -> fw ,
221221 RPI_FIRMWARE_FRAMEBUFFER_SET_DISPLAY_NUM ,
@@ -350,22 +350,22 @@ static int bcm2708_fb_set_par(struct fb_info *info)
350350{
351351 struct bcm2708_fb * fb = to_bcm2708 (info );
352352 struct fb_alloc_tags fbinfo = {
353- .tag1 = { RPI_FIRMWARE_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT ,
354- 8 , 0 , },
355- .xres = info -> var .xres ,
356- .yres = info -> var .yres ,
357- .tag2 = { RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT ,
358- 8 , 0 , },
359- .xres_virtual = info -> var .xres_virtual ,
360- .yres_virtual = info -> var .yres_virtual ,
361- .tag3 = { RPI_FIRMWARE_FRAMEBUFFER_SET_DEPTH , 4 , 0 },
362- .bpp = info -> var .bits_per_pixel ,
363- .tag4 = { RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET , 8 , 0 },
364- .xoffset = info -> var .xoffset ,
365- .yoffset = info -> var .yoffset ,
366- .tag5 = { RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE , 8 , 0 },
353+ .tag1 = { cpu_to_le32 ( RPI_FIRMWARE_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT ) ,
354+ cpu_to_le32 ( 8 ) , 0 , },
355+ .xres = cpu_to_le32 ( info -> var .xres ) ,
356+ .yres = cpu_to_le32 ( info -> var .yres ) ,
357+ .tag2 = { cpu_to_le32 ( RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT ) ,
358+ cpu_to_le32 ( 8 ) , 0 , },
359+ .xres_virtual = cpu_to_le32 ( info -> var .xres_virtual ) ,
360+ .yres_virtual = cpu_to_le32 ( info -> var .yres_virtual ) ,
361+ .tag3 = { cpu_to_le32 ( RPI_FIRMWARE_FRAMEBUFFER_SET_DEPTH ), cpu_to_le32 ( 4 ) , 0 },
362+ .bpp = cpu_to_le32 ( info -> var .bits_per_pixel ) ,
363+ .tag4 = { cpu_to_le32 ( RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET ), cpu_to_le32 ( 8 ) , 0 },
364+ .xoffset = cpu_to_le32 ( info -> var .xoffset ) ,
365+ .yoffset = cpu_to_le32 ( info -> var .yoffset ) ,
366+ .tag5 = { cpu_to_le32 ( RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE ), cpu_to_le32 ( 8 ) , 0 },
367367 /* base and screen_size will be initialised later */
368- .tag6 = { RPI_FIRMWARE_FRAMEBUFFER_SET_PITCH , 4 , 0 },
368+ .tag6 = { cpu_to_le32 ( RPI_FIRMWARE_FRAMEBUFFER_SET_PITCH ), cpu_to_le32 ( 4 ) , 0 },
369369 /* pitch will be initialised later */
370370 };
371371 int ret , image_size ;
@@ -397,6 +397,7 @@ static int bcm2708_fb_set_par(struct fb_info *info)
397397 fb -> dma_addr = 0 ;
398398 }
399399
400+ printk (KERN_ERR "allocating %d bytes\n" , image_size );
400401 fb -> cpuaddr = dma_alloc_coherent (info -> device , image_size ,
401402 & fb -> dma_addr , GFP_KERNEL );
402403
@@ -409,13 +410,13 @@ static int bcm2708_fb_set_par(struct fb_info *info)
409410 }
410411
411412 if (fb -> cpuaddr ) {
412- fbinfo .base = fb -> dma_addr ;
413- fbinfo .screen_size = image_size ;
414- fbinfo .pitch = ( info -> var .xres * info -> var .bits_per_pixel ) >> 3 ;
413+ fbinfo .base = cpu_to_le32 ( fb -> dma_addr ) ;
414+ fbinfo .screen_size = cpu_to_le32 ( image_size ) ;
415+ fbinfo .pitch = cpu_to_le32 (( info -> var .xres * info -> var .bits_per_pixel ) >> 3 ) ;
415416
416417 ret = rpi_firmware_property_list (fb -> fbdev -> fw , & fbinfo ,
417418 sizeof (fbinfo ));
418- if (ret || fbinfo .base != fb -> dma_addr ) {
419+ if (ret || le32_to_cpu ( fbinfo .base ) != fb -> dma_addr ) {
419420 /* Firmware either failed, or assigned a different base
420421 * address (ie it doesn't support being passed an FB
421422 * allocation).
@@ -442,7 +443,7 @@ static int bcm2708_fb_set_par(struct fb_info *info)
442443 */
443444 fbinfo .base = 0 ;
444445 fbinfo .screen_size = 0 ;
445- fbinfo .tag6 .tag = RPI_FIRMWARE_FRAMEBUFFER_GET_PITCH ;
446+ fbinfo .tag6 .tag = cpu_to_le32 ( RPI_FIRMWARE_FRAMEBUFFER_GET_PITCH ) ;
446447 fbinfo .pitch = 0 ;
447448
448449 ret = rpi_firmware_property_list (fb -> fbdev -> fw , & fbinfo ,
@@ -460,6 +461,14 @@ static int bcm2708_fb_set_par(struct fb_info *info)
460461 else
461462 fb -> fb .fix .visual = FB_VISUAL_TRUECOLOR ;
462463
464+ fbinfo .base = le32_to_cpu (fbinfo .base );
465+ fbinfo .bpp = le32_to_cpu (fbinfo .bpp );
466+ fbinfo .pitch = le32_to_cpu (fbinfo .pitch );
467+ fbinfo .screen_size = le32_to_cpu (fbinfo .screen_size );
468+ fbinfo .xres = le32_to_cpu (fbinfo .xres );
469+ fbinfo .yres = le32_to_cpu (fbinfo .yres );
470+ fbinfo .yres_virtual = le32_to_cpu (fbinfo .yres_virtual );
471+
463472 fb -> fb .fix .line_length = fbinfo .pitch ;
464473 fbinfo .base |= 0x40000000 ;
465474 fb -> fb_bus_address = fbinfo .base ;
@@ -1087,6 +1096,7 @@ static int bcm2708_fb_probe(struct platform_device *dev)
10871096 ret = rpi_firmware_property (fw ,
10881097 RPI_FIRMWARE_FRAMEBUFFER_GET_NUM_DISPLAYS ,
10891098 & num_displays , sizeof (u32 ));
1099+ num_displays = le32_to_cpu (num_displays );
10901100
10911101 /* If we fail to get the number of displays, or it returns 0, then
10921102 * assume old firmware that doesn't have the mailbox call, so just
@@ -1149,19 +1159,23 @@ static int bcm2708_fb_probe(struct platform_device *dev)
11491159 for (i = 0 ; i < num_displays ; i ++ ) {
11501160 struct bcm2708_fb * fb = & fbdev -> displays [i ];
11511161
1152- fb -> display_settings .display_num = i ;
1162+ fb -> display_settings .display_num = cpu_to_le32 ( i ) ;
11531163 fb -> dev = dev ;
11541164 fb -> fb .device = & dev -> dev ;
11551165 fb -> fbdev = fbdev ;
11561166
1157- fb -> gpu .base = gpu_mem .base ;
1158- fb -> gpu .length = gpu_mem .length ;
1167+ fb -> gpu .base = le32_to_cpu ( gpu_mem .base ) ;
1168+ fb -> gpu .length = le32_to_cpu ( gpu_mem .length ) ;
11591169
11601170 if (fbdev -> firmware_supports_multifb ) {
11611171 ret = rpi_firmware_property (fw ,
11621172 RPI_FIRMWARE_FRAMEBUFFER_GET_DISPLAY_SETTINGS ,
11631173 & fb -> display_settings ,
11641174 GET_DISPLAY_SETTINGS_PAYLOAD_SIZE );
1175+ fb -> display_settings .display_num = le32_to_cpu (fb -> display_settings .display_num );
1176+ fb -> display_settings .width = le32_to_cpu (fb -> display_settings .width );
1177+ fb -> display_settings .height = le32_to_cpu (fb -> display_settings .height );
1178+ fb -> display_settings .depth = le32_to_cpu (fb -> display_settings .depth );
11651179 } else {
11661180 memset (& fb -> display_settings , 0 ,
11671181 sizeof (fb -> display_settings ));
0 commit comments