Skip to contentSkip to conversation

g_NCR5380: fix broken MMIO compilation

PATCH In review [email protected] 3 participants 4 messages May 24, 2010 – May 29, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 12/26 g_NCR5380: fix broken MMIO compilation

From: Ondrej Zary <[email protected]>

The ifdefs are broken so the MMIO code is never compiled and so it's broken too. Fix them all. Untested as I don't have the hardware.

---

 drivers/scsi/g_NCR5380.c |   43 +++++++++++++++++++------------------
 drivers/scsi/g_NCR5380.h |    6 ++---
 2 files changed, 26 insertions(+), 23 deletions(-)
drivers/scsi/g_NCR5380.c renamed from drivers/scsi/g_NCR5380.c~g_ncr5380-fix-broken-mmio-compilation +23 -20
diff -puN drivers/scsi/g_NCR5380.c~g_ncr5380-fix-broken-mmio-compilation drivers/scsi/g_NCR5380.c
@@ -285,9 +285,12 @@ static int __init do_DTC3181E_setup(char
 int __init generic_NCR5380_detect(struct scsi_host_template * tpnt)
 {
 	static int current_override = 0;
-	int count, i;
+	int count;
 	unsigned int *ports;
+#ifndef SCSI_G_NCR5380_MEM
+	int i;
 	unsigned long region_size = 16;
+#endif
 	static unsigned int __initdata ncr_53c400a_ports[] = {
 		0x280, 0x290, 0x300, 0x310, 0x330, 0x340, 0x348, 0x350, 0
 	};
@@ -296,7 +299,7 @@ int __init generic_NCR5380_detect(struct
 	};
 	int flags = 0;
 	struct Scsi_Host *instance;
-#ifdef CONFIG_SCSI_G_NCR5380_MEM
+#ifdef SCSI_G_NCR5380_MEM
 	unsigned long base;
 	void __iomem *iomem;
 #endif
@@ -315,7 +318,7 @@ int __init generic_NCR5380_detect(struct
 		overrides[0].board = BOARD_NCR53C400A;
 	else if (dtc_3181e != NCR_NOT_SET)
 		overrides[0].board = BOARD_DTC3181E;
-
+#ifndef SCSI_G_NCR5380_MEM
 	if (!current_override && isapnp_present()) {
 		struct pnp_dev *dev = NULL;
 		count = 0;
@@ -347,7 +350,7 @@ int __init generic_NCR5380_detect(struct
 			count++;
 		}
 	}
-
+#endif
 	tpnt->proc_name = "g_NCR5380";
 
 	for (count = 0; current_override < NO_OVERRIDES; ++current_override) {
@@ -372,7 +375,7 @@ int __init generic_NCR5380_detect(struct
 			break;
 		}
 
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 		if (ports) {
 			/* wakeup sequence for the NCR53C400A and DTC3181E */
 
@@ -434,7 +437,7 @@ int __init generic_NCR5380_detect(struct
 #endif
 		instance = scsi_register(tpnt, sizeof(struct NCR5380_hostdata));
 		if (instance == NULL) {
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 			release_region(overrides[current_override].NCR5380_map_name, region_size);
 #else
 			iounmap(iomem);
@@ -444,10 +447,10 @@ int __init generic_NCR5380_detect(struct
 		}
 
 		instance->NCR5380_instance_name = overrides[current_override].NCR5380_map_name;
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 		instance->n_io_port = region_size;
 #else
-		((struct NCR5380_hostdata *)instance->hostdata).iomem = iomem;
+		((struct NCR5380_hostdata *)instance->hostdata)->iomem = iomem;
 #endif
 
 		NCR5380_init(instance, flags);
@@ -515,10 +518,10 @@ int generic_NCR5380_release_resources(st
 		free_irq(instance->irq, instance);
 	NCR5380_exit(instance);
 
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 	release_region(instance->NCR5380_instance_name, instance->n_io_port);
 #else
-	iounmap(((struct NCR5380_hostdata *)instance->hostdata).iomem);
+	iounmap(((struct NCR5380_hostdata *)instance->hostdata)->iomem);
 	release_mem_region(instance->NCR5380_instance_name, NCR5380_region_size);
 #endif
 
@@ -588,14 +591,14 @@ static inline int NCR5380_pread(struct S
 		}
 		while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY);
 
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 		{
 			int i;
 			for (i = 0; i < 128; i++)
 				dst[start + i] = NCR5380_read(C400_HOST_BUFFER);
 		}
 #else
-		/* implies CONFIG_SCSI_G_NCR5380_MEM */
+		/* implies SCSI_G_NCR5380_MEM */
 		memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128);
 #endif
 		start += 128;
@@ -608,14 +611,14 @@ static inline int NCR5380_pread(struct S
 			// FIXME - no timeout
 		}
 
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 		{
 			int i;	
 			for (i = 0; i < 128; i++)
 				dst[start + i] = NCR5380_read(C400_HOST_BUFFER);
 		}
 #else
-		/* implies CONFIG_SCSI_G_NCR5380_MEM */
+		/* implies SCSI_G_NCR5380_MEM */
 		memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128);
 #endif
 		start += 128;
@@ -674,13 +677,13 @@ static inline int NCR5380_pwrite(struct 
 		}
 		while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY)
 			; // FIXME - timeout
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 		{
 			for (i = 0; i < 128; i++)
 				NCR5380_write(C400_HOST_BUFFER, src[start + i]);
 		}
 #else
-		/* implies CONFIG_SCSI_G_NCR5380_MEM */
+		/* implies SCSI_G_NCR5380_MEM */
 		memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128);
 #endif
 		start += 128;
@@ -690,13 +693,13 @@ static inline int NCR5380_pwrite(struct 
 		while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY)
 			; // FIXME - no timeout
 
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 		{
 			for (i = 0; i < 128; i++)
 				NCR5380_write(C400_HOST_BUFFER, src[start + i]);
 		}
 #else
-		/* implies CONFIG_SCSI_G_NCR5380_MEM */
+		/* implies SCSI_G_NCR5380_MEM */
 		memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128);
 #endif
 		start += 128;
@@ -936,7 +939,7 @@ module_param(ncr_53c400a, int, 0);
 module_param(dtc_3181e, int, 0);
 MODULE_LICENSE("GPL");
 
-
+#ifndef SCSI_G_NCR5380_MEM
 static struct isapnp_device_id id_table[] __devinitdata = {
 	{
 	 ISAPNP_ANY_ID, ISAPNP_ANY_ID,
@@ -946,7 +949,7 @@ static struct isapnp_device_id id_table[
 };
 
 MODULE_DEVICE_TABLE(isapnp, id_table);
-
+#endif
 
 __setup("ncr5380=", do_NCR5380_setup);
 __setup("ncr53c400=", do_NCR53C400_setup);
drivers/scsi/g_NCR5380.h renamed from drivers/scsi/g_NCR5380.h~g_ncr5380-fix-broken-mmio-compilation +3 -3
diff -puN drivers/scsi/g_NCR5380.h~g_ncr5380-fix-broken-mmio-compilation drivers/scsi/g_NCR5380.h
@@ -63,7 +63,7 @@ static const char* generic_NCR5380_info(
 #define __STRVAL(x) #x
 #define STRVAL(x) __STRVAL(x)
 
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 
 #define NCR5380_map_config port
 #define NCR5380_map_type int
@@ -91,7 +91,7 @@ static const char* generic_NCR5380_info(
     NCR5380_map_name = (NCR5380_map_type)((instance)->NCR5380_instance_name)
 
 #else 
-/* therefore CONFIG_SCSI_G_NCR5380_MEM */
+/* therefore SCSI_G_NCR5380_MEM */
 
 #define NCR5380_map_config memory
 #define NCR5380_map_type unsigned long
@@ -114,7 +114,7 @@ static const char* generic_NCR5380_info(
     register void __iomem *iomem
 
 #define NCR5380_setup(instance) \
-    iomem = (((struct NCR5380_hostdata *)(instance)->hostdata).iomem)
+    iomem = (((struct NCR5380_hostdata *)(instance)->hostdata)->iomem)
 
 #endif
 

_

Reviewed-by on v1 12/26
#1 lore raw
Quoted 9 lines · On Mon, 2010-05-24 at 12:22 -0700, [email protected] wrote:

From: Ondrej Zary <[email protected]>

The ifdefs are broken so the MMIO code is never compiled and so it's broken too. Fix them all. Untested as I don't have the hardware.

I remeber inspecting this before and thinking they were fine.

(my [email protected] account is obsolete)

If anyone in the US is interested in ancient ISA bus SCSI hardware for NCR5380 driver development, I can send them:

1. a DTC3181E
NCR5380
ISA I/O ports
no IRQ
no Pseudo-DMA
DB-25 external connector
...definitely a piece of junk.

2. a SUMO SCSI AT
NCR5380
ISA I/O ports
IRQ is is enabled by a bit in a board specific reg at reg_base+8 Pseudo DMA is enabled by a a board specific reg at reg_base+8 No watchdog timer on the pseudo DMA, so a failed pseudo-DMA
can hang your whole machine :D
SCSI-1 external connector (Centronics-type with bail locks) Internal SCSI connector
Removeable terminating resistors for the card.
Two BIOS firmware images on board, each having a divide by
0 bug in their fake C/H/S drive geometry computations :D
...in general, also a piece of junk.

Neither of them will help with testing the MMIO mode of the driver.

Regards,
Andy

Quoted 209 lines

---

 drivers/scsi/g_NCR5380.c |   43 +++++++++++++++++++------------------
 drivers/scsi/g_NCR5380.h |    6 ++---
 2 files changed, 26 insertions(+), 23 deletions(-)

diff -puN drivers/scsi/g_NCR5380.c~g_ncr5380-fix-broken-mmio-compilation drivers/scsi/g_NCR5380.c

drivers/scsi/g_NCR5380.c renamed from drivers/scsi/g_NCR5380.c~g_ncr5380-fix-broken-mmio-compilation +23 -20
@@ -285,9 +285,12 @@ static int __init do_DTC3181E_setup(char
 int __init generic_NCR5380_detect(struct scsi_host_template * tpnt)
 {
 	static int current_override = 0;
-	int count, i;
+	int count;
 	unsigned int *ports;
+#ifndef SCSI_G_NCR5380_MEM
+	int i;
 	unsigned long region_size = 16;
+#endif
 	static unsigned int __initdata ncr_53c400a_ports[] = {
 		0x280, 0x290, 0x300, 0x310, 0x330, 0x340, 0x348, 0x350, 0
 	};
@@ -296,7 +299,7 @@ int __init generic_NCR5380_detect(struct
 	};
 	int flags = 0;
 	struct Scsi_Host *instance;
-#ifdef CONFIG_SCSI_G_NCR5380_MEM
+#ifdef SCSI_G_NCR5380_MEM
 	unsigned long base;
 	void __iomem *iomem;
 #endif
@@ -315,7 +318,7 @@ int __init generic_NCR5380_detect(struct
 		overrides[0].board = BOARD_NCR53C400A;
 	else if (dtc_3181e != NCR_NOT_SET)
 		overrides[0].board = BOARD_DTC3181E;
-
+#ifndef SCSI_G_NCR5380_MEM
 	if (!current_override && isapnp_present()) {
 		struct pnp_dev *dev = NULL;
 		count = 0;
@@ -347,7 +350,7 @@ int __init generic_NCR5380_detect(struct
 			count++;
 		}
 	}
-
+#endif
 	tpnt->proc_name = "g_NCR5380";
 
 	for (count = 0; current_override < NO_OVERRIDES; ++current_override) {
@@ -372,7 +375,7 @@ int __init generic_NCR5380_detect(struct
 			break;
 		}
 
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 		if (ports) {
 			/* wakeup sequence for the NCR53C400A and DTC3181E */
 
@@ -434,7 +437,7 @@ int __init generic_NCR5380_detect(struct
 #endif
 		instance = scsi_register(tpnt, sizeof(struct NCR5380_hostdata));
 		if (instance == NULL) {
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 			release_region(overrides[current_override].NCR5380_map_name, region_size);
 #else
 			iounmap(iomem);
@@ -444,10 +447,10 @@ int __init generic_NCR5380_detect(struct
 		}
 
 		instance->NCR5380_instance_name = overrides[current_override].NCR5380_map_name;
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 		instance->n_io_port = region_size;
 #else
-		((struct NCR5380_hostdata *)instance->hostdata).iomem = iomem;
+		((struct NCR5380_hostdata *)instance->hostdata)->iomem = iomem;
 #endif
 
 		NCR5380_init(instance, flags);
@@ -515,10 +518,10 @@ int generic_NCR5380_release_resources(st
 		free_irq(instance->irq, instance);
 	NCR5380_exit(instance);
 
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 	release_region(instance->NCR5380_instance_name, instance->n_io_port);
 #else
-	iounmap(((struct NCR5380_hostdata *)instance->hostdata).iomem);
+	iounmap(((struct NCR5380_hostdata *)instance->hostdata)->iomem);
 	release_mem_region(instance->NCR5380_instance_name, NCR5380_region_size);
 #endif
 
@@ -588,14 +591,14 @@ static inline int NCR5380_pread(struct S
 		}
 		while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY);
 
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 		{
 			int i;
 			for (i = 0; i < 128; i++)
 				dst[start + i] = NCR5380_read(C400_HOST_BUFFER);
 		}
 #else
-		/* implies CONFIG_SCSI_G_NCR5380_MEM */
+		/* implies SCSI_G_NCR5380_MEM */
 		memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128);
 #endif
 		start += 128;
@@ -608,14 +611,14 @@ static inline int NCR5380_pread(struct S
 			// FIXME - no timeout
 		}
 
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 		{
 			int i;	
 			for (i = 0; i < 128; i++)
 				dst[start + i] = NCR5380_read(C400_HOST_BUFFER);
 		}
 #else
-		/* implies CONFIG_SCSI_G_NCR5380_MEM */
+		/* implies SCSI_G_NCR5380_MEM */
 		memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128);
 #endif
 		start += 128;
@@ -674,13 +677,13 @@ static inline int NCR5380_pwrite(struct 
 		}
 		while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY)
 			; // FIXME - timeout
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 		{
 			for (i = 0; i < 128; i++)
 				NCR5380_write(C400_HOST_BUFFER, src[start + i]);
 		}
 #else
-		/* implies CONFIG_SCSI_G_NCR5380_MEM */
+		/* implies SCSI_G_NCR5380_MEM */
 		memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128);
 #endif
 		start += 128;
@@ -690,13 +693,13 @@ static inline int NCR5380_pwrite(struct 
 		while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY)
 			; // FIXME - no timeout
 
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 		{
 			for (i = 0; i < 128; i++)
 				NCR5380_write(C400_HOST_BUFFER, src[start + i]);
 		}
 #else
-		/* implies CONFIG_SCSI_G_NCR5380_MEM */
+		/* implies SCSI_G_NCR5380_MEM */
 		memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128);
 #endif
 		start += 128;
@@ -936,7 +939,7 @@ module_param(ncr_53c400a, int, 0);
 module_param(dtc_3181e, int, 0);
 MODULE_LICENSE("GPL");
 
-
+#ifndef SCSI_G_NCR5380_MEM
 static struct isapnp_device_id id_table[] __devinitdata = {
 	{
 	 ISAPNP_ANY_ID, ISAPNP_ANY_ID,
@@ -946,7 +949,7 @@ static struct isapnp_device_id id_table[
 };
 
 MODULE_DEVICE_TABLE(isapnp, id_table);
-
+#endif
 
 __setup("ncr5380=", do_NCR5380_setup);
 __setup("ncr53c400=", do_NCR53C400_setup);

diff -puN drivers/scsi/g_NCR5380.h~g_ncr5380-fix-broken-mmio-compilation drivers/scsi/g_NCR5380.h

drivers/scsi/g_NCR5380.h renamed from drivers/scsi/g_NCR5380.h~g_ncr5380-fix-broken-mmio-compilation +3 -3
@@ -63,7 +63,7 @@ static const char* generic_NCR5380_info(
 #define __STRVAL(x) #x
 #define STRVAL(x) __STRVAL(x)
 
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 
 #define NCR5380_map_config port
 #define NCR5380_map_type int
@@ -91,7 +91,7 @@ static const char* generic_NCR5380_info(
     NCR5380_map_name = (NCR5380_map_type)((instance)->NCR5380_instance_name)
 
 #else 
-/* therefore CONFIG_SCSI_G_NCR5380_MEM */
+/* therefore SCSI_G_NCR5380_MEM */
 
 #define NCR5380_map_config memory
 #define NCR5380_map_type unsigned long
@@ -114,7 +114,7 @@ static const char* generic_NCR5380_info(
     register void __iomem *iomem
 
 #define NCR5380_setup(instance) \
-    iomem = (((struct NCR5380_hostdata *)(instance)->hostdata).iomem)
+    iomem = (((struct NCR5380_hostdata *)(instance)->hostdata)->iomem)
 
 #endif
 

_

#2 lore raw
Quoted 41 lines · On Tuesday 25 May 2010 02:16:55 Andy Walls wrote:
Quoted 9 lines · On Mon, 2010-05-24 at 12:22 -0700, [email protected] wrote:

From: Ondrej Zary <[email protected]>

The ifdefs are broken so the MMIO code is never compiled and so it's broken too. Fix them all. Untested as I don't have the hardware.

I remeber inspecting this before and thinking they were fine.

(my [email protected] account is obsolete)

If anyone in the US is interested in ancient ISA bus SCSI hardware for NCR5380 driver development, I can send them:

1. a DTC3181E
NCR5380
ISA I/O ports
no IRQ
no Pseudo-DMA
DB-25 external connector
...definitely a piece of junk.

2. a SUMO SCSI AT
NCR5380
ISA I/O ports
IRQ is is enabled by a bit in a board specific reg at reg_base+8 Pseudo DMA is enabled by a a board specific reg at reg_base+8 No watchdog timer on the pseudo DMA, so a failed pseudo-DMA
can hang your whole machine :D
SCSI-1 external connector (Centronics-type with bail locks) Internal SCSI connector
Removeable terminating resistors for the card.
Two BIOS firmware images on board, each having a divide by
0 bug in their fake C/H/S drive geometry computations :D
...in general, also a piece of junk.

Quoted 1 line

Neither of them will help with testing the MMIO mode of the driver.

I actually have a memory-mapped card - Canon FG2-5202 (hardwired to IRQ7). It did not work for me. But the other (I/O) mapped cards do neither. They seem to work if there's no SCSI device connected but I was not able to get neither IBM DORS-32160 hard disk nor SONY CDU415 CD-ROM working.

The driver hangs the machine completely because it waits for timeout using time_before with interrupts disabled - e.g. in NCR5380_poll_politely() in drivers/scsi/NCR5380.c.

Tried older kernels to find when did it work last time - and found none! 2.4 kernels were able to at least display device name and firmware version. Maybe I should try some older CPU & motherboard (this was on a P3, IIRC).

Quoted 216 lines

Regards,
Andy

Quoted 213 lines

---

 drivers/scsi/g_NCR5380.c |   43 +++++++++++++++++++------------------
 drivers/scsi/g_NCR5380.h |    6 ++---
 2 files changed, 26 insertions(+), 23 deletions(-)

diff -puN drivers/scsi/g_NCR5380.c~g_ncr5380-fix-broken-mmio-compilation drivers/scsi/g_NCR5380.c --- a/drivers/scsi/g_NCR5380.c~g_ncr5380-fix-broken-mmio-compilation +++ a/drivers/scsi/g_NCR5380.c

drivers/scsi/g_NCR5380.c renamed from drivers/scsi/g_NCR5380.c~g_ncr5380-fix-broken-mmio-compilation +9 -6
@@ -285,9 +285,12 @@ static int __init do_DTC3181E_setup(char
 int __init generic_NCR5380_detect(struct scsi_host_template * tpnt)
 {
 	static int current_override = 0;
-	int count, i;
+	int count;
 	unsigned int *ports;
+#ifndef SCSI_G_NCR5380_MEM
+	int i;
 	unsigned long region_size = 16;
+#endif
 	static unsigned int __initdata ncr_53c400a_ports[] = {
 		0x280, 0x290, 0x300, 0x310, 0x330, 0x340, 0x348, 0x350, 0
 	};
@@ -296,7 +299,7 @@ int __init generic_NCR5380_detect(struct
 	};
 	int flags = 0;
 	struct Scsi_Host *instance;
-#ifdef CONFIG_SCSI_G_NCR5380_MEM
+#ifdef SCSI_G_NCR5380_MEM
 	unsigned long base;
 	void __iomem *iomem;
 #endif
@@ -315,7 +318,7 @@ int __init generic_NCR5380_detect(struct
 		overrides[0].board = BOARD_NCR53C400A;
 	else if (dtc_3181e != NCR_NOT_SET)
 		overrides[0].board = BOARD_DTC3181E;
-
+#ifndef SCSI_G_NCR5380_MEM
 	if (!current_override && isapnp_present()) {
 		struct pnp_dev *dev = NULL;
 		count = 0;
@@ -347,7 +350,7 @@ int __init generic_NCR5380_detect(struct
 			count++;
 		}
 	}
-
+#endif
 	tpnt->proc_name = "g_NCR5380";
 
 	for (count = 0; current_override < NO_OVERRIDES; ++current_override) {
@@ -372,7 +375,7 @@ int __init generic_NCR5380_detect(struct
 			break;
 		}
 
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 		if (ports) {
 			/* wakeup sequence for the NCR53C400A and DTC3181E */
 
@@ -434,7 +437,7 @@ int __init generic_NCR5380_detect(struct
 #endif
 		instance = scsi_register(tpnt, sizeof(struct NCR5380_hostdata));
 		if (instance == NULL) {
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 			release_region(overrides[current_override].NCR5380_map_name,

region_size); #else

drivers/scsi/g_NCR5380.c renamed from drivers/scsi/g_NCR5380.c~g_ncr5380-fix-broken-mmio-compilation +0 -0
 			iounmap(iomem);
@@ -444,10 +447,10 @@ int __init generic_NCR5380_detect(struct
 		}
 
 		instance->NCR5380_instance_name =

overrides[current_override].NCR5380_map_name; -#ifndef CONFIG_SCSI_G_NCR5380_MEM

drivers/scsi/g_NCR5380.c renamed from drivers/scsi/g_NCR5380.c~g_ncr5380-fix-broken-mmio-compilation +4 -3
+#ifndef SCSI_G_NCR5380_MEM
 		instance->n_io_port = region_size;
 #else
-		((struct NCR5380_hostdata *)instance->hostdata).iomem = iomem;
+		((struct NCR5380_hostdata *)instance->hostdata)->iomem = iomem;
 #endif
 
 		NCR5380_init(instance, flags);
@@ -515,10 +518,10 @@ int generic_NCR5380_release_resources(st
 		free_irq(instance->irq, instance);
 	NCR5380_exit(instance);
 
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 	release_region(instance->NCR5380_instance_name, instance->n_io_port);
 #else
-	iounmap(((struct NCR5380_hostdata *)instance->hostdata).iomem);
+	iounmap(((struct NCR5380_hostdata *)instance->hostdata)->iomem);
 	release_mem_region(instance->NCR5380_instance_name,

NCR5380_region_size); #endif

drivers/scsi/g_NCR5380.c renamed from drivers/scsi/g_NCR5380.c~g_ncr5380-fix-broken-mmio-compilation +10 -10
@@ -588,14 +591,14 @@ static inline int NCR5380_pread(struct S
 		}
 		while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY);
 
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 		{
 			int i;
 			for (i = 0; i < 128; i++)
 				dst[start + i] = NCR5380_read(C400_HOST_BUFFER);
 		}
 #else
-		/* implies CONFIG_SCSI_G_NCR5380_MEM */
+		/* implies SCSI_G_NCR5380_MEM */
 		memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128);
 #endif
 		start += 128;
@@ -608,14 +611,14 @@ static inline int NCR5380_pread(struct S
 			// FIXME - no timeout
 		}
 
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 		{
 			int i;
 			for (i = 0; i < 128; i++)
 				dst[start + i] = NCR5380_read(C400_HOST_BUFFER);
 		}
 #else
-		/* implies CONFIG_SCSI_G_NCR5380_MEM */
+		/* implies SCSI_G_NCR5380_MEM */
 		memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128);
 #endif
 		start += 128;
@@ -674,13 +677,13 @@ static inline int NCR5380_pwrite(struct
 		}
 		while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY)
 			; // FIXME - timeout
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 		{
 			for (i = 0; i < 128; i++)
 				NCR5380_write(C400_HOST_BUFFER, src[start + i]);
 		}
 #else
-		/* implies CONFIG_SCSI_G_NCR5380_MEM */
+		/* implies SCSI_G_NCR5380_MEM */
 		memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128);
 #endif
 		start += 128;
@@ -690,13 +693,13 @@ static inline int NCR5380_pwrite(struct
 		while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY)
 			; // FIXME - no timeout
 
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 		{
 			for (i = 0; i < 128; i++)
 				NCR5380_write(C400_HOST_BUFFER, src[start + i]);
 		}
 #else
-		/* implies CONFIG_SCSI_G_NCR5380_MEM */
+		/* implies SCSI_G_NCR5380_MEM */
 		memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128);
 #endif
 		start += 128;
@@ -936,7 +939,7 @@ module_param(ncr_53c400a, int, 0);
 module_param(dtc_3181e, int, 0);
 MODULE_LICENSE("GPL");
 
-
+#ifndef SCSI_G_NCR5380_MEM
 static struct isapnp_device_id id_table[] __devinitdata = {
 	{
 	 ISAPNP_ANY_ID, ISAPNP_ANY_ID,
@@ -946,7 +949,7 @@ static struct isapnp_device_id id_table[
 };
 
 MODULE_DEVICE_TABLE(isapnp, id_table);
-
+#endif
 
 __setup("ncr5380=", do_NCR5380_setup);
 __setup("ncr53c400=", do_NCR53C400_setup);

diff -puN drivers/scsi/g_NCR5380.h~g_ncr5380-fix-broken-mmio-compilation drivers/scsi/g_NCR5380.h --- a/drivers/scsi/g_NCR5380.h~g_ncr5380-fix-broken-mmio-compilation +++ a/drivers/scsi/g_NCR5380.h

drivers/scsi/g_NCR5380.h renamed from drivers/scsi/g_NCR5380.h~g_ncr5380-fix-broken-mmio-compilation +2 -2
@@ -63,7 +63,7 @@ static const char* generic_NCR5380_info(
 #define __STRVAL(x) #x
 #define STRVAL(x) __STRVAL(x)
 
-#ifndef CONFIG_SCSI_G_NCR5380_MEM
+#ifndef SCSI_G_NCR5380_MEM
 
 #define NCR5380_map_config port
 #define NCR5380_map_type int
@@ -91,7 +91,7 @@ static const char* generic_NCR5380_info(
     NCR5380_map_name =
 (NCR5380_map_type)((instance)->NCR5380_instance_name)
 
 #else
-/* therefore CONFIG_SCSI_G_NCR5380_MEM */
+/* therefore SCSI_G_NCR5380_MEM */
 
 #define NCR5380_map_config memory

#define NCR5380_map_type unsigned long

drivers/scsi/g_NCR5380.h renamed from drivers/scsi/g_NCR5380.h~g_ncr5380-fix-broken-mmio-compilation +1 -1
@@ -114,7 +114,7 @@ static const char* generic_NCR5380_info(
     register void __iomem *iomem
 
 #define NCR5380_setup(instance) \
-    iomem = (((struct NCR5380_hostdata *)(instance)->hostdata).iomem)
+    iomem = (((struct NCR5380_hostdata *)(instance)->hostdata)->iomem)
 
 #endif
 

_

Signature · 1 line
Ondrej Zary
#3 lore raw
Quoted 49 lines · Ondrej Zary
Quoted 41 lines · On Tuesday 25 May 2010 02:16:55 Andy Walls wrote:
Quoted 9 lines · On Mon, 2010-05-24 at 12:22 -0700, [email protected] wrote:

From: Ondrej Zary <[email protected]>

The ifdefs are broken so the MMIO code is never compiled and so it's broken too. Fix them all. Untested as I don't have the hardware.

I remeber inspecting this before and thinking they were fine.

(my [email protected] account is obsolete)

If anyone in the US is interested in ancient ISA bus SCSI hardware for NCR5380 driver development, I can send them:

1. a DTC3181E
NCR5380
ISA I/O ports
no IRQ
no Pseudo-DMA
DB-25 external connector
...definitely a piece of junk.

2. a SUMO SCSI AT
NCR5380
ISA I/O ports
IRQ is is enabled by a bit in a board specific reg at reg_base+8 Pseudo DMA is enabled by a a board specific reg at reg_base+8 No watchdog timer on the pseudo DMA, so a failed pseudo-DMA
can hang your whole machine :D
SCSI-1 external connector (Centronics-type with bail locks) Internal SCSI connector
Removeable terminating resistors for the card.
Two BIOS firmware images on board, each having a divide by
0 bug in their fake C/H/S drive geometry computations :D
...in general, also a piece of junk.

Quoted 1 line

Neither of them will help with testing the MMIO mode of the driver.

I actually have a memory-mapped card - Canon FG2-5202 (hardwired to IRQ7). It did not work for me. But the other (I/O) mapped cards do neither. They seem to work if there's no SCSI device connected but I was not able to get neither IBM DORS-32160 hard disk nor SONY CDU415 CD-ROM working.

Quoted 7 lines

The driver hangs the machine completely because it waits for timeout using time_before with interrupts disabled - e.g. in NCR5380_poll_politely() in drivers/scsi/NCR5380.c.

Tried older kernels to find when did it work last time - and found none! 2.4 kernels were able to at least display device name and firmware version. Maybe I should try some older CPU & motherboard (this was on a P3, IIRC).

I pulled out my Pentium 100 machine from the closet today. I did some tests with the DTC3181e and a Mustek scanner and found some old notes.

1. The g_NCR5380 driver loads, under kernel 2.6.9 as delivered with Fedora Core 3, but after performing some Inquiry commands (and maybe some Test Unit Ready commands) to non-existant Targets it Oops-es the kernel. It appears to be problems with abort handling.

2. I know for sure that the driver worked with this machine on Redhat 5.0 or 5.2, Kernel 2.0.32 (that was RedHat 5.x before RedHat 9.0 which was the last RedHat distro before the split into RHEL and Fedora Core) both with my DTC card and Mustek scanner and my SUMO card with an external Exabyte 8500 tape drive.

3. I have some half completed source code for a dedicated driver module for the SUMO SCSI AT card. I was working on with kernel version 2.2.5 at the time. I'm very sure the g_NCR530 driver worked then too.

4. Alan Cox left some comments in the driver talking about waiting for kernel 2.3 to add SMP support to the g_NCR5380 driver. It may be prudent to assume the driver is not SMP safe. It may also lets me knwo the driver had to be working still sometime in kernel v2.2

5. I recall noting at one point in the NCR5380.[ch] files' evolution that some really platform specific code (Motorola VME cards?) started getting hacked into the driver. Maybe that has been split out by now.

On a somewhat related note, I also found my old Pro Audio Spectrum 16 card, that had a NCR5380 SCSI host embedded into a Zilog chip on the board (From the days when sound cards provided a SCSI drive interface for playing CD-ROMs). It used to work with the pas16 SCSI driver (which is based on the NCR5380.[ch] files). I don't know if the pas16 driver still works.

My only working machine with ISA slots is a Pentium 100. It is too slow for me to do any serious development on, so I likely won't be making any patches to the g_NCR5380 driver.

Good luck.

Regards,
Andy

Quoted 9 lines
Quoted 7 lines
Quoted 7 lines

---

 drivers/scsi/g_NCR5380.c |   43 +++++++++++++++++++------------------
 drivers/scsi/g_NCR5380.h |    6 ++---
 2 files changed, 26 insertions(+), 23 deletions(-)

diff -puN drivers/scsi/g_NCR5380.c~g_ncr5380-fix-broken-mmio-compilation