mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
hw/mips: Evaluate TARGET_BIG_ENDIAN at compile time
Rather than evaluating TARGET_BIG_ENDIAN at preprocessing time via #ifdef'ry, do it in C at compile time Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250417131004.47205-7-philmd@linaro.org>
This commit is contained in:
parent
770f2e64b6
commit
1b079a6eeb
3 changed files with 14 additions and 29 deletions
|
@ -94,12 +94,6 @@ typedef struct {
|
|||
bool display_inited;
|
||||
} MaltaFPGAState;
|
||||
|
||||
#if TARGET_BIG_ENDIAN
|
||||
#define BIOS_FILENAME "mips_bios.bin"
|
||||
#else
|
||||
#define BIOS_FILENAME "mipsel_bios.bin"
|
||||
#endif
|
||||
|
||||
#define TYPE_MIPS_MALTA "mips-malta"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(MaltaState, MIPS_MALTA)
|
||||
|
||||
|
@ -383,11 +377,7 @@ static uint64_t malta_fpga_read(void *opaque, hwaddr addr,
|
|||
|
||||
/* STATUS Register */
|
||||
case 0x00208:
|
||||
#if TARGET_BIG_ENDIAN
|
||||
val = 0x00000012;
|
||||
#else
|
||||
val = 0x00000010;
|
||||
#endif
|
||||
val = TARGET_BIG_ENDIAN ? 0x00000012 : 0x00000010;
|
||||
break;
|
||||
|
||||
/* JMPRS Register */
|
||||
|
@ -1177,9 +1167,12 @@ void mips_malta_init(MachineState *machine)
|
|||
target_long bios_size = FLASH_SIZE;
|
||||
/* Load firmware from flash. */
|
||||
if (!dinfo) {
|
||||
const char *bios_name = TARGET_BIG_ENDIAN ? "mips_bios.bin"
|
||||
: "mipsel_bios.bin";
|
||||
|
||||
/* Load a BIOS image. */
|
||||
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS,
|
||||
machine->firmware ?: BIOS_FILENAME);
|
||||
machine->firmware ?: bios_name);
|
||||
if (filename) {
|
||||
bios_size = load_image_targphys(filename, FLASH_ADDRESS,
|
||||
BIOS_SIZE);
|
||||
|
@ -1197,8 +1190,7 @@ void mips_malta_init(MachineState *machine)
|
|||
* In little endian mode the 32bit words in the bios are swapped,
|
||||
* a neat trick which allows bi-endian firmware.
|
||||
*/
|
||||
#if !TARGET_BIG_ENDIAN
|
||||
{
|
||||
if (!TARGET_BIG_ENDIAN) {
|
||||
uint32_t *end, *addr;
|
||||
const size_t swapsize = MIN(bios_size, 0x3e0000);
|
||||
addr = rom_ptr(FLASH_ADDRESS, swapsize);
|
||||
|
@ -1211,7 +1203,6 @@ void mips_malta_init(MachineState *machine)
|
|||
addr++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue