cuda: misc fixes and cleanups
cover cuda: misc fixes and cleanups
Hi,
This patchset cleans up a little bit the Apple CUDA emulation:
- correctly reject unknown commands
- correctly reject commands with wrong parameters
- support changing the frequency of auto-polling
- support changing device list probed in auto-poll
- add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
- remove unused commands (GET/SET_6805_ADDR)
- remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC
GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once we implement the I2C bus provided by CUDA.
This also fixes MacBugs hanging at startup in the absence of ADB mouse input.
Hervé
Hervé Poussineau (13):
cuda: add a framework to handle commands
cuda: reject unknown commands
cuda: port AUTOPOLL command to new framework
cuda: port SET_AUTO_RATE command to new framework
cuda: port SET_DEVICE_LIST command to new framework
cuda: port POWERDOWN command to new framework
cuda: port RESET_SYSTEM command to new framework
cuda: port FILE_SERVER_FLAG command to new framework
cuda: port SET_POWER_MESSAGES command to new framework
cuda: port GET_TIME command to new framework
cuda: port SET_TIME command to new framework
cuda: remove GET_6805_ADDR command
cuda: remove CUDA_GET_SET_IIC/CUDA_COMBINED_FORMAT_IIC commands
hw/input/adb.c | 18 ++-- hw/misc/macio/cuda.c | 268 ++++++++++++++++++++++++++++++++++++------------- hw/ppc/mac.h | 2 + include/hw/input/adb.h | 2 +- roms/SLOF | 2 +- roms/openbios | 2 +- 6 files changed, 215 insertions(+), 79 deletions(-)
Signature · 1 line
2.1.4
PATCH 1/13 cuda: add a framework to handle commands
Next commits will port existing CUDA commands to this framework.
--- hw/misc/macio/cuda.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
hw/misc/macio/cuda.c +34 -0
@@ -534,13 +534,47 @@ static void cuda_adb_poll(void *opaque) (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ)); } +/* description of commands */ +typedef struct CudaCommand { +uint8_t command; +const char *name; +bool (*handler)(CUDAState *s, +const uint8_t *in_args,int in_len, +uint8_t *out_args,int *out_len); +}CudaCommand ; + +static const CudaCommand handlers[] = { +}; +static void cuda_receive_packet (CUDAState *s,const uint8_t *data,int len) {uint8_t obuf[16 ] = {CUDA_PACKET ,0 , data[0 ] };int autopoll; +int i, out_len =0 ;uint32_t ti; +for (i =0 ; i <ARRAY_SIZE (handlers); i++) { +const CudaCommand *desc = &handlers[i]; +if (desc->command == data[0 ]) { +CUDA_DPRINTF ("handling command %s\n" , desc->name); + out_len =0 ; +if (desc->handler (s, data +1 , len -1 , obuf +3 , &out_len)) { +cuda_send_packet_to_host (s, obuf,3 + out_len); + }else { +qemu_log_mask (LOG_GUEST_ERROR , +"CUDA: %s: wrong parameters %d\n" , + desc->name, len); + obuf[0 ] =ERROR_PACKET ; + obuf[1 ] =0x5 ;/* bad parameters */ + obuf[2 ] =CUDA_PACKET ; + obuf[3 ] = data[0 ]; +cuda_send_packet_to_host (s, obuf,4 ); + } +return ; + } + } +switch (data[0 ]) {case CUDA_AUTOPOLL : autopoll = (data[1 ] !=0 );
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 01/13] cuda: add a framework to handle commands
Quoted 3 lines · Hervé Poussineau
Next commits will port existing CUDA commands to this framework.
Signed-off-by Hervé Poussineau <[email protected]>
Quoted 56 lines
--- hw/misc/macio/cuda.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)hw/misc/macio/cuda.c +34
-0@@ -534,13 +534,47 @@ static void cuda_adb_poll(void *opaque) (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ)); } +/* description of commands */ +typedef struct CudaCommand { +uint8_t command; +const char *name; +bool (*handler)(CUDAState *s, +const uint8_t *in_args,int in_len, +uint8_t *out_args,int *out_len); +}CudaCommand ; + +static const CudaCommand handlers[] = { +}; +static void cuda_receive_packet (CUDAState *s,const uint8_t *data,int len) {uint8_t obuf[16 ] = {CUDA_PACKET ,0 , data[0 ] };int autopoll; +int i, out_len =0 ;uint32_t ti; +for (i =0 ; i <ARRAY_SIZE (handlers); i++) { +const CudaCommand *desc = &handlers[i]; +if (desc->command == data[0 ]) { +CUDA_DPRINTF ("handling command %s\n" , desc->name); + out_len =0 ; +if (desc->handler (s, data +1 , len -1 , obuf +3 , &out_len)) { +cuda_send_packet_to_host (s, obuf,3 + out_len); + }else { +qemu_log_mask (LOG_GUEST_ERROR , +"CUDA: %s: wrong parameters %d\n" , + desc->name, len); + obuf[0 ] =ERROR_PACKET ; + obuf[1 ] =0x5 ;/* bad parameters */ + obuf[2 ] =CUDA_PACKET ; + obuf[3 ] = data[0 ]; +cuda_send_packet_to_host (s, obuf,4 ); + } +return ; + } + } +switch (data[0 ]) {case CUDA_AUTOPOLL : autopoll = (data[1 ] !=0 );
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 2/13 cuda: reject unknown commands
In reply to Hervé Poussineau--- hw/misc/macio/cuda.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
hw/misc/macio/cuda.c +16 -9
@@ -589,15 +589,15 @@ static void cuda_receive_packet(CUDAState *s, } }cuda_send_packet_to_host (s, obuf,3 ); -break ; +return ;case CUDA_GET_6805_ADDR :cuda_send_packet_to_host (s, obuf,3 ); -break ; +return ;case CUDA_SET_TIME : ti = (((uint32_t )data[1 ]) <<24 ) + (((uint32_t )data[2 ]) <<16 ) + (((uint32_t )data[3 ]) <<8 ) + data[4 ]; s->tick_offset = ti - (qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) /get_ticks_per_sec ());cuda_send_packet_to_host (s, obuf,3 ); -break ; +return ;case CUDA_GET_TIME : ti = s->tick_offset + (qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) /get_ticks_per_sec ()); obuf[3 ] = ti >>24 ;
@@ -605,28 +605,28 @@ static void cuda_receive_packet(CUDAState *s, obuf[5 ] = ti >>8 ; obuf[6 ] = ti;cuda_send_packet_to_host (s, obuf,7 ); -break ; +return ;case CUDA_FILE_SERVER_FLAG :case CUDA_SET_DEVICE_LIST :case CUDA_SET_AUTO_RATE :case CUDA_SET_POWER_MESSAGES :cuda_send_packet_to_host (s, obuf,3 ); -break ; +return ;case CUDA_POWERDOWN :cuda_send_packet_to_host (s, obuf,3 );qemu_system_shutdown_request (); -break ; +return ;case CUDA_RESET_SYSTEM :cuda_send_packet_to_host (s, obuf,3 );qemu_system_reset_request (); -break ; +return ;case CUDA_COMBINED_FORMAT_IIC : obuf[0 ] =ERROR_PACKET ; obuf[1 ] =0x5 ; obuf[2 ] =CUDA_PACKET ; obuf[3 ] = data[0 ];cuda_send_packet_to_host (s, obuf,4 ); -break ; +return ;case CUDA_GET_SET_IIC :if (len ==4 ) {cuda_send_packet_to_host (s, obuf,3 );
@@ -637,10 +637,17 @@ static void cuda_receive_packet(CUDAState *s, obuf[3 ] = data[0 ];cuda_send_packet_to_host (s, obuf,4 ); } -break ; +return ;default :break ; } + +qemu_log_mask (LOG_GUEST_ERROR ,"CUDA: unknown command 0x%02x\n" , data[0 ]); + obuf[0 ] =ERROR_PACKET ; + obuf[1 ] =0x2 ;/* unknown command */ + obuf[2 ] =CUDA_PACKET ; + obuf[3 ] = data[0 ]; +cuda_send_packet_to_host (s, obuf,4 ); } static void cuda_receive_packet_from_host(CUDAState *s,
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 02/13] cuda: reject unknown commands
Quoted 63 lines · Hervé Poussineau
Signed-off-by Hervé Poussineau <[email protected]>--- hw/misc/macio/cuda.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)hw/misc/macio/cuda.c +8
-8@@ -589,15 +589,15 @@ static void cuda_receive_packet(CUDAState *s, } }cuda_send_packet_to_host (s, obuf,3 ); -break ; +return ;case CUDA_GET_6805_ADDR :cuda_send_packet_to_host (s, obuf,3 ); -break ; +return ;case CUDA_SET_TIME : ti = (((uint32_t )data[1 ]) <<24 ) + (((uint32_t )data[2 ]) <<16 ) + (((uint32_t )data[3 ]) <<8 ) + data[4 ]; s->tick_offset = ti - (qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) /get_ticks_per_sec ());cuda_send_packet_to_host (s, obuf,3 ); -break ; +return ;case CUDA_GET_TIME : ti = s->tick_offset + (qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) /get_ticks_per_sec ()); obuf[3 ] = ti >>24 ;@@ -605,28 +605,28 @@ static void cuda_receive_packet(CUDAState *s, obuf[5 ] = ti >>8 ; obuf[6 ] = ti;cuda_send_packet_to_host (s, obuf,7 ); -break ; +return ;case CUDA_FILE_SERVER_FLAG :case CUDA_SET_DEVICE_LIST :case CUDA_SET_AUTO_RATE :case CUDA_SET_POWER_MESSAGES :cuda_send_packet_to_host (s, obuf,3 ); -break ; +return ;case CUDA_POWERDOWN :cuda_send_packet_to_host (s, obuf,3 );qemu_system_shutdown_request (); -break ; +return ;case CUDA_RESET_SYSTEM :cuda_send_packet_to_host (s, obuf,3 );qemu_system_reset_request (); -break ; +return ;case CUDA_COMBINED_FORMAT_IIC : obuf[0 ] =ERROR_PACKET ; obuf[1 ] =0x5 ; obuf[2 ] =CUDA_PACKET ; obuf[3 ] = data[0 ];cuda_send_packet_to_host (s, obuf,4 ); -break ; +return ;case CUDA_GET_SET_IIC :if (len ==4 ) {cuda_send_packet_to_host (s, obuf,3 );
hw/misc/macio/cuda.c static void cuda_receive_packet(CUDAState *s, · line 645
Quoted 10 lines
hw/misc/macio/cuda.c +3
-1@@ -637,10 +637,17 @@ static void cuda_receive_packet(CUDAState *s, obuf[3 ] = data[0 ];cuda_send_packet_to_host (s, obuf,4 ); } -break ; +return ;default :break ; } + +qemu_log_mask (LOG_GUEST_ERROR ,"CUDA: unknown command 0x%02x\n" , data[0 ]);
AFAICT qemu_log isn't much used these days, and it's not already used in this file. I think you'd be better off with either CUDA_DPRINTF() or a tracepoint.
Quoted 8 lines
hw/misc/macio/cuda.c +5
-0+ obuf[0 ] =ERROR_PACKET ; + obuf[1 ] =0x2 ;/* unknown command */ + obuf[2 ] =CUDA_PACKET ; + obuf[3 ] = data[0 ]; +cuda_send_packet_to_host (s, obuf,4 ); } static void cuda_receive_packet_from_host(CUDAState *s,
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 3/13 cuda: port AUTOPOLL command to new framework
In reply to Hervé Poussineau--- hw/misc/macio/cuda.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-)
hw/misc/macio/cuda.c +25 -15
@@ -543,14 +543,38 @@ typedef struct CudaCommand { uint8_t *out_args, int *out_len); } CudaCommand; +static bool cuda_cmd_autopoll (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +int autopoll; + +if (in_len !=1 ) { +return false; + } + + autopoll = (in_data[0 ] !=0 ); +if (autopoll != s->autopoll) { + s->autopoll = autopoll; +if (autopoll) { +timer_mod (s->adb_poll_timer, +qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + + (get_ticks_per_sec () /CUDA_ADB_POLL_FREQ )); + }else { +timer_del (s->adb_poll_timer); + } + } +return true; +} +static const CudaCommand handlers[] = { + {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, };static void cuda_receive_packet (CUDAState *s,const uint8_t *data,int len) {uint8_t obuf[16 ] = {CUDA_PACKET ,0 , data[0 ] }; -int autopoll;int i, out_len =0 ;uint32_t ti;
@@ -576,20 +600,6 @@ static void cuda_receive_packet(CUDAState *s, }switch (data[0 ]) { -case CUDA_AUTOPOLL : - autopoll = (data[1 ] !=0 ); -if (autopoll != s->autopoll) { - s->autopoll = autopoll; -if (autopoll) { -timer_mod (s->adb_poll_timer, -qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + - (get_ticks_per_sec () /CUDA_ADB_POLL_FREQ )); - }else { -timer_del (s->adb_poll_timer); - } - } -cuda_send_packet_to_host (s, obuf,3 ); -return ;case CUDA_GET_6805_ADDR :cuda_send_packet_to_host (s, obuf,3 );return ;
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 03/13] cuda: port AUTOPOLL command to new framework
Quoted 1 line · Hervé Poussineau
Signed-off-by Hervé Poussineau <[email protected]>
Quoted 69 lines
--- hw/misc/macio/cuda.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-)hw/misc/macio/cuda.c +25
-15@@ -543,14 +543,38 @@ typedef struct CudaCommand { uint8_t *out_args, int *out_len); } CudaCommand; +static bool cuda_cmd_autopoll (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +int autopoll; + +if (in_len !=1 ) { +return false; + } + + autopoll = (in_data[0 ] !=0 ); +if (autopoll != s->autopoll) { + s->autopoll = autopoll; +if (autopoll) { +timer_mod (s->adb_poll_timer, +qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + + (get_ticks_per_sec () /CUDA_ADB_POLL_FREQ )); + }else { +timer_del (s->adb_poll_timer); + } + } +return true; +} +static const CudaCommand handlers[] = { + {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, };static void cuda_receive_packet (CUDAState *s,const uint8_t *data,int len) {uint8_t obuf[16 ] = {CUDA_PACKET ,0 , data[0 ] }; -int autopoll;int i, out_len =0 ;uint32_t ti;@@ -576,20 +600,6 @@ static void cuda_receive_packet(CUDAState *s, }switch (data[0 ]) { -case CUDA_AUTOPOLL : - autopoll = (data[1 ] !=0 ); -if (autopoll != s->autopoll) { - s->autopoll = autopoll; -if (autopoll) { -timer_mod (s->adb_poll_timer, -qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + - (get_ticks_per_sec () /CUDA_ADB_POLL_FREQ )); - }else { -timer_del (s->adb_poll_timer); - } - } -cuda_send_packet_to_host (s, obuf,3 ); -return ;case CUDA_GET_6805_ADDR :cuda_send_packet_to_host (s, obuf,3 );return ;
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 4/13 cuda: port SET_AUTO_RATE command to new framework
In reply to Hervé PoussineauTake requested autopoll rate into account
--- hw/misc/macio/cuda.c | 31 +++++++++++++++++++++++++++---- hw/ppc/mac.h | 1 + 2 files changed, 28 insertions(+), 4 deletions(-)
hw/misc/macio/cuda.c +27 -4
@@ -105,7 +105,6 @@#define CUDA_COMBINED_FORMAT_IIC 0x25#define CUDA_TIMER_FREQ (4700000 / 6) -#define CUDA_ADB_POLL_FREQ 50/* CUDA returns time_t's offset from Jan 1, 1904, not 1970 */ #define RTC_OFFSET 2082844800
@@ -531,7 +530,7 @@ static void cuda_adb_poll(void *opaque) }timer_mod (s->adb_poll_timer,qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + - (get_ticks_per_sec () /CUDA_ADB_POLL_FREQ )); + (get_ticks_per_sec () / (1000 / s->auto_rate_ms))); }/* description of commands */
@@ -559,7 +558,7 @@ static bool cuda_cmd_autopoll(CUDAState *s,if (autopoll) {timer_mod (s->adb_poll_timer,qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + - (get_ticks_per_sec () /CUDA_ADB_POLL_FREQ )); + (get_ticks_per_sec () / (1000 / s->auto_rate_ms))); }else {timer_del (s->adb_poll_timer); }
@@ -567,8 +566,32 @@ static bool cuda_cmd_autopoll(CUDAState *s,return true; } +static bool cuda_cmd_set_autorate (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +if (in_len !=1 ) { +return false; + } + +/* we don't want a period of 0 ms */ +/* FIXME: check what real hardware does */ +if (in_data[0 ] ==0 ) { +return ; + } + + s->auto_rate_ms = in_data[0 ]; +if (s->autopoll) { +timer_mod (s->adb_poll_timer, +qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + + (get_ticks_per_sec () / (1000 / s->auto_rate_ms))); + } +return true; +} +static const CudaCommand handlers[] = { {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, + {CUDA_SET_AUTO_RATE ,"SET_AUTO_RATE" , cuda_cmd_set_autorate }, }; static void cuda_receive_packet(CUDAState *s,
@@ -618,7 +641,6 @@ static void cuda_receive_packet(CUDAState *s,return ;case CUDA_FILE_SERVER_FLAG :case CUDA_SET_DEVICE_LIST : -case CUDA_SET_AUTO_RATE :case CUDA_SET_POWER_MESSAGES :cuda_send_packet_to_host (s, obuf,3 );return ;
@@ -824,6 +846,7 @@ static void cuda_realizefn(DeviceState *dev, Error **errp) s->tick_offset = (uint32_t )mktimegm (&tm) +RTC_OFFSET ; s->adb_poll_timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , cuda_adb_poll, s); + s->auto_rate_ms =20 ; }static void cuda_initfn (Object *obj)
hw/ppc/mac.h +1 -0
@@ -111,6 +111,7 @@ typedef struct CUDAState {int data_out_index;qemu_irq irq; +uint8_t auto_rate_ms;uint8_t autopoll;uint8_t data_in[128 ];uint8_t data_out[16 ];
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 04/13] cuda: port SET_AUTO_RATE command to new framework
Quoted 44 lines · Hervé Poussineau
Take requested autopoll rate into account
Signed-off-by Hervé Poussineau <[email protected]>--- hw/misc/macio/cuda.c | 31 +++++++++++++++++++++++++++---- hw/ppc/mac.h | 1 + 2 files changed, 28 insertions(+), 4 deletions(-)hw/misc/macio/cuda.c +4
-3@@ -105,7 +105,6 @@#define CUDA_COMBINED_FORMAT_IIC 0x25#define CUDA_TIMER_FREQ (4700000 / 6) -#define CUDA_ADB_POLL_FREQ 50/* CUDA returns time_t's offset from Jan 1, 1904, not 1970 */ #define RTC_OFFSET 2082844800@@ -531,7 +530,7 @@ static void cuda_adb_poll(void *opaque) }timer_mod (s->adb_poll_timer,qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + - (get_ticks_per_sec () /CUDA_ADB_POLL_FREQ )); + (get_ticks_per_sec () / (1000 / s->auto_rate_ms))); }/* description of commands */ @@ -559,7 +558,7 @@ static bool cuda_cmd_autopoll(CUDAState *s,if (autopoll) {timer_mod (s->adb_poll_timer,qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + - (get_ticks_per_sec () /CUDA_ADB_POLL_FREQ )); + (get_ticks_per_sec () / (1000 / s->auto_rate_ms))); }else {timer_del (s->adb_poll_timer); }@@ -567,8 +566,32 @@ static bool cuda_cmd_autopoll(CUDAState *s,return true; } +static bool cuda_cmd_set_autorate(CUDAState *s, + const uint8_t *in_data, int in_len,
hw/misc/macio/cuda.c static bool cuda_cmd_autopoll(CUDAState *s, · line 580
Quoted 10 lines
hw/misc/macio/cuda.c +10
-0+ uint8_t *out_data, int *out_len) +{ +if (in_len !=1 ) { +return false; + } + +/* we don't want a period of 0 ms */ +/* FIXME: check what real hardware does */ +if (in_data[0 ] ==0 ) { +return ;
This 'return' should be changed into a 'return false'.
Quoted 46 lines
hw/misc/macio/cuda.c +13
-1+ } + + s->auto_rate_ms = in_data[0 ]; +if (s->autopoll) { +timer_mod (s->adb_poll_timer, +qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + + (get_ticks_per_sec () / (1000 / s->auto_rate_ms))); + } +return true; +} +static const CudaCommand handlers[] = { {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, + {CUDA_SET_AUTO_RATE ,"SET_AUTO_RATE" , cuda_cmd_set_autorate }, }; static void cuda_receive_packet(CUDAState *s,@@ -618,7 +641,6 @@ static void cuda_receive_packet(CUDAState *s,return ;case CUDA_FILE_SERVER_FLAG :case CUDA_SET_DEVICE_LIST : -case CUDA_SET_AUTO_RATE :case CUDA_SET_POWER_MESSAGES :cuda_send_packet_to_host (s, obuf,3 );return ;@@ -824,6 +846,7 @@ static void cuda_realizefn(DeviceState *dev, Error **errp) s->tick_offset = (uint32_t )mktimegm (&tm) +RTC_OFFSET ; s->adb_poll_timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , cuda_adb_poll, s); + s->auto_rate_ms =20 ; }static void cuda_initfn (Object *obj)hw/ppc/mac.h +1
-0@@ -111,6 +111,7 @@ typedef struct CUDAState {int data_out_index;qemu_irq irq; +uint8_t auto_rate_ms;uint8_t autopoll;uint8_t data_in[128 ];uint8_t data_out[16 ];
Re: [Qemu-devel] [PATCH 04/13] cuda: port SET_AUTO_RATE command to new framework
In reply to Hervé PoussineauQuoted 1 line · Hervé Poussineau
Take requested autopoll rate into account
Commit message needs some work - as far as I can tell this is not just moving this to the new framework, but implementing it - previously the command was silently ignored.
Quoted 20 lines
Signed-off-by Hervé Poussineau <[email protected]>--- hw/misc/macio/cuda.c | 31 +++++++++++++++++++++++++++---- hw/ppc/mac.h | 1 + 2 files changed, 28 insertions(+), 4 deletions(-)hw/misc/macio/cuda.c +0
-1@@ -105,7 +105,6 @@#define CUDA_COMBINED_FORMAT_IIC 0x25#define CUDA_TIMER_FREQ (4700000 / 6) -#define CUDA_ADB_POLL_FREQ 50/* CUDA returns time_t's offset from Jan 1, 1904, not 1970 */ #define RTC_OFFSET 2082844800
hw/misc/macio/cuda.c static void cuda_adb_poll(void *opaque) · line 533
Quoted 5 lines
hw/misc/macio/cuda.c +1
-1@@ -531,7 +530,7 @@ static void cuda_adb_poll(void *opaque) }timer_mod (s->adb_poll_timer,qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + - (get_ticks_per_sec () /CUDA_ADB_POLL_FREQ )); + (get_ticks_per_sec () / (1000 / s->auto_rate_ms)));
I believe you can reduce the rounding errors by expressing this as:
(s->auto_rate_ms * get_ticks_per_sec()) / 1000
Quoted 25 lines
hw/misc/macio/cuda.c +10
-1}/* description of commands */ @@ -559,7 +558,7 @@ static bool cuda_cmd_autopoll(CUDAState *s,if (autopoll) {timer_mod (s->adb_poll_timer,qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + - (get_ticks_per_sec () /CUDA_ADB_POLL_FREQ )); + (get_ticks_per_sec () / (1000 / s->auto_rate_ms))); }else {timer_del (s->adb_poll_timer); }@@ -567,8 +566,32 @@ static bool cuda_cmd_autopoll(CUDAState *s,return true; } +static bool cuda_cmd_set_autorate (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +if (in_len !=1 ) { +return false; + } + +/* we don't want a period of 0 ms */
hw/misc/macio/cuda.c static bool cuda_cmd_autopoll(CUDAState *s, · line 587
Quoted 10 lines
hw/misc/macio/cuda.c +10
-0+/* FIXME: check what real hardware does */ +if (in_data[0 ] ==0 ) { +return ; + } + + s->auto_rate_ms = in_data[0 ]; +if (s->autopoll) { +timer_mod (s->adb_poll_timer, +qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + + (get_ticks_per_sec () / (1000 / s->auto_rate_ms)));
IIUC this will make the next even occur in auto_rate_ms milliseconds, rather than auto_rate_ms from the previous event. i.e. it discards any time elapsed on the currently running timer.
That may be the intended behaviour, or at least close enough that it doesn't matter, but I think it deserves comment.
Quoted 38 lines
hw/misc/macio/cuda.c +6
-1+ } +return true; +} +static const CudaCommand handlers[] = { {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, + {CUDA_SET_AUTO_RATE ,"SET_AUTO_RATE" , cuda_cmd_set_autorate }, }; static void cuda_receive_packet(CUDAState *s,@@ -618,7 +641,6 @@ static void cuda_receive_packet(CUDAState *s,return ;case CUDA_FILE_SERVER_FLAG :case CUDA_SET_DEVICE_LIST : -case CUDA_SET_AUTO_RATE :case CUDA_SET_POWER_MESSAGES :cuda_send_packet_to_host (s, obuf,3 );return ;@@ -824,6 +846,7 @@ static void cuda_realizefn(DeviceState *dev, Error **errp) s->tick_offset = (uint32_t )mktimegm (&tm) +RTC_OFFSET ; s->adb_poll_timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , cuda_adb_poll, s); + s->auto_rate_ms =20 ; }static void cuda_initfn (Object *obj)hw/ppc/mac.h +1
-0@@ -111,6 +111,7 @@ typedef struct CUDAState {int data_out_index;qemu_irq irq; +uint8_t auto_rate_ms;uint8_t autopoll;uint8_t data_in[128 ];uint8_t data_out[16 ];
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH 04/13] cuda: port SET_AUTO_RATE command to new framework
In reply to Hervé PoussineauQuoted 80 lines · Hervé Poussineau
Take requested autopoll rate into account
Signed-off-by Hervé Poussineau <[email protected]>--- hw/misc/macio/cuda.c | 31 +++++++++++++++++++++++++++---- hw/ppc/mac.h | 1 + 2 files changed, 28 insertions(+), 4 deletions(-)hw/misc/macio/cuda.c +26
-4@@ -105,7 +105,6 @@#define CUDA_COMBINED_FORMAT_IIC 0x25#define CUDA_TIMER_FREQ (4700000 / 6) -#define CUDA_ADB_POLL_FREQ 50/* CUDA returns time_t's offset from Jan 1, 1904, not 1970 */ #define RTC_OFFSET 2082844800@@ -531,7 +530,7 @@ static void cuda_adb_poll(void *opaque) }timer_mod (s->adb_poll_timer,qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + - (get_ticks_per_sec () /CUDA_ADB_POLL_FREQ )); + (get_ticks_per_sec () / (1000 / s->auto_rate_ms))); }/* description of commands */ @@ -559,7 +558,7 @@ static bool cuda_cmd_autopoll(CUDAState *s,if (autopoll) {timer_mod (s->adb_poll_timer,qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + - (get_ticks_per_sec () /CUDA_ADB_POLL_FREQ )); + (get_ticks_per_sec () / (1000 / s->auto_rate_ms))); }else {timer_del (s->adb_poll_timer); }@@ -567,8 +566,32 @@ static bool cuda_cmd_autopoll(CUDAState *s,return true; } +static bool cuda_cmd_set_autorate (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +if (in_len !=1 ) { +return false; + } + +/* we don't want a period of 0 ms */ +/* FIXME: check what real hardware does */ +if (in_data[0 ] ==0 ) { +return ; + } + + s->auto_rate_ms = in_data[0 ]; +if (s->autopoll) { +timer_mod (s->adb_poll_timer, +qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + + (get_ticks_per_sec () / (1000 / s->auto_rate_ms))); + } +return true; +} +static const CudaCommand handlers[] = { {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, + {CUDA_SET_AUTO_RATE ,"SET_AUTO_RATE" , cuda_cmd_set_autorate }, }; static void cuda_receive_packet(CUDAState *s,@@ -618,7 +641,6 @@ static void cuda_receive_packet(CUDAState *s,return ;case CUDA_FILE_SERVER_FLAG :case CUDA_SET_DEVICE_LIST : -case CUDA_SET_AUTO_RATE :case CUDA_SET_POWER_MESSAGES :cuda_send_packet_to_host (s, obuf,3 );return ;
hw/misc/macio/cuda.c static void cuda_realizefn(DeviceState *dev, Error **errp) · line 849
Quoted 4 lines
hw/misc/macio/cuda.c +1
-0@@ -824,6 +846,7 @@ static void cuda_realizefn(DeviceState *dev, Error **errp) s->tick_offset = (uint32_t )mktimegm (&tm) +RTC_OFFSET ; s->adb_poll_timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , cuda_adb_poll, s); + s->auto_rate_ms =20 ;
Can we call this s->autopoll_rate_ms instead for consistency?
Quoted 9 lines
hw/misc/macio/cuda.c +0
-0}static void cuda_initfn (Object *obj)hw/ppc/mac.h +0
-0
hw/ppc/mac.h typedef struct CUDAState { · line 117
Quoted 7 lines
hw/ppc/mac.h +1
-0@@ -111,6 +111,7 @@ typedef struct CUDAState {int data_out_index;qemu_irq irq; +uint8_t auto_rate_ms;uint8_t autopoll;uint8_t data_in[128 ];uint8_t data_out[16 ];
I think that the autopoll rate field will also need adding to VMStateDescription for CUDA (along with a corresponding increase in version number).
ATB,
Mark.
PATCH 5/13 cuda: port SET_DEVICE_LIST command to new framework
In reply to Hervé PoussineauTake device list mask into account when polling ADB devices.
--- hw/input/adb.c | 18 ++++++++++-------- hw/misc/macio/cuda.c | 17 +++++++++++++++-- hw/ppc/mac.h | 1 + include/hw/input/adb.h | 2 +- roms/SLOF | 2 +- roms/openbios | 2 +- 6 files changed, 29 insertions(+), 13 deletions(-)
hw/input/adb.c +10 -8
@@ -88,7 +88,7 @@ int adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf, int len) }/* XXX: move that to cuda ? */ -int adb_poll (ADBBusState *s,uint8_t *obuf) +int adb_poll (ADBBusState *s,uint8_t *obuf,uint16_t poll_mask) {ADBDevice *d;int olen, i;
@@ -99,13 +99,15 @@ int adb_poll(ADBBusState *s, uint8_t *obuf)if (s->poll_index >= s->nb_devices) s->poll_index =0 ; d = s->devices[s->poll_index]; - buf[0 ] =ADB_READREG | (d->devaddr <<4 ); - olen =adb_request (s, obuf +1 , buf,1 ); -/* if there is data, we poll again the same device */ -if (olen >0 ) { - obuf[0 ] = buf[0 ]; - olen++; -break ; +if ((1 << d->devaddr) & poll_mask) { + buf[0 ] =ADB_READREG | (d->devaddr <<4 ); + olen =adb_request (s, obuf +1 , buf,1 ); +/* if there is data, we poll again the same device */ +if (olen >0 ) { + obuf[0 ] = buf[0 ]; + olen++; +break ; + } } s->poll_index++; }
hw/misc/macio/cuda.c +15 -2
@@ -522,7 +522,7 @@ static void cuda_adb_poll(void *opaque)uint8_t obuf[ADB_MAX_OUT_LEN +2 ];int olen; - olen =adb_poll (&s->adb_bus, obuf +2 ); + olen =adb_poll (&s->adb_bus, obuf +2 , s->poll_mask);if (olen >0 ) { obuf[0 ] =ADB_PACKET ; obuf[1 ] =0x40 ;/* polled data */
@@ -589,9 +589,22 @@ static bool cuda_cmd_set_autorate(CUDAState *s,return true; } +static bool cuda_cmd_set_device_list (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +if (in_len !=2 ) { +return false; + } + + s->poll_mask = (((uint16_t )in_data[0 ]) <<8 ) | in_data[1 ]; +return true; +} +static const CudaCommand handlers[] = { {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, {CUDA_SET_AUTO_RATE ,"SET_AUTO_RATE" , cuda_cmd_set_autorate }, + {CUDA_SET_DEVICE_LIST ,"SET_DEVICE_LIST" , cuda_cmd_set_device_list }, }; static void cuda_receive_packet(CUDAState *s,
@@ -640,7 +653,6 @@ static void cuda_receive_packet(CUDAState *s,cuda_send_packet_to_host (s, obuf,7 );return ;case CUDA_FILE_SERVER_FLAG : -case CUDA_SET_DEVICE_LIST :case CUDA_SET_POWER_MESSAGES :cuda_send_packet_to_host (s, obuf,3 );return ;
@@ -847,6 +859,7 @@ static void cuda_realizefn(DeviceState *dev, Error **errp) s->adb_poll_timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , cuda_adb_poll, s); s->auto_rate_ms =20 ; + s->poll_mask =0xffff ; }static void cuda_initfn (Object *obj)
hw/ppc/mac.h +1 -0
@@ -111,6 +111,7 @@ typedef struct CUDAState {int data_out_index;qemu_irq irq; +uint16_t poll_mask;uint8_t auto_rate_ms;uint8_t autopoll;uint8_t data_in[128 ];
include/hw/input/adb.h +1 -1
@@ -79,7 +79,7 @@ struct ADBBusState {int adb_request (ADBBusState *s,uint8_t *buf_out,const uint8_t *buf,int len); -int adb_poll (ADBBusState *s,uint8_t *buf_out); +int adb_poll (ADBBusState *s,uint8_t *buf_out,uint16_t poll_mask);#define TYPE_ADB_KEYBOARD "adb-keyboard"#define TYPE_ADB_MOUSE "adb-mouse"
roms/SLOF +1 -1
@@ -1 +1 @@ -Subproject commit b4c93802a5b2c72f096649c497ec9ff5708e4456 +Subproject commit 811277ac91f674a9273e2b529791e9b75350f3e8
roms/openbios +1 -1
@@ -1 +1 @@ -Subproject commit 3caee1794ac3f742315823d8447d21f33ce019e9 +Subproject commit 18f02b14de795c1aab4fe23c1810bfd0944da6aa
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 05/13] cuda: port SET_DEVICE_LIST command to new framework
Quoted 1 line · Hervé Poussineau
Take device list mask into account when polling ADB devices.
Again, this appears to implement the command, not just move it.
Quoted 135 lines
Signed-off-by Hervé Poussineau <[email protected]>--- hw/input/adb.c | 18 ++++++++++-------- hw/misc/macio/cuda.c | 17 +++++++++++++++-- hw/ppc/mac.h | 1 + include/hw/input/adb.h | 2 +- roms/SLOF | 2 +- roms/openbios | 2 +- 6 files changed, 29 insertions(+), 13 deletions(-)hw/input/adb.c +10
-8@@ -88,7 +88,7 @@ int adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf, int len) }/* XXX: move that to cuda ? */ -int adb_poll (ADBBusState *s,uint8_t *obuf) +int adb_poll (ADBBusState *s,uint8_t *obuf,uint16_t poll_mask) {ADBDevice *d;int olen, i;@@ -99,13 +99,15 @@ int adb_poll(ADBBusState *s, uint8_t *obuf)if (s->poll_index >= s->nb_devices) s->poll_index =0 ; d = s->devices[s->poll_index]; - buf[0 ] =ADB_READREG | (d->devaddr <<4 ); - olen =adb_request (s, obuf +1 , buf,1 ); -/* if there is data, we poll again the same device */ -if (olen >0 ) { - obuf[0 ] = buf[0 ]; - olen++; -break ; +if ((1 << d->devaddr) & poll_mask) { + buf[0 ] =ADB_READREG | (d->devaddr <<4 ); + olen =adb_request (s, obuf +1 , buf,1 ); +/* if there is data, we poll again the same device */ +if (olen >0 ) { + obuf[0 ] = buf[0 ]; + olen++; +break ; + } } s->poll_index++; }hw/misc/macio/cuda.c +15
-2@@ -522,7 +522,7 @@ static void cuda_adb_poll(void *opaque)uint8_t obuf[ADB_MAX_OUT_LEN +2 ];int olen; - olen =adb_poll (&s->adb_bus, obuf +2 ); + olen =adb_poll (&s->adb_bus, obuf +2 , s->poll_mask);if (olen >0 ) { obuf[0 ] =ADB_PACKET ; obuf[1 ] =0x40 ;/* polled data */ @@ -589,9 +589,22 @@ static bool cuda_cmd_set_autorate(CUDAState *s,return true; } +static bool cuda_cmd_set_device_list (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +if (in_len !=2 ) { +return false; + } + + s->poll_mask = (((uint16_t )in_data[0 ]) <<8 ) | in_data[1 ]; +return true; +} +static const CudaCommand handlers[] = { {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, {CUDA_SET_AUTO_RATE ,"SET_AUTO_RATE" , cuda_cmd_set_autorate }, + {CUDA_SET_DEVICE_LIST ,"SET_DEVICE_LIST" , cuda_cmd_set_device_list }, }; static void cuda_receive_packet(CUDAState *s,@@ -640,7 +653,6 @@ static void cuda_receive_packet(CUDAState *s,cuda_send_packet_to_host (s, obuf,7 );return ;case CUDA_FILE_SERVER_FLAG : -case CUDA_SET_DEVICE_LIST :case CUDA_SET_POWER_MESSAGES :cuda_send_packet_to_host (s, obuf,3 );return ;@@ -847,6 +859,7 @@ static void cuda_realizefn(DeviceState *dev, Error **errp) s->adb_poll_timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , cuda_adb_poll, s); s->auto_rate_ms =20 ; + s->poll_mask =0xffff ; }static void cuda_initfn (Object *obj)hw/ppc/mac.h +1
-0@@ -111,6 +111,7 @@ typedef struct CUDAState {int data_out_index;qemu_irq irq; +uint16_t poll_mask;uint8_t auto_rate_ms;uint8_t autopoll;uint8_t data_in[128 ];include/hw/input/adb.h +1
-1@@ -79,7 +79,7 @@ struct ADBBusState {int adb_request (ADBBusState *s,uint8_t *buf_out,const uint8_t *buf,int len); -int adb_poll (ADBBusState *s,uint8_t *buf_out); +int adb_poll (ADBBusState *s,uint8_t *buf_out,uint16_t poll_mask);#define TYPE_ADB_KEYBOARD "adb-keyboard"#define TYPE_ADB_MOUSE "adb-mouse"roms/SLOF +1
-1@@ -1 +1 @@ -Subproject commit b4c93802a5b2c72f096649c497ec9ff5708e4456 +Subproject commit 811277ac91f674a9273e2b529791e9b75350f3e8roms/openbios +0
-0
roms/openbios line 1
Quoted 2 lines
roms/openbios +1
-1@@ -1 +1 @@ -Subproject commit 3caee1794ac3f742315823d8447d21f33ce019e9 +Subproject commit 18f02b14de795c1aab4fe23c1810bfd0944da6aa
These SLOF and openbios changes look unrelated. If they're not, they definitely need to be mentioned in the commit message.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH 05/13] cuda: port SET_DEVICE_LIST command to new framework
In reply to Hervé PoussineauQuoted 93 lines · Hervé Poussineau
Take device list mask into account when polling ADB devices.
Signed-off-by Hervé Poussineau <[email protected]>--- hw/input/adb.c | 18 ++++++++++-------- hw/misc/macio/cuda.c | 17 +++++++++++++++-- hw/ppc/mac.h | 1 + include/hw/input/adb.h | 2 +- roms/SLOF | 2 +- roms/openbios | 2 +- 6 files changed, 29 insertions(+), 13 deletions(-)hw/input/adb.c +10
-8@@ -88,7 +88,7 @@ int adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf, int len) }/* XXX: move that to cuda ? */ -int adb_poll (ADBBusState *s,uint8_t *obuf) +int adb_poll (ADBBusState *s,uint8_t *obuf,uint16_t poll_mask) {ADBDevice *d;int olen, i;@@ -99,13 +99,15 @@ int adb_poll(ADBBusState *s, uint8_t *obuf)if (s->poll_index >= s->nb_devices) s->poll_index =0 ; d = s->devices[s->poll_index]; - buf[0 ] =ADB_READREG | (d->devaddr <<4 ); - olen =adb_request (s, obuf +1 , buf,1 ); -/* if there is data, we poll again the same device */ -if (olen >0 ) { - obuf[0 ] = buf[0 ]; - olen++; -break ; +if ((1 << d->devaddr) & poll_mask) { + buf[0 ] =ADB_READREG | (d->devaddr <<4 ); + olen =adb_request (s, obuf +1 , buf,1 ); +/* if there is data, we poll again the same device */ +if (olen >0 ) { + obuf[0 ] = buf[0 ]; + olen++; +break ; + } } s->poll_index++; }hw/misc/macio/cuda.c +14
-2@@ -522,7 +522,7 @@ static void cuda_adb_poll(void *opaque)uint8_t obuf[ADB_MAX_OUT_LEN +2 ];int olen; - olen =adb_poll (&s->adb_bus, obuf +2 ); + olen =adb_poll (&s->adb_bus, obuf +2 , s->poll_mask);if (olen >0 ) { obuf[0 ] =ADB_PACKET ; obuf[1 ] =0x40 ;/* polled data */ @@ -589,9 +589,22 @@ static bool cuda_cmd_set_autorate(CUDAState *s,return true; } +static bool cuda_cmd_set_device_list (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +if (in_len !=2 ) { +return false; + } + + s->poll_mask = (((uint16_t )in_data[0 ]) <<8 ) | in_data[1 ]; +return true; +} +static const CudaCommand handlers[] = { {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, {CUDA_SET_AUTO_RATE ,"SET_AUTO_RATE" , cuda_cmd_set_autorate }, + {CUDA_SET_DEVICE_LIST ,"SET_DEVICE_LIST" , cuda_cmd_set_device_list }, }; static void cuda_receive_packet(CUDAState *s,@@ -640,7 +653,6 @@ static void cuda_receive_packet(CUDAState *s,cuda_send_packet_to_host (s, obuf,7 );return ;case CUDA_FILE_SERVER_FLAG : -case CUDA_SET_DEVICE_LIST :case CUDA_SET_POWER_MESSAGES :cuda_send_packet_to_host (s, obuf,3 );return ;
hw/misc/macio/cuda.c static void cuda_realizefn(DeviceState *dev, Error **errp) · line 862
Quoted 4 lines
hw/misc/macio/cuda.c +1
-0@@ -847,6 +859,7 @@ static void cuda_realizefn(DeviceState *dev, Error **errp) s->adb_poll_timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , cuda_adb_poll, s); s->auto_rate_ms =20 ; + s->poll_mask =0xffff ;
How about calling this s->adb_poll_mask to both match adb_poll_timer and also indicate that this is related to ADB?
hw/ppc/mac.h typedef struct CUDAState { · line 114
Quoted 12 lines
hw/misc/macio/cuda.c +0
-0}static void cuda_initfn (Object *obj)hw/ppc/mac.h +1
-0@@ -111,6 +111,7 @@ typedef struct CUDAState {int data_out_index;qemu_irq irq; +uint16_t poll_mask;
Again, with this you'll need a VMStateDescription update.
Quoted 28 lines
hw/ppc/mac.h +0
-0uint8_t auto_rate_ms;uint8_t autopoll;uint8_t data_in[128 ];include/hw/input/adb.h +1
-1@@ -79,7 +79,7 @@ struct ADBBusState {int adb_request (ADBBusState *s,uint8_t *buf_out,const uint8_t *buf,int len); -int adb_poll (ADBBusState *s,uint8_t *buf_out); +int adb_poll (ADBBusState *s,uint8_t *buf_out,uint16_t poll_mask);#define TYPE_ADB_KEYBOARD "adb-keyboard"#define TYPE_ADB_MOUSE "adb-mouse"roms/SLOF +1
-1@@ -1 +1 @@ -Subproject commit b4c93802a5b2c72f096649c497ec9ff5708e4456 +Subproject commit 811277ac91f674a9273e2b529791e9b75350f3e8roms/openbios +0
-0
roms/openbios line 1
Quoted 2 lines
roms/openbios +1
-1@@ -1 +1 @@ -Subproject commit 3caee1794ac3f742315823d8447d21f33ce019e9 +Subproject commit 18f02b14de795c1aab4fe23c1810bfd0944da6aa
And these ROM changes shouldn't be included here either.
ATB,
Mark.
PATCH 6/13 cuda: port POWERDOWN command to new framework
In reply to Hervé Poussineau--- hw/misc/macio/cuda.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
hw/misc/macio/cuda.c +13 -4
@@ -601,10 +601,23 @@ static bool cuda_cmd_set_device_list(CUDAState *s,return true; } +static bool cuda_cmd_powerdown (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +if (in_len !=0 ) { +return false; + } + +qemu_system_shutdown_request (); +return true; +} +static const CudaCommand handlers[] = { {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, {CUDA_SET_AUTO_RATE ,"SET_AUTO_RATE" , cuda_cmd_set_autorate }, {CUDA_SET_DEVICE_LIST ,"SET_DEVICE_LIST" , cuda_cmd_set_device_list }, + {CUDA_POWERDOWN ,"POWERDOWN" , cuda_cmd_powerdown }, }; static void cuda_receive_packet(CUDAState *s,
@@ -656,10 +669,6 @@ static void cuda_receive_packet(CUDAState *s,case CUDA_SET_POWER_MESSAGES :cuda_send_packet_to_host (s, obuf,3 );return ; -case CUDA_POWERDOWN : -cuda_send_packet_to_host (s, obuf,3 ); -qemu_system_shutdown_request (); -return ;case CUDA_RESET_SYSTEM :cuda_send_packet_to_host (s, obuf,3 );qemu_system_reset_request ();
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 06/13] cuda: port POWERDOWN command to new framework
Quoted 1 line · Hervé Poussineau
Signed-off-by Hervé Poussineau <[email protected]>
Quoted 43 lines
--- hw/misc/macio/cuda.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)hw/misc/macio/cuda.c +13
-4@@ -601,10 +601,23 @@ static bool cuda_cmd_set_device_list(CUDAState *s,return true; } +static bool cuda_cmd_powerdown (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +if (in_len !=0 ) { +return false; + } + +qemu_system_shutdown_request (); +return true; +} +static const CudaCommand handlers[] = { {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, {CUDA_SET_AUTO_RATE ,"SET_AUTO_RATE" , cuda_cmd_set_autorate }, {CUDA_SET_DEVICE_LIST ,"SET_DEVICE_LIST" , cuda_cmd_set_device_list }, + {CUDA_POWERDOWN ,"POWERDOWN" , cuda_cmd_powerdown }, }; static void cuda_receive_packet(CUDAState *s,@@ -656,10 +669,6 @@ static void cuda_receive_packet(CUDAState *s,case CUDA_SET_POWER_MESSAGES :cuda_send_packet_to_host (s, obuf,3 );return ; -case CUDA_POWERDOWN : -cuda_send_packet_to_host (s, obuf,3 ); -qemu_system_shutdown_request (); -return ;case CUDA_RESET_SYSTEM :cuda_send_packet_to_host (s, obuf,3 );qemu_system_reset_request ();
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 7/13 cuda: port RESET_SYSTEM command to new framework
In reply to Hervé Poussineau--- hw/misc/macio/cuda.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
hw/misc/macio/cuda.c +13 -4
@@ -613,11 +613,24 @@ static bool cuda_cmd_powerdown(CUDAState *s,return true; } +static bool cuda_cmd_reset_system (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +if (in_len !=0 ) { +return false; + } + +qemu_system_reset_request (); +return true; +} +static const CudaCommand handlers[] = { {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, {CUDA_SET_AUTO_RATE ,"SET_AUTO_RATE" , cuda_cmd_set_autorate }, {CUDA_SET_DEVICE_LIST ,"SET_DEVICE_LIST" , cuda_cmd_set_device_list }, {CUDA_POWERDOWN ,"POWERDOWN" , cuda_cmd_powerdown }, + {CUDA_RESET_SYSTEM ,"RESET_SYSTEM" , cuda_cmd_reset_system }, }; static void cuda_receive_packet(CUDAState *s,
@@ -669,10 +682,6 @@ static void cuda_receive_packet(CUDAState *s,case CUDA_SET_POWER_MESSAGES :cuda_send_packet_to_host (s, obuf,3 );return ; -case CUDA_RESET_SYSTEM : -cuda_send_packet_to_host (s, obuf,3 ); -qemu_system_reset_request (); -return ;case CUDA_COMBINED_FORMAT_IIC : obuf[0 ] =ERROR_PACKET ; obuf[1 ] =0x5 ;
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 07/13] cuda: port RESET_SYSTEM command to new framework
Quoted 1 line · Hervé Poussineau
Signed-off-by Hervé Poussineau <[email protected]>
Quoted 44 lines
--- hw/misc/macio/cuda.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)hw/misc/macio/cuda.c +13
-4@@ -613,11 +613,24 @@ static bool cuda_cmd_powerdown(CUDAState *s,return true; } +static bool cuda_cmd_reset_system (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +if (in_len !=0 ) { +return false; + } + +qemu_system_reset_request (); +return true; +} +static const CudaCommand handlers[] = { {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, {CUDA_SET_AUTO_RATE ,"SET_AUTO_RATE" , cuda_cmd_set_autorate }, {CUDA_SET_DEVICE_LIST ,"SET_DEVICE_LIST" , cuda_cmd_set_device_list }, {CUDA_POWERDOWN ,"POWERDOWN" , cuda_cmd_powerdown }, + {CUDA_RESET_SYSTEM ,"RESET_SYSTEM" , cuda_cmd_reset_system }, }; static void cuda_receive_packet(CUDAState *s,@@ -669,10 +682,6 @@ static void cuda_receive_packet(CUDAState *s,case CUDA_SET_POWER_MESSAGES :cuda_send_packet_to_host (s, obuf,3 );return ; -case CUDA_RESET_SYSTEM : -cuda_send_packet_to_host (s, obuf,3 ); -qemu_system_reset_request (); -return ;case CUDA_COMBINED_FORMAT_IIC : obuf[0 ] =ERROR_PACKET ; obuf[1 ] =0x5 ;
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 8/13 cuda: port FILE_SERVER_FLAG command to new framework
In reply to Hervé PoussineauThis command tells if computer should automatically wake-up after a power loss.
--- hw/misc/macio/cuda.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
hw/misc/macio/cuda.c +16 -1
@@ -625,12 +625,28 @@ static bool cuda_cmd_reset_system(CUDAState *s,return true; } +static bool cuda_cmd_set_file_server_flag (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +if (in_len !=1 ) { +return false; + } + +qemu_log_mask (LOG_UNIMP , +"CUDA: unimplemented command FILE_SERVER_FLAG %d\n" , + in_data[0 ]); +return true; +} +static const CudaCommand handlers[] = { {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, {CUDA_SET_AUTO_RATE ,"SET_AUTO_RATE" , cuda_cmd_set_autorate }, {CUDA_SET_DEVICE_LIST ,"SET_DEVICE_LIST" , cuda_cmd_set_device_list }, {CUDA_POWERDOWN ,"POWERDOWN" , cuda_cmd_powerdown }, {CUDA_RESET_SYSTEM ,"RESET_SYSTEM" , cuda_cmd_reset_system }, + {CUDA_FILE_SERVER_FLAG ,"FILE_SERVER_FLAG" , + cuda_cmd_set_file_server_flag }, }; static void cuda_receive_packet(CUDAState *s,
@@ -678,7 +694,6 @@ static void cuda_receive_packet(CUDAState *s, obuf[6 ] = ti;cuda_send_packet_to_host (s, obuf,7 );return ; -case CUDA_FILE_SERVER_FLAG :case CUDA_SET_POWER_MESSAGES :cuda_send_packet_to_host (s, obuf,3 );return ;
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 08/13] cuda: port FILE_SERVER_FLAG command to new framework
Quoted 3 lines · Hervé Poussineau
This command tells if computer should automatically wake-up after a power loss.
Signed-off-by Hervé Poussineau <[email protected]>
Quoted 45 lines
--- hw/misc/macio/cuda.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)hw/misc/macio/cuda.c +16
-1@@ -625,12 +625,28 @@ static bool cuda_cmd_reset_system(CUDAState *s,return true; } +static bool cuda_cmd_set_file_server_flag (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +if (in_len !=1 ) { +return false; + } + +qemu_log_mask (LOG_UNIMP , +"CUDA: unimplemented command FILE_SERVER_FLAG %d\n" , + in_data[0 ]); +return true; +} +static const CudaCommand handlers[] = { {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, {CUDA_SET_AUTO_RATE ,"SET_AUTO_RATE" , cuda_cmd_set_autorate }, {CUDA_SET_DEVICE_LIST ,"SET_DEVICE_LIST" , cuda_cmd_set_device_list }, {CUDA_POWERDOWN ,"POWERDOWN" , cuda_cmd_powerdown }, {CUDA_RESET_SYSTEM ,"RESET_SYSTEM" , cuda_cmd_reset_system }, + {CUDA_FILE_SERVER_FLAG ,"FILE_SERVER_FLAG" , + cuda_cmd_set_file_server_flag }, }; static void cuda_receive_packet(CUDAState *s,@@ -678,7 +694,6 @@ static void cuda_receive_packet(CUDAState *s, obuf[6 ] = ti;cuda_send_packet_to_host (s, obuf,7 );return ; -case CUDA_FILE_SERVER_FLAG :case CUDA_SET_POWER_MESSAGES :cuda_send_packet_to_host (s, obuf,3 );return ;
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 9/13 cuda: port SET_POWER_MESSAGES command to new framework
In reply to Hervé Poussineau--- hw/misc/macio/cuda.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
hw/misc/macio/cuda.c +16 -3
@@ -639,6 +639,20 @@ static bool cuda_cmd_set_file_server_flag(CUDAState *s,return true; } +static bool cuda_cmd_set_power_message (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +if (in_len !=1 ) { +return false; + } + +qemu_log_mask (LOG_UNIMP , +"CUDA: unimplemented command SET_POWER_MESSAGE %d\n" , + in_data[0 ]); +return true; +} +static const CudaCommand handlers[] = { {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, {CUDA_SET_AUTO_RATE ,"SET_AUTO_RATE" , cuda_cmd_set_autorate },
@@ -647,6 +661,8 @@ static const CudaCommand handlers[] = { { CUDA_RESET_SYSTEM, "RESET_SYSTEM", cuda_cmd_reset_system }, { CUDA_FILE_SERVER_FLAG, "FILE_SERVER_FLAG", cuda_cmd_set_file_server_flag }, + { CUDA_SET_POWER_MESSAGES, "SET_POWER_MESSAGES", + cuda_cmd_set_power_message }, }; static void cuda_receive_packet(CUDAState *s,
@@ -694,9 +710,6 @@ static void cuda_receive_packet(CUDAState *s, obuf[6 ] = ti;cuda_send_packet_to_host (s, obuf,7 );return ; -case CUDA_SET_POWER_MESSAGES : -cuda_send_packet_to_host (s, obuf,3 ); -return ;case CUDA_COMBINED_FORMAT_IIC : obuf[0 ] =ERROR_PACKET ; obuf[1 ] =0x5 ;
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 09/13] cuda: port SET_POWER_MESSAGES command to new framework
Quoted 1 line · Hervé Poussineau
Signed-off-by Hervé Poussineau <[email protected]>
Quoted 48 lines
--- hw/misc/macio/cuda.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)hw/misc/macio/cuda.c +16
-3@@ -639,6 +639,20 @@ static bool cuda_cmd_set_file_server_flag(CUDAState *s,return true; } +static bool cuda_cmd_set_power_message (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +if (in_len !=1 ) { +return false; + } + +qemu_log_mask (LOG_UNIMP , +"CUDA: unimplemented command SET_POWER_MESSAGE %d\n" , + in_data[0 ]); +return true; +} +static const CudaCommand handlers[] = { {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, {CUDA_SET_AUTO_RATE ,"SET_AUTO_RATE" , cuda_cmd_set_autorate },@@ -647,6 +661,8 @@ static const CudaCommand handlers[] = { { CUDA_RESET_SYSTEM, "RESET_SYSTEM", cuda_cmd_reset_system }, { CUDA_FILE_SERVER_FLAG, "FILE_SERVER_FLAG", cuda_cmd_set_file_server_flag }, + { CUDA_SET_POWER_MESSAGES, "SET_POWER_MESSAGES", + cuda_cmd_set_power_message }, }; static void cuda_receive_packet(CUDAState *s,@@ -694,9 +710,6 @@ static void cuda_receive_packet(CUDAState *s, obuf[6 ] = ti;cuda_send_packet_to_host (s, obuf,7 );return ; -case CUDA_SET_POWER_MESSAGES : -cuda_send_packet_to_host (s, obuf,3 ); -return ;case CUDA_COMBINED_FORMAT_IIC : obuf[0 ] =ERROR_PACKET ; obuf[1 ] =0x5 ;
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 10/13 cuda: port GET_TIME command to new framework
In reply to Hervé Poussineau--- hw/misc/macio/cuda.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)
hw/misc/macio/cuda.c +21 -8
@@ -653,6 +653,26 @@ static bool cuda_cmd_set_power_message(CUDAState *s,return true; } +static bool cuda_cmd_get_time (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +uint32_t ti; + +if (in_len !=0 ) { +return false; + } + + ti = s->tick_offset + (qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + /get_ticks_per_sec ()); + out_data[0 ] = ti >>24 ; + out_data[1 ] = ti >>16 ; + out_data[2 ] = ti >>8 ; + out_data[3 ] = ti; + *out_len =4 ; +return true; +} +static const CudaCommand handlers[] = { {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, {CUDA_SET_AUTO_RATE ,"SET_AUTO_RATE" , cuda_cmd_set_autorate },
@@ -663,6 +683,7 @@ static const CudaCommand handlers[] = { cuda_cmd_set_file_server_flag }, { CUDA_SET_POWER_MESSAGES, "SET_POWER_MESSAGES", cuda_cmd_set_power_message }, + { CUDA_GET_TIME, "GET_TIME", cuda_cmd_get_time }, }; static void cuda_receive_packet(CUDAState *s,
@@ -702,14 +723,6 @@ static void cuda_receive_packet(CUDAState *s, s->tick_offset = ti - (qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) /get_ticks_per_sec ());cuda_send_packet_to_host (s, obuf,3 );return ; -case CUDA_GET_TIME : - ti = s->tick_offset + (qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) /get_ticks_per_sec ()); - obuf[3 ] = ti >>24 ; - obuf[4 ] = ti >>16 ; - obuf[5 ] = ti >>8 ; - obuf[6 ] = ti; -cuda_send_packet_to_host (s, obuf,7 ); -return ;case CUDA_COMBINED_FORMAT_IIC : obuf[0 ] =ERROR_PACKET ; obuf[1 ] =0x5 ;
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 10/13] cuda: port GET_TIME command to new framework
Quoted 1 line · Hervé Poussineau
Signed-off-by Hervé Poussineau <[email protected]>
Quoted 58 lines
--- hw/misc/macio/cuda.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)hw/misc/macio/cuda.c +21
-8@@ -653,6 +653,26 @@ static bool cuda_cmd_set_power_message(CUDAState *s,return true; } +static bool cuda_cmd_get_time (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +uint32_t ti; + +if (in_len !=0 ) { +return false; + } + + ti = s->tick_offset + (qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + /get_ticks_per_sec ()); + out_data[0 ] = ti >>24 ; + out_data[1 ] = ti >>16 ; + out_data[2 ] = ti >>8 ; + out_data[3 ] = ti; + *out_len =4 ; +return true; +} +static const CudaCommand handlers[] = { {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, {CUDA_SET_AUTO_RATE ,"SET_AUTO_RATE" , cuda_cmd_set_autorate },@@ -663,6 +683,7 @@ static const CudaCommand handlers[] = { cuda_cmd_set_file_server_flag }, { CUDA_SET_POWER_MESSAGES, "SET_POWER_MESSAGES", cuda_cmd_set_power_message }, + { CUDA_GET_TIME, "GET_TIME", cuda_cmd_get_time }, }; static void cuda_receive_packet(CUDAState *s,@@ -702,14 +723,6 @@ static void cuda_receive_packet(CUDAState *s, s->tick_offset = ti - (qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) /get_ticks_per_sec ());cuda_send_packet_to_host (s, obuf,3 );return ; -case CUDA_GET_TIME : - ti = s->tick_offset + (qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) /get_ticks_per_sec ()); - obuf[3 ] = ti >>24 ; - obuf[4 ] = ti >>16 ; - obuf[5 ] = ti >>8 ; - obuf[6 ] = ti; -cuda_send_packet_to_host (s, obuf,7 ); -return ;case CUDA_COMBINED_FORMAT_IIC : obuf[0 ] =ERROR_PACKET ; obuf[1 ] =0x5 ;
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 11/13 cuda: port SET_TIME command to new framework
In reply to Hervé Poussineau--- hw/misc/macio/cuda.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
hw/misc/macio/cuda.c +18 -6
@@ -673,6 +673,23 @@ static bool cuda_cmd_get_time(CUDAState *s,return true; } +static bool cuda_cmd_set_time (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +uint32_t ti; + +if (in_len !=4 ) { +return false; + } + + ti = (((uint32_t )in_data[1 ]) <<24 ) + (((uint32_t )in_data[2 ]) <<16 ) + + (((uint32_t )in_data[3 ]) <<8 ) + in_data[4 ]; + s->tick_offset = ti - (qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + /get_ticks_per_sec ()); +return true; +} +static const CudaCommand handlers[] = { {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, {CUDA_SET_AUTO_RATE ,"SET_AUTO_RATE" , cuda_cmd_set_autorate },
@@ -684,6 +701,7 @@ static const CudaCommand handlers[] = { {CUDA_SET_POWER_MESSAGES ,"SET_POWER_MESSAGES" , cuda_cmd_set_power_message }, { CUDA_GET_TIME, "GET_TIME", cuda_cmd_get_time }, + { CUDA_SET_TIME, "SET_TIME", cuda_cmd_set_time }, }; static void cuda_receive_packet(CUDAState *s,
@@ -691,7 +709,6 @@ static void cuda_receive_packet(CUDAState *s, {uint8_t obuf[16 ] = {CUDA_PACKET ,0 , data[0 ] };int i, out_len =0 ; -uint32_t ti;for (i =0 ; i <ARRAY_SIZE (handlers); i++) {const CudaCommand *desc = &handlers[i];
@@ -718,11 +735,6 @@ static void cuda_receive_packet(CUDAState *s,case CUDA_GET_6805_ADDR :cuda_send_packet_to_host (s, obuf,3 );return ; -case CUDA_SET_TIME : - ti = (((uint32_t )data[1 ]) <<24 ) + (((uint32_t )data[2 ]) <<16 ) + (((uint32_t )data[3 ]) <<8 ) + data[4 ]; - s->tick_offset = ti - (qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) /get_ticks_per_sec ()); -cuda_send_packet_to_host (s, obuf,3 ); -return ;case CUDA_COMBINED_FORMAT_IIC : obuf[0 ] =ERROR_PACKET ; obuf[1 ] =0x5 ;
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 11/13] cuda: port SET_TIME command to new framework
Quoted 1 line · Hervé Poussineau
Signed-off-by Hervé Poussineau <[email protected]>
Quoted 60 lines
--- hw/misc/macio/cuda.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)hw/misc/macio/cuda.c +18
-6@@ -673,6 +673,23 @@ static bool cuda_cmd_get_time(CUDAState *s,return true; } +static bool cuda_cmd_set_time (CUDAState *s, +const uint8_t *in_data,int in_len, +uint8_t *out_data,int *out_len) +{ +uint32_t ti; + +if (in_len !=4 ) { +return false; + } + + ti = (((uint32_t )in_data[1 ]) <<24 ) + (((uint32_t )in_data[2 ]) <<16 ) + + (((uint32_t )in_data[3 ]) <<8 ) + in_data[4 ]; + s->tick_offset = ti - (qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) + /get_ticks_per_sec ()); +return true; +} +static const CudaCommand handlers[] = { {CUDA_AUTOPOLL ,"AUTOPOLL" , cuda_cmd_autopoll }, {CUDA_SET_AUTO_RATE ,"SET_AUTO_RATE" , cuda_cmd_set_autorate },@@ -684,6 +701,7 @@ static const CudaCommand handlers[] = { {CUDA_SET_POWER_MESSAGES ,"SET_POWER_MESSAGES" , cuda_cmd_set_power_message }, { CUDA_GET_TIME, "GET_TIME", cuda_cmd_get_time }, + { CUDA_SET_TIME, "SET_TIME", cuda_cmd_set_time }, }; static void cuda_receive_packet(CUDAState *s,@@ -691,7 +709,6 @@ static void cuda_receive_packet(CUDAState *s, {uint8_t obuf[16 ] = {CUDA_PACKET ,0 , data[0 ] };int i, out_len =0 ; -uint32_t ti;for (i =0 ; i <ARRAY_SIZE (handlers); i++) {const CudaCommand *desc = &handlers[i];@@ -718,11 +735,6 @@ static void cuda_receive_packet(CUDAState *s,case CUDA_GET_6805_ADDR :cuda_send_packet_to_host (s, obuf,3 );return ; -case CUDA_SET_TIME : - ti = (((uint32_t )data[1 ]) <<24 ) + (((uint32_t )data[2 ]) <<16 ) + (((uint32_t )data[3 ]) <<8 ) + data[4 ]; - s->tick_offset = ti - (qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) /get_ticks_per_sec ()); -cuda_send_packet_to_host (s, obuf,3 ); -return ;case CUDA_COMBINED_FORMAT_IIC : obuf[0 ] =ERROR_PACKET ; obuf[1 ] =0x5 ;
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 12/13 cuda: remove GET_6805_ADDR command
In reply to Hervé PoussineauIt doesn't seem to be used, and operating systems should accept a 'unknown command' answer.
--- hw/misc/macio/cuda.c | 3 --- 1 file changed, 3 deletions(-)
hw/misc/macio/cuda.c +0 -3
@@ -732,9 +732,6 @@ static void cuda_receive_packet(CUDAState *s, }switch (data[0 ]) { -case CUDA_GET_6805_ADDR : -cuda_send_packet_to_host (s, obuf,3 ); -return ;case CUDA_COMBINED_FORMAT_IIC : obuf[0 ] =ERROR_PACKET ; obuf[1 ] =0x5 ;
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 12/13] cuda: remove GET_6805_ADDR command
Quoted 1 line · Hervé Poussineau
It doesn't seem to be used, and operating systems should accept a 'unknown command' answer.
Mac OS 9 does seem to make the call, but it seems happy getting an 'unknown command' response; I can't find the original MOL tree (I guess it used to be in BitKeeper at mol.bkbits.net?) to work out why it's there - I assume that's where it's derived from - but it does seem unnecessary.
- Alyssa
Re: [Qemu-devel] [PATCH 12/13] cuda: remove GET_6805_ADDR command
Quoted 7 lines · Alyssa Milburn
Quoted 1 line · Hervé Poussineau
It doesn't seem to be used, and operating systems should accept a 'unknown command' answer.
Mac OS 9 does seem to make the call, but it seems happy getting an 'unknown command' response; I can't find the original MOL tree (I guess it used to be in BitKeeper at mol.bkbits.net?) to work out why it's there - I assume that's where it's derived from - but it does seem unnecessary.
Yeah, a lot of the CUDA patches were based upon MOL, i.e. some things aren't explicitly documented in the source but as they appear to work it makes sense to copy the same behaviour in QEMU.
The main source tree I used came from the SF project page here:
http://sourceforge.net/projects/mac-on-linux/.
ATB,
Mark.
Re: [Qemu-devel] [PATCH 12/13] cuda: remove GET_6805_ADDR command
Quoted 11 lines · Mark Cave-Ayland
Quoted 4 lines
Mac OS 9 does seem to make the call, but it seems happy getting an 'unknown command' response; I can't find the original MOL tree (I guess it used to be in BitKeeper at mol.bkbits.net?) to work out why it's there - I assume that's where it's derived from - but it does seem unnecessary.
Yeah, a lot of the CUDA patches were based upon MOL, i.e. some things aren't explicitly documented in the source but as they appear to work it makes sense to copy the same behaviour in QEMU.
The main source tree I used came from the SF project page here:
http://sourceforge.net/projects/mac-on-linux/.
Only the "recent" changes are there (it seems the project moved there after a new maintainer took over), unfortunately. It doesn't matter; I was just curious if these changes were justifed somewhere, in case any of the strange "hacks" are actually necessary.
- Alyssa
PATCH 13/13 cuda: remove CUDA_GET_SET_IIC/CUDA_COMBINED_FORMAT_IIC commands
In reply to Hervé PoussineauWe currently don't emulate the I2C bus provided by CUDA.
--- hw/misc/macio/cuda.c | 23 ----------------------- 1 file changed, 23 deletions(-)
hw/misc/macio/cuda.c +0 -23
@@ -731,29 +731,6 @@ static void cuda_receive_packet(CUDAState *s, } } -switch (data[0 ]) { -case CUDA_COMBINED_FORMAT_IIC : - obuf[0 ] =ERROR_PACKET ; - obuf[1 ] =0x5 ; - obuf[2 ] =CUDA_PACKET ; - obuf[3 ] = data[0 ]; -cuda_send_packet_to_host (s, obuf,4 ); -return ; -case CUDA_GET_SET_IIC : -if (len ==4 ) { -cuda_send_packet_to_host (s, obuf,3 ); - }else { - obuf[0 ] =ERROR_PACKET ; - obuf[1 ] =0x2 ; - obuf[2 ] =CUDA_PACKET ; - obuf[3 ] = data[0 ]; -cuda_send_packet_to_host (s, obuf,4 ); - } -return ; -default : -break ; - } -qemu_log_mask (LOG_GUEST_ERROR ,"CUDA: unknown command 0x%02x\n" , data[0 ]); obuf[0 ] =ERROR_PACKET ; obuf[1 ] =0x2 ;/* unknown command */
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 13/13] cuda: remove CUDA_GET_SET_IIC/CUDA_COMBINED_FORMAT_IIC commands
Quoted 1 line · Hervé Poussineau
We currently don't emulate the I2C bus provided by CUDA.
The MOL source has the comment /* this reply is important on B&W G3 */ in the CUDA_COMBINED_FORMAT_IIC case (differentiating it from the general 0x2 error case); any idea if that's relevant? (0x5 is an SRQ error? I guess it would also be nice to add constants for all these magic numbers.)
- Alyssa
Quoted 11 lines · Hervé Poussineau
Hi,
This patchset cleans up a little bit the Apple CUDA emulation:
- correctly reject unknown commands
- correctly reject commands with wrong parameters
- support changing the frequency of auto-polling
- support changing device list probed in auto-poll
- add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
- remove unused commands (GET/SET_6805_ADDR)
- remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC
Quoted 7 lines
GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once we implement the I2C bus provided by CUDA.
This also fixes MacBugs hanging at startup in the absence of ADB mouse input.
Hervé
This series looks sound in concept, but there's a couple of things I need before applying it:
* On inspection I noticed a handful of small problems, noted in comments on the individual patches
* I'm not really set up to test Mac, so if I can get a Tested-by from someone who can, that would be good (Mark?).
Thanks,
David.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 11 lines · Hervé Poussineau
Hi,
This patchset cleans up a little bit the Apple CUDA emulation:
- correctly reject unknown commands
- correctly reject commands with wrong parameters
- support changing the frequency of auto-polling
- support changing device list probed in auto-poll
- add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
- remove unused commands (GET/SET_6805_ADDR)
- remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC
Quoted 2 lines
GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once we implement the I2C bus provided by CUDA.
Neat! (I wish I'd seen this before trying to debug issues with this code!) Do you have any plans to work on this code further? The VIA register code doesn't seem to really match what the hardware does, and I've been wondering if it's responsible for weird input problems under Mac OS, but didn't find time to look into it yet (and don't want to duplicate effort).
- Alyssa
Quoted 12 lines · Alyssa Milburn
Quoted 11 lines · Hervé Poussineau
Hi,
This patchset cleans up a little bit the Apple CUDA emulation:
- correctly reject unknown commands
- correctly reject commands with wrong parameters
- support changing the frequency of auto-polling
- support changing device list probed in auto-poll
- add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
- remove unused commands (GET/SET_6805_ADDR)
- remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC
Quoted 8 lines
Quoted 2 lines
GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once we implement the I2C bus provided by CUDA.
Neat! (I wish I'd seen this before trying to debug issues with this code!) Do you have any plans to work on this code further? The VIA register code doesn't seem to really match what the hardware does, and I've been wondering if it's responsible for weird input problems under Mac OS, but didn't find time to look into it yet (and don't want to duplicate effort).
David had some review comments (and I still need to have a look in detail) so as long as it passes my various OpenBIOS OS tests then there is a good chance it can be applied during this release cycle.
ATB,
Mark.
Hi,
Quoted 12 lines · Alyssa Milburn
Quoted 11 lines · Hervé Poussineau
Hi,
This patchset cleans up a little bit the Apple CUDA emulation:
- correctly reject unknown commands
- correctly reject commands with wrong parameters
- support changing the frequency of auto-polling
- support changing device list probed in auto-poll
- add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
- remove unused commands (GET/SET_6805_ADDR)
- remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC
Quoted 8 lines
Quoted 2 lines
GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once we implement the I2C bus provided by CUDA.
Neat! (I wish I'd seen this before trying to debug issues with this code!) Do you have any plans to work on this code further? The VIA register code doesn't seem to really match what the hardware does, and I've been wondering if it's responsible for weird input problems under Mac OS, but didn't find time to look into it yet (and don't want to duplicate effort).
I already have some code to add the I2C bus, but it's mostly used by MacOS 9 which probably tries to configure some devices.
Do you have a Linux/NetBSD/... image, where I can run some command line tool to probe the I2C bus?
Hervé
Quoted 1 line · Hervé Poussineau
Do you have a Linux/NetBSD/... image, where I can run some command line tool to probe the I2C bus?
Have you tried the iso from www.finnix.org? When booting it you may see a boot prompt on black screen with dark gray text first which is hard to read but pressing enter here should go on to boot.
Regards,
BALATON Zoltan
Quoted 5 lines · BALATON Zoltan
Quoted 1 line · Hervé Poussineau
Do you have a Linux/NetBSD/... image, where I can run some command line tool to probe the I2C bus?
Have you tried the iso from www.finnix.org? When booting it you may see a boot prompt on black screen with dark gray text first which is hard to read but pressing enter here should go on to boot.
Unfortunately, Finnix doesn't try to access I2C bus, not even to initialize it. I suppose it is because OpenBIOS doesn't describe the I2C bus in the device tree...
Hervé
Quoted 1 line · Hervé Poussineau
Unfortunately, Finnix doesn't try to access I2C bus, not even to initialize it. I suppose it is because OpenBIOS doesn't describe the I2C bus in the device tree...
The kernel in Finnix seems to have a driver but unfortunately I2C debugging is not enabled so you probably won't get much useful info. The best idea in this case is probably to compile a kernel with debugging messages for I2C so you get some info on where it fails if it tries to find the bus at all.
It could be that the problem is that the device tree does not correctly describe something. Real hardware seems to have two i2c aliases related to some serial ports that is believed to maybe causing problems with MacOS 9 (see: http://web.archive.org/web/20090107145016/http://penguinppc.org/historical/dev-trees-html/g4_agp_400_1.html#.)
ki2c-serial: /pci@f2000000/@d/mac-io@7/i2c/cereal
and
ui2c-serial: /uni-n/i2c/cereal
but I don't know if any of this is relevant, just mentioning it in the hope that some of this might help. (I've also noticed that real PowerMac3,1 seems to have a modem connected to one of its serial ports so that could also be something MacOS 9 is looking for or tries to use.)
Regards,
BALATON Zoltan
Quoted 6 lines · BALATON Zoltan
Quoted 1 line · Hervé Poussineau
Unfortunately, Finnix doesn't try to access I2C bus, not even to initialize it. I suppose it is because OpenBIOS doesn't describe the I2C bus in the device tree...
The kernel in Finnix seems to have a driver but unfortunately I2C debugging is not enabled so you probably won't get much useful info. The best idea in this case is probably to compile a kernel with debugging messages for I2C so you get some info on where it fails if it tries to find the bus at all.
I just checked Linux source. arch/powerpc/platforms/powermac/low_i2c.c is searching for 3 types of I2C buses
- if some device in DT is compatible with "keywest-i2c"
- if CONFIG_ADB_PMU is set, if some device in DT is named "pmu-i2c" or "via-pmu"
- if CONFIG_PMAC_SMU is set, if some device in DT is named "smu-i2c-control" or "smu"
So, OpenBIOS needs to be changed to declare an I2C bus.
Then, maybe, I'll get some bus probing.
Regards,
Hervé
Quoted 11 lines · Hervé Poussineau
This patchset cleans up a little bit the Apple CUDA emulation:
- correctly reject unknown commands
- correctly reject commands with wrong parameters
- support changing the frequency of auto-polling
- support changing device list probed in auto-poll
- add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
- remove unused commands (GET/SET_6805_ADDR)
- remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IICGET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once we implement the I2C bus provided by CUDA.
Overall, this doesn't seem to make any obvious functional difference in Mac OS 8/9 nor the Linux/BSD images I checked - but it's a clear improvement and it's also a much nicer baseline to build on! I can't think of any comments other than what has already been said.
I wrote some code for the one-timer mode, and also added some more #defines instead of the magical constants. I guess I should refactor that on top of this patchset, though. You're going to look at the I2C code (I see that at least the EDID stuff uses it)?
- Alyssa
Quoted 11 lines · Hervé Poussineau
Hi,
This patchset cleans up a little bit the Apple CUDA emulation:
- correctly reject unknown commands
- correctly reject commands with wrong parameters
- support changing the frequency of auto-polling
- support changing device list probed in auto-poll
- add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
- remove unused commands (GET/SET_6805_ADDR)
- remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC
Quoted 7 lines
GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once we implement the I2C bus provided by CUDA.
This also fixes MacBugs hanging at startup in the absence of ADB mouse input.
Hervé
Hi Hervé,
I've just tried to rebase your git remote onto master to run some tests and it looks like due to recent changes then I get a number of conflicts. Any chance that you could rebase this patchset onto master and update your remote accordingly?
Many thanks,
Mark.
Hi Mark,
Quoted 19 lines · Mark Cave-Ayland
Quoted 17 lines · Hervé Poussineau
Hi,
This patchset cleans up a little bit the Apple CUDA emulation:
- correctly reject unknown commands
- correctly reject commands with wrong parameters
- support changing the frequency of auto-polling
- support changing device list probed in auto-poll
- add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
- remove unused commands (GET/SET_6805_ADDR)
- remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IICGET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once we implement the I2C bus provided by CUDA.
This also fixes MacBugs hanging at startup in the absence of ADB mouse input.
Quoted 8 lines
Quoted 1 line
Hervé
Hi Hervé,
I've just tried to rebase your git remote onto master to run some tests and it looks like due to recent changes then I get a number of conflicts. Any chance that you could rebase this patchset onto master and update your remote accordingly?
I've rebased this patchset. This is available at
http://repo.or.cz/qemu/hpoussin.git branch cuda
As a bonus, you have an implementation of CUDA_GET_SET_IIC command and the I2C bus. Unfortunately, I was unable to test if it really works.
Regards,
Hervé
Quoted 31 lines · Hervé Poussineau
Hi Mark,
Quoted 19 lines · Mark Cave-Ayland
Quoted 17 lines · Hervé Poussineau
Hi,
This patchset cleans up a little bit the Apple CUDA emulation:
- correctly reject unknown commands
- correctly reject commands with wrong parameters
- support changing the frequency of auto-polling
- support changing device list probed in auto-poll
- add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
- remove unused commands (GET/SET_6805_ADDR)
- remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IICGET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once we implement the I2C bus provided by CUDA.
This also fixes MacBugs hanging at startup in the absence of ADB mouse input.
Quoted 8 lines
Quoted 1 line
Hervé
Hi Hervé,
I've just tried to rebase your git remote onto master to run some tests and it looks like due to recent changes then I get a number of conflicts. Any chance that you could rebase this patchset onto master and update your remote accordingly?
Quoted 6 lines
I've rebased this patchset. This is available at
http://repo.or.cz/qemu/hpoussin.git branch cudaAs a bonus, you have an implementation of
CUDA_GET_SET_IICcommand and the I2C bus.
Unfortunately, I was unable to test if it really works.
I've posted a couple of minor comments on a couple of patches, but in general I think this is a good improvement, especially given that there is active work fixing up more CUDA functionality.
Other than the comments mentioned above, there is also the compile fix for patch 4 posted to the list plus I still see some IIC debugging enabled from the git repository which outputs to stdout, e.g.
CUDA: XXX receive data from I2C [addr 48] => ff
CUDA: XXX send data to I2C [addr 40]: 05 c0
Perhaps for the moment it is best to leave out the IIC functionality simply to get the majority of the patchset included in preparation for more detailed work later?
With all these issues addressed in a revised v2 patchset, I'm fairly confident I can give the Tested-by requested by David before inclusion in ppc-next since I didn't observe any regressions on my test images with the patchset in its current form.
ATB,
Mark.
Quoted 48 lines · Mark Cave-Ayland
Quoted 31 lines · Hervé Poussineau
Hi Mark,
Quoted 19 lines · Mark Cave-Ayland
Quoted 17 lines · Hervé Poussineau
Hi,
This patchset cleans up a little bit the Apple CUDA emulation:
- correctly reject unknown commands
- correctly reject commands with wrong parameters
- support changing the frequency of auto-polling
- support changing device list probed in auto-poll
- add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
- remove unused commands (GET/SET_6805_ADDR)
- remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IICGET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once we implement the I2C bus provided by CUDA.
This also fixes MacBugs hanging at startup in the absence of ADB mouse input.
Quoted 8 lines
Quoted 1 line
Hervé
Hi Hervé,
I've just tried to rebase your git remote onto master to run some tests and it looks like due to recent changes then I get a number of conflicts. Any chance that you could rebase this patchset onto master and update your remote accordingly?
Quoted 6 lines
I've rebased this patchset. This is available at
http://repo.or.cz/qemu/hpoussin.git branch cudaAs a bonus, you have an implementation of
CUDA_GET_SET_IICcommand and the I2C bus.
Unfortunately, I was unable to test if it really works.I've posted a couple of minor comments on a couple of patches, but in general I think this is a good improvement, especially given that there is active work fixing up more CUDA functionality.
Other than the comments mentioned above, there is also the compile fix for patch 4 posted to the list plus I still see some IIC debugging enabled from the git repository which outputs to stdout, e.g.
Quoted 6 lines
CUDA: XXX receive data from I2C [addr 48] => ff
CUDA: XXX send data to I2C [addr 40]: 05 c0Perhaps for the moment it is best to leave out the IIC functionality simply to get the majority of the patchset included in preparation for more detailed work later?
I2C bus is not meant to be committed right now. That's only a proof a concept of how things can work. You can note that commit message was starting with "[RFC]".
Quoted 5 lines
With all these issues addressed in a revised v2 patchset, I'm fairly confident I can give the Tested-by requested by David before inclusion in ppc-next since I didn't observe any regressions on my test images with the patchset in its current form.
Patchset v2 has just been sent a few minutes ago. Thanks for you review!
Hervé