Commit 3b4366de399b384d715c631d32f024c2bde3a38a
1 parent
3f05d3dc
Add an opaque parameter to boot_set API, move function to monitor.c
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4763 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
4 changed files
with
17 additions
and
16 deletions
hw/hw.h
@@ -94,9 +94,8 @@ void qemu_register_reset(QEMUResetHandler *func, void *opaque); | @@ -94,9 +94,8 @@ void qemu_register_reset(QEMUResetHandler *func, void *opaque); | ||
94 | 94 | ||
95 | /* handler to set the boot_device for a specific type of QEMUMachine */ | 95 | /* handler to set the boot_device for a specific type of QEMUMachine */ |
96 | /* return 0 if success */ | 96 | /* return 0 if success */ |
97 | -typedef int QEMUBootSetHandler(const char *boot_device); | ||
98 | -extern QEMUBootSetHandler *qemu_boot_set_handler; | ||
99 | -void qemu_register_boot_set(QEMUBootSetHandler *func); | 97 | +typedef int QEMUBootSetHandler(void *opaque, const char *boot_device); |
98 | +void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque); | ||
100 | 99 | ||
101 | /* These should really be in isa.h, but are here to make pc.h happy. */ | 100 | /* These should really be in isa.h, but are here to make pc.h happy. */ |
102 | typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data); | 101 | typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data); |
hw/pc.c
@@ -192,10 +192,10 @@ static int boot_device2nibble(char boot_device) | @@ -192,10 +192,10 @@ static int boot_device2nibble(char boot_device) | ||
192 | 192 | ||
193 | /* copy/pasted from cmos_init, should be made a general function | 193 | /* copy/pasted from cmos_init, should be made a general function |
194 | and used there as well */ | 194 | and used there as well */ |
195 | -int pc_boot_set(const char *boot_device) | 195 | +static int pc_boot_set(void *opaque, const char *boot_device) |
196 | { | 196 | { |
197 | #define PC_MAX_BOOT_DEVICES 3 | 197 | #define PC_MAX_BOOT_DEVICES 3 |
198 | - RTCState *s = rtc_state; | 198 | + RTCState *s = (RTCState *)opaque; |
199 | int nbds, bds[3] = { 0, }; | 199 | int nbds, bds[3] = { 0, }; |
200 | int i; | 200 | int i; |
201 | 201 | ||
@@ -741,8 +741,6 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size, | @@ -741,8 +741,6 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size, | ||
741 | below_4g_mem_size = ram_size; | 741 | below_4g_mem_size = ram_size; |
742 | } | 742 | } |
743 | 743 | ||
744 | - qemu_register_boot_set(pc_boot_set); | ||
745 | - | ||
746 | linux_boot = (kernel_filename != NULL); | 744 | linux_boot = (kernel_filename != NULL); |
747 | 745 | ||
748 | /* init CPUs */ | 746 | /* init CPUs */ |
@@ -917,6 +915,8 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size, | @@ -917,6 +915,8 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size, | ||
917 | 915 | ||
918 | rtc_state = rtc_init(0x70, i8259[8]); | 916 | rtc_state = rtc_init(0x70, i8259[8]); |
919 | 917 | ||
918 | + qemu_register_boot_set(pc_boot_set, rtc_state); | ||
919 | + | ||
920 | register_ioport_read(0x92, 1, 1, ioport92_read, NULL); | 920 | register_ioport_read(0x92, 1, 1, ioport92_read, NULL); |
921 | register_ioport_write(0x92, 1, 1, ioport92_write, NULL); | 921 | register_ioport_write(0x92, 1, 1, ioport92_write, NULL); |
922 | 922 |
monitor.c
@@ -1044,12 +1044,22 @@ static void do_ioport_read(int count, int format, int size, int addr, int has_in | @@ -1044,12 +1044,22 @@ static void do_ioport_read(int count, int format, int size, int addr, int has_in | ||
1044 | suffix, addr, size * 2, val); | 1044 | suffix, addr, size * 2, val); |
1045 | } | 1045 | } |
1046 | 1046 | ||
1047 | +/* boot_set handler */ | ||
1048 | +static QEMUBootSetHandler *qemu_boot_set_handler = NULL; | ||
1049 | +static void *boot_opaque; | ||
1050 | + | ||
1051 | +void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque) | ||
1052 | +{ | ||
1053 | + qemu_boot_set_handler = func; | ||
1054 | + boot_opaque = opaque; | ||
1055 | +} | ||
1056 | + | ||
1047 | static void do_boot_set(const char *bootdevice) | 1057 | static void do_boot_set(const char *bootdevice) |
1048 | { | 1058 | { |
1049 | int res; | 1059 | int res; |
1050 | 1060 | ||
1051 | if (qemu_boot_set_handler) { | 1061 | if (qemu_boot_set_handler) { |
1052 | - res = qemu_boot_set_handler(bootdevice); | 1062 | + res = qemu_boot_set_handler(boot_opaque, bootdevice); |
1053 | if (res == 0) | 1063 | if (res == 0) |
1054 | term_printf("boot device list now set to %s\n", bootdevice); | 1064 | term_printf("boot device list now set to %s\n", bootdevice); |
1055 | else | 1065 | else |
vl.c
@@ -6908,14 +6908,6 @@ void qemu_system_powerdown_request(void) | @@ -6908,14 +6908,6 @@ void qemu_system_powerdown_request(void) | ||
6908 | cpu_interrupt(cpu_single_env, CPU_INTERRUPT_EXIT); | 6908 | cpu_interrupt(cpu_single_env, CPU_INTERRUPT_EXIT); |
6909 | } | 6909 | } |
6910 | 6910 | ||
6911 | -/* boot_set handler */ | ||
6912 | -QEMUBootSetHandler *qemu_boot_set_handler = NULL; | ||
6913 | - | ||
6914 | -void qemu_register_boot_set(QEMUBootSetHandler *func) | ||
6915 | -{ | ||
6916 | - qemu_boot_set_handler = func; | ||
6917 | -} | ||
6918 | - | ||
6919 | void main_loop_wait(int timeout) | 6911 | void main_loop_wait(int timeout) |
6920 | { | 6912 | { |
6921 | IOHandlerRecord *ioh; | 6913 | IOHandlerRecord *ioh; |