hw: better i440 emulation
updated version of an old patch http://xenon.stanford.edu/~eswierk/misc/qemu-linuxbios/qemu-piix-ram-size.patch that together with http://www.mail-archive.com/linuxbios@linuxbios.org/msg02390.html (which is already in coreboot trunk) allows coreboot to autodetect the amount of RAM within qemu/kvm from a register in i440 northbridge. The message on the old patch states: Unfortunately the current version of qemu does not set these registers, but I have patched qemu so that it emulates the i440 more faithfully in this regard. Signed-off-by: Bernhard M. Wiedemann <qemudevbmw@lsmod.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
		
							parent
							
								
									cb4e5f8ed1
								
							
						
					
					
						commit
						ec5f92ce6a
					
				
							
								
								
									
										2
									
								
								hw/pc.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								hw/pc.c
									
									
									
									
									
								
							@ -924,7 +924,7 @@ static void pc_init1(ram_addr_t ram_size,
 | 
				
			|||||||
    isa_irq = qemu_allocate_irqs(isa_irq_handler, isa_irq_state, 24);
 | 
					    isa_irq = qemu_allocate_irqs(isa_irq_handler, isa_irq_state, 24);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (pci_enabled) {
 | 
					    if (pci_enabled) {
 | 
				
			||||||
        pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, isa_irq);
 | 
					        pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, isa_irq, ram_size);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        pci_bus = NULL;
 | 
					        pci_bus = NULL;
 | 
				
			||||||
        isa_bus_new(NULL);
 | 
					        isa_bus_new(NULL);
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								hw/pc.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								hw/pc.h
									
									
									
									
									
								
							@ -107,7 +107,7 @@ int pcspk_audio_init(qemu_irq *pic);
 | 
				
			|||||||
struct PCII440FXState;
 | 
					struct PCII440FXState;
 | 
				
			||||||
typedef struct PCII440FXState PCII440FXState;
 | 
					typedef struct PCII440FXState PCII440FXState;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, qemu_irq *pic);
 | 
					PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, qemu_irq *pic, int ram_size);
 | 
				
			||||||
void i440fx_set_smm(PCII440FXState *d, int val);
 | 
					void i440fx_set_smm(PCII440FXState *d, int val);
 | 
				
			||||||
void i440fx_init_memory_mappings(PCII440FXState *d);
 | 
					void i440fx_init_memory_mappings(PCII440FXState *d);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -213,7 +213,7 @@ static int i440fx_initfn(PCIDevice *dev)
 | 
				
			|||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq *pic)
 | 
					PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq *pic, int ram_size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    DeviceState *dev;
 | 
					    DeviceState *dev;
 | 
				
			||||||
    PCIBus *b;
 | 
					    PCIBus *b;
 | 
				
			||||||
@ -238,6 +238,11 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq *
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    *piix3_devfn = piix3->dev.devfn;
 | 
					    *piix3_devfn = piix3->dev.devfn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ram_size = ram_size / 8 / 1024 / 1024;
 | 
				
			||||||
 | 
					    if (ram_size > 255)
 | 
				
			||||||
 | 
					        ram_size = 255;
 | 
				
			||||||
 | 
					    (*pi440fx_state)->dev.config[0x57]=ram_size;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return b;
 | 
					    return b;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user