Skip to content

Commit

Permalink
Merge branch 'master' into usb_uhci
Browse files Browse the repository at this point in the history
  • Loading branch information
fysnet authored Sep 4, 2023
2 parents eb2293c + fe53752 commit 37aaf38
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 30 deletions.
2 changes: 1 addition & 1 deletion bochs/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
#error You must use SMF to have plugins
#endif

#define USE_RAW_SERIAL 0
#define BX_USE_RAW_SERIAL 0

// This option enables RAM file backing for large guest memory with a smaller
// amount host memory, without causing a panic when host memory is exhausted.
Expand Down
6 changes: 3 additions & 3 deletions bochs/configure
Original file line number Diff line number Diff line change
Expand Up @@ -24911,19 +24911,19 @@ then :
enableval=$enable_raw_serial; if test "$enableval" = yes; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
printf "%s\n" "#define USE_RAW_SERIAL 1" >>confdefs.h
printf "%s\n" "#define BX_USE_RAW_SERIAL 1" >>confdefs.h

else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
printf "%s\n" "#define USE_RAW_SERIAL 0" >>confdefs.h
printf "%s\n" "#define BX_USE_RAW_SERIAL 0" >>confdefs.h

fi
else $as_nop

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
printf "%s\n" "#define USE_RAW_SERIAL 0" >>confdefs.h
printf "%s\n" "#define BX_USE_RAW_SERIAL 0" >>confdefs.h



Expand Down
6 changes: 3 additions & 3 deletions bochs/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1784,14 +1784,14 @@ AC_ARG_ENABLE(raw-serial,
AS_HELP_STRING([--enable-raw-serial], [use raw serial port access (no - incomplete)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(USE_RAW_SERIAL, 1)
AC_DEFINE(BX_USE_RAW_SERIAL, 1)
else
AC_MSG_RESULT(no)
AC_DEFINE(USE_RAW_SERIAL, 0)
AC_DEFINE(BX_USE_RAW_SERIAL, 0)
fi],
[
AC_MSG_RESULT(no)
AC_DEFINE(USE_RAW_SERIAL, 0)
AC_DEFINE(BX_USE_RAW_SERIAL, 0)
]
)
Expand Down
30 changes: 15 additions & 15 deletions bochs/iodev/serial.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ typedef int SOCKET;
#define FILE_FLAG_FIRST_PIPE_INSTANCE 0
#endif

#if USE_RAW_SERIAL
#if BX_USE_RAW_SERIAL
#include "serial_raw.h"
#endif

Expand Down Expand Up @@ -216,7 +216,7 @@ bx_serial_c::~bx_serial_c(void)
#endif
break;
case BX_SER_MODE_RAW:
#if USE_RAW_SERIAL
#if BX_USE_RAW_SERIAL
delete [] BX_SER_THIS s[i].raw;
#endif
break;
Expand Down Expand Up @@ -438,7 +438,7 @@ bx_serial_c::init(void)
BX_PANIC(("serial terminal support not available"));
#endif /* def SERIAL_ENABLE */
} else if (mode == BX_SER_MODE_RAW) {
#if USE_RAW_SERIAL
#if BX_USE_RAW_SERIAL
BX_SER_THIS s[i].raw = new serial_raw(dev);
BX_SER_THIS s[i].io_mode = BX_SER_MODE_RAW;
#else
Expand Down Expand Up @@ -899,7 +899,7 @@ Bit32u bx_serial_c::read(Bit32u address, unsigned io_len)
break;

case BX_SER_MSR: /* MODEM status register */
#if USE_RAW_SERIAL
#if BX_USE_RAW_SERIAL
if (BX_SER_THIS s[port].io_mode == BX_SER_MODE_RAW) {
bool prev_cts = BX_SER_THIS s[port].modem_status.cts;
bool prev_dsr = BX_SER_THIS s[port].modem_status.dsr;
Expand Down Expand Up @@ -974,7 +974,7 @@ void bx_serial_c::write(Bit32u address, Bit32u value, unsigned io_len)
#endif // !BX_USE_SER_SMF
bool gen_int = 0;
Bit8u offset, new_wordlen;
#if USE_RAW_SERIAL
#if BX_USE_RAW_SERIAL
bool mcr_changed = 0;
Bit8u p_mode;
#endif
Expand Down Expand Up @@ -1156,7 +1156,7 @@ void bx_serial_c::write(Bit32u address, Bit32u value, unsigned io_len)

case BX_SER_LCR: /* Line control register */
new_wordlen = value & 0x03;
#if USE_RAW_SERIAL
#if BX_USE_RAW_SERIAL
if (BX_SER_THIS s[port].io_mode == BX_SER_MODE_RAW) {
if (BX_SER_THIS s[port].line_cntl.wordlen_sel != new_wordlen) {
BX_SER_THIS s[port].raw->set_data_bits(new_wordlen + 5);
Expand All @@ -1179,7 +1179,7 @@ void bx_serial_c::write(Bit32u address, Bit32u value, unsigned io_len)
BX_SER_THIS s[port].raw->set_break(new_b6);
}
}
#endif // USE_RAW_SERIAL
#endif // BX_USE_RAW_SERIAL
/* These are ignored, but set them up so they can be read back */
BX_SER_THIS s[port].line_cntl.stopbits = new_b2;
BX_SER_THIS s[port].line_cntl.parity_enable = new_b3;
Expand All @@ -1201,7 +1201,7 @@ void bx_serial_c::write(Bit32u address, Bit32u value, unsigned io_len)
BX_SER_THIS s[port].baudrate = new_baudrate;
restart_timer = 1;
BX_DEBUG(("com%d: baud rate set to %d", port+1, BX_SER_THIS s[port].baudrate));
#if USE_RAW_SERIAL
#if BX_USE_RAW_SERIAL
if (BX_SER_THIS s[port].io_mode == BX_SER_MODE_RAW) {
BX_SER_THIS s[port].raw->set_baudrate(BX_SER_THIS s[port].baudrate);
}
Expand Down Expand Up @@ -1238,7 +1238,7 @@ void bx_serial_c::write(Bit32u address, Bit32u value, unsigned io_len)
BX_SER_THIS detect_mouse = 2;
}
}
#if USE_RAW_SERIAL
#if BX_USE_RAW_SERIAL
if (BX_SER_THIS s[port].io_mode == BX_SER_MODE_RAW) {
mcr_changed = (BX_SER_THIS s[port].modem_cntl.dtr != new_b0) |
(BX_SER_THIS s[port].modem_cntl.rts != new_b1);
Expand All @@ -1253,7 +1253,7 @@ void bx_serial_c::write(Bit32u address, Bit32u value, unsigned io_len)
BX_SER_THIS s[port].modem_cntl.local_loopback = new_b4;
if (BX_SER_THIS s[port].modem_cntl.local_loopback) {
/* transition to loopback mode */
#if USE_RAW_SERIAL
#if BX_USE_RAW_SERIAL
if (BX_SER_THIS s[port].io_mode == BX_SER_MODE_RAW) {
if (BX_SER_THIS s[port].modem_cntl.dtr ||
BX_SER_THIS s[port].modem_cntl.rts) {
Expand All @@ -1262,7 +1262,7 @@ void bx_serial_c::write(Bit32u address, Bit32u value, unsigned io_len)
}
#endif
if (BX_SER_THIS s[port].line_cntl.break_cntl) {
#if USE_RAW_SERIAL
#if BX_USE_RAW_SERIAL
if (BX_SER_THIS s[port].io_mode == BX_SER_MODE_RAW) {
BX_SER_THIS s[port].raw->set_break(0);
}
Expand All @@ -1273,7 +1273,7 @@ void bx_serial_c::write(Bit32u address, Bit32u value, unsigned io_len)
}
} else {
/* transition to normal mode */
#if USE_RAW_SERIAL
#if BX_USE_RAW_SERIAL
if (BX_SER_THIS s[port].io_mode == BX_SER_MODE_RAW) {
mcr_changed = 1;
if (BX_SER_THIS s[port].line_cntl.break_cntl) {
Expand Down Expand Up @@ -1337,7 +1337,7 @@ void bx_serial_c::write(Bit32u address, Bit32u value, unsigned io_len)
}

if (BX_SER_THIS s[port].io_mode == BX_SER_MODE_RAW) {
#if USE_RAW_SERIAL
#if BX_USE_RAW_SERIAL
if (mcr_changed) {
BX_SER_THIS s[port].raw->set_modem_control(value & 0x03);
}
Expand Down Expand Up @@ -1456,7 +1456,7 @@ void bx_serial_c::tx_timer(void)
#endif
break;
case BX_SER_MODE_RAW:
#if USE_RAW_SERIAL
#if BX_USE_RAW_SERIAL
if (!BX_SER_THIS s[port].raw->ready_transmit())
BX_PANIC(("com%d: not ready to transmit", port+1));
BX_SER_THIS s[port].raw->transmit(BX_SER_THIS s[port].tsrbuffer);
Expand Down Expand Up @@ -1564,7 +1564,7 @@ void bx_serial_c::rx_timer(void)
#endif
break;
case BX_SER_MODE_RAW:
#if USE_RAW_SERIAL
#if BX_USE_RAW_SERIAL
int data;
if ((data_ready = BX_SER_THIS s[port].raw->ready_receive())) {
data = BX_SER_THIS s[port].raw->receive();
Expand Down
4 changes: 2 additions & 2 deletions bochs/iodev/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ enum {
BX_SER_INT_FIFO
};

#if USE_RAW_SERIAL
#if BX_USE_RAW_SERIAL
class serial_raw;
#endif

Expand Down Expand Up @@ -121,7 +121,7 @@ typedef struct {
HANDLE pipe;
#endif

#if USE_RAW_SERIAL
#if BX_USE_RAW_SERIAL
serial_raw* raw;
#endif
#if defined(SERIAL_ENABLE) && !defined(BX_SER_WIN32)
Expand Down
2 changes: 1 addition & 1 deletion bochs/iodev/serial_raw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include "iodev.h"

#if USE_RAW_SERIAL
#if BX_USE_RAW_SERIAL

#include "serial_raw.h"

Expand Down
2 changes: 1 addition & 1 deletion bochs/iodev/serial_raw.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

#if USE_RAW_SERIAL
#if BX_USE_RAW_SERIAL

#ifdef __linux__
#include <linux/serial.h>
Expand Down
4 changes: 0 additions & 4 deletions bochs/osdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,6 @@ BOCHSAPI_MSVCONLY extern Bit64u bx_get_realtime64_usec (void);
}
#endif /* __cplusplus */

#if BX_LARGE_RAMFILE

// these macros required for large ramfile option functionality
#if BX_HAVE_TMPFILE64 == 0
#define tmpfile64 tmpfile /* use regular tmpfile() function */
Expand All @@ -377,6 +375,4 @@ BOCHSAPI_MSVCONLY extern Bit64u bx_get_realtime64_usec (void);
#endif
#endif

#endif // BX_LARGE_RAMFILE

#endif /* ifdef BX_OSDEP_H */

0 comments on commit 37aaf38

Please sign in to comment.