Patchwork [8/8] x86_64 config: fix compile for CONFIG_FDC=n

login
register
mail settings
Submitter David S. Ahern
Date Jan. 13, 2011, 6:34 a.m.
Message ID <1294900477-23722-9-git-send-email-daahern@cisco.com>
Download mbox | patch
Permalink /patch/78670/
State New
Headers show

Comments

David S. Ahern - Jan. 13, 2011, 6:34 a.m.
Signed-off-by: David Ahern <daahern@cisco.com>
---
 hw/pc.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
Paolo Bonzini - Jan. 13, 2011, 5:04 p.m.
On 01/13/2011 07:34 AM, David Ahern wrote:
>
> +#ifdef CONFIG_FDC
>       /* floppy type */
>
>       fd0 = fdctrl_get_drive_type(floppy_controller, 0);
> @@ -403,6 +408,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
>       val |= 0x02; /* FPU is there */
>       val |= 0x04; /* PS/2 mouse installed */
>       rtc_set_memory(s, REG_EQUIPMENT_BYTE, val);
> +#endif

Isn't it a bit too eager?  The equipment byte should still be set, or 
have you checked with a real machine?

Paolo
David S. Ahern - Jan. 13, 2011, 5:25 p.m.
On 01/13/11 10:04, Paolo Bonzini wrote:
> On 01/13/2011 07:34 AM, David Ahern wrote:
>>
>> +#ifdef CONFIG_FDC
>>       /* floppy type */
>>
>>       fd0 = fdctrl_get_drive_type(floppy_controller, 0);
>> @@ -403,6 +408,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t
>> above_4g_mem_size,
>>       val |= 0x02; /* FPU is there */
>>       val |= 0x04; /* PS/2 mouse installed */
>>       rtc_set_memory(s, REG_EQUIPMENT_BYTE, val);
>> +#endif
> 
> Isn't it a bit too eager?  The equipment byte should still be set, or
> have you checked with a real machine?
> 
> Paolo

A bit to eager.  I'll fix.

David

Patch

diff --git a/hw/pc.c b/hw/pc.c
index 11b570f..71750f5 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -189,6 +189,7 @@  static void pic_irq_request(void *opaque, int irq, int level)
 
 /* PC cmos mappings */
 
+#ifdef CONFIG_FDC
 #define REG_EQUIPMENT_BYTE          0x14
 
 static int cmos_get_fd_drive_type(int fd0)
@@ -214,6 +215,7 @@  static int cmos_get_fd_drive_type(int fd0)
     }
     return val;
 }
+#endif
 
 static void cmos_init_hd(int type_ofs, int info_ofs, BlockDriverState *hd,
                          ISADevice *s)
@@ -335,7 +337,9 @@  void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
                   FDCtrl *floppy_controller, ISADevice *s)
 {
     int val;
+#ifdef CONFIG_FDC
     int fd0, fd1, nb;
+#endif
     static pc_cmos_init_late_arg arg;
 
     /* various important CMOS locations needed by PC/Bochs bios */
@@ -376,6 +380,7 @@  void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
         exit(1);
     }
 
+#ifdef CONFIG_FDC
     /* floppy type */
 
     fd0 = fdctrl_get_drive_type(floppy_controller, 0);
@@ -403,6 +408,7 @@  void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
     val |= 0x02; /* FPU is there */
     val |= 0x04; /* PS/2 mouse installed */
     rtc_set_memory(s, REG_EQUIPMENT_BYTE, val);
+#endif
 
     /* hard drives */
     arg.rtc_state = s;
@@ -1162,7 +1168,9 @@  void pc_basic_device_init(qemu_irq *isa_irq,
     for(i = 0; i < MAX_FD; i++) {
         fd[i] = drive_get(IF_FLOPPY, 0, i);
     }
+#ifdef CONFIG_FDC
     *floppy_controller = fdctrl_init_isa(fd);
+#endif
 }
 
 void pc_pci_device_init(PCIBus *pci_bus)