[PATCH] Big endian support for RV730

Cédric Cano ccano at interfaceconcept.com
Fri Feb 11 01:54:59 PST 2011


Signed-off-by: Cedric Cano <ccano at interfaceconcept.com>
---
diff -Naur linux-2.6.35.6/drivers/gpu/drm/radeon/atombios_crtc.c 
linux-2.6.35.6/drivers/gpu/drm/radeon/atombios_crtc.c
--- linux-2.6.35.6/drivers/gpu/drm/radeon/atombios_crtc.c    2010-09-27 
02:19:16.000000000 +0200
+++ linux-2.6.35.6/drivers/gpu/drm/radeon/atombios_crtc.c    2011-01-27 
15:03:46.000000000 +0100
@@ -808,6 +808,7 @@
      struct radeon_bo *rbo;
      uint64_t fb_location;
      uint32_t fb_format, fb_pitch_pixels, tiling_flags;
+    u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE);
      int r;

      /* no fb bound */
@@ -844,11 +845,17 @@
      case 16:
          fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) |
                   EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB565));
+#ifdef __BIG_ENDIAN
+        fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN16);
+#endif
          break;
      case 24:
      case 32:
          fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_32BPP) |
                   EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB8888));
+#ifdef __BIG_ENDIAN
+        fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN32);
+#endif
          break;
      default:
          DRM_ERROR("Unsupported screen depth %d\n",
@@ -888,6 +895,7 @@
      WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS + 
radeon_crtc->crtc_offset,
             (u32) fb_location & EVERGREEN_GRPH_SURFACE_ADDRESS_MASK);
      WREG32(EVERGREEN_GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format);
+    WREG32(EVERGREEN_GRPH_SWAP_CONTROL + radeon_crtc->crtc_offset, 
fb_swap);

      WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0);
      WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0);
@@ -942,6 +950,7 @@
      struct radeon_bo *rbo;
      uint64_t fb_location;
      uint32_t fb_format, fb_pitch_pixels, tiling_flags;
+    u32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE;
      int r;

      /* no fb bound */
@@ -981,12 +990,18 @@
          fb_format =
              AVIVO_D1GRPH_CONTROL_DEPTH_16BPP |
              AVIVO_D1GRPH_CONTROL_16BPP_RGB565;
+#ifdef __BIG_ENDIAN
+        fb_swap = R600_D1GRPH_SWAP_ENDIAN_16BIT;
+#endif
          break;
      case 24:
      case 32:
          fb_format =
              AVIVO_D1GRPH_CONTROL_DEPTH_32BPP |
              AVIVO_D1GRPH_CONTROL_32BPP_ARGB8888;
+#ifdef __BIG_ENDIAN
+        fb_swap = R600_D1GRPH_SWAP_ENDIAN_32BIT;
+#endif
          break;
      default:
          DRM_ERROR("Unsupported screen depth %d\n",
@@ -1019,6 +1034,8 @@
      WREG32(AVIVO_D1GRPH_SECONDARY_SURFACE_ADDRESS +
             radeon_crtc->crtc_offset, (u32) fb_location);
      WREG32(AVIVO_D1GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format);
+    if (rdev->family >= CHIP_R600)
+        WREG32(R600_D1GRPH_SWAP_CONTROL + radeon_crtc->crtc_offset, 
fb_swap);

      WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0);
      WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0);
diff -Naur linux-2.6.35.6/drivers/gpu/drm/radeon/r600_blit.c 
linux-2.6.35.6/drivers/gpu/drm/radeon/r600_blit.c
--- linux-2.6.35.6/drivers/gpu/drm/radeon/r600_blit.c    2010-09-27 
02:19:16.000000000 +0200
+++ linux-2.6.35.6/drivers/gpu/drm/radeon/r600_blit.c    2011-02-10 
10:25:32.000000000 +0100
@@ -53,7 +53,9 @@
      if (h < 8)
          h = 8;

-    cb_color_info = ((format << 2) | (1 << 27));
+    cb_color_info = (0 |
+        (format << 2) |
+        (1 << 27));
      pitch = (w / 8) - 1;
      slice = ((w * h) / 64) - 1;

@@ -137,9 +139,9 @@
      ps = (u32 *) ((char *)dev->agp_buffer_map->handle + 
dev_priv->blit_vb->offset + 256);

      for (i = 0; i < r6xx_vs_size; i++)
-        vs[i] = r6xx_vs[i];
+        vs[i] = cpu_to_le32(r6xx_vs[i]);
      for (i = 0; i < r6xx_ps_size; i++)
-        ps[i] = r6xx_ps[i];
+        ps[i] = cpu_to_le32(r6xx_ps[i]);

      dev_priv->blit_vb->used = 512;

@@ -191,7 +193,12 @@
      RING_LOCALS;
      DRM_DEBUG("\n");

-    sq_vtx_constant_word2 = (((gpu_addr >> 32) & 0xff) | (16 << 8));
+    sq_vtx_constant_word2 = (0 |
+#ifdef __BIG_ENDIAN
+        (2 << 30) |
+#endif
+        ((gpu_addr >> 32) & 0xff) |
+        (16 << 8));

      BEGIN_RING(9);
      OUT_RING(CP_PACKET3(R600_IT_SET_RESOURCE, 7));
@@ -235,7 +242,8 @@
      sq_tex_resource_word1 = (format << 26);
      sq_tex_resource_word1 |= ((h - 1) << 0);

-    sq_tex_resource_word4 = ((1 << 14) |
+    sq_tex_resource_word4 = (0 |
+                 (1 << 14) |
                   (0 << 16) |
                   (1 << 19) |
                   (2 << 22) |
@@ -291,7 +299,11 @@
      OUT_RING(DI_PT_RECTLIST);

      OUT_RING(CP_PACKET3(R600_IT_INDEX_TYPE, 0));
+#ifdef __BIG_ENDIAN
+    OUT_RING((2 << 2) | DI_INDEX_SIZE_16_BIT);
+#else
      OUT_RING(DI_INDEX_SIZE_16_BIT);
+#endif

      OUT_RING(CP_PACKET3(R600_IT_NUM_INSTANCES, 0));
      OUT_RING(1);
diff -Naur linux-2.6.35.6/drivers/gpu/drm/radeon/r600_blit_kms.c 
linux-2.6.35.6/drivers/gpu/drm/radeon/r600_blit_kms.c
--- linux-2.6.35.6/drivers/gpu/drm/radeon/r600_blit_kms.c    2010-09-27 
02:19:16.000000000 +0200
+++ linux-2.6.35.6/drivers/gpu/drm/radeon/r600_blit_kms.c    2011-02-10 
10:25:43.000000000 +0100
@@ -29,7 +29,9 @@
      if (h < 8)
          h = 8;

-    cb_color_info = ((format << 2) | (1 << 27));
+    cb_color_info = (0 |
+            (format << 2) |
+            (1 << 27));
      pitch = (w / 8) - 1;
      slice = ((w * h) / 64) - 1;

@@ -139,7 +141,12 @@
  {
      u32 sq_vtx_constant_word2;

-    sq_vtx_constant_word2 = ((upper_32_bits(gpu_addr) & 0xff) | (16 << 8));
+    sq_vtx_constant_word2 = (0 |
+#ifdef __BIG_ENDIAN
+            (2 << 30) |
+#endif
+            (upper_32_bits(gpu_addr) & 0xff) |
+            (16 << 8));

      radeon_ring_write(rdev, PACKET3(PACKET3_SET_RESOURCE, 7));
      radeon_ring_write(rdev, 0x460);
@@ -181,7 +188,8 @@
      sq_tex_resource_word1 = (format << 26);
      sq_tex_resource_word1 |= ((h - 1) << 0);

-    sq_tex_resource_word4 = ((1 << 14) |
+    sq_tex_resource_word4 = (0 |
+                 (1 << 14) |
                   (0 << 16) |
                   (1 << 19) |
                   (2 << 22) |
@@ -228,7 +236,11 @@
      radeon_ring_write(rdev, DI_PT_RECTLIST);

      radeon_ring_write(rdev, PACKET3(PACKET3_INDEX_TYPE, 0));
+#ifdef __BIG_ENDIAN
+    radeon_ring_write(rdev, (2 << 2) | DI_INDEX_SIZE_16_BIT);
+#else
      radeon_ring_write(rdev, DI_INDEX_SIZE_16_BIT);
+#endif

      radeon_ring_write(rdev, PACKET3(PACKET3_NUM_INSTANCES, 0));
      radeon_ring_write(rdev, 1);
@@ -399,7 +411,11 @@
      dwords = ALIGN(rdev->r600_blit.state_len, 0x10);
      gpu_addr = rdev->r600_blit.shader_gpu_addr + 
rdev->r600_blit.state_offset;
      radeon_ring_write(rdev, PACKET3(PACKET3_INDIRECT_BUFFER, 2));
+#ifdef __BIG_ENDIAN
+    radeon_ring_write(rdev, (gpu_addr & 0xFFFFFFFC) | (2 << 0));
+#else
      radeon_ring_write(rdev, gpu_addr & 0xFFFFFFFC);
+#endif
      radeon_ring_write(rdev, upper_32_bits(gpu_addr) & 0xFF);
      radeon_ring_write(rdev, dwords);

@@ -442,7 +458,7 @@
  int r600_blit_init(struct radeon_device *rdev)
  {
      u32 obj_size;
-    int r, dwords;
+    int i, r, dwords;
      void *ptr;
      u32 packet2s[16];
      int num_packet2s = 0;
@@ -460,7 +476,7 @@

      dwords = rdev->r600_blit.state_len;
      while (dwords & 0xf) {
-        packet2s[num_packet2s++] = PACKET2(0);
+        packet2s[num_packet2s++] = cpu_to_le32(PACKET2(0));
          dwords++;
      }

@@ -503,8 +519,12 @@
      if (num_packet2s)
          memcpy_toio(ptr + rdev->r600_blit.state_offset + 
(rdev->r600_blit.state_len * 4),
                  packet2s, num_packet2s * 4);
-    memcpy(ptr + rdev->r600_blit.vs_offset, r6xx_vs, r6xx_vs_size * 4);
-    memcpy(ptr + rdev->r600_blit.ps_offset, r6xx_ps, r6xx_ps_size * 4);
+    for(i = 0; i < r6xx_vs_size; i++) {
+        *(u32 *)((unsigned long)ptr + rdev->r600_blit.vs_offset + i * 
4) = cpu_to_le32(r6xx_vs[i]);
+    }
+    for(i = 0; i < r6xx_ps_size; i++) {
+        *(u32 *)((unsigned long)ptr + rdev->r600_blit.ps_offset + i * 
4) = cpu_to_le32(r6xx_ps[i]);
+    }
      radeon_bo_kunmap(rdev->r600_blit.shader_obj);
      radeon_bo_unreserve(rdev->r600_blit.shader_obj);
      return 0;
diff -Naur linux-2.6.35.6/drivers/gpu/drm/radeon/r600_blit_shaders.c 
linux-2.6.35.6/drivers/gpu/drm/radeon/r600_blit_shaders.c
--- linux-2.6.35.6/drivers/gpu/drm/radeon/r600_blit_shaders.c   
  2010-09-27 02:19:16.000000000 +0200
+++ linux-2.6.35.6/drivers/gpu/drm/radeon/r600_blit_shaders.c   
  2011-01-27 15:09:59.000000000 +0100
@@ -1075,7 +1075,11 @@
      0x00000000,
      0x3c000000,
      0x68cd1000,
+#ifdef __BIG_ENDIAN
+    0x000a0000,
+#else
      0x00080000,
+#endif
      0x00000000,
  };

diff -Naur linux-2.6.35.6/drivers/gpu/drm/radeon/r600.c 
linux-2.6.35.6/drivers/gpu/drm/radeon/r600.c
--- linux-2.6.35.6/drivers/gpu/drm/radeon/r600.c    2010-09-27 
02:19:16.000000000 +0200
+++ linux-2.6.35.6/drivers/gpu/drm/radeon/r600.c    2011-02-09 
11:31:24.000000000 +0100
@@ -2064,7 +2064,11 @@

      r600_cp_stop(rdev);

-    WREG32(CP_RB_CNTL, RB_NO_UPDATE | RB_BLKSZ(15) | RB_BUFSZ(3));
+    WREG32(CP_RB_CNTL,
+#ifdef __BIG_ENDIAN
+        BUF_SWAP_32BIT |
+#endif
+        RB_NO_UPDATE | RB_BLKSZ(15) | RB_BUFSZ(3));

      /* Reset cp */
      WREG32(GRBM_SOFT_RESET, SOFT_RESET_CP);
@@ -2149,7 +2153,11 @@
      WREG32(CP_RB_CNTL, tmp | RB_RPTR_WR_ENA);
      WREG32(CP_RB_RPTR_WR, 0);
      WREG32(CP_RB_WPTR, 0);
-    WREG32(CP_RB_RPTR_ADDR, rdev->cp.gpu_addr & 0xFFFFFFFF);
+#ifdef __BIG_ENDIAN
+    WREG32(CP_RB_RPTR_ADDR, (rdev->cp.gpu_addr & 0xFFFFFFFC) | (2 << 0));
+#else
+    WREG32(CP_RB_RPTR_ADDR, rdev->cp.gpu_addr & 0xFFFFFFFC);
+#endif
      WREG32(CP_RB_RPTR_ADDR_HI, upper_32_bits(rdev->cp.gpu_addr));
      mdelay(1);
      WREG32(CP_RB_CNTL, tmp);
@@ -2306,7 +2314,11 @@
          }
      }
      WREG32(SCRATCH_ADDR, (rdev->wb.gpu_addr >> 8) & 0xFFFFFFFF);
+#ifdef __BIG_ENDIAN
+    WREG32(CP_RB_RPTR_ADDR, ((rdev->wb.gpu_addr + 1024) & 0xFFFFFFFC) | 
(2 << 0));
+#else
      WREG32(CP_RB_RPTR_ADDR, (rdev->wb.gpu_addr + 1024) & 0xFFFFFFFC);
+#endif
      WREG32(CP_RB_RPTR_ADDR_HI, upper_32_bits(rdev->wb.gpu_addr + 1024) 
& 0xFF);
      WREG32(SCRATCH_UMSK, 0xff);
      return 0;
@@ -2661,7 +2673,11 @@
  {
      /* FIXME: implement */
      radeon_ring_write(rdev, PACKET3(PACKET3_INDIRECT_BUFFER, 2));
+#ifdef __BIG_ENDIAN
+    radeon_ring_write(rdev, (ib->gpu_addr & 0xFFFFFFFC) | (2 << 0));
+#else
      radeon_ring_write(rdev, ib->gpu_addr & 0xFFFFFFFC);
+#endif
      radeon_ring_write(rdev, upper_32_bits(ib->gpu_addr) & 0xFF);
      radeon_ring_write(rdev, ib->length_dw);
  }
@@ -3316,8 +3332,8 @@
      while (rptr != wptr) {
          /* wptr/rptr are in bytes! */
          ring_index = rptr / 4;
-        src_id =  rdev->ih.ring[ring_index] & 0xff;
-        src_data = rdev->ih.ring[ring_index + 1] & 0xfffffff;
+        src_id =  readl(rdev->ih.ring + ring_index) & 0xff;
+        src_data = readl(rdev->ih.ring + ring_index + 1) & 0xfffffff;

          switch (src_id) {
          case 1: /* D1 vblank/vline */
diff -Naur linux-2.6.35.6/drivers/gpu/drm/radeon/r600_cp.c 
linux-2.6.35.6/drivers/gpu/drm/radeon/r600_cp.c
--- linux-2.6.35.6/drivers/gpu/drm/radeon/r600_cp.c    2010-09-27 
02:19:16.000000000 +0200
+++ linux-2.6.35.6/drivers/gpu/drm/radeon/r600_cp.c    2011-01-27 
14:29:01.000000000 +0100
@@ -396,6 +396,9 @@
      r600_do_cp_stop(dev_priv);

      RADEON_WRITE(R600_CP_RB_CNTL,
+#ifdef __BIG_ENDIAN
+             RADEON_BUF_SWAP_32BIT |
+#endif
               R600_RB_NO_UPDATE |
               R600_RB_BLKSZ(15) |
               R600_RB_BUFSZ(3));
@@ -486,6 +489,9 @@
      r600_do_cp_stop(dev_priv);

      RADEON_WRITE(R600_CP_RB_CNTL,
+#ifdef __BIG_ENDIAN
+             RADEON_BUF_SWAP_32BIT |
+#endif
               R600_RB_NO_UPDATE |
               (15 << 8) |
               (3 << 0));
@@ -550,7 +556,11 @@

      if (!dev_priv->writeback_works) {
          /* Disable writeback to avoid unnecessary bus master transfer */
-        RADEON_WRITE(R600_CP_RB_CNTL, RADEON_READ(R600_CP_RB_CNTL) |
+        RADEON_WRITE(R600_CP_RB_CNTL,
+#ifdef __BIG_ENDIAN
+                RADEON_BUF_SWAP_32BIT |
+#endif
+                 RADEON_READ(R600_CP_RB_CNTL) |
                   RADEON_RB_NO_UPDATE);
          RADEON_WRITE(R600_SCRATCH_UMSK, 0);
      }
@@ -575,7 +585,11 @@

      RADEON_WRITE(R600_CP_RB_WPTR_DELAY, 0);
      cp_rb_cntl = RADEON_READ(R600_CP_RB_CNTL);
-    RADEON_WRITE(R600_CP_RB_CNTL, R600_RB_RPTR_WR_ENA);
+    RADEON_WRITE(R600_CP_RB_CNTL,
+#ifdef __BIG_ENDIAN
+        RADEON_BUF_SWAP_32BIT |
+#endif
+        R600_RB_RPTR_WR_ENA);

      RADEON_WRITE(R600_CP_RB_RPTR_WR, cp_ptr);
      RADEON_WRITE(R600_CP_RB_WPTR, cp_ptr);
@@ -1838,7 +1852,10 @@
              + dev_priv->gart_vm_start;
      }
      RADEON_WRITE(R600_CP_RB_RPTR_ADDR,
-             rptr_addr & 0xffffffff);
+#ifdef __BIG_ENDIAN
+             (2 << 0) |
+#endif
+             (rptr_addr & 0xfffffffc));
      RADEON_WRITE(R600_CP_RB_RPTR_ADDR_HI,
               upper_32_bits(rptr_addr));

@@ -1889,7 +1906,7 @@
      {
          u64 scratch_addr;

-        scratch_addr = RADEON_READ(R600_CP_RB_RPTR_ADDR);
+        scratch_addr = RADEON_READ(R600_CP_RB_RPTR_ADDR) & 0xFFFFFFFC;
          scratch_addr |= ((u64)RADEON_READ(R600_CP_RB_RPTR_ADDR_HI)) << 32;
          scratch_addr += R600_SCRATCH_REG_OFFSET;
          scratch_addr >>= 8;
diff -Naur linux-2.6.35.6/drivers/gpu/drm/radeon/r600_reg.h 
linux-2.6.35.6/drivers/gpu/drm/radeon/r600_reg.h
--- linux-2.6.35.6/drivers/gpu/drm/radeon/r600_reg.h    2010-09-27 
02:19:16.000000000 +0200
+++ linux-2.6.35.6/drivers/gpu/drm/radeon/r600_reg.h    2011-01-27 
15:05:50.000000000 +0100
@@ -81,7 +81,11 @@
  #define R600_MEDIUM_VID_LOWER_GPIO_CNTL                            0x720
  #define R600_LOW_VID_LOWER_GPIO_CNTL                               0x724

-
+#define R600_D1GRPH_SWAP_CONTROL                               0x610C
+#       define R600_D1GRPH_SWAP_ENDIAN_NONE                    (0 << 0)
+#       define R600_D1GRPH_SWAP_ENDIAN_16BIT                   (1 << 0)
+#       define R600_D1GRPH_SWAP_ENDIAN_32BIT                   (2 << 0)
+#       define R600_D1GRPH_SWAP_ENDIAN_64BIT                   (3 << 0)

  #define R600_HDP_NONSURFACE_BASE                                0x2c04

diff -Naur linux-2.6.35.6/drivers/gpu/drm/radeon/radeon_atombios.c 
linux-2.6.35.6/drivers/gpu/drm/radeon/radeon_atombios.c
--- linux-2.6.35.6/drivers/gpu/drm/radeon/radeon_atombios.c   
  2010-09-27 02:19:16.000000000 +0200
+++ linux-2.6.35.6/drivers/gpu/drm/radeon/radeon_atombios.c   
  2011-01-27 16:08:53.000000000 +0100
@@ -147,7 +147,7 @@
              pin = &gpio_info->asGPIO_Pin[i];
              if (id == pin->ucGPIO_ID) {
                  gpio.id = pin->ucGPIO_ID;
-                gpio.reg = pin->usGpioPin_AIndex * 4;
+                gpio.reg = le16_to_cpu(pin->usGpioPin_AIndex) * 4;
                  gpio.mask = (1 << pin->ucGpioPinBitShift);
                  gpio.valid = true;
                  break;
@@ -1795,7 +1795,7 @@
                  firmware_info =
                      (union firmware_info 
*)(mode_info->atom_context->bios +
                                  fw_data_offset);
-                vddc = firmware_info->info_14.usBootUpVDDCVoltage;
+                vddc = 
le16_to_cpu(firmware_info->info_14.usBootUpVDDCVoltage);
              }

              /* add the i2c bus for thermal/fan chip */
@@ -1882,7 +1882,7 @@
                         
  rdev->pm.power_state[state_index].clock_info[mode_index].voltage.type =
                              VOLTAGE_SW;
                         
  rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage =
-                            clock_info->usVDDC;
+                            le16_to_cpu(clock_info->usVDDC);
                          /* XXX usVDDCI */
                          mode_index++;
                      } else {
@@ -1906,7 +1906,7 @@
                         
  rdev->pm.power_state[state_index].clock_info[mode_index].voltage.type =
                              VOLTAGE_SW;
                         
  rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage =
-                            clock_info->usVDDC;
+                            le16_to_cpu(clock_info->usVDDC);
                          mode_index++;
                      }
                  }
@@ -2011,7 +2011,7 @@
      int index = GetIndexIntoMasterTable(COMMAND, GetEngineClock);

      atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t 
*)&args);
-    return args.ulReturnEngineClock;
+    return le32_to_cpu(args.ulReturnEngineClock);
  }

  uint32_t radeon_atom_get_memory_clock(struct radeon_device *rdev)
@@ -2020,7 +2020,7 @@
      int index = GetIndexIntoMasterTable(COMMAND, GetMemoryClock);

      atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t 
*)&args);
-    return args.ulReturnMemoryClock;
+    return le32_to_cpu(args.ulReturnMemoryClock);
  }

  void radeon_atom_set_engine_clock(struct radeon_device *rdev,
@@ -2029,7 +2029,7 @@
      SET_ENGINE_CLOCK_PS_ALLOCATION args;
      int index = GetIndexIntoMasterTable(COMMAND, SetEngineClock);

-    args.ulTargetEngineClock = eng_clock;    /* 10 khz */
+    args.ulTargetEngineClock = cpu_to_le32(eng_clock);    /* 10 khz */

      atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t 
*)&args);
  }
@@ -2043,7 +2043,7 @@
      if (rdev->flags & RADEON_IS_IGP)
          return;

-    args.ulTargetMemoryClock = mem_clock;    /* 10 khz */
+    args.ulTargetMemoryClock = cpu_to_le32(mem_clock);    /* 10 khz */

      atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t 
*)&args);
  }
diff -Naur linux-2.6.35.6/drivers/gpu/drm/radeon/radeon_cp.c 
linux-2.6.35.6/drivers/gpu/drm/radeon/radeon_cp.c
--- linux-2.6.35.6/drivers/gpu/drm/radeon/radeon_cp.c    2010-09-27 
02:19:16.000000000 +0200
+++ linux-2.6.35.6/drivers/gpu/drm/radeon/radeon_cp.c    2011-01-27 
14:20:06.000000000 +0100
@@ -911,8 +911,11 @@

      if (!dev_priv->writeback_works) {
          /* Disable writeback to avoid unnecessary bus master transfer */
-        RADEON_WRITE(RADEON_CP_RB_CNTL, RADEON_READ(RADEON_CP_RB_CNTL) |
-                 RADEON_RB_NO_UPDATE);
+        RADEON_WRITE(RADEON_CP_RB_CNTL,
+#ifdef __BIG_ENDIAN
+            RADEON_BUF_SWAP_32BIT |
+#endif
+            RADEON_READ(RADEON_CP_RB_CNTL) | RADEON_RB_NO_UPDATE);
          RADEON_WRITE(RADEON_SCRATCH_UMSK, 0);
      }
  }
diff -Naur linux-2.6.35.6/drivers/gpu/drm/radeon/rv770.c 
linux-2.6.35.6/drivers/gpu/drm/radeon/rv770.c
--- linux-2.6.35.6/drivers/gpu/drm/radeon/rv770.c    2010-09-27 
02:19:16.000000000 +0200
+++ linux-2.6.35.6/drivers/gpu/drm/radeon/rv770.c    2011-01-27 
14:52:04.000000000 +0100
@@ -264,7 +264,11 @@
          return -EINVAL;

      r700_cp_stop(rdev);
-    WREG32(CP_RB_CNTL, RB_NO_UPDATE | (15 << 8) | (3 << 0));
+    WREG32(CP_RB_CNTL,
+#ifdef __BIG_ENDIAN
+        BUF_SWAP_32BIT |
+#endif
+        RB_NO_UPDATE | (15 << 8) | (3 << 0));

      /* Reset cp */
      WREG32(GRBM_SOFT_RESET, SOFT_RESET_CP);
@@ -1114,6 +1118,8 @@
   * should also allow to remove a bunch of callback function
   * like vram_info.
   */
+extern int r600_debugfs_mc_info_init(struct radeon_device *rdev);
+
  int rv770_init(struct radeon_device *rdev)
  {
      int r;
@@ -1121,6 +1127,9 @@
      r = radeon_dummy_page_init(rdev);
      if (r)
          return r;
+    if (r600_debugfs_mc_info_init(rdev)) {
+        DRM_ERROR("Failed to register debugfs file for mc !\n");
+    }
      /* This don't do much */
      r = radeon_gem_init(rdev);
      if (r)


More information about the dri-devel mailing list