~vcs-imports/qemu/maemo

« back to all changes in this revision

Viewing changes to hw/mips_malta.c

  • Committer: Riku Voipio
  • Date: 2009-06-08 15:31:58 UTC
  • mfrom: (6281.2.366)
  • mto: This revision was merged to the branch mainline in revision 6452.
  • Revision ID: git-v1:759b334a9739814df2883aa4c41b1c0f5670e90a
Merge commit 'gnu/master' into test

Epic merge

Conflicts:
        Makefile
        block.c
        block.h
        configure
        hw/boards.h
        hw/flash.h
        hw/integratorcp.c
        hw/nand.c
        hw/omap2.c
        hw/omap_i2c.c
        hw/sd.c
        hw/smc91c111.c
        hw/tsc2005.c
        hw/tusb6010.c
        hw/usb-musb.c
        linux-user/syscall.c
        target-arm/machine.c
        target-arm/translate.c

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
#include "audio/audio.h"
38
38
#include "boards.h"
39
39
#include "qemu-log.h"
 
40
#include "mips-bios.h"
40
41
 
41
42
//#define DEBUG_BOARD_INIT
42
43
 
43
 
#ifdef TARGET_WORDS_BIGENDIAN
44
 
#define BIOS_FILENAME "mips_bios.bin"
45
 
#else
46
 
#define BIOS_FILENAME "mipsel_bios.bin"
47
 
#endif
48
 
 
49
44
#ifdef TARGET_MIPS64
50
45
#define PHYS_TO_VIRT(x) ((x) | ~0x7fffffffULL)
51
46
#else
114
109
//~ #define DEBUG
115
110
 
116
111
#if defined(DEBUG)
117
 
#  define logout(fmt, args...) fprintf(stderr, "MALTA\t%-24s" fmt, __func__, ##args)
 
112
#  define logout(fmt, ...) fprintf(stderr, "MALTA\t%-24s" fmt, __func__, ## __VA_ARGS__)
118
113
#else
119
 
#  define logout(fmt, args...) ((void)0)
 
114
#  define logout(fmt, ...) ((void)0)
120
115
#endif
121
116
 
122
117
struct _eeprom24c0x_t {
452
447
    s->uart = serial_mm_init(base + 0x900, 3, uart_irq, 230400, uart_chr, 1);
453
448
 
454
449
    malta_fpga_reset(s);
455
 
    qemu_register_reset(malta_fpga_reset, s);
 
450
    qemu_register_reset(malta_fpga_reset, 0, s);
456
451
 
457
452
    return s;
458
453
}
469
464
    }
470
465
 
471
466
    if (audio_enabled) {
472
 
        AudioState *s;
473
 
 
474
 
        s = AUD_init ();
475
 
        if (s) {
476
 
            for (c = soundhw; c->name; ++c) {
477
 
                if (c->enabled)
478
 
                    c->init.init_pci (pci_bus, s);
 
467
        for (c = soundhw; c->name; ++c) {
 
468
            if (c->enabled) {
 
469
                c->init.init_pci(pci_bus);
479
470
            }
480
471
        }
481
472
    }
762
753
}
763
754
 
764
755
static
765
 
void mips_malta_init (ram_addr_t ram_size, int vga_ram_size,
 
756
void mips_malta_init (ram_addr_t ram_size,
766
757
                      const char *boot_device,
767
758
                      const char *kernel_filename, const char *kernel_cmdline,
768
759
                      const char *initrd_filename, const char *cpu_model)
769
760
{
770
 
    char buf[1024];
 
761
    char *filename;
771
762
    ram_addr_t ram_offset;
772
763
    ram_addr_t bios_offset;
773
764
    target_long bios_size;
801
792
        fprintf(stderr, "Unable to find CPU definition\n");
802
793
        exit(1);
803
794
    }
804
 
    qemu_register_reset(main_cpu_reset, env);
 
795
    qemu_register_reset(main_cpu_reset, 0, env);
805
796
 
806
797
    /* allocate RAM */
807
798
    if (ram_size > (256 << 20)) {
855
846
            /* Load a BIOS image. */
856
847
            if (bios_name == NULL)
857
848
                bios_name = BIOS_FILENAME;
858
 
            snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
859
 
            bios_size = load_image_targphys(buf, 0x1fc00000LL, BIOS_SIZE);
 
849
            filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
 
850
            if (filename) {
 
851
                bios_size = load_image_targphys(filename, 0x1fc00000LL,
 
852
                                                BIOS_SIZE);
 
853
                qemu_free(filename);
 
854
            } else {
 
855
                bios_size = -1;
 
856
            }
860
857
            if ((bios_size < 0 || bios_size > BIOS_SIZE) && !kernel_filename) {
861
858
                fprintf(stderr,
862
859
                        "qemu: Could not load MIPS bios '%s', and no -kernel argument was specified\n",
863
 
                        buf);
 
860
                        bios_name);
864
861
                exit(1);
865
862
            }
866
863
        }
915
912
    eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */
916
913
    for (i = 0; i < 8; i++) {
917
914
        /* TODO: Populate SPD eeprom data.  */
918
 
        smbus_eeprom_device_init(smbus, 0x50 + i, eeprom_buf + (i * 256));
 
915
        DeviceState *eeprom;
 
916
        eeprom = qdev_create((BusState *)smbus, "smbus-eeprom");
 
917
        qdev_set_prop_int(eeprom, "address", 0x50 + i);
 
918
        qdev_set_prop_ptr(eeprom, "data", eeprom_buf + (i * 256));
 
919
        qdev_init(eeprom);
919
920
    }
920
921
    pit = pit_init(0x40, i8259[0]);
921
922
    DMA_init(0);
946
947
 
947
948
    /* Optional PCI video card */
948
949
    if (cirrus_vga_enabled) {
949
 
        pci_cirrus_vga_init(pci_bus, vga_ram_size);
 
950
        pci_cirrus_vga_init(pci_bus);
950
951
    } else if (vmsvga_enabled) {
951
 
        pci_vmsvga_init(pci_bus, vga_ram_size);
 
952
        pci_vmsvga_init(pci_bus);
952
953
    } else if (std_vga_enabled) {
953
 
        pci_vga_init(pci_bus, vga_ram_size, 0, 0);
 
954
        pci_vga_init(pci_bus, 0, 0);
954
955
    }
955
956
}
956
957
 
957
 
QEMUMachine mips_malta_machine = {
 
958
static QEMUMachine mips_malta_machine = {
958
959
    .name = "malta",
959
960
    .desc = "MIPS Malta Core LV",
960
961
    .init = mips_malta_init,
 
962
    .is_default = 1,
961
963
};
 
964
 
 
965
static void mips_malta_machine_init(void)
 
966
{
 
967
    qemu_register_machine(&mips_malta_machine);
 
968
}
 
969
 
 
970
machine_init(mips_malta_machine_init);