Skip to contentSkip to conversation

qemu-kvm: extboot: Clean up host-guest interface

PATCH Applied Jan Kiszka 2 participants 2 messages Feb 18, 2010 KVM

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 2/2 qemu-kvm: extboot: Clean up host-guest interface

Drop the unused boot mode port 0x404 from the host-guest interface of extboot and remove related code from both sides.

---
 hw/extboot.c                |   14 +-------------
 hw/pc.c                     |    2 +-
 hw/pc.h                     |    2 +-
 pc-bios/optionrom/extboot.S |   23 -----------------------
 4 files changed, 3 insertions(+), 38 deletions(-)
hw/extboot.c +1 -13
index b91d54f..8ada21b 100644
@@ -65,12 +65,6 @@ static void get_translated_chs(BlockDriverState *bs, int *c, int *h, int *s)
     }
 }
 
-static uint32_t extboot_read(void *opaque, uint32_t addr)
-{
-    int *pcmd = opaque;
-    return *pcmd;
-}
-
 static void extboot_write_cmd(void *opaque, uint32_t addr, uint32_t value)
 {
     union extboot_cmd cmd;
@@ -123,13 +117,7 @@ static void extboot_write_cmd(void *opaque, uint32_t addr, uint32_t value)
         qemu_free(buf);
 }
 
-void extboot_init(BlockDriverState *bs, int cmd)
+void extboot_init(BlockDriverState *bs)
 {
-    int *pcmd;
-
-    pcmd = qemu_mallocz(sizeof(int));
-
-    *pcmd = cmd;
-    register_ioport_read(0x404, 1, 1, extboot_read, pcmd);
     register_ioport_write(0x405, 1, 2, extboot_write_cmd, bs);
 }
hw/pc.c +1 -1
index 97e16ce..8175874 100644
@@ -1057,7 +1057,7 @@ static void pc_init1(ram_addr_t ram_size,
 	    bdrv_set_geometry_hint(info->bdrv, cyls, heads, secs);
 	}
 
-	extboot_init(info->bdrv, 1);
+	extboot_init(info->bdrv);
     }
 
 #ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
hw/pc.h +1 -1
index b00f311..e9da683 100644
@@ -165,7 +165,7 @@ void isa_ne2000_init(int base, int irq, NICInfo *nd);
 
 /* extboot.c */
 
-void extboot_init(BlockDriverState *bs, int cmd);
+void extboot_init(BlockDriverState *bs);
 
 int cpu_is_bsp(CPUState *env);
 
pc-bios/optionrom/extboot.S +0 -23
index 1eeb172..db6c2b6 100644
@@ -62,15 +62,6 @@ int19_handler:
 	xor %ax, %ax
 	mov %ax, %ds
 
-	movw $0x404, %dx
-	inb %dx, %al
-	cmp $1, %al
-	je 1f
-	cmp $2, %al
-	je 2f
-	jmp 3f
-
-1: /* hook int13: intb(0x404) == 1 */
 	/* save old int 13 to int 2c */
 	mov (0x13*4), %eax
 	mov %eax, (OLD_INT13)
@@ -78,21 +69,7 @@ int19_handler:
 	/* install our int 13 handler */
 	movw $int13_handler, (0x13*4)
 	mov %cs, (0x13*4+2)
-	jmp 3f
 
-2: /* linux boot: intb(0x404) == 2 */
-	cli
-	cld
-	mov $0x9000, %ax
-	mov %ax, %ds
-	mov %ax, %es
-	mov %ax, %fs
-	mov %ax, %gs
-	mov %ax, %ss
-	mov $0x8ffe, %sp
-	ljmp $0x9000 + 0x20, $0
-
-3: /* fall through: inb(0x404) == 0 */
 	/* restore previous int $0x19 handler */
 	mov (OLD_INT19),%eax
 	mov %eax,(0x19*4)
Acked-by on v1 2/2
#1 lore raw
Quoted 5 lines · Jan Kiszka

Drop the unused boot mode port 0x404 from the host-guest interface of extboot and remove related code from both sides.

Makes sense.

Quoted 112 lines
---
  hw/extboot.c                |   14 +-------------
  hw/pc.c                     |    2 +-
  hw/pc.h                     |    2 +-
  pc-bios/optionrom/extboot.S |   23 -----------------------
  4 files changed, 3 insertions(+), 38 deletions(-)
hw/extboot.c +1 -13
index b91d54f..8ada21b 100644
@@ -65,12 +65,6 @@ static void get_translated_chs(BlockDriverState *bs, int *c, int *h, int *s)
      }
  }
 
-static uint32_t extboot_read(void *opaque, uint32_t addr)
-{
-    int *pcmd = opaque;
-    return *pcmd;
-}
-
  static void extboot_write_cmd(void *opaque, uint32_t addr, uint32_t value)
  {
      union extboot_cmd cmd;
@@ -123,13 +117,7 @@ static void extboot_write_cmd(void *opaque, uint32_t addr, uint32_t value)
          qemu_free(buf);
  }
 
-void extboot_init(BlockDriverState *bs, int cmd)
+void extboot_init(BlockDriverState *bs)
  {
-    int *pcmd;
-
-    pcmd = qemu_mallocz(sizeof(int));
-
-    *pcmd = cmd;
-    register_ioport_read(0x404, 1, 1, extboot_read, pcmd);
      register_ioport_write(0x405, 1, 2, extboot_write_cmd, bs);
  }
hw/pc.c +1 -1
index 97e16ce..8175874 100644
@@ -1057,7 +1057,7 @@ static void pc_init1(ram_addr_t ram_size,
  	    bdrv_set_geometry_hint(info->bdrv, cyls, heads, secs);
  	}
 
-	extboot_init(info->bdrv, 1);
+	extboot_init(info->bdrv);
      }
 
  #ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
hw/pc.h +1 -1
index b00f311..e9da683 100644
@@ -165,7 +165,7 @@ void isa_ne2000_init(int base, int irq, NICInfo *nd);
 
  /* extboot.c */
 
-void extboot_init(BlockDriverState *bs, int cmd);
+void extboot_init(BlockDriverState *bs);
 
  int cpu_is_bsp(CPUState *env);
 
pc-bios/optionrom/extboot.S +0 -24
index 1eeb172..db6c2b6 100644
@@ -62,15 +62,6 @@ int19_handler:
  	xor %ax, %ax
  	mov %ax, %ds
 
-	movw $0x404, %dx
-	inb %dx, %al
-	cmp $1, %al
-	je 1f
-	cmp $2, %al
-	je 2f
-	jmp 3f
-
-1: /* hook int13: intb(0x404) == 1 */
  	/* save old int 13 to int 2c */
  	mov (0x13*4), %eax
  	mov %eax, (OLD_INT13)
@@ -78,21 +69,7 @@ int19_handler:
  	/* install our int 13 handler */
  	movw $int13_handler, (0x13*4)
  	mov %cs, (0x13*4+2)
-	jmp 3f
 
-2: /* linux boot: intb(0x404) == 2 */
-	cli
-	cld
-	mov $0x9000, %ax
-	mov %ax, %ds
-	mov %ax, %es
-	mov %ax, %fs
-	mov %ax, %gs
-	mov %ax, %ss
-	mov $0x8ffe, %sp
-	ljmp $0x9000 + 0x20, $0
-
-3: /* fall through: inb(0x404) == 0 */
  	/* restore previous int $0x19 handler */
  	mov (OLD_INT19),%eax
  	mov %eax,(0x19*4)
--

To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html