MIPS: Octeon: Handle bootloader structures in little-endian mode.
authorDavid Daney <david.daney@cavium.com>
Fri, 20 Mar 2015 16:11:56 +0000 (19:11 +0300)
committerRalf Baechle <ralf@linux-mips.org>
Wed, 1 Apr 2015 15:21:23 +0000 (17:21 +0200)
Compensate for the differences in the layout of in-memory bootloader
information as seen from little-endian mode.

Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@auriga.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/9590/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/cavium-octeon/octeon_boot.h
arch/mips/include/asm/octeon/cvmx-bootinfo.h

index 7b066bbca86d11f9020932475854e85944347db7..a6ce7c43e0aea16655a6da5560d15154396d27fb 100644 (file)
@@ -37,11 +37,13 @@ struct boot_init_vector {
 
 /* similar to bootloader's linux_app_boot_info but without global data */
 struct linux_app_boot_info {
+#ifdef __BIG_ENDIAN_BITFIELD
        uint32_t labi_signature;
        uint32_t start_core0_addr;
        uint32_t avail_coremask;
        uint32_t pci_console_active;
        uint32_t icache_prefetch_disable;
+       uint32_t padding;
        uint64_t InitTLBStart_addr;
        uint32_t start_app_addr;
        uint32_t cur_exception_base;
@@ -49,6 +51,27 @@ struct linux_app_boot_info {
        uint32_t compact_flash_common_base_addr;
        uint32_t compact_flash_attribute_base_addr;
        uint32_t led_display_base_addr;
+#else
+       uint32_t start_core0_addr;
+       uint32_t labi_signature;
+
+       uint32_t pci_console_active;
+       uint32_t avail_coremask;
+
+       uint32_t padding;
+       uint32_t icache_prefetch_disable;
+
+       uint64_t InitTLBStart_addr;
+
+       uint32_t cur_exception_base;
+       uint32_t start_app_addr;
+
+       uint32_t compact_flash_common_base_addr;
+       uint32_t no_mark_private_data;
+
+       uint32_t led_display_base_addr;
+       uint32_t compact_flash_attribute_base_addr;
+#endif
 };
 
 /* If not to copy a lot of bootloader's structures
index 2298199a287e8076bb168dfbdce21a70dafa9cad..c373d95b5e2cfa5202108d263249ac5594ed67a2 100644 (file)
@@ -53,6 +53,7 @@
  * to 0.
  */
 struct cvmx_bootinfo {
+#ifdef __BIG_ENDIAN_BITFIELD
        uint32_t major_version;
        uint32_t minor_version;
 
@@ -123,6 +124,60 @@ struct cvmx_bootinfo {
         */
        uint64_t fdt_addr;
 #endif
+#else                          /* __BIG_ENDIAN */
+       /*
+        * Little-Endian: When the CPU mode is switched to
+        * little-endian, the view of the structure has some of the
+        * fields swapped.
+        */
+       uint32_t minor_version;
+       uint32_t major_version;
+
+       uint64_t stack_top;
+       uint64_t heap_base;
+       uint64_t heap_end;
+       uint64_t desc_vaddr;
+
+       uint32_t stack_size;
+       uint32_t exception_base_addr;
+
+       uint32_t core_mask;
+       uint32_t flags;
+
+       uint32_t phy_mem_desc_addr;
+       uint32_t dram_size;
+
+       uint32_t eclock_hz;
+       uint32_t debugger_flags_base_addr;
+
+       uint32_t reserved0;
+       uint32_t dclock_hz;
+
+       uint8_t reserved3;
+       uint8_t reserved2;
+       uint16_t reserved1;
+       uint8_t board_rev_minor;
+       uint8_t board_rev_major;
+       uint16_t board_type;
+
+       char board_serial_number[CVMX_BOOTINFO_OCTEON_SERIAL_LEN];
+       uint8_t mac_addr_base[6];
+       uint8_t mac_addr_count;
+       uint8_t pad[5];
+
+#if (CVMX_BOOTINFO_MIN_VER >= 1)
+       uint64_t compact_flash_common_base_addr;
+       uint64_t compact_flash_attribute_base_addr;
+       uint64_t led_display_base_addr;
+#endif
+#if (CVMX_BOOTINFO_MIN_VER >= 2)
+       uint32_t config_flags;
+       uint32_t dfa_ref_clock_hz;
+#endif
+#if (CVMX_BOOTINFO_MIN_VER >= 3)
+       uint64_t fdt_addr;
+#endif
+#endif
 };
 
 #define CVMX_BOOTINFO_CFG_FLAG_PCI_HOST                        (1ull << 0)