Skip to contentSkip to conversation

dec_esp: Use physical addresses

PATCH In review Ralf Baechle 3 participants 3 messages Oct 17, 2005 – Oct 25, 2005 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dec_esp: Use physical addresses

FYI. This is part of a larger MIPS patch which I'd like to submit to akpm as a single patch.

Use physical addresses at the interface level, letting drivers remap them as appropriate.

drivers/scsi/dec_esp.c +7 -4
Index: manual.git/drivers/scsi/dec_esp.c
===================================================================
@@ -18,7 +18,7 @@
  * 20001005	- Initialization fixes for 2.4.0-test9
  * 			  Florian Lohoff <[email protected]>
  *
- *	Copyright (C) 2002, 2003  Maciej W. Rozycki
+ *	Copyright (C) 2002, 2003, 2005  Maciej W. Rozycki
  */
 
 #include <linux/kernel.h>
@@ -41,6 +41,7 @@
 #include <asm/dec/ioasic_addrs.h>
 #include <asm/dec/ioasic_ints.h>
 #include <asm/dec/machtype.h>
+#include <asm/dec/system.h>
 #include <asm/dec/tc.h>
 
 #define DEC_SCSI_SREG 0
@@ -183,7 +184,8 @@ static int dec_esp_detect(Scsi_Host_Temp
 		esp->dregs = 0;
 
 		/* ESP register base */
-		esp->eregs = (struct ESP_regs *) (system_base + IOASIC_SCSI);
+		esp->eregs = (void *)CKSEG1ADDR(dec_kn_slot_base +
+						IOASIC_SCSI);
 
 		/* Set the command buffer */
 		esp->esp_command = (volatile unsigned char *) cmd_buffer;
@@ -228,10 +230,11 @@ static int dec_esp_detect(Scsi_Host_Temp
 			mem_start = get_tc_base_addr(slot);
 
 			/* Store base addr into esp struct */
-			esp->slot = CPHYSADDR(mem_start);
+			esp->slot = mem_start;
 
 			esp->dregs = 0;
-			esp->eregs = (struct ESP_regs *) (mem_start + DEC_SCSI_SREG);
+			esp->eregs = (void *)CKSEG1ADDR(mem_start +
+							DEC_SCSI_SREG);
 			esp->do_pio_cmds = 1;
 
 			/* Set the command buffer */
#1 lore raw
Quoted 2 lines · Ralf Baechle

FYI. This is part of a larger MIPS patch which I'd like to submit to akpm as a single patch.

Please don't do that _ever_. (dito for the other bits sent out) scsi patches should be submitted to linux-scsi as individual patcvhes.

drivers/scsi/dec_esp.c static int dec_esp_detect(Scsi_Host_Temp · line 188

Quoted 6 lines

Use physical addresses at the interface level, letting drivers remap them as appropriate.

drivers/scsi/dec_esp.c +2 -1
-		esp->eregs = (struct ESP_regs *) (system_base + IOASIC_SCSI);
+		esp->eregs = (void *)CKSEG1ADDR(dec_kn_slot_base +
+						IOASIC_SCSI);

Both the old and new code look very odd. This looks like iomaped-ish memory and should be using some iomap variant. The patch is probably okay for now, but I'd prefer if this used the proper APIs.

#2 lore raw
Quoted 10 lines · Christoph Hellwig

drivers/scsi/dec_esp.c static int dec_esp_detect(Scsi_Host_Temp · line 188

Quoted 6 lines

Use physical addresses at the interface level, letting drivers remap them as appropriate.

drivers/scsi/dec_esp.c +2 -1
-		esp->eregs = (struct ESP_regs *) (system_base + IOASIC_SCSI);
+		esp->eregs = (void *)CKSEG1ADDR(dec_kn_slot_base +
+						IOASIC_SCSI);

Both the old and new code look very odd. This looks like iomaped-ish memory and should be using some iomap variant. The patch is probably okay for now, but I'd prefer if this used the proper APIs.

It's a step in the transition to modern I/O bus APIs for TURBOchannel
systems. It's certainly not going to stay there any longer than necessary as this driver is meant to support Alphas and VAXen eventually.

Maciej