Commit 67f99519 authored by James Bottomley's avatar James Bottomley

Mac SCSI fixes (from Matthias Urlichs)

From: Geert Uytterhoeven <geert@linux-m68k.org>

Mac SCSI fixes (from Matthias Urlichs):
  - Inline functions need to be defined before being used.
  - out_8() takes an address and a value, not the other way round.
parent 48469908
...@@ -74,9 +74,6 @@ extern void via_scsi_clear(void); ...@@ -74,9 +74,6 @@ extern void via_scsi_clear(void);
static void mac_scsi_reset_boot(struct Scsi_Host *instance); static void mac_scsi_reset_boot(struct Scsi_Host *instance);
#endif #endif
static __inline__ char macscsi_read(struct Scsi_Host *instance, int reg);
static __inline__ void macscsi_write(struct Scsi_Host *instance, int reg, int value);
static int setup_called = 0; static int setup_called = 0;
static int setup_can_queue = -1; static int setup_can_queue = -1;
static int setup_cmd_per_lun = -1; static int setup_cmd_per_lun = -1;
...@@ -102,6 +99,52 @@ static volatile unsigned char *mac_scsi_regp = NULL; ...@@ -102,6 +99,52 @@ static volatile unsigned char *mac_scsi_regp = NULL;
static volatile unsigned char *mac_scsi_drq = NULL; static volatile unsigned char *mac_scsi_drq = NULL;
static volatile unsigned char *mac_scsi_nodrq = NULL; static volatile unsigned char *mac_scsi_nodrq = NULL;
/*
* NCR 5380 register access functions
*/
#if 0
/* Debug versions */
#define CTRL(p,v) (*ctrl = (v))
static char macscsi_read(struct Scsi_Host *instance, int reg)
{
int iobase = instance->io_port;
int i;
int *ctrl = &((struct NCR5380_hostdata *)instance->hostdata)->ctrl;
CTRL(iobase, 0);
i = in_8(iobase + (reg<<4));
CTRL(iobase, 0x40);
return i;
}
static void macscsi_write(struct Scsi_Host *instance, int reg, int value)
{
int iobase = instance->io_port;
int *ctrl = &((struct NCR5380_hostdata *)instance->hostdata)->ctrl;
CTRL(iobase, 0);
out_8(iobase + (reg<<4), value);
CTRL(iobase, 0x40);
}
#else
/* Fast versions */
static __inline__ char macscsi_read(struct Scsi_Host *instance, int reg)
{
return in_8(instance->io_port + (reg<<4));
}
static __inline__ void macscsi_write(struct Scsi_Host *instance, int reg, int value)
{
out_8(instance->io_port + (reg<<4), value);
}
#endif
/* /*
* Function : mac_scsi_setup(char *str) * Function : mac_scsi_setup(char *str)
* *
...@@ -163,18 +206,20 @@ static int __init mac_scsi_setup(char *str) { ...@@ -163,18 +206,20 @@ static int __init mac_scsi_setup(char *str) {
if (ints[5] >= 0) if (ints[5] >= 0)
setup_use_pdma = ints[5]; setup_use_pdma = ints[5];
} }
#endif #endif /* SUPPORT_TAGS */
#endif #endif /* DRIVER_SETUP */
return 1; return 1;
} }
__setup("mac5380=", mac_scsi_setup); __setup("mac5380=", mac_scsi_setup);
/* /*
* XXX: status debug * If you want to find the instance with (k)gdb ...
*/ */
#if NDEBUG
static struct Scsi_Host *default_instance; static struct Scsi_Host *default_instance;
#endif
/* /*
* Function : int macscsi_detect(Scsi_Host_Template * tpnt) * Function : int macscsi_detect(Scsi_Host_Template * tpnt)
...@@ -223,7 +268,9 @@ int macscsi_detect(Scsi_Host_Template * tpnt) ...@@ -223,7 +268,9 @@ int macscsi_detect(Scsi_Host_Template * tpnt)
/* Once we support multiple 5380s (e.g. DuoDock) we'll do /* Once we support multiple 5380s (e.g. DuoDock) we'll do
something different here */ something different here */
instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata)); instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata));
#if NDEBUG
default_instance = instance; default_instance = instance;
#endif
if (macintosh_config->ident == MAC_MODEL_IIFX) { if (macintosh_config->ident == MAC_MODEL_IIFX) {
mac_scsi_regp = via1+0x8000; mac_scsi_regp = via1+0x8000;
...@@ -331,49 +378,6 @@ const char * macscsi_info (struct Scsi_Host *spnt) { ...@@ -331,49 +378,6 @@ const char * macscsi_info (struct Scsi_Host *spnt) {
return ""; return "";
} }
/*
* NCR 5380 register access functions
*/
/* Debug versions
#define CTRL(p,v) (*ctrl = (v))
static char macscsi_read(struct Scsi_Host *instance, int reg)
{
int iobase = instance->io_port;
int i;
int *ctrl = &((struct NCR5380_hostdata *)instance->hostdata)->ctrl;
CTRL(iobase, 0);
i = in_8(iobase + (reg<<4));
CTRL(iobase, 0x40);
return i;
}
static void macscsi_write(struct Scsi_Host *instance, int reg, int value)
{
int iobase = instance->io_port;
int *ctrl = &((struct NCR5380_hostdata *)instance->hostdata)->ctrl;
CTRL(iobase, 0);
out_8(value, iobase + (reg<<4));
CTRL(iobase, 0x40);
}
*/
/* Fast versions */
static __inline__ char macscsi_read(struct Scsi_Host *instance, int reg)
{
return in_8(instance->io_port + (reg<<4));
}
static __inline__ void macscsi_write(struct Scsi_Host *instance, int reg, int value)
{
out_8(value, instance->io_port + (reg<<4));
}
/* /*
Pseudo-DMA: (Ove Edlund) Pseudo-DMA: (Ove Edlund)
The code attempts to catch bus errors that occur if one for example The code attempts to catch bus errors that occur if one for example
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment