~vcs-imports/qemu/git

« back to all changes in this revision

Viewing changes to hw/gt64xxx.c

  • Committer: blueswir1
  • Date: 2007-09-25 17:30:09 UTC
  • Revision ID: git-v1:eb296a0a03eebd2d73718d31cd0d8a8db0b804de
 Remove the target dependency introduced by previous patch


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3239 c046a42c-6fe2-441c-8c8c-71466251a162

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 * THE SOFTWARE.
23
23
 */
24
24
 
25
 
#include "hw.h"
26
 
#include "mips.h"
27
 
#include "pci.h"
28
 
#include "pc.h"
 
25
#include "vl.h"
29
26
 
30
27
typedef target_phys_addr_t pci_addr_t;
31
28
#include "pci_host.h"
309
306
    GT64120State *s = opaque;
310
307
    uint32_t saddr;
311
308
 
312
 
    if (!(s->regs[GT_CPU] & 0x00001000))
313
 
        val = bswap32(val);
 
309
#ifdef TARGET_WORDS_BIGENDIAN
 
310
    val = bswap32(val);
 
311
#endif
314
312
 
315
313
    saddr = (addr & 0xfff) >> 2;
316
314
    switch (saddr) {
530
528
        s->pci->config_reg = val & 0x80fffffc;
531
529
        break;
532
530
    case GT_PCI0_CFGDATA:
533
 
        if (!(s->regs[GT_PCI0_CMD] & 1) && (s->pci->config_reg & 0x00fff800))
534
 
            val = bswap32(val);
535
531
        if (s->pci->config_reg & (1u << 31))
536
 
            pci_data_write(s->pci->bus, s->pci->config_reg, val, 4);
 
532
            pci_host_data_writel(s->pci, 0, val);
537
533
        break;
538
534
 
539
535
    /* Interrupts */
589
585
    uint32_t val;
590
586
    uint32_t saddr;
591
587
 
 
588
    val = 0;
592
589
    saddr = (addr & 0xfff) >> 2;
 
590
 
593
591
    switch (saddr) {
594
592
 
595
593
    /* CPU Configuration */
770
768
        val = s->pci->config_reg;
771
769
        break;
772
770
    case GT_PCI0_CFGDATA:
773
 
        if (!(s->pci->config_reg & (1 << 31)))
 
771
        if (!(s->pci->config_reg & (1u << 31)))
774
772
            val = 0xffffffff;
775
773
        else
776
 
            val = pci_data_read(s->pci->bus, s->pci->config_reg, 4);
777
 
        if (!(s->regs[GT_PCI0_CMD] & 1) && (s->pci->config_reg & 0x00fff800))
778
 
            val = bswap32(val);
 
774
            val = pci_host_data_readl(s->pci, 0);
779
775
        break;
780
776
 
781
777
    case GT_PCI0_CMD:
848
844
        break;
849
845
    }
850
846
 
851
 
    if (!(s->regs[GT_CPU] & 0x00001000))
852
 
        val = bswap32(val);
853
 
 
 
847
#ifdef TARGET_WORDS_BIGENDIAN
 
848
    val = bswap32(val);
 
849
#endif
854
850
    return val;
855
851
}
856
852
 
891
887
    }
892
888
}
893
889
 
 
890
extern PCIDevice *piix4_dev;
894
891
static int pci_irq_levels[4];
895
892
 
896
893
static void pci_gt64120_set_irq(qemu_irq *pic, int irq_num, int level)
915
912
}
916
913
 
917
914
 
918
 
static void gt64120_reset(void *opaque)
 
915
void gt64120_reset(void *opaque)
919
916
{
920
917
    GT64120State *s = opaque;
921
918
 
1076
1073
    s->regs[GT_PCI1_CFGADDR]  = 0x00000000;
1077
1074
    s->regs[GT_PCI1_CFGDATA]  = 0x00000000;
1078
1075
    s->regs[GT_PCI0_CFGADDR]  = 0x00000000;
 
1076
    s->regs[GT_PCI0_CFGDATA]  = 0x00000000;
1079
1077
 
1080
1078
    /* Interrupt registers are all zeroed at reset */
1081
1079
 
1085
1083
 
1086
1084
static uint32_t gt64120_read_config(PCIDevice *d, uint32_t address, int len)
1087
1085
{
1088
 
    return pci_default_read_config(d, address, len);
 
1086
    uint32_t val = pci_default_read_config(d, address, len);
 
1087
#ifdef TARGET_WORDS_BIGENDIAN
 
1088
    val = bswap32(val);
 
1089
#endif
 
1090
    return val;
1089
1091
}
1090
1092
 
1091
1093
static void gt64120_write_config(PCIDevice *d, uint32_t address, uint32_t val,
1092
1094
                                 int len)
1093
1095
{
 
1096
#ifdef TARGET_WORDS_BIGENDIAN
 
1097
    val = bswap32(val);
 
1098
#endif
1094
1099
    pci_default_write_config(d, address, val, len);
1095
1100
}
1096
1101
 
1118
1123
    GT64120State *s;
1119
1124
    PCIDevice *d;
1120
1125
 
1121
 
    (void)&pci_host_data_writeb; /* avoid warning */
1122
 
    (void)&pci_host_data_writew; /* avoid warning */
1123
 
    (void)&pci_host_data_writel; /* avoid warning */
1124
 
    (void)&pci_host_data_readb; /* avoid warning */
1125
 
    (void)&pci_host_data_readw; /* avoid warning */
1126
 
    (void)&pci_host_data_readl; /* avoid warning */
1127
 
 
1128
1126
    s = qemu_mallocz(sizeof(GT64120State));
1129
1127
    s->pci = qemu_mallocz(sizeof(GT64120PCIState));
1130
1128