Commit 20ba3ae101c64c03d31b2e92abf7abe10250a45e

Authored by bellard
1 parent 4c7634bc

better to use different ID for ISA and PCI


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@901 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 10 additions and 13 deletions
hw/cirrus_vga.c
... ... @@ -50,11 +50,6 @@
50 50 #define CIRRUS_ID_CLGD5436 (0x2B<<2)
51 51 #define CIRRUS_ID_CLGD5446 (0x2E<<2)
52 52  
53   -/* this define is used to select the exact CLGD implementation we
54   - emulate. */
55   -//#define CIRRUS_ID CIRRUS_ID_CLGD5430
56   -#define CIRRUS_ID CIRRUS_ID_CLGD5446
57   -
58 53 // sequencer 0x07
59 54 #define CIRRUS_SR7_BPP_VGA 0x00
60 55 #define CIRRUS_SR7_BPP_SVGA 0x01
... ... @@ -163,7 +158,6 @@
163 158  
164 159 // PCI 0x00: vendor, 0x02: device
165 160 #define PCI_VENDOR_CIRRUS 0x1013
166   -#define PCI_DEVICE_ID CIRRUS_ID
167 161 #define PCI_DEVICE_CLGD5462 0x00d0
168 162 #define PCI_DEVICE_CLGD5465 0x00d6
169 163  
... ... @@ -2695,7 +2689,7 @@ static CPUWriteMemoryFunc *cirrus_mmio_write[3] = {
2695 2689 *
2696 2690 ***************************************/
2697 2691  
2698   -static void cirrus_init_common(CirrusVGAState * s)
  2692 +static void cirrus_init_common(CirrusVGAState * s, int device_id)
2699 2693 {
2700 2694 int vga_io_memory;
2701 2695  
... ... @@ -2722,7 +2716,7 @@ static void cirrus_init_common(CirrusVGAState * s)
2722 2716 s->sr[0x0F] = CIRRUS_MEMSIZE_2M;
2723 2717 s->sr[0x1F] = 0x22; // MemClock
2724 2718  
2725   - s->cr[0x27] = CIRRUS_ID;
  2719 + s->cr[0x27] = device_id;
2726 2720  
2727 2721 s->cirrus_hidden_dac_lockindex = 5;
2728 2722 s->cirrus_hidden_dac_data = 0;
... ... @@ -2757,7 +2751,7 @@ void isa_cirrus_vga_init(DisplayState *ds, uint8_t *vga_ram_base,
2757 2751  
2758 2752 vga_common_init((VGAState *)s,
2759 2753 ds, vga_ram_base, vga_ram_offset, vga_ram_size);
2760   - cirrus_init_common(s);
  2754 + cirrus_init_common(s, CIRRUS_ID_CLGD5430);
2761 2755 s->sr[0x17] = CIRRUS_BUSTYPE_ISA;
2762 2756 /* XXX ISA-LFB support */
2763 2757 }
... ... @@ -2792,6 +2786,9 @@ void pci_cirrus_vga_init(DisplayState *ds, uint8_t *vga_ram_base,
2792 2786 PCICirrusVGAState *d;
2793 2787 uint8_t *pci_conf;
2794 2788 CirrusVGAState *s;
  2789 + int device_id;
  2790 +
  2791 + device_id = CIRRUS_ID_CLGD5446;
2795 2792  
2796 2793 /* setup PCI configuration registers */
2797 2794 d = (PCICirrusVGAState *)pci_register_device("Cirrus VGA",
... ... @@ -2800,8 +2797,8 @@ void pci_cirrus_vga_init(DisplayState *ds, uint8_t *vga_ram_base,
2800 2797 pci_conf = d->dev.config;
2801 2798 pci_conf[0x00] = (uint8_t) (PCI_VENDOR_CIRRUS & 0xff);
2802 2799 pci_conf[0x01] = (uint8_t) (PCI_VENDOR_CIRRUS >> 8);
2803   - pci_conf[0x02] = (uint8_t) (PCI_DEVICE_ID & 0xff);
2804   - pci_conf[0x03] = (uint8_t) (PCI_DEVICE_ID >> 8);
  2800 + pci_conf[0x02] = (uint8_t) (device_id & 0xff);
  2801 + pci_conf[0x03] = (uint8_t) (device_id >> 8);
2805 2802 pci_conf[0x04] = PCI_COMMAND_IOACCESS | PCI_COMMAND_MEMACCESS;
2806 2803 pci_conf[0x0a] = PCI_CLASS_SUB_VGA;
2807 2804 pci_conf[0x0b] = PCI_CLASS_BASE_DISPLAY;
... ... @@ -2811,7 +2808,7 @@ void pci_cirrus_vga_init(DisplayState *ds, uint8_t *vga_ram_base,
2811 2808 s = &d->cirrus_vga;
2812 2809 vga_common_init((VGAState *)s,
2813 2810 ds, vga_ram_base, vga_ram_offset, vga_ram_size);
2814   - cirrus_init_common(s);
  2811 + cirrus_init_common(s, device_id);
2815 2812 s->sr[0x17] = CIRRUS_BUSTYPE_PCI;
2816 2813  
2817 2814 /* setup memory space */
... ... @@ -2820,7 +2817,7 @@ void pci_cirrus_vga_init(DisplayState *ds, uint8_t *vga_ram_base,
2820 2817 /* XXX: s->vram_size must be a power of two */
2821 2818 pci_register_io_region((PCIDevice *)d, 0, s->vram_size,
2822 2819 PCI_ADDRESS_SPACE_MEM_PREFETCH, cirrus_pci_lfb_map);
2823   - if (CIRRUS_ID == CIRRUS_ID_CLGD5446) {
  2820 + if (device_id == CIRRUS_ID_CLGD5446) {
2824 2821 pci_register_io_region((PCIDevice *)d, 1, CIRRUS_PNPMMIO_SIZE,
2825 2822 PCI_ADDRESS_SPACE_MEM, cirrus_pci_mmio_map);
2826 2823 }
... ...