diff options
author | SeokYeon Hwang <syeon.hwang@samsung.com> | 2016-01-04 19:28:26 +0900 |
---|---|---|
committer | SeokYeon Hwang <syeon.hwang@samsung.com> | 2016-01-05 21:15:21 +0900 |
commit | 346ee8b1ee5cccd871ba7bc2c0a78c4e98d88748 (patch) | |
tree | f47ecdfe195bcb018ea1483cdefa24748bf31fd8 /tizen/src/emul_state.c | |
parent | 67a8399cae344e2261475fb054914385624f19a5 (diff) | |
download | qemu-346ee8b1ee5cccd871ba7bc2c0a78c4e98d88748.tar.gz qemu-346ee8b1ee5cccd871ba7bc2c0a78c4e98d88748.tar.bz2 qemu-346ee8b1ee5cccd871ba7bc2c0a78c4e98d88748.zip |
emulator: clean-up emulator network initialization
Do port forwarding and base port initialization at once.
Some emul_state getters/setters are refined.
"sdb.c" is "net_helper.c" now and it use new_debug_channel.
Change-Id: I0659b35e231a8f60bd3707a2d04b09213a9cb830
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
Signed-off-by: Jinhyung Choi <jinh0.choi@samsung.com>
Diffstat (limited to 'tizen/src/emul_state.c')
-rw-r--r-- | tizen/src/emul_state.c | 84 |
1 files changed, 39 insertions, 45 deletions
diff --git a/tizen/src/emul_state.c b/tizen/src/emul_state.c index 6772eeb876..3962298767 100644 --- a/tizen/src/emul_state.c +++ b/tizen/src/emul_state.c @@ -57,12 +57,14 @@ extern bool hax_allowed; #include "emulator_options.h" #include "hw/virtio/maru_virtio_touchscreen.h" #include "hw/virtio/maru_virtio_evdi.h" -#include "util/new_debug_ch.h" +#include "util/net_helper.h" #ifdef CONFIG_JAVA_UI #include "skin/maruskin_server.h" #endif +#include "util/new_debug_ch.h" + DECLARE_DEBUG_CHANNEL(emul_state); #define MAXLEN 512 @@ -134,50 +136,6 @@ int get_max_touch_point(void) } } -/* base port for emualtor vm */ -void set_emul_vm_base_port(int port) -{ - _emul_info.vm_base_port = port; - if (is_netclient_tap_attached()) { - _emul_info.device_serial_number = 26101; - } else { - _emul_info.device_serial_number = port + 1; - } - _emul_info.ecs_port = port + 3; - _emul_info.serial_port = port + 4; - _emul_info.spice_port = port + 5; -} - -int get_emul_spice_port(void) -{ - return _emul_info.spice_port; -} - -void set_emul_ecs_port(int port) -{ - _emul_info.ecs_port = port; -} - -int get_emul_vm_base_port(void) -{ - return _emul_info.vm_base_port; -} - -int get_device_serial_number(void) -{ - return _emul_info.device_serial_number; -} - -int get_emul_ecs_port(void) -{ - return _emul_info.ecs_port; -} - -int get_emul_serial_port(void) -{ - return _emul_info.serial_port; -} - /* current emulator condition */ int get_emulator_condition(void) { @@ -661,6 +619,42 @@ uint64_t get_ram_size(void) return ram_size; } +// VM base port +static int vm_base_port = 0; + +void set_vm_base_port(int port) +{ + vm_base_port = port; +} + +int get_vm_base_port(void) +{ + // should not be called before base port is prepared + g_assert(vm_base_port != 0); + + return vm_base_port; +} + +int get_vm_spice_port(void) +{ + // should not be called before base port is prepared + g_assert(vm_base_port != 0); + + return vm_base_port + SPICE_TCP_INDEX; +} + +int get_vm_device_serial_number(void) +{ + // should not be called before base port is prepared + g_assert(vm_base_port != 0); + + if (is_netclient_tap_attached()) { + return (START_VM_BASE_PORT + SDB_TCP_INDEX); + } + + return vm_base_port + SDB_TCP_INDEX; +} + // look-up PCI devices bool is_pci_device_enabled(int device_id) { |