Missing Diag/Debug Registers in lsi53c895a emulation
Hi,
while trying to run an ASA1000V appliance I found that registers 0x09 and 0x3c-3f are read during boot up. Which currently results in an exit(1). The appliance uses an quite ancient 2.6.29.6 Linux kernel. These registers are mainly for diag and debug purposes so I came up with the following patch. The system works with the following patch, but I wonder if this is a correct workaround:
hw/scsi/lsi53c895a.c +7 -0
@@ -1513,6 +1513,8 @@ static uint8_t lsi_reg_readb(LSIState *s, int offset)return 0x7f ;case 0x08 :/* Revision ID */ return 0x00 ; +case 0x09 :/* SOCL */ +return 0x00 ;case 0xa :/* SSID */ return s->ssid;case 0xb :/* SBCL */
@@ -1577,6 +1579,11 @@ static uint8_t lsi_reg_readb(LSIState *s, int offset)return s->sbr;case 0x3b :/* DCNTL */ return s->dcntl; +case 0x3c :/* ADDER Output (Debug purpose only) */ +case 0x3d : +case 0x3e : +case 0x3f : +return 0x00 ;case 0x40 :/* SIEN0 */ return s->sien0;case 0x41 :/* SIEN1 */
Peter
Quoted 6 lines · Peter Lieven
Hi,
while trying to run an ASA1000V appliance I found that registers
0x09and 0x3c-3f are read during boot up. Which currently results in an exit(1). The appliance uses an quite ancient 2.6.29.6 Linux kernel. These registers are mainly for diag and debug purposes so I came up with the following patch. The system works with the following patch, but I wonder if this is a correct workaround:
Maybe this is better:
hw/scsi/lsi53c895a.c +6 -0
@@ -277,6 +277,7 @@ typedef struct {uint32_t csbc;uint32_t scratch[18 ];/* SCRATCHA-SCRATCHR */ uint8_t sbr; +uint32_t adder;/* Script ram is stored as 32-bit words in host byteorder. */ uint32_t script_ram[2048 ];
@@ -1389,6 +1390,7 @@ again:switch ((insn >>27 ) &7 ) {case 0 :/* Jump */ DPRINTF ("Jump to 0x%08x\n" , addr); + s->adder = addr; s->dsp = addr;break ;case 1 :/* Call */
@@ -1513,6 +1515,8 @@ static uint8_t lsi_reg_readb(LSIState *s, int offset)return 0x7f ;case 0x08 :/* Revision ID */ return 0x00 ; +case 0x09 :/* SOCL */ +return s->socl;case 0xa :/* SSID */ return s->ssid;case 0xb :/* SBCL */
@@ -1577,6 +1581,8 @@ static uint8_t lsi_reg_readb(LSIState *s, int offset)return s->sbr;case 0x3b :/* DCNTL */ return s->dcntl; +/* ADDER Output (Debug of relative jump address) */ + CASE_GET_REG32(adder, 0x3c)case 0x40 :/* SIEN0 */ return s->sien0;case 0x41 :/* SIEN1 */
Quoted 44 lines · Peter Lieven
Quoted 9 lines · Peter Lieven
Hi,
while trying to run an ASA1000V appliance I found that registers
0x09and 0x3c-3f are read during boot up. Which
currently results in an exit(1). The appliance uses an quite ancient 2.6.29.6 Linux kernel.
These registers are mainly for diag and debug purposes so I came up with the following patch. The system works
with the following patch, but I wonder if this is a correct workaround:Maybe this is better:
hw/scsi/lsi53c895a.c +4
-0@@ -277,6 +277,7 @@ typedef struct {uint32_t csbc;uint32_t scratch[18 ];/* SCRATCHA-SCRATCHR */ uint8_t sbr; +uint32_t adder;/* Script ram is stored as 32-bit words in host byteorder. */ uint32_t script_ram[2048 ];@@ -1389,6 +1390,7 @@ again:switch ((insn >>27 ) &7 ) {case 0 :/* Jump */ DPRINTF ("Jump to 0x%08x\n" , addr); + s->adder = addr; s->dsp = addr;break ;case 1 :/* Call */ @@ -1513,6 +1515,8 @@ static uint8_t lsi_reg_readb(LSIState *s, int offset)return 0x7f ;case 0x08 :/* Revision ID */ return 0x00 ; +case 0x09 :/* SOCL */ +return s->socl;case 0xa :/* SSID */ return s->ssid;case 0xb :/* SBCL */
hw/scsi/lsi53c895a.c static uint8_t lsi_reg_readb(LSIState *s, int offset) · line 1588
Quoted 8 lines
hw/scsi/lsi53c895a.c +2
-0@@ -1577,6 +1581,8 @@ static uint8_t lsi_reg_readb(LSIState *s, int offset)return s->sbr;case 0x3b :/* DCNTL */ return s->dcntl; +/* ADDER Output (Debug of relative jump address) */ + CASE_GET_REG32(adder, 0x3c)case 0x40 :/* SIEN0 */ return s->sien0;case 0x41 :/* SIEN1 */
This looks good. Can you send it with SoB and git-format-patch?
Paolo
Quoted 46 lines · Paolo Bonzini
Quoted 44 lines · Peter Lieven
Quoted 9 lines · Peter Lieven
Hi,
while trying to run an ASA1000V appliance I found that registers
0x09and 0x3c-3f are read during boot up. Which
currently results in an exit(1). The appliance uses an quite ancient 2.6.29.6 Linux kernel.
These registers are mainly for diag and debug purposes so I came up with the following patch. The system works
with the following patch, but I wonder if this is a correct workaround:Maybe this is better:
hw/scsi/lsi53c895a.c +4
-0@@ -277,6 +277,7 @@ typedef struct {uint32_t csbc;uint32_t scratch[18 ];/* SCRATCHA-SCRATCHR */ uint8_t sbr; +uint32_t adder;/* Script ram is stored as 32-bit words in host byteorder. */ uint32_t script_ram[2048 ];@@ -1389,6 +1390,7 @@ again:switch ((insn >>27 ) &7 ) {case 0 :/* Jump */ DPRINTF ("Jump to 0x%08x\n" , addr); + s->adder = addr; s->dsp = addr;break ;case 1 :/* Call */ @@ -1513,6 +1515,8 @@ static uint8_t lsi_reg_readb(LSIState *s, int offset)return 0x7f ;case 0x08 :/* Revision ID */ return 0x00 ; +case 0x09 :/* SOCL */ +return s->socl;case 0xa :/* SSID */ return s->ssid;case 0xb :/* SBCL */ @@ -1577,6 +1581,8 @@ static uint8_t lsi_reg_readb(LSIState *s, int offset)return s->sbr;case 0x3b :/* DCNTL */
Quoted 8 lines
hw/scsi/lsi53c895a.c static uint8_t lsi_reg_readb(LSIState *s, int offset) · line 1588
Quoted 7 lines
hw/scsi/lsi53c895a.c +2
-0return s->dcntl; +/* ADDER Output (Debug of relative jump address) */ + CASE_GET_REG32(adder, 0x3c)case 0x40 :/* SIEN0 */ return s->sien0;case 0x41 :/* SIEN1 */ This looks good. Can you send it with SoB and git-format-patch?
Sure. I think full support of the adder debug register would be more complicated, but as the spec says its main purpose is debugging of relative jump address calculation it should be fine. In fact if anything had read from this register before qemu would have aborted ;-)
Peter
Quoted 2 lines
Paolo
Signature · 16 lines
Mit freundlichen Grüßen Peter Lieven ........................................................... KAMP Netzwerkdienste GmbH Vestische Str. 89-91 | 46117 Oberhausen Tel: +49 (0) 208.89 402-50 | Fax: +49 (0) 208.89 402-40 [email protected] | http://www.kamp.de Geschäftsführer: Heiner Lante | Michael Lante Amtsgericht Duisburg | HRB Nr. 12154 USt-Id-Nr.: DE 120607556 ...........................................................