m68k patches for 2.6.22
Subsystems (12)
Geert Uytterhoeven
maintainercover m68k patches for 2.6.22
[ resending, due to quilt rookie getting trapped in Dave's spamfilters ]
Here are the m68k patches for 2.6.22. Please apply. Thanks!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 1/33 m68k: Atari SCSI revival
From: Michael Schmitz <[email protected]>
SCSI should be working on a TT (but someone should really try!) but causes trouble on a Falcon (as in: it ate a filesystem of mine) at least when used concurrently with IDE. I have the notion it's because locking of the ST-DMA interrupt by IDE is broken in 2.6 (the IDE driver always complains about trying to release an already-released ST-DMA). Needs more work, but that's on the IDE or m68k interrupt side rather than SCSI.
--- drivers/scsi/Kconfig | 2 - drivers/scsi/atari_NCR5380.c | 52 ++++++++++++++++++++++++++++++++++++++----- drivers/scsi/atari_scsi.c | 10 +++----- drivers/scsi/atari_scsi.h | 30 +++++++++++++++++++++--- 4 files changed, 77 insertions(+), 17 deletions(-)
drivers/scsi/Kconfig +1 -1
@@ -1649,7 +1649,7 @@ config OKTAGON_SCSI config ATARI_SCSI tristate "Atari native SCSI support" - depends on ATARI && SCSI && BROKEN + depends on ATARI && SCSI select SCSI_SPI_ATTRS ---help--- If you have an Atari with built-in NCR5380 SCSI controller (TT,
drivers/scsi/atari_NCR5380.c +46 -6
89 lines not on this page · raw message
drivers/scsi/atari_scsi.c +4 -6
@@ -395,7 +395,7 @@ static irqreturn_t scsi_tt_intr (int irq#endif /* REAL_DMA */ -NCR5380_intr (0 ,0 ,0 ); +NCR5380_intr (0 ,0 );#if 0 /* To be sure the int is not masked */
@@ -461,7 +461,7 @@ static irqreturn_t scsi_falcon_intr (int#endif /* REAL_DMA */ -NCR5380_intr (0 ,0 ,0 ); +NCR5380_intr (0 ,0 );return IRQ_HANDLED ; }
@@ -557,11 +557,11 @@ static void falcon_get_lock( void )local_irq_save (flags); -while ( !in_interrupt () && falcon_got_lock &&stdma_others_waiting () ) +while (!in_irq () && falcon_got_lock &&stdma_others_waiting ())sleep_on ( &falcon_fairness_wait );while (!falcon_got_lock) { -if (in_interrupt ()) +if (in_irq ())panic ("Falcon SCSI hasn't ST-DMA lock in interrupt" );if (!falcon_trying_lock) { falcon_trying_lock =1 ;
@@ -763,7 +763,6 @@ int atari_scsi_detect (struct scsi_host_return (1 ); } -#ifdef MODULE int atari_scsi_release (struct Scsi_Host *sh) {if (IS_A_TT ())
@@ -772,7 +771,6 @@ int atari_scsi_release (struct Scsi_Hostatari_stram_free (atari_dma_buffer);return 1 ; } -#endif void __init atari_scsi_setup (char *str,int *ints) {
drivers/scsi/atari_scsi.h +26 -4
@@ -21,11 +21,7 @@int atari_scsi_detect (struct scsi_host_template *);const char *atari_scsi_info (struct Scsi_Host *);int atari_scsi_reset (Scsi_Cmnd *,unsigned int ); -#ifdef MODULE int atari_scsi_release (struct Scsi_Host *); -#else -#define atari_scsi_release NULL -#endif /* The values for CMD_PER_LUN and CAN_QUEUE are somehow arbitrary. Higher * values should work, too; try it! (but cmd_per_lun costs memory!) */
@@ -63,6 +59,32 @@ int atari_scsi_release (struct Scsi_Host#define NCR5380_dma_xfer_len (i,cmd,phase) \ atari_dma_xfer_len(cmd->SCp.this_residual,cmd,((phase) & SR_IO) ? 0 : 1) +/* former generic SCSI error handling stuff */ + +#define SCSI_ABORT_SNOOZE 0 +#define SCSI_ABORT_SUCCESS 1 +#define SCSI_ABORT_PENDING 2 +#define SCSI_ABORT_BUSY 3 +#define SCSI_ABORT_NOT_RUNNING 4 +#define SCSI_ABORT_ERROR 5 + +#define SCSI_RESET_SNOOZE 0 +#define SCSI_RESET_PUNT 1 +#define SCSI_RESET_SUCCESS 2 +#define SCSI_RESET_PENDING 3 +#define SCSI_RESET_WAKEUP 4 +#define SCSI_RESET_NOT_RUNNING 5 +#define SCSI_RESET_ERROR 6 + +#define SCSI_RESET_SYNCHRONOUS 0x01 +#define SCSI_RESET_ASYNCHRONOUS 0x02 +#define SCSI_RESET_SUGGEST_BUS_RESET 0x04 +#define SCSI_RESET_SUGGEST_HOST_RESET 0x08 + +#define SCSI_RESET_BUS_RESET 0x100 +#define SCSI_RESET_HOST_RESET 0x200 +#define SCSI_RESET_ACTION 0xff +/* Debugging printk definitions: * * ARB -> arbitration
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Re: [patch 01/33] m68k: Atari SCSI revival
Quoted 38 lines · Geert Uytterhoeven
From: Michael Schmitz <[email protected]>
SCSI should be working on a TT (but someone should really try!) but causes trouble on a Falcon (as in: it ate a filesystem of mine) at least when used concurrently with IDE. I have the notion it's because locking of the ST-DMA interrupt by IDE is broken in 2.6 (the IDE driver always complains about trying to release an already-released ST-DMA). Needs more work, but that's on the IDE or m68k interrupt side rather than SCSI.
/*
+ * our own old-style timeout update
+ */drivers/scsi/atari_NCR5380.c +26
-0+/* +* The strategy is to cause the timer code to call scsi_times_out() +* when the soonest timeout is pending. +* The arguments are used when we are queueing a new command, because +* we do not want to subtract the time used from this time, but when we +* set the timer, we want to take this value into account. +*/ + +int atari_scsi_update_timeout (Scsi_Cmnd * SCset,int timeout) +{ +int rtn; + +/* +* We are using the new error handling code to actually register/deregister +* timers for timeout. +*/ + +if (!timer_pending (&SCset->eh_timeout)) { + rtn =0 ; + }else { + rtn = SCset->eh_timeout.expires - jiffies; + } + +if (timeout ==0 ) { +del_timer (&SCset->eh_timeout); + SCset->eh_timeout.data = (unsigned long )NULL ;
drivers/scsi/atari_NCR5380.c static int NCR5380_init (struct Scsi_Hos · line 918
Quoted 10 lines
drivers/scsi/atari_NCR5380.c +10
-0+ SCset->eh_timeout.expires =0 ; + }else { +if (SCset->eh_timeout.data != (unsigned long )NULL ) +del_timer (&SCset->eh_timeout); + SCset->eh_timeout.data = (unsigned long ) SCset; + SCset->eh_timeout.expires = jiffies + timeout; +add_timer (&SCset->eh_timeout); + } +return rtn; +}
NACK, driver have no business messing around with eh_timeout.
Quoted 15 lines
drivers/scsi/atari_scsi.h +15
-0+/* former generic SCSI error handling stuff */ + +#define SCSI_ABORT_SNOOZE 0 +#define SCSI_ABORT_SUCCESS 1 +#define SCSI_ABORT_PENDING 2 +#define SCSI_ABORT_BUSY 3 +#define SCSI_ABORT_NOT_RUNNING 4 +#define SCSI_ABORT_ERROR 5 + +#define SCSI_RESET_SNOOZE 0 +#define SCSI_RESET_PUNT 1 +#define SCSI_RESET_SUCCESS 2 +#define SCSI_RESET_PENDING 3 +#define SCSI_RESET_WAKEUP 4 +#define SCSI_RESET_NOT_RUNNING 5
drivers/scsi/atari_scsi.h int atari_scsi_release (struct Scsi_Host · line 86
Quoted 10 lines
drivers/scsi/atari_scsi.h +10
-0+#define SCSI_RESET_ERROR 6 + +#define SCSI_RESET_SYNCHRONOUS 0x01 +#define SCSI_RESET_ASYNCHRONOUS 0x02 +#define SCSI_RESET_SUGGEST_BUS_RESET 0x04 +#define SCSI_RESET_SUGGEST_HOST_RESET 0x08 + +#define SCSI_RESET_BUS_RESET 0x100 +#define SCSI_RESET_HOST_RESET 0x200 +#define SCSI_RESET_ACTION 0xff
Please don't use these anymore but rather kill all uses of them.
Also note that we'd be much happier if you killed the atari specific NCR8350 and used the generic one instead.
Geert Uytterhoeven
maintainerPATCH 2/33 m68k: Reformat the Atari SCSI driver
In reply to Geert UytterhoevenFrom: Roman Zippel <[email protected]>
Reformat the Atari SCSI driver
--- drivers/scsi/atari_NCR5380.c | 4433 +++++++++++++++++++++---------------------- drivers/scsi/atari_scsi.c | 363 +-- 2 files changed, 2397 insertions(+), 2399 deletions(-)
drivers/scsi/atari_NCR5380.c +2221 -2212
@@ -1,19 +1,19 @@ -/* +/* * NCR 5380 generic driver routines. These should make it *trivial* -* to implement 5380 SCSI drivers under Linux with a non-trantor +* to implement 5380 SCSI drivers under Linux with a non-trantor * architecture. * * Note that these routines also work with NR53c400 family chips. * * Copyright 1993, Drew Eckhardt -* Visionary Computing +* Visionary Computing * (Unix and Linux consulting and custom programming) -* [email protected] +* [email protected] * +1 (303) 666-5836 * -* DISTRIBUTION RELEASE 6. +* DISTRIBUTION RELEASE 6. * -* For more information, please consult +* For more information, please consult * * NCR 5380 Family * SCSI Protocol Controller
@@ -57,7 +57,7 @@* - I've deleted all the stuff for AUTOPROBE_IRQ, REAL_DMA_POLL, PSEUDO_DMA * and USLEEP, because these were messing up readability and will never be * needed for Atari SCSI. -* +* * - I've revised the NCR5380_main() calling scheme (relax the 'main_running' * stuff), and 'main' is executed in a bottom half if awoken by an * interrupt.
@@ -69,21 +69,29 @@*/ /* -* Further development / testing that should be done : -* 1. Test linked command handling code after Eric is ready with +* Further development / testing that should be done : +* 1. Test linked command handling code after Eric is ready with * the high level code. */ #include <scsi/scsi_dbg.h> #include <scsi/scsi_transport_spi.h> #if (NDEBUG &NDEBUG_LISTS ) -#define LIST (x,y) \ - { printk("LINE:%d Adding %p to %p\n", __LINE__, (void*)(x), (void*)(y)); \ - if ((x)==(y)) udelay(5); } -#define REMOVE (w,x,y,z) \ - { printk("LINE:%d Removing: %p->%p %p->%p \n", __LINE__, \ - (void*)(w), (void*)(x), (void*)(y), (void*)(z)); \ - if ((x)==(y)) udelay(5); } +#define LIST (x, y) \ + do { \ + printk("LINE:%d Adding %p to %p\n", \ + __LINE__, (void*)(x), (void*)(y)); \ + if ((x) == (y)) \ + udelay(5); \ + } while (0) +#define REMOVE (w, x, y, z) \ + do { \ + printk("LINE:%d Removing: %p->%p %p->%p \n", \ + __LINE__, (void*)(w), (void*)(x), \ + (void*)(y), (void*)(z)); \ + if ((x) == (y)) \ + udelay(5); \ + } while (0)#else #define LIST (x,y)#define REMOVE (w,x,y,z)
@@ -103,62 +111,62 @@* more difficult than it has to be. * * Also, many of the SCSI drivers were written before the command queuing -* routines were implemented, meaning their implementations of queued +* routines were implemented, meaning their implementations of queued * commands were hacked on rather than designed in from the start. * -* When I designed the Linux SCSI drivers I figured that +* When I designed the Linux SCSI drivers I figured that * while having two different SCSI boards in a system might be useful * for debugging things, two of the same type wouldn't be used. * Well, I was wrong and a number of users have mailed me about running * multiple high-performance SCSI boards in a server. * -* Finally, when I get questions from users, I have no idea what +* Finally, when I get questions from users, I have no idea what * revision of my driver they are running. * * This driver attempts to address these problems : -* This is a generic 5380 driver. To use it on a different platform, +* This is a generic 5380 driver. To use it on a different platform, * one simply writes appropriate system specific macros (ie, data -* transfer - some PC's will use the I/O bus, 68K's must use +* transfer - some PC's will use the I/O bus, 68K's must use * memory mapped) and drops this file in their 'C' wrapper. * -* As far as command queueing, two queues are maintained for +* As far as command queueing, two queues are maintained for * each 5380 in the system - commands that haven't been issued yet, -* and commands that are currently executing. This means that an -* unlimited number of commands may be queued, letting -* more commands propagate from the higher driver levels giving higher -* throughput. Note that both I_T_L and I_T_L_Q nexuses are supported, -* allowing multiple commands to propagate all the way to a SCSI-II device +* and commands that are currently executing. This means that an +* unlimited number of commands may be queued, letting +* more commands propagate from the higher driver levels giving higher +* throughput. Note that both I_T_L and I_T_L_Q nexuses are supported, +* allowing multiple commands to propagate all the way to a SCSI-II device * while a command is already executing. * -* To solve the multiple-boards-in-the-same-system problem, +* To solve the multiple-boards-in-the-same-system problem, * there is a separate instance structure for each instance * of a 5380 in the system. So, multiple NCR5380 drivers will * be able to coexist with appropriate changes to the high level -* SCSI code. +* SCSI code. * * A NCR5380_PUBLIC_REVISION macro is provided, with the release -* number (updated for each public release) printed by the -* NCR5380_print_options command, which should be called from the +* number (updated for each public release) printed by the +* NCR5380_print_options command, which should be called from the * wrapper detect function, so that I know what release of the driver * users are using. * -* Issues specific to the NCR5380 : +* Issues specific to the NCR5380 : * -* When used in a PIO or pseudo-dma mode, the NCR5380 is a braindead -* piece of hardware that requires you to sit in a loop polling for -* the REQ signal as long as you are connected. Some devices are -* brain dead (ie, many TEXEL CD ROM drives) and won't disconnect +* When used in a PIO or pseudo-dma mode, the NCR5380 is a braindead +* piece of hardware that requires you to sit in a loop polling for +* the REQ signal as long as you are connected. Some devices are +* brain dead (ie, many TEXEL CD ROM drives) and won't disconnect * while doing long seek operations. -* +* * The workaround for this is to keep track of devices that have * disconnected. If the device hasn't disconnected, for commands that -* should disconnect, we do something like +* should disconnect, we do something like * * while (!REQ is asserted) { sleep for N usecs; poll for M usecs } -* -* Some tweaking of N and M needs to be done. An algorithm based +* +* Some tweaking of N and M needs to be done. An algorithm based * on "time to data" would give the best results as long as short time -* to datas (ie, on the same track) were considered, however these +* to datas (ie, on the same track) were considered, however these * broken devices are the exception rather than the rule and I'd rather * spend my time optimizing for the normal case. *
@@ -167,9 +175,9 @@* At the heart of the design is a coroutine, NCR5380_main, * which is started when not running by the interrupt handler, * timer, and queue command function. It attempts to establish -* I_T_L or I_T_L_Q nexuses by removing the commands from the -* issue queue and calling NCR5380_select() if a nexus -* is not established. +* I_T_L or I_T_L_Q nexuses by removing the commands from the +* issue queue and calling NCR5380_select() if a nexus +* is not established. * * Once a nexus is established, the NCR5380_information_transfer() * phase goes through the various phases as instructed by the target.
@@ -183,10 +191,10 @@* calling NCR5380_intr() which will in turn call NCR5380_reselect * to reestablish a nexus. This will run main if necessary. * -* On command termination, the done function will be called as +* On command termination, the done function will be called as * appropriate. * -* SCSI pointers are maintained in the SCp field of SCSI command +* SCSI pointers are maintained in the SCp field of SCSI command * structures, being initialized after the command is connected * in NCR5380_select, and set as appropriate in NCR5380_information_transfer. * Note that in violation of the standard, an implicit SAVE POINTERS operation
@@ -196,12 +204,12 @@/* * Using this file : * This file a skeleton Linux SCSI driver for the NCR 5380 series -* of chips. To use it, you write an architecture specific functions +* of chips. To use it, you write an architecture specific functions * and macros and include this file in your driver. * -* These macros control options : +* These macros control options : * AUTOSENSE - if defined, REQUEST SENSE will be performed automatically -* for commands that return with a CHECK CONDITION status. +* for commands that return with a CHECK CONDITION status. * * LINKED - if defined, linked commands are supported. *
@@ -210,18 +218,18 @@* SUPPORT_TAGS - if defined, SCSI-2 tagged queuing is used where possible * * These macros MUST be defined : -* +* * NCR5380_read(register) - read from the specified register * -* NCR5380_write(register, value) - write to the specific register +* NCR5380_write(register, value) - write to the specific register * * Either real DMA *or* pseudo DMA may be implemented -* REAL functions : +* REAL functions : * NCR5380_REAL_DMA should be defined if real DMA is to be used. -* Note that the DMA setup functions should return the number of bytes +* Note that the DMA setup functions should return the number of bytes * that they were able to program the controller for. * -* Also note that generic i386/PC versions of these macros are +* Also note that generic i386/PC versions of these macros are * available as NCR5380_i386_dma_write_setup, * NCR5380_i386_dma_read_setup, and NCR5380_i386_dma_residual. *
@@ -234,14 +242,14 @@* NCR5380_pread(instance, dst, count); * * If nothing specific to this implementation needs doing (ie, with external -* hardware), you must also define -* +* hardware), you must also define +* * NCR5380_queue_command * NCR5380_reset * NCR5380_abort * NCR5380_proc_info * -* to be the global entry points into the specific driver, ie +* to be the global entry points into the specific driver, ie * #define NCR5380_queue_command t128_queue_command. * * If this is not done, the routines will be defined as static functions
@@ -249,7 +257,7 @@* accessible wrapper function. * * The generic driver is initialized by calling NCR5380_init(instance), -* after setting the appropriate host specific fields and ID. If the +* after setting the appropriate host specific fields and ID. If the * driver wishes to autoprobe for an IRQ line, the NCR5380_probe_irq(instance, * possible) function may be used. Before the specific driver initialization * code finishes, NCR5380_print_options should be called.
@@ -312,34 +320,34 @@ static struct scsi_host_template *the_te#define TAG_NONE 0xfftypedef struct { - DECLARE_BITMAP(allocated, MAX_TAGS); -int nr_allocated; -int queue_size; + DECLARE_BITMAP(allocated, MAX_TAGS); +int nr_allocated; +int queue_size; }TAG_ALLOC ; -static TAG_ALLOC TagAlloc[8 ][8 ];/* 8 targets and 8 LUNs */ +static TAG_ALLOC TagAlloc[8 ][8 ];/* 8 targets and 8 LUNs */ -static void __init init_tags (void ) +static void __init init_tags (void ) { -int target, lun; -TAG_ALLOC *ta; - -if (!setup_use_tagged_queuing) -return ; - -for ( target =0 ; target <8 ; ++target ) { -for ( lun =0 ; lun <8 ; ++lun ) { - ta = &TagAlloc[target][lun]; -bitmap_zero (ta->allocated,MAX_TAGS ); - ta->nr_allocated =0 ; -/* At the beginning, assume the maximum queue size we could -* support (MAX_TAGS). This value will be decreased if the target -* returns QUEUE_FULL status. -*/ - ta->queue_size =MAX_TAGS ; +int target, lun; +TAG_ALLOC *ta; + +if (!setup_use_tagged_queuing) +return ; + +for (target =0 ; target <8 ; ++target) { +for (lun =0 ; lun <8 ; ++lun) { + ta = &TagAlloc[target][lun]; +bitmap_zero (ta->allocated,MAX_TAGS ); + ta->nr_allocated =0 ; +/* At the beginning, assume the maximum queue size we could +* support (MAX_TAGS). This value will be decreased if the target +* returns QUEUE_FULL status. +*/ + ta->queue_size =MAX_TAGS ; + } } - } }
@@ -348,24 +356,24 @@ static void __init init_tags( void )* check that there is a free tag and the target's queue won't overflow. This * function should be called with interrupts disabled to avoid race * conditions. -*/ +*/ -static int is_lun_busy (Scsi_Cmnd *cmd,int should_be_tagged ) +static int is_lun_busy (Scsi_Cmnd *cmd,int should_be_tagged) { -SETUP_HOSTDATA (cmd->device->host); +SETUP_HOSTDATA (cmd->device->host); -if (hostdata->busy[cmd->device->id] & (1 << cmd->device->lun)) -return (1 ); -if (!should_be_tagged || - !setup_use_tagged_queuing || !cmd->device->tagged_supported) -return (0 ); -if (TagAlloc[cmd->device->id][cmd->device->lun].nr_allocated >= - TagAlloc[cmd->device->id][cmd->device->lun].queue_size ) { -TAG_PRINTK ("scsi%d: target %d lun %d: no free tags\n" , -H_NO (cmd), cmd->device->id, cmd->device->lun ); -return (1 ); - } -return (0 ); +if (hostdata->busy[cmd->device->id] & (1 << cmd->device->lun)) +return 1 ; +if (!should_be_tagged || + !setup_use_tagged_queuing || !cmd->device->tagged_supported) +return 0 ; +if (TagAlloc[cmd->device->id][cmd->device->lun].nr_allocated >= + TagAlloc[cmd->device->id][cmd->device->lun].queue_size) { +TAG_PRINTK ("scsi%d: target %d lun %d: no free tags\n" , +H_NO (cmd), cmd->device->id, cmd->device->lun); +return 1 ; + } +return 0 ; }
@@ -374,31 +382,30 @@ static int is_lun_busy( Scsi_Cmnd *cmd,* untagged. */ -static void cmd_get_tag (Scsi_Cmnd *cmd,int should_be_tagged ) +static void cmd_get_tag (Scsi_Cmnd *cmd,int should_be_tagged) { -SETUP_HOSTDATA (cmd->device->host); +SETUP_HOSTDATA (cmd->device->host); -/* If we or the target don't support tagged queuing, allocate the LUN for -* an untagged command. -*/ -if (!should_be_tagged || - !setup_use_tagged_queuing || !cmd->device->tagged_supported) { - cmd->tag =TAG_NONE ; - hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); -TAG_PRINTK ("scsi%d: target %d lun %d now allocated by untagged " -"command\n" ,H_NO (cmd), cmd->device->id, cmd->device->lun ); - } -else { -TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun]; - - cmd->tag =find_first_zero_bit ( ta->allocated,MAX_TAGS ); -set_bit ( cmd->tag, ta->allocated ); - ta->nr_allocated++; -TAG_PRINTK ("scsi%d: using tag %d for target %d lun %d " -"(now %d tags in use)\n" , -H_NO (cmd), cmd->tag, cmd->device->id, cmd->device->lun, - ta->nr_allocated ); - } +/* If we or the target don't support tagged queuing, allocate the LUN for +* an untagged command. +*/ +if (!should_be_tagged || + !setup_use_tagged_queuing || !cmd->device->tagged_supported) { + cmd->tag =TAG_NONE ; + hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); +TAG_PRINTK ("scsi%d: target %d lun %d now allocated by untagged " +"command\n" ,H_NO (cmd), cmd->device->id, cmd->device->lun); + }else { +TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun]; + + cmd->tag =find_first_zero_bit (ta->allocated,MAX_TAGS ); +set_bit (cmd->tag, ta->allocated); + ta->nr_allocated++; +TAG_PRINTK ("scsi%d: using tag %d for target %d lun %d " +"(now %d tags in use)\n" , +H_NO (cmd), cmd->tag, cmd->device->id, + cmd->device->lun, ta->nr_allocated); + } }
@@ -406,44 +413,42 @@ static void cmd_get_tag( Scsi_Cmnd *cmd,* unlock the LUN. */ -static void cmd_free_tag (Scsi_Cmnd *cmd ) +static void cmd_free_tag (Scsi_Cmnd *cmd) { -SETUP_HOSTDATA (cmd->device->host); +SETUP_HOSTDATA (cmd->device->host); -if (cmd->tag ==TAG_NONE ) { - hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); -TAG_PRINTK ("scsi%d: target %d lun %d untagged cmd finished\n" , -H_NO (cmd), cmd->device->id, cmd->device->lun ); - } -else if (cmd->tag >=MAX_TAGS ) { -printk (KERN_NOTICE "scsi%d: trying to free bad tag %d!\n" , -H_NO (cmd), cmd->tag ); - } -else { -TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun]; -clear_bit ( cmd->tag, ta->allocated ); - ta->nr_allocated--; -TAG_PRINTK ("scsi%d: freed tag %d for target %d lun %d\n" , -H_NO (cmd), cmd->tag, cmd->device->id, cmd->device->lun ); - } +if (cmd->tag ==TAG_NONE ) { + hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); +TAG_PRINTK ("scsi%d: target %d lun %d untagged cmd finished\n" , +H_NO (cmd), cmd->device->id, cmd->device->lun); + }else if (cmd->tag >=MAX_TAGS ) { +printk (KERN_NOTICE "scsi%d: trying to free bad tag %d!\n" , +H_NO (cmd), cmd->tag); + }else { +TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun]; +clear_bit (cmd->tag, ta->allocated); + ta->nr_allocated--; +TAG_PRINTK ("scsi%d: freed tag %d for target %d lun %d\n" , +H_NO (cmd), cmd->tag, cmd->device->id, cmd->device->lun); + } } -static void free_all_tags (void ) -{ -int target, lun; -TAG_ALLOC *ta; - -if (!setup_use_tagged_queuing) -return ; - -for ( target =0 ; target <8 ; ++target ) { -for ( lun =0 ; lun <8 ; ++lun ) { - ta = &TagAlloc[target][lun]; -bitmap_zero (ta->allocated,MAX_TAGS ); - ta->nr_allocated =0 ; +static void free_all_tags (void ) +{ +int target, lun; +TAG_ALLOC *ta; + +if (!setup_use_tagged_queuing) +return ; + +for (target =0 ; target <8 ; ++target) { +for (lun =0 ; lun <8 ; ++lun) { + ta = &TagAlloc[target][lun]; +bitmap_zero (ta->allocated,MAX_TAGS ); + ta->nr_allocated =0 ; + } } - } }#endif /* SUPPORT_TAGS */
@@ -461,89 +466,94 @@ static void free_all_tags( void )* assumed to be already transfered into ptr/this_residual. */ -static void merge_contiguous_buffers (Scsi_Cmnd *cmd ) +static void merge_contiguous_buffers (Scsi_Cmnd *cmd) { -unsigned long endaddr; +unsigned long endaddr;#if (NDEBUG &NDEBUG_MERGING ) -unsigned long oldlen = cmd->SCp.this_residual; -int cnt =1 ; +unsigned long oldlen = cmd->SCp.this_residual; +int cnt =1 ;#endif -for (endaddr =virt_to_phys (cmd->SCp.ptr + cmd->SCp.this_residual -1 ) +1 ; - cmd->SCp.buffers_residual && -virt_to_phys (page_address (cmd->SCp.buffer[1 ].page)+ - cmd->SCp.buffer[1 ].offset) == endaddr; ) { -MER_PRINTK ("VTOP(%p) == %08lx -> merging\n" , - cmd->SCp.buffer[1 ].address, endaddr); +for (endaddr =virt_to_phys (cmd->SCp.ptr + cmd->SCp.this_residual -1 ) +1 ; + cmd->SCp.buffers_residual && +virt_to_phys (page_address (cmd->SCp.buffer[1 ].page) + + cmd->SCp.buffer[1 ].offset) == endaddr;) { +MER_PRINTK ("VTOP(%p) == %08lx -> merging\n" , + cmd->SCp.buffer[1 ].address, endaddr);#if (NDEBUG &NDEBUG_MERGING ) - ++cnt; + ++cnt;#endif - ++cmd->SCp.buffer; - --cmd->SCp.buffers_residual; - cmd->SCp.this_residual += cmd->SCp.buffer->length; - endaddr += cmd->SCp.buffer->length; - } + ++cmd->SCp.buffer; + --cmd->SCp.buffers_residual; + cmd->SCp.this_residual += cmd->SCp.buffer->length; + endaddr += cmd->SCp.buffer->length; + }#if (NDEBUG &NDEBUG_MERGING ) -if (oldlen != cmd->SCp.this_residual) -MER_PRINTK ("merged %d buffers from %p, new length %08x\n" , - cnt, cmd->SCp.ptr, cmd->SCp.this_residual); +if (oldlen != cmd->SCp.this_residual) +MER_PRINTK ("merged %d buffers from %p, new length %08x\n" , + cnt, cmd->SCp.ptr, cmd->SCp.this_residual);#endif }/* * Function : void initialize_SCp(Scsi_Cmnd *cmd) * -* Purpose : initialize the saved data pointers for cmd to point to the +* Purpose : initialize the saved data pointers for cmd to point to the * start of the buffer. * * Inputs : cmd - Scsi_Cmnd structure to have pointers reset. */ -static __inline__void initialize_SCp (Scsi_Cmnd *cmd) +static inline void initialize_SCp (Scsi_Cmnd *cmd) { -/* -* Initialize the Scsi Pointer field so that all of the commands in the -* various queues are valid. -*/ - -if (cmd->use_sg) { - cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; - cmd->SCp.buffers_residual = cmd->use_sg -1 ; - cmd->SCp.ptr = (char *)page_address (cmd->SCp.buffer->page)+ - cmd->SCp.buffer->offset; - cmd->SCp.this_residual = cmd->SCp.buffer->length; -/* ++roman: Try to merge some scatter-buffers if they are at -* contiguous physical addresses. -*/ -merge_contiguous_buffers ( cmd ); - }else { - cmd->SCp.buffer =NULL ; - cmd->SCp.buffers_residual =0 ; - cmd->SCp.ptr = (char *) cmd->request_buffer; - cmd->SCp.this_residual = cmd->request_bufflen; - } +/* +* Initialize the Scsi Pointer field so that all of the commands in the +* various queues are valid. +*/ + +if (cmd->use_sg) { + cmd->SCp.buffer = (struct scatterlist *)cmd->request_buffer; + cmd->SCp.buffers_residual = cmd->use_sg -1 ; + cmd->SCp.ptr = (char *)page_address (cmd->SCp.buffer->page) + + cmd->SCp.buffer->offset; + cmd->SCp.this_residual = cmd->SCp.buffer->length; +/* ++roman: Try to merge some scatter-buffers if they are at +* contiguous physical addresses. +*/ +merge_contiguous_buffers (cmd); + }else { + cmd->SCp.buffer =NULL ; + cmd->SCp.buffers_residual =0 ; + cmd->SCp.ptr = (char *)cmd->request_buffer; + cmd->SCp.this_residual = cmd->request_bufflen; + } }#include <linux/delay.h> #if NDEBUG static struct { -unsigned char mask; -const char * name;} -signals[] = {{SR_DBP ,"PARITY" }, {SR_RST ,"RST" }, {SR_BSY ,"BSY" }, - {SR_REQ ,"REQ" }, {SR_MSG ,"MSG" }, {SR_CD ,"CD" }, {SR_IO ,"IO" }, - {SR_SEL ,"SEL" }, {0 ,NULL }}, -basrs[] = {{BASR_ATN ,"ATN" }, {BASR_ACK ,"ACK" }, {0 ,NULL }}, -icrs[] = {{ICR_ASSERT_RST ,"ASSERT RST" },{ICR_ASSERT_ACK ,"ASSERT ACK" }, - {ICR_ASSERT_BSY ,"ASSERT BSY" }, {ICR_ASSERT_SEL ,"ASSERT SEL" }, - {ICR_ASSERT_ATN ,"ASSERT ATN" }, {ICR_ASSERT_DATA ,"ASSERT DATA" }, - {0 ,NULL }}, -mrs[] = {{MR_BLOCK_DMA_MODE ,"MODE BLOCK DMA" }, {MR_TARGET ,"MODE TARGET" }, - {MR_ENABLE_PAR_CHECK ,"MODE PARITY CHECK" }, {MR_ENABLE_PAR_INTR , -"MODE PARITY INTR" }, {MR_ENABLE_EOP_INTR ,"MODE EOP INTR" }, - {MR_MONITOR_BSY ,"MODE MONITOR BSY" }, - {MR_DMA_MODE ,"MODE DMA" }, {MR_ARBITRATE ,"MODE ARBITRATION" }, - {0 ,NULL }}; +unsigned char mask; +const char *name; +} signals[] = { + {SR_DBP ,"PARITY" }, {SR_RST ,"RST" }, {SR_BSY ,"BSY" }, + {SR_REQ ,"REQ" }, {SR_MSG ,"MSG" }, {SR_CD ,"CD" }, {SR_IO ,"IO" }, + {SR_SEL ,"SEL" }, {0 ,NULL } +}, basrs[] = { + {BASR_ATN ,"ATN" }, {BASR_ACK ,"ACK" }, {0 ,NULL } +}, icrs[] = { + {ICR_ASSERT_RST ,"ASSERT RST" },{ICR_ASSERT_ACK ,"ASSERT ACK" }, + {ICR_ASSERT_BSY ,"ASSERT BSY" }, {ICR_ASSERT_SEL ,"ASSERT SEL" }, + {ICR_ASSERT_ATN ,"ASSERT ATN" }, {ICR_ASSERT_DATA ,"ASSERT DATA" }, + {0 ,NULL } +}, mrs[] = { + {MR_BLOCK_DMA_MODE ,"MODE BLOCK DMA" }, {MR_TARGET ,"MODE TARGET" }, + {MR_ENABLE_PAR_CHECK ,"MODE PARITY CHECK" }, {MR_ENABLE_PAR_INTR , +"MODE PARITY INTR" }, {MR_ENABLE_EOP_INTR ,"MODE EOP INTR" }, + {MR_MONITOR_BSY ,"MODE MONITOR BSY" }, + {MR_DMA_MODE ,"MODE DMA" }, {MR_ARBITRATE ,"MODE ARBITRATION" }, + {0 ,NULL } +};/* * Function : void NCR5380_print(struct Scsi_Host *instance)
@@ -553,45 +563,47 @@ mrs[] = {{MR_BLOCK_DMA_MODE, "MODE BLOCK* Input : instance - which NCR5380 */ -static void NCR5380_print (struct Scsi_Host *instance) { -unsigned char status, data, basr, mr, icr, i; -unsigned long flags; - -local_irq_save (flags); - data =NCR5380_read (CURRENT_SCSI_DATA_REG ); - status =NCR5380_read (STATUS_REG ); - mr =NCR5380_read (MODE_REG ); - icr =NCR5380_read (INITIATOR_COMMAND_REG ); - basr =NCR5380_read (BUS_AND_STATUS_REG ); -local_irq_restore (flags); -printk ("STATUS_REG: %02x " , status); -for (i =0 ; signals[i].mask ; ++i) -if (status & signals[i].mask) -printk (",%s" , signals[i].name); -printk ("\nBASR: %02x " , basr); -for (i =0 ; basrs[i].mask ; ++i) -if (basr & basrs[i].mask) -printk (",%s" , basrs[i].name); -printk ("\nICR: %02x " , icr); -for (i =0 ; icrs[i].mask; ++i) -if (icr & icrs[i].mask) -printk (",%s" , icrs[i].name); -printk ("\nMODE: %02x " , mr); -for (i =0 ; mrs[i].mask; ++i) -if (mr & mrs[i].mask) -printk (",%s" , mrs[i].name); -printk ("\n" ); +static void NCR5380_print (struct Scsi_Host *instance) +{ +unsigned char status, data, basr, mr, icr, i; +unsigned long flags; + +local_irq_save (flags); + data =NCR5380_read (CURRENT_SCSI_DATA_REG ); + status =NCR5380_read (STATUS_REG ); + mr =NCR5380_read (MODE_REG ); + icr =NCR5380_read (INITIATOR_COMMAND_REG ); + basr =NCR5380_read (BUS_AND_STATUS_REG ); +local_irq_restore (flags); +printk ("STATUS_REG: %02x " , status); +for (i =0 ; signals[i].mask; ++i) +if (status & signals[i].mask) +printk (",%s" , signals[i].name); +printk ("\nBASR: %02x " , basr); +for (i =0 ; basrs[i].mask; ++i) +if (basr & basrs[i].mask) +printk (",%s" , basrs[i].name); +printk ("\nICR: %02x " , icr); +for (i =0 ; icrs[i].mask; ++i) +if (icr & icrs[i].mask) +printk (",%s" , icrs[i].name); +printk ("\nMODE: %02x " , mr); +for (i =0 ; mrs[i].mask; ++i) +if (mr & mrs[i].mask) +printk (",%s" , mrs[i].name); +printk ("\n" ); }static struct { -unsigned char value; -const char *name; +unsigned char value; +const char *name; } phases[] = { - {PHASE_DATAOUT ,"DATAOUT" }, {PHASE_DATAIN ,"DATAIN" }, {PHASE_CMDOUT ,"CMDOUT" }, - {PHASE_STATIN ,"STATIN" }, {PHASE_MSGOUT ,"MSGOUT" }, {PHASE_MSGIN ,"MSGIN" }, - {PHASE_UNKNOWN ,"UNKNOWN" }}; + {PHASE_DATAOUT ,"DATAOUT" }, {PHASE_DATAIN ,"DATAIN" }, {PHASE_CMDOUT ,"CMDOUT" }, + {PHASE_STATIN ,"STATIN" }, {PHASE_MSGOUT ,"MSGOUT" }, {PHASE_MSGIN ,"MSGIN" }, + {PHASE_UNKNOWN ,"UNKNOWN" } +}; -/* +/* * Function : void NCR5380_print_phase(struct Scsi_Host *instance) * * Purpose : print the current SCSI phase for debugging purposes
@@ -601,30 +613,35 @@ static struct {static void NCR5380_print_phase (struct Scsi_Host *instance) { -unsigned char status; -int i; +unsigned char status; +int i; - status =NCR5380_read (STATUS_REG ); -if (!(status &SR_REQ )) -printk (KERN_DEBUG "scsi%d: REQ not asserted, phase unknown.\n" ,HOSTNO ); -else { -for (i =0 ; (phases[i].value !=PHASE_UNKNOWN ) && - (phases[i].value != (status &PHASE_MASK )); ++i); -printk (KERN_DEBUG "scsi%d: phase %s\n" ,HOSTNO , phases[i].name); - } + status =NCR5380_read (STATUS_REG ); +if (!(status &SR_REQ )) +printk (KERN_DEBUG "scsi%d: REQ not asserted, phase unknown.\n" ,HOSTNO ); +else { +for (i =0 ; (phases[i].value !=PHASE_UNKNOWN ) && + (phases[i].value != (status &PHASE_MASK )); ++i) + ; +printk (KERN_DEBUG "scsi%d: phase %s\n" ,HOSTNO , phases[i].name); + } }#else /* !NDEBUG */ /* dummies... */ -__inline__void NCR5380_print (struct Scsi_Host *instance) { }; -__inline__void NCR5380_print_phase (struct Scsi_Host *instance) { }; +static inline void NCR5380_print (struct Scsi_Host *instance) +{ +}; +static inline void NCR5380_print_phase (struct Scsi_Host *instance) +{ +};#endif /* * ++roman: New scheme of calling NCR5380_main() -* +* * If we're not in an interrupt, we can call our main directly, it cannot be * already running. Else, we queue it on a task queue, if not 'main_running' * tells us that a lower level is already executing it. This way,
@@ -638,33 +655,33 @@ __inline__ void NCR5380_print_phase(stru#include <linux/workqueue.h> #include <linux/interrupt.h> -static volatile int main_running =0 ; -static DECLARE_WORK(NCR5380_tqueue, (void (*)(void*))NCR5380_main, NULL); +static volatile int main_running; +static DECLARE_WORK(NCR5380_tqueue, (void (*)(void *))NCR5380_main, NULL); -static __inline__void queue_main (void ) +static inline void queue_main (void ) { -if (!main_running) { -/* If in interrupt and NCR5380_main() not already running, -queue it on the 'immediate' task queue, to be processed -immediately after the current interrupt processing has -finished. */ -schedule_work (&NCR5380_tqueue); - } -/* else: nothing to do: the running NCR5380_main() will pick up -any newly queued command. */ +if (!main_running) { +/* If in interrupt and NCR5380_main() not already running, +queue it on the 'immediate' task queue, to be processed +immediately after the current interrupt processing has +finished. */ +schedule_work (&NCR5380_tqueue); + } +/* else: nothing to do: the running NCR5380_main() will pick up +any newly queued command. */ } -static inline void NCR5380_all_init (void ) +static inline void NCR5380_all_init (void ) { -static int done =0 ; -if (!done) { -INI_PRINTK ("scsi : NCR5380_all_init()\n" ); - done =1 ; - } +static int done =0 ; +if (!done) { +INI_PRINTK ("scsi : NCR5380_all_init()\n" ); + done =1 ; + } } - +/* * Function : void NCR58380_print_options (struct Scsi_Host *instance) *
@@ -674,23 +691,23 @@ static inline void NCR5380_all_init (voi* Inputs : instance, pointer to this instance. Unused. */ -static void __init NCR5380_print_options (struct Scsi_Host *instance) +static void __init NCR5380_print_options (struct Scsi_Host *instance) { - printk(" generic options" -#ifdef AUTOSENSE - " AUTOSENSE" + printk(" generic options" +#ifdef AUTOSENSE + " AUTOSENSE" #endif #ifdef REAL_DMA - " REAL DMA" + " REAL DMA" #endif #ifdef PARITY - " PARITY" + " PARITY" #endif #ifdef SUPPORT_TAGS -" SCSI-2 TAGGED QUEUING" +" SCSI-2 TAGGED QUEUING" #endif - ); -printk (" generic release=%d" ,NCR5380_PUBLIC_RELEASE ); + ); +printk (" generic release=%d" ,NCR5380_PUBLIC_RELEASE ); }/*
@@ -699,27 +716,27 @@ static void __init NCR5380_print_options* Purpose : print commands in the various queues, called from * NCR5380_abort and NCR5380_debug to aid debugging. * -* Inputs : instance, pointer to this instance. +* Inputs : instance, pointer to this instance. */ -static void NCR5380_print_status (struct Scsi_Host *instance) +static void NCR5380_print_status (struct Scsi_Host *instance) { -char *pr_bfr; -char *start; -int len; - -NCR_PRINT (NDEBUG_ANY ); -NCR_PRINT_PHASE (NDEBUG_ANY ); - - pr_bfr = (char *)__get_free_page (GFP_ATOMIC ); -if (!pr_bfr) { -printk ("NCR5380_print_status: no memory for print buffer\n" ); -return ; - } - len =NCR5380_proc_info (instance, pr_bfr, &start,0 ,PAGE_SIZE ,0 ); - pr_bfr[len] =0 ; -printk ("\n%s\n" , pr_bfr); -free_page ((unsigned long ) pr_bfr); +char *pr_bfr; +char *start; +int len; + +NCR_PRINT (NDEBUG_ANY ); +NCR_PRINT_PHASE (NDEBUG_ANY ); + + pr_bfr = (char *)__get_free_page (GFP_ATOMIC ); +if (!pr_bfr) { +printk ("NCR5380_print_status: no memory for print buffer\n" ); +return ; + } + len =NCR5380_proc_info (instance, pr_bfr, &start,0 ,PAGE_SIZE ,0 ); + pr_bfr[len] =0 ; +printk ("\n%s\n" , pr_bfr); +free_page ((unsigned long )pr_bfr); }
@@ -738,146 +755,144 @@ static void NCR5380_print_status (struct*/ #undef SPRINTF -#define SPRINTF(fmt,args...) \ - do { if (pos + strlen(fmt) + 20 /* slop */ < buffer + length) \ - pos += sprintf(pos, fmt , ## args); } while(0) -static -char *lprint_Scsi_Cmnd (Scsi_Cmnd *cmd,char *pos,char *buffer,int length); - -static -int NCR5380_proc_info (struct Scsi_Host *instance,char *buffer,char **start,off_t offset, -int length,int inout) -{ -char *pos = buffer; -struct NCR5380_hostdata *hostdata; -Scsi_Cmnd *ptr; -unsigned long flags; -off_t begin =0 ; -#define check_offset () \ - do { \ - if (pos - buffer < offset - begin) { \ - begin += pos - buffer; \ - pos = buffer; \ - } \ - } while (0) - - hostdata = (struct NCR5380_hostdata *)instance->hostdata; - -if (inout) {/* Has data been written to the file ? */ -return (-ENOSYS );/* Currently this is a no-op */ - } -SPRINTF ("NCR5380 core release=%d.\n" ,NCR5380_PUBLIC_RELEASE ); -check_offset (); -local_irq_save (flags); -SPRINTF ("NCR5380: coroutine is%s running.\n" , main_running ?"" :"n't" ); -check_offset (); -if (!hostdata->connected) -SPRINTF ("scsi%d: no currently connected command\n" ,HOSTNO ); -else - pos =lprint_Scsi_Cmnd ((Scsi_Cmnd *) hostdata->connected, - pos, buffer, length); -SPRINTF ("scsi%d: issue_queue\n" ,HOSTNO ); -check_offset (); -for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr =NEXT (ptr)) { - pos =lprint_Scsi_Cmnd (ptr, pos, buffer, length); +#define SPRINTF(fmt,args...) \ + do { \ + if (pos + strlen(fmt) + 20 /* slop */ < buffer + length) \ + pos += sprintf(pos, fmt , ## args); \ + } while(0) +static char *lprint_Scsi_Cmnd (Scsi_Cmnd *cmd,char *pos,char *buffer,int length); + +static int NCR5380_proc_info (struct Scsi_Host *instance,char *buffer, +char **start,off_t offset,int length,int inout) +{ +char *pos = buffer; +struct NCR5380_hostdata *hostdata; +Scsi_Cmnd *ptr; +unsigned long flags; +off_t begin =0 ; +#define check_offset () \ + do { \ + if (pos - buffer < offset - begin) { \ + begin += pos - buffer; \ + pos = buffer; \ + } \ + } while (0) + + hostdata = (struct NCR5380_hostdata *)instance->hostdata; + +if (inout)/* Has data been written to the file ? */ +return -ENOSYS ;/* Currently this is a no-op */ +SPRINTF ("NCR5380 core release=%d.\n" ,NCR5380_PUBLIC_RELEASE );check_offset (); - } - -SPRINTF ("scsi%d: disconnected_queue\n" ,HOSTNO ); -check_offset (); -for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; - ptr =NEXT (ptr)) { - pos =lprint_Scsi_Cmnd (ptr, pos, buffer, length); +local_irq_save (flags); +SPRINTF ("NCR5380: coroutine is%s running.\n" , + main_running ?"" :"n't" );check_offset (); - } +if (!hostdata->connected) +SPRINTF ("scsi%d: no currently connected command\n" ,HOSTNO ); +else + pos =lprint_Scsi_Cmnd ((Scsi_Cmnd *) hostdata->connected, + pos, buffer, length); +SPRINTF ("scsi%d: issue_queue\n" ,HOSTNO ); +check_offset (); +for (ptr = (Scsi_Cmnd *)hostdata->issue_queue; ptr; ptr =NEXT (ptr)) { + pos =lprint_Scsi_Cmnd (ptr, pos, buffer, length); +check_offset (); + } -local_irq_restore (flags); - *start = buffer + (offset - begin); -if (pos - buffer < offset - begin) -return 0 ; -else if (pos - buffer - (offset - begin) < length) -return pos - buffer - (offset - begin); -return length; -} +SPRINTF ("scsi%d: disconnected_queue\n" ,HOSTNO ); +check_offset (); +for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; + ptr =NEXT (ptr)) { + pos =lprint_Scsi_Cmnd (ptr, pos, buffer, length); +check_offset (); + } -static char * -lprint_Scsi_Cmnd (Scsi_Cmnd *cmd,char *pos,char *buffer,int length) -{ -int i, s; -unsigned char *command; -SPRINTF ("scsi%d: destination target %d, lun %d\n" , -H_NO (cmd), cmd->device->id, cmd->device->lun); -SPRINTF (" command = " ); - command = cmd->cmnd; -SPRINTF ("%2d (0x%02x)" , command[0 ], command[0 ]); -for (i =1 , s =COMMAND_SIZE (command[0 ]); i < s; ++i) -SPRINTF (" %02x" , command[i]); -SPRINTF ("\n" ); -return pos; +local_irq_restore (flags); + *start = buffer + (offset - begin); +if (pos - buffer < offset - begin) +return 0 ; +else if (pos - buffer - (offset - begin) < length) +return pos - buffer - (offset - begin); +return length; +} + +static char *lprint_Scsi_Cmnd (Scsi_Cmnd *cmd,char *pos,char *buffer,int length) +{ +int i, s; +unsigned char *command; +SPRINTF ("scsi%d: destination target %d, lun %d\n" , +H_NO (cmd), cmd->device->id, cmd->device->lun); +SPRINTF (" command = " ); + command = cmd->cmnd; +SPRINTF ("%2d (0x%02x)" , command[0 ], command[0 ]); +for (i =1 , s =COMMAND_SIZE (command[0 ]); i < s; ++i) +SPRINTF (" %02x" , command[i]); +SPRINTF ("\n" ); +return pos; } -/* +/* * Function : void NCR5380_init (struct Scsi_Host *instance) * * Purpose : initializes *instance and corresponding 5380 chip. * -* Inputs : instance - instantiation of the 5380 driver. +* Inputs : instance - instantiation of the 5380 driver. * * Notes : I assume that the host, hostno, and id bits have been -* set correctly. I don't care about the irq and other fields. -* +* set correctly. I don't care about the irq and other fields. +* */ -static int NCR5380_init (struct Scsi_Host *instance,int flags) +static int NCR5380_init (struct Scsi_Host *instance,int flags) { -int i; -SETUP_HOSTDATA (instance); +int i; +SETUP_HOSTDATA (instance); -NCR5380_all_init (); +NCR5380_all_init (); - hostdata->aborted =0 ; - hostdata->id_mask =1 << instance->this_id; - hostdata->id_higher_mask =0 ; -for (i = hostdata->id_mask; i <=0x80 ; i <<=1 ) -if (i > hostdata->id_mask) - hostdata->id_higher_mask |= i; -for (i =0 ; i <8 ; ++i) - hostdata->busy[i] =0 ; + hostdata->aborted =0 ; + hostdata->id_mask =1 << instance->this_id; + hostdata->id_higher_mask =0 ; +for (i = hostdata->id_mask; i <=0x80 ; i <<=1 ) +if (i > hostdata->id_mask) + hostdata->id_higher_mask |= i; +for (i =0 ; i <8 ; ++i) + hostdata->busy[i] =0 ;#ifdef SUPPORT_TAGS -init_tags (); +init_tags ();#endif #if defined (REAL_DMA ) - hostdata->dma_len =0 ; + hostdata->dma_len =0 ;#endif - hostdata->targets_present =0 ; - hostdata->connected =NULL ; - hostdata->issue_queue =NULL ; - hostdata->disconnected_queue =NULL ; - hostdata->flags =FLAG_CHECK_LAST_BYTE_SENT ; - -if (!the_template) { - the_template = instance->hostt; - first_instance = instance; - } - + hostdata->targets_present =0 ; + hostdata->connected =NULL ; + hostdata->issue_queue =NULL ; + hostdata->disconnected_queue =NULL ; + hostdata->flags =FLAG_CHECK_LAST_BYTE_SENT ; + +if (!the_template) { + the_template = instance->hostt; + first_instance = instance; + }#ifndef AUTOSENSE -if ((instance->cmd_per_lun >1 ) || (instance->can_queue >1 )) -printk ("scsi%d: WARNING : support for multiple outstanding commands enabled\n" -" without AUTOSENSE option, contingent allegiance conditions may\n" -" be incorrectly cleared.\n" ,HOSTNO ); +if ((instance->cmd_per_lun >1 ) || (instance->can_queue >1 )) +printk ("scsi%d: WARNING : support for multiple outstanding commands enabled\n" +" without AUTOSENSE option, contingent allegiance conditions may\n" +" be incorrectly cleared.\n" ,HOSTNO );#endif /* def AUTOSENSE */ -NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); -NCR5380_write (MODE_REG ,MR_BASE ); -NCR5380_write (TARGET_COMMAND_REG ,0 ); -NCR5380_write (SELECT_ENABLE_REG ,0 ); +NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); +NCR5380_write (MODE_REG ,MR_BASE ); +NCR5380_write (TARGET_COMMAND_REG ,0 ); +NCR5380_write (SELECT_ENABLE_REG ,0 ); -return 0 ; +return 0 ; } -/* +/* * our own old-style timeout update */ /*
@@ -890,331 +905,328 @@ static int NCR5380_init (struct Scsi_Hosint atari_scsi_update_timeout (Scsi_Cmnd * SCset,int timeout) { -int rtn; +int rtn; -/* -* We are using the new error handling code to actually register/deregister -* timers for timeout. -*/ - -if (!timer_pending (&SCset->eh_timeout)) { - rtn =0 ; - }else { - rtn = SCset->eh_timeout.expires - jiffies; - } - -if (timeout ==0 ) { -del_timer (&SCset->eh_timeout); - SCset->eh_timeout.data = (unsigned long )NULL ; - SCset->eh_timeout.expires =0 ; - }else { -if (SCset->eh_timeout.data != (unsigned long )NULL ) -del_timer (&SCset->eh_timeout); - SCset->eh_timeout.data = (unsigned long ) SCset; - SCset->eh_timeout.expires = jiffies + timeout; -add_timer (&SCset->eh_timeout); - } +/* +* We are using the new error handling code to actually register/deregister +* timers for timeout. +*/ + +if (!timer_pending (&SCset->eh_timeout)) + rtn =0 ; +else + rtn = SCset->eh_timeout.expires - jiffies; + +if (timeout ==0 ) { +del_timer (&SCset->eh_timeout); + SCset->eh_timeout.data = (unsigned long )NULL ; + SCset->eh_timeout.expires =0 ; + }else { +if (SCset->eh_timeout.data != (unsigned long )NULL ) +del_timer (&SCset->eh_timeout); + SCset->eh_timeout.data = (unsigned long )SCset; + SCset->eh_timeout.expires = jiffies + timeout; +add_timer (&SCset->eh_timeout); + }return rtn; } -/* -* Function : int NCR5380_queue_command (Scsi_Cmnd *cmd, -* void (*done)(Scsi_Cmnd *)) +/* +* Function : int NCR5380_queue_command (Scsi_Cmnd *cmd, +* void (*done)(Scsi_Cmnd *)) * * Purpose : enqueues a SCSI command * * Inputs : cmd - SCSI command, done - function called on completion, with * a pointer to the command descriptor. -* +* * Returns : 0 * -* Side effects : -* cmd is added to the per instance issue_queue, with minor -* twiddling done to the host specific fields of cmd. If the +* Side effects : +* cmd is added to the per instance issue_queue, with minor +* twiddling done to the host specific fields of cmd. If the * main coroutine is not running, it is restarted. * */ -static -int NCR5380_queue_command (Scsi_Cmnd *cmd,void (*done)(Scsi_Cmnd *)) +static int NCR5380_queue_command (Scsi_Cmnd *cmd,void (*done)(Scsi_Cmnd *)) { -SETUP_HOSTDATA (cmd->device->host); -Scsi_Cmnd *tmp; -int oldto; -unsigned long flags; -// extern int update_timeout(Scsi_Cmnd * SCset, int timeout); +SETUP_HOSTDATA (cmd->device->host); +Scsi_Cmnd *tmp; +int oldto; +unsigned long flags; +// extern int update_timeout(Scsi_Cmnd * SCset, int timeout); #if (NDEBUG &NDEBUG_NO_WRITE ) -switch (cmd->cmnd[0 ]) { -case WRITE_6 : -case WRITE_10 : -printk (KERN_NOTICE "scsi%d: WRITE attempted with NO_WRITE debugging flag set\n" , -H_NO (cmd)); - cmd->result = (DID_ERROR <<16 ); -done (cmd); -return 0 ; - } +switch (cmd->cmnd[0 ]) { +case WRITE_6 : +case WRITE_10 : +printk (KERN_NOTICE "scsi%d: WRITE attempted with NO_WRITE debugging flag set\n" , +H_NO (cmd)); + cmd->result = (DID_ERROR <<16 ); +done (cmd); +return 0 ; + }#endif /* (NDEBUG & NDEBUG_NO_WRITE) */ -#ifdef NCR5380_STATS # if 0 -if (!hostdata->connected && !hostdata->issue_queue && - !hostdata->disconnected_queue) { - hostdata->timebase = jiffies; - } +if (!hostdata->connected && !hostdata->issue_queue && + !hostdata->disconnected_queue) { + hostdata->timebase = jiffies; + }# endif # ifdef NCR5380_STAT_LIMIT - if (cmd->request_bufflen > NCR5380_STAT_LIMIT) + if (cmd->request_bufflen > NCR5380_STAT_LIMIT)# endif -switch (cmd->cmnd[0 ]) - { -case WRITE : -case WRITE_6 : -case WRITE_10 : - hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase); - hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen; - hostdata->pendingw++; -break ; -case READ : -case READ_6 : -case READ_10 : - hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase); - hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen; - hostdata->pendingr++; -break ; - } -#endif - -/* -* We use the host_scribble field as a pointer to the next command -* in a queue -*/ - -NEXT (cmd) =NULL ; - cmd->scsi_done = done; - - cmd->result =0 ; - - -/* -* Insert the cmd into the issue queue. Note that REQUEST SENSE -* commands are added to the head of the queue since any command will -* clear the contingent allegiance condition that exists and the -* sense data is only guaranteed to be valid while the condition exists. -*/ - -local_irq_save (flags); -/* ++guenther: now that the issue queue is being set up, we can lock ST-DMA. -* Otherwise a running NCR5380_main may steal the lock. -* Lock before actually inserting due to fairness reasons explained in -* atari_scsi.c. If we insert first, then it's impossible for this driver -* to release the lock. -* Stop timer for this command while waiting for the lock, or timeouts -* may happen (and they really do), and it's no good if the command doesn't -* appear in any of the queues. -* ++roman: Just disabling the NCR interrupt isn't sufficient here, -* because also a timer int can trigger an abort or reset, which would -* alter queues and touch the lock. -*/ -if (!IS_A_TT ()) { - oldto =atari_scsi_update_timeout (cmd,0 ); -falcon_get_lock (); -atari_scsi_update_timeout (cmd, oldto); - } -if (!(hostdata->issue_queue) || (cmd->cmnd[0 ] ==REQUEST_SENSE )) { -LIST (cmd, hostdata->issue_queue); -NEXT (cmd) = hostdata->issue_queue; - hostdata->issue_queue = cmd; - }else { -for (tmp = (Scsi_Cmnd *)hostdata->issue_queue; -NEXT (tmp); tmp =NEXT (tmp)) - ; -LIST (cmd, tmp); -NEXT (tmp) = cmd; - } -local_irq_restore (flags); - -QU_PRINTK ("scsi%d: command added to %s of queue\n" ,H_NO (cmd), - (cmd->cmnd[0 ] ==REQUEST_SENSE ) ?"head" :"tail" ); - -/* If queue_command() is called from an interrupt (real one or bottom -* half), we let queue_main() do the job of taking care about main. If it -* is already running, this is a no-op, else main will be queued. -* -* If we're not in an interrupt, we can call NCR5380_main() -* unconditionally, because it cannot be already running. -*/ -if (in_interrupt () || ((flags >>8 ) &7 ) >=6 ) -queue_main (); -else -NCR5380_main (NULL ); -return 0 ; -} - -/* -* Function : NCR5380_main (void) -* -* Purpose : NCR5380_main is a coroutine that runs as long as more work can -* be done on the NCR5380 host adapters in a system. Both -* NCR5380_queue_command() and NCR5380_intr() will try to start it +switch (cmd->cmnd[0 ]) { +case WRITE : +case WRITE_6 : +case WRITE_10 : + hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase); + hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen; + hostdata->pendingw++; +break ; +case READ : +case READ_6 : +case READ_10 : + hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase); + hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen; + hostdata->pendingr++; +break ; + } +#endif + +/* +* We use the host_scribble field as a pointer to the next command +* in a queue +*/ + +NEXT (cmd) =NULL ; + cmd->scsi_done = done; + + cmd->result =0 ; + +/* +* Insert the cmd into the issue queue. Note that REQUEST SENSE +* commands are added to the head of the queue since any command will +* clear the contingent allegiance condition that exists and the +* sense data is only guaranteed to be valid while the condition exists. +*/ + +local_irq_save (flags); +/* ++guenther: now that the issue queue is being set up, we can lock ST-DMA. +* Otherwise a running NCR5380_main may steal the lock. +* Lock before actually inserting due to fairness reasons explained in +* atari_scsi.c. If we insert first, then it's impossible for this driver +* to release the lock. +* Stop timer for this command while waiting for the lock, or timeouts +* may happen (and they really do), and it's no good if the command doesn't +* appear in any of the queues. +* ++roman: Just disabling the NCR interrupt isn't sufficient here, +* because also a timer int can trigger an abort or reset, which would +* alter queues and touch the lock. +*/ +if (!IS_A_TT ()) { + oldto =atari_scsi_update_timeout (cmd,0 ); +falcon_get_lock (); +atari_scsi_update_timeout (cmd, oldto); + } +if (!(hostdata->issue_queue) || (cmd->cmnd[0 ] ==REQUEST_SENSE )) { +LIST (cmd, hostdata->issue_queue); +NEXT (cmd) = hostdata->issue_queue; + hostdata->issue_queue = cmd; + }else { +for (tmp = (Scsi_Cmnd *)hostdata->issue_queue; +NEXT (tmp); tmp =NEXT (tmp)) + ; +LIST (cmd, tmp); +NEXT (tmp) = cmd; + } +local_irq_restore (flags); + +QU_PRINTK ("scsi%d: command added to %s of queue\n" ,H_NO (cmd), + (cmd->cmnd[0 ] ==REQUEST_SENSE ) ?"head" :"tail" ); + +/* If queue_command() is called from an interrupt (real one or bottom +* half), we let queue_main() do the job of taking care about main. If it +* is already running, this is a no-op, else main will be queued. +* +* If we're not in an interrupt, we can call NCR5380_main() +* unconditionally, because it cannot be already running. +*/ +if (in_interrupt () || ((flags >>8 ) &7 ) >=6 ) +queue_main (); +else +NCR5380_main (NULL ); +return 0 ; +} + +/* +* Function : NCR5380_main (void) +* +* Purpose : NCR5380_main is a coroutine that runs as long as more work can +* be done on the NCR5380 host adapters in a system. Both +* NCR5380_queue_command() and NCR5380_intr() will try to start it * in case it is not running. -* -* NOTE : NCR5380_main exits with interrupts *disabled*, the caller should +* +* NOTE : NCR5380_main exits with interrupts *disabled*, the caller should * reenable them. This prevents reentrancy and kernel stack overflow. -*/ - -static void NCR5380_main (void *bl) -{ -Scsi_Cmnd *tmp, *prev; -struct Scsi_Host *instance = first_instance; -struct NCR5380_hostdata *hostdata =HOSTDATA (instance); -int done; -unsigned long flags; - -/* -* We run (with interrupts disabled) until we're sure that none of -* the host adapters have anything that can be done, at which point -* we set main_running to 0 and exit. -* -* Interrupts are enabled before doing various other internal -* instructions, after we've decided that we need to run through -* the loop again. -* -* this should prevent any race conditions. -* -* ++roman: Just disabling the NCR interrupt isn't sufficient here, -* because also a timer int can trigger an abort or reset, which can -* alter queues and touch the Falcon lock. -*/ - -/* Tell int handlers main() is now already executing. Note that -no races are possible here. If an int comes in before -'main_running' is set here, and queues/executes main via the -task queue, it doesn't do any harm, just this instance of main -won't find any work left to do. */ -if (main_running) -return ; - main_running =1 ; - -local_save_flags (flags); -do { -local_irq_disable ();/* Freeze request queues */ - done =1 ; - -if (!hostdata->connected) { -MAIN_PRINTK ("scsi%d: not connected\n" ,HOSTNO ); -/* -* Search through the issue_queue for a command destined -* for a target that's not busy. -*/ +*/ + +static void NCR5380_main (void *bl) +{ +Scsi_Cmnd *tmp, *prev; +struct Scsi_Host *instance = first_instance; +struct NCR5380_hostdata *hostdata =HOSTDATA (instance); +int done; +unsigned long flags; + +/* +* We run (with interrupts disabled) until we're sure that none of +* the host adapters have anything that can be done, at which point +* we set main_running to 0 and exit. +* +* Interrupts are enabled before doing various other internal +* instructions, after we've decided that we need to run through +* the loop again. +* +* this should prevent any race conditions. +* +* ++roman: Just disabling the NCR interrupt isn't sufficient here, +* because also a timer int can trigger an abort or reset, which can +* alter queues and touch the Falcon lock. +*/ + +/* Tell int handlers main() is now already executing. Note that +no races are possible here. If an int comes in before +'main_running' is set here, and queues/executes main via the +task queue, it doesn't do any harm, just this instance of main +won't find any work left to do. */ +if (main_running) +return ; + main_running =1 ; + +local_save_flags (flags); +do { +local_irq_disable ();/* Freeze request queues */ + done =1 ; + +if (!hostdata->connected) { +MAIN_PRINTK ("scsi%d: not connected\n" ,HOSTNO ); +/* +* Search through the issue_queue for a command destined +* for a target that's not busy. +*/ #if (NDEBUG &NDEBUG_LISTS ) -for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, prev =NULL ; - tmp && (tmp != prev); prev = tmp, tmp =NEXT (tmp)) - ; -/*printk("%p ", tmp);*/ -if ((tmp == prev) && tmp)printk (" LOOP\n" );/* else printk("\n");*/ +for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, prev =NULL ; + tmp && (tmp != prev); prev = tmp, tmp =NEXT (tmp)) + ; +/*printk("%p ", tmp);*/ +if ((tmp == prev) && tmp) +printk (" LOOP\n" ); +/* else printk("\n"); */ #endif -for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, - prev =NULL ; tmp; prev = tmp, tmp =NEXT (tmp) ) { +for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, + prev =NULL ; tmp; prev = tmp, tmp =NEXT (tmp)) {#if (NDEBUG &NDEBUG_LISTS ) -if (prev != tmp) -printk ("MAIN tmp=%p target=%d busy=%d lun=%d\n" , - tmp, tmp->device->id, hostdata->busy[tmp->device->id], - tmp->device->lun); -#endif -/* When we find one, remove it from the issue queue. */ -/* ++guenther: possible race with Falcon locking */ - if ( +if (prev != tmp) +printk ("MAIN tmp=%p target=%d busy=%d lun=%d\n" , + tmp, tmp->device->id, hostdata->busy[tmp->device->id], + tmp->device->lun); +#endif +/* When we find one, remove it from the issue queue. */ +/* ++guenther: possible race with Falcon locking */ + if (#ifdef SUPPORT_TAGS - !is_lun_busy( tmp, tmp->cmnd[0] != REQUEST_SENSE) + !is_lun_busy( tmp, tmp->cmnd[0] != REQUEST_SENSE)#else - !(hostdata->busy[tmp->device->id] & (1 << tmp->device->lun)) + !(hostdata->busy[tmp->device->id] & (1 << tmp->device->lun)) #endif - ) { -/* ++guenther: just to be sure, this must be atomic */ -local_irq_disable (); -if (prev) { -REMOVE (prev,NEXT (prev), tmp,NEXT (tmp)); -NEXT (prev) =NEXT (tmp); - }else { -REMOVE (-1 , hostdata->issue_queue, tmp,NEXT (tmp)); - hostdata->issue_queue =NEXT (tmp); - } -NEXT (tmp) =NULL ; - falcon_dont_release++; - -/* reenable interrupts after finding one */ -local_irq_restore (flags); - -/* -* Attempt to establish an I_T_L nexus here. -* On success, instance->hostdata->connected is set. -* On failure, we must add the command back to the -* issue queue so we can keep trying. -*/ -MAIN_PRINTK ("scsi%d: main(): command for target %d " -"lun %d removed from issue_queue\n" , -HOSTNO , tmp->device->id, tmp->device->lun); -/* -* REQUEST SENSE commands are issued without tagged -* queueing, even on SCSI-II devices because the -* contingent allegiance condition exists for the -* entire unit. -*/ -/* ++roman: ...and the standard also requires that -* REQUEST SENSE command are untagged. -*/ - + ) { +/* ++guenther: just to be sure, this must be atomic */ +local_irq_disable (); +if (prev) { +REMOVE (prev,NEXT (prev), tmp,NEXT (tmp)); +NEXT (prev) =NEXT (tmp); + }else { +REMOVE (-1 , hostdata->issue_queue, tmp,NEXT (tmp)); + hostdata->issue_queue =NEXT (tmp); + } +NEXT (tmp) =NULL ; + falcon_dont_release++; + +/* reenable interrupts after finding one */ +local_irq_restore (flags); + +/* +* Attempt to establish an I_T_L nexus here. +* On success, instance->hostdata->connected is set. +* On failure, we must add the command back to the +* issue queue so we can keep trying. +*/ +MAIN_PRINTK ("scsi%d: main(): command for target %d " +"lun %d removed from issue_queue\n" , +HOSTNO , tmp->device->id, tmp->device->lun); +/* +* REQUEST SENSE commands are issued without tagged +* queueing, even on SCSI-II devices because the +* contingent allegiance condition exists for the +* entire unit. +*/ +/* ++roman: ...and the standard also requires that +* REQUEST SENSE command are untagged. +*/ +#ifdef SUPPORT_TAGS -cmd_get_tag ( tmp, tmp->cmnd[0 ] !=REQUEST_SENSE ); +cmd_get_tag (tmp, tmp->cmnd[0 ] !=REQUEST_SENSE );#endif -if (!NCR5380_select (instance, tmp, - (tmp->cmnd[0 ] ==REQUEST_SENSE ) ?TAG_NONE : -TAG_NEXT )) { - falcon_dont_release--; -/* release if target did not response! */ -falcon_release_lock_if_possible ( hostdata ); -break ; - }else { -local_irq_disable (); -LIST (tmp, hostdata->issue_queue); -NEXT (tmp) = hostdata->issue_queue; - hostdata->issue_queue = tmp; +if (!NCR5380_select (instance, tmp, + (tmp->cmnd[0 ] ==REQUEST_SENSE ) ?TAG_NONE : +TAG_NEXT )) { + falcon_dont_release--; +/* release if target did not response! */ +falcon_release_lock_if_possible (hostdata); +break ; + }else { +local_irq_disable (); +LIST (tmp, hostdata->issue_queue); +NEXT (tmp) = hostdata->issue_queue; + hostdata->issue_queue = tmp;#ifdef SUPPORT_TAGS -cmd_free_tag ( tmp ); +cmd_free_tag (tmp);#endif - falcon_dont_release--; -local_irq_restore (flags); -MAIN_PRINTK ("scsi%d: main(): select() failed, " -"returned to issue_queue\n" ,HOSTNO ); -if (hostdata->connected) -break ; - } - } /* if target/lun/target queue is not busy */ - }/* for issue_queue */ - }/* if (!hostdata->connected) */ - -if (hostdata->connected + falcon_dont_release--; +local_irq_restore (flags); +MAIN_PRINTK ("scsi%d: main(): select() failed, " +"returned to issue_queue\n" ,HOSTNO ); +if (hostdata->connected) +break ; + } + } /* if target/lun/target queue is not busy */ + }/* for issue_queue */ + }/* if (!hostdata->connected) */ + +if (hostdata->connected #ifdef REAL_DMA - && !hostdata->dma_len + && !hostdata->dma_len #endif - ) { -local_irq_restore (flags); -MAIN_PRINTK ("scsi%d: main: performing information transfer\n" , -HOSTNO ); -NCR5380_information_transfer (instance); -MAIN_PRINTK ("scsi%d: main: done set false\n" ,HOSTNO ); - done =0 ; - } - }while (!done); - -/* Better allow ints _after_ 'main_running' has been cleared, else -an interrupt could believe we'll pick up the work it left for -us, but we won't see it anymore here... */ - main_running =0 ; -local_irq_restore (flags); + ) { +local_irq_restore (flags); +MAIN_PRINTK ("scsi%d: main: performing information transfer\n" , +HOSTNO ); +NCR5380_information_transfer (instance); +MAIN_PRINTK ("scsi%d: main: done set false\n" ,HOSTNO ); + done =0 ; + } + }while (!done); + +/* Better allow ints _after_ 'main_running' has been cleared, else +an interrupt could believe we'll pick up the work it left for +us, but we won't see it anymore here... */ + main_running =0 ; +local_irq_restore (flags); }
@@ -1223,1441 +1235,1439 @@ static void NCR5380_main (void *bl)* Function : void NCR5380_dma_complete (struct Scsi_Host *instance) * * Purpose : Called by interrupt handler when DMA finishes or a phase -* mismatch occurs (which would finish the DMA transfer). +* mismatch occurs (which would finish the DMA transfer). * * Inputs : instance - this instance of the NCR5380. * */ -static void NCR5380_dma_complete (struct Scsi_Host *instance ) +static void NCR5380_dma_complete (struct Scsi_Host *instance) { -SETUP_HOSTDATA (instance); -int transfered, saved_data =0 , overrun =0 , cnt, toPIO; -unsigned char **data, p; -volatile int *count; - -if (!hostdata->connected) { -printk (KERN_WARNING "scsi%d: received end of DMA interrupt with " -"no connected cmd\n" ,HOSTNO ); -return ; - } - -if (atari_read_overruns) { - p = hostdata->connected->SCp.phase; -if (p &SR_IO ) { -udelay (10 ); -if ((((NCR5380_read (BUS_AND_STATUS_REG )) & - (BASR_PHASE_MATCH |BASR_ACK )) == - (BASR_PHASE_MATCH |BASR_ACK ))) { - saved_data =NCR5380_read (INPUT_DATA_REG ); - overrun =1 ; -DMA_PRINTK ("scsi%d: read overrun handled\n" ,HOSTNO ); - } - } - } - -DMA_PRINTK ("scsi%d: real DMA transfer complete, basr 0x%X, sr 0x%X\n" , -HOSTNO ,NCR5380_read (BUS_AND_STATUS_REG ), -NCR5380_read (STATUS_REG )); - - (void )NCR5380_read (RESET_PARITY_INTERRUPT_REG ); -NCR5380_write (MODE_REG ,MR_BASE ); -NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); - - transfered = hostdata->dma_len -NCR5380_dma_residual (instance); - hostdata->dma_len =0 ; - - data = (unsigned char **) &(hostdata->connected->SCp.ptr); - count = &(hostdata->connected->SCp.this_residual); - *data += transfered; - *count -= transfered; - -if (atari_read_overruns) { -if ((NCR5380_read (STATUS_REG ) &PHASE_MASK ) == p && (p &SR_IO )) { - cnt = toPIO = atari_read_overruns; -if (overrun) { -DMA_PRINTK ("Got an input overrun, using saved byte\n" ); - *(*data)++ = saved_data; - (*count)--; - cnt--; - toPIO--; - } -DMA_PRINTK ("Doing %d-byte PIO to 0x%08lx\n" , cnt, (long )*data); -NCR5380_transfer_pio (instance, &p, &cnt, data); - *count -= toPIO - cnt; +SETUP_HOSTDATA (instance); +int transfered, saved_data =0 , overrun =0 , cnt, toPIO; +unsigned char **data, p; +volatile int *count; + +if (!hostdata->connected) { +printk (KERN_WARNING "scsi%d: received end of DMA interrupt with " +"no connected cmd\n" ,HOSTNO ); +return ; + } + +if (atari_read_overruns) { + p = hostdata->connected->SCp.phase; +if (p &SR_IO ) { +udelay (10 ); +if ((NCR5380_read (BUS_AND_STATUS_REG ) & + (BASR_PHASE_MATCH |BASR_ACK )) == + (BASR_PHASE_MATCH |BASR_ACK )) { + saved_data =NCR5380_read (INPUT_DATA_REG ); + overrun =1 ; +DMA_PRINTK ("scsi%d: read overrun handled\n" ,HOSTNO ); + } + } + } + +DMA_PRINTK ("scsi%d: real DMA transfer complete, basr 0x%X, sr 0x%X\n" , +HOSTNO ,NCR5380_read (BUS_AND_STATUS_REG ), +NCR5380_read (STATUS_REG )); + + (void )NCR5380_read (RESET_PARITY_INTERRUPT_REG ); +NCR5380_write (MODE_REG ,MR_BASE ); +NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); + + transfered = hostdata->dma_len -NCR5380_dma_residual (instance); + hostdata->dma_len =0 ; + + data = (unsigned char **)&hostdata->connected->SCp.ptr; + count = &hostdata->connected->SCp.this_residual; + *data += transfered; + *count -= transfered; + +if (atari_read_overruns) { +if ((NCR5380_read (STATUS_REG ) &PHASE_MASK ) == p && (p &SR_IO )) { + cnt = toPIO = atari_read_overruns; +if (overrun) { +DMA_PRINTK ("Got an input overrun, using saved byte\n" ); + *(*data)++ = saved_data; + (*count)--; + cnt--; + toPIO--; + } +DMA_PRINTK ("Doing %d-byte PIO to 0x%08lx\n" , cnt, (long )*data); +NCR5380_transfer_pio (instance, &p, &cnt, data); + *count -= toPIO - cnt; + } } - } }#endif /* REAL_DMA */ /* * Function : void NCR5380_intr (int irq) -* +* * Purpose : handle interrupts, reestablishing I_T_L or I_T_L_Q nexuses -* from the disconnected queue, and restarting NCR5380_main() +* from the disconnected queue, and restarting NCR5380_main() * as required. * * Inputs : int irq, irq that caused this interrupt. * */ -static irqreturn_t NCR5380_intr (int irq,void *dev_id) +static irqreturn_t NCR5380_intr (int irq,void *dev_id) { -struct Scsi_Host *instance = first_instance; -int done =1 , handled =0 ; -unsigned char basr; - -INT_PRINTK ("scsi%d: NCR5380 irq triggered\n" ,HOSTNO ); - -/* Look for pending interrupts */ - basr =NCR5380_read (BUS_AND_STATUS_REG ); -INT_PRINTK ("scsi%d: BASR=%02x\n" ,HOSTNO , basr); -/* dispatch to appropriate routine if found and done=0 */ -if (basr &BASR_IRQ ) { -NCR_PRINT (NDEBUG_INTR ); -if ((NCR5380_read (STATUS_REG ) & (SR_SEL |SR_IO )) == (SR_SEL |SR_IO )) { - done =0 ; -ENABLE_IRQ (); -INT_PRINTK ("scsi%d: SEL interrupt\n" ,HOSTNO ); -NCR5380_reselect (instance); - (void )NCR5380_read (RESET_PARITY_INTERRUPT_REG ); - } -else if (basr &BASR_PARITY_ERROR ) { -INT_PRINTK ("scsi%d: PARITY interrupt\n" ,HOSTNO ); - (void )NCR5380_read (RESET_PARITY_INTERRUPT_REG ); - } -else if ((NCR5380_read (STATUS_REG ) &SR_RST ) ==SR_RST ) { -INT_PRINTK ("scsi%d: RESET interrupt\n" ,HOSTNO ); - (void )NCR5380_read (RESET_PARITY_INTERRUPT_REG ); - } -else { -/* -* The rest of the interrupt conditions can occur only during a -* DMA transfer -*/ +struct Scsi_Host *instance = first_instance; +int done =1 , handled =0 ; +unsigned char basr; + +INT_PRINTK ("scsi%d: NCR5380 irq triggered\n" ,HOSTNO ); + +/* Look for pending interrupts */ + basr =NCR5380_read (BUS_AND_STATUS_REG ); +INT_PRINTK ("scsi%d: BASR=%02x\n" ,HOSTNO , basr); +/* dispatch to appropriate routine if found and done=0 */ +if (basr &BASR_IRQ ) { +NCR_PRINT (NDEBUG_INTR ); +if ((NCR5380_read (STATUS_REG ) & (SR_SEL |SR_IO )) == (SR_SEL |SR_IO )) { + done =0 ; +ENABLE_IRQ (); +INT_PRINTK ("scsi%d: SEL interrupt\n" ,HOSTNO ); +NCR5380_reselect (instance); + (void )NCR5380_read (RESET_PARITY_INTERRUPT_REG ); + }else if (basr &BASR_PARITY_ERROR ) { +INT_PRINTK ("scsi%d: PARITY interrupt\n" ,HOSTNO ); + (void )NCR5380_read (RESET_PARITY_INTERRUPT_REG ); + }else if ((NCR5380_read (STATUS_REG ) &SR_RST ) ==SR_RST ) { +INT_PRINTK ("scsi%d: RESET interrupt\n" ,HOSTNO ); + (void )NCR5380_read (RESET_PARITY_INTERRUPT_REG ); + }else { +/* +* The rest of the interrupt conditions can occur only during a +* DMA transfer +*/ #if defined(REAL_DMA ) -/* -* We should only get PHASE MISMATCH and EOP interrupts if we have -* DMA enabled, so do a sanity check based on the current setting -* of the MODE register. -*/ - -if ((NCR5380_read (MODE_REG ) &MR_DMA_MODE ) && - ((basr &BASR_END_DMA_TRANSFER ) || - !(basr &BASR_PHASE_MATCH ))) { - -INT_PRINTK ("scsi%d: PHASE MISM or EOP interrupt\n" ,HOSTNO ); -NCR5380_dma_complete ( instance ); - done =0 ; -ENABLE_IRQ (); - } else +/* +* We should only get PHASE MISMATCH and EOP interrupts if we have +* DMA enabled, so do a sanity check based on the current setting +* of the MODE register. +*/ + +if ((NCR5380_read (MODE_REG ) &MR_DMA_MODE ) && + ((basr &BASR_END_DMA_TRANSFER ) || + !(basr &BASR_PHASE_MATCH ))) { + +INT_PRINTK ("scsi%d: PHASE MISM or EOP interrupt\n" ,HOSTNO ); +NCR5380_dma_complete ( instance ); + done =0 ; +ENABLE_IRQ (); + } else#endif /* REAL_DMA */ - { + {/* MS: Ignore unknown phase mismatch interrupts (caused by EOP interrupt) */ -if (basr &BASR_PHASE_MATCH ) -printk (KERN_NOTICE "scsi%d: unknown interrupt, " -"BASR 0x%x, MR 0x%x, SR 0x%x\n" , -HOSTNO , basr,NCR5380_read (MODE_REG ), -NCR5380_read (STATUS_REG )); - (void )NCR5380_read (RESET_PARITY_INTERRUPT_REG ); - } - }/* if !(SELECTION || PARITY) */ - handled =1 ; - }/* BASR & IRQ */ -else { -printk (KERN_NOTICE "scsi%d: interrupt without IRQ bit set in BASR, " -"BASR 0x%X, MR 0x%X, SR 0x%x\n" ,HOSTNO , basr, -NCR5380_read (MODE_REG ),NCR5380_read (STATUS_REG )); - (void )NCR5380_read (RESET_PARITY_INTERRUPT_REG ); - } - -if (!done) { -INT_PRINTK ("scsi%d: in int routine, calling main\n" ,HOSTNO ); -/* Put a call to NCR5380_main() on the queue... */ -queue_main (); - } -return IRQ_RETVAL (handled); +if (basr &BASR_PHASE_MATCH ) +printk (KERN_NOTICE "scsi%d: unknown interrupt, " +"BASR 0x%x, MR 0x%x, SR 0x%x\n" , +HOSTNO , basr,NCR5380_read (MODE_REG ), +NCR5380_read (STATUS_REG )); + (void )NCR5380_read (RESET_PARITY_INTERRUPT_REG ); + } + }/* if !(SELECTION || PARITY) */ + handled =1 ; + }/* BASR & IRQ */ else { +printk (KERN_NOTICE "scsi%d: interrupt without IRQ bit set in BASR, " +"BASR 0x%X, MR 0x%X, SR 0x%x\n" ,HOSTNO , basr, +NCR5380_read (MODE_REG ),NCR5380_read (STATUS_REG )); + (void )NCR5380_read (RESET_PARITY_INTERRUPT_REG ); + } + +if (!done) { +INT_PRINTK ("scsi%d: in int routine, calling main\n" ,HOSTNO ); +/* Put a call to NCR5380_main() on the queue... */ +queue_main (); + } +return IRQ_RETVAL (handled); }#ifdef NCR5380_STATS -static void collect_stats (struct NCR5380_hostdata * hostdata,Scsi_Cmnd * cmd) +static void collect_stats (struct NCR5380_hostdata * hostdata,Scsi_Cmnd *cmd) {# ifdef NCR5380_STAT_LIMIT - if (cmd->request_bufflen > NCR5380_STAT_LIMIT) + if (cmd->request_bufflen > NCR5380_STAT_LIMIT)# endif -switch (cmd->cmnd[0 ]) - { -case WRITE : -case WRITE_6 : -case WRITE_10 : - hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase); -/*hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;*/ - hostdata->pendingw--; -break ; -case READ : -case READ_6 : -case READ_10 : - hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase); -/*hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;*/ - hostdata->pendingr--; -break ; - } +switch (cmd->cmnd[0 ]) { +case WRITE : +case WRITE_6 : +case WRITE_10 : + hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase); +/*hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;*/ + hostdata->pendingw--; +break ; +case READ : +case READ_6 : +case READ_10 : + hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase); +/*hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;*/ + hostdata->pendingr--; +break ; + } }#endif -/* -* Function : int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, +/* +* Function : int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, * int tag); * * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command, -* including ARBITRATION, SELECTION, and initial message out for -* IDENTIFY and queue messages. +* including ARBITRATION, SELECTION, and initial message out for +* IDENTIFY and queue messages. * -* Inputs : instance - instantiation of the 5380 driver on which this -* target lives, cmd - SCSI command to execute, tag - set to TAG_NEXT for -* new tag, TAG_NONE for untagged queueing, otherwise set to the tag for +* Inputs : instance - instantiation of the 5380 driver on which this +* target lives, cmd - SCSI command to execute, tag - set to TAG_NEXT for +* new tag, TAG_NONE for untagged queueing, otherwise set to the tag for * the command that is presently connected. -* +* * Returns : -1 if selection could not execute for some reason, -* 0 if selection succeeded or failed because the target -* did not respond. +* 0 if selection succeeded or failed because the target +* did not respond. * -* Side effects : -* If bus busy, arbitration failed, etc, NCR5380_select() will exit +* Side effects : +* If bus busy, arbitration failed, etc, NCR5380_select() will exit * with registers as they should have been on entry - ie * SELECT_ENABLE will be set appropriately, the NCR5380 * will cease to drive any SCSI bus signals. * -* If successful : I_T_L or I_T_L_Q nexus will be established, -* instance->connected will be set to cmd. -* SELECT interrupt will be disabled. +* If successful : I_T_L or I_T_L_Q nexus will be established, +* instance->connected will be set to cmd. +* SELECT interrupt will be disabled. * -* If failed (no target) : cmd->scsi_done() will be called, and the +* If failed (no target) : cmd->scsi_done() will be called, and the * cmd->result host byte set to DID_BAD_TARGET. */ -static int NCR5380_select (struct Scsi_Host *instance,Scsi_Cmnd *cmd,int tag) +static int NCR5380_select (struct Scsi_Host *instance,Scsi_Cmnd *cmd,int tag) { -SETUP_HOSTDATA (instance); -unsigned char tmp[3 ], phase; -unsigned char *data; -int len; -unsigned long timeout; -unsigned long flags; - - hostdata->restart_select =0 ; -NCR_PRINT (NDEBUG_ARBITRATION ); -ARB_PRINTK ("scsi%d: starting arbitration, id = %d\n" ,HOSTNO , - instance->this_id); - -/* -* Set the phase bits to 0, otherwise the NCR5380 won't drive the -* data bus during SELECTION. -*/ +SETUP_HOSTDATA (instance); +unsigned char tmp[3 ], phase; +unsigned char *data; +int len; +unsigned long timeout; +unsigned long flags; + + hostdata->restart_select =0 ; +NCR_PRINT (NDEBUG_ARBITRATION ); +ARB_PRINTK ("scsi%d: starting arbitration, id = %d\n" ,HOSTNO , + instance->this_id); + +/* +* Set the phase bits to 0, otherwise the NCR5380 won't drive the +* data bus during SELECTION. +*/ -local_irq_save (flags); -if (hostdata->connected) { -local_irq_restore (flags); -return -1 ; - } -NCR5380_write (TARGET_COMMAND_REG ,0 ); +local_irq_save (flags); +if (hostdata->connected) { +local_irq_restore (flags); +return -1 ; + } +NCR5380_write (TARGET_COMMAND_REG ,0 ); +/* +* Start arbitration. +*/ -/* -* Start arbitration. -*/ - -NCR5380_write (OUTPUT_DATA_REG , hostdata->id_mask); -NCR5380_write (MODE_REG ,MR_ARBITRATE ); +NCR5380_write (OUTPUT_DATA_REG , hostdata->id_mask); +NCR5380_write (MODE_REG ,MR_ARBITRATE ); -local_irq_restore (flags); +local_irq_restore (flags); -/* Wait for arbitration logic to complete */ +/* Wait for arbitration logic to complete */ #if defined(NCR_TIMEOUT ) - { -unsigned long timeout = jiffies +2 *NCR_TIMEOUT ; + { +unsigned long timeout = jiffies +2 *NCR_TIMEOUT ; -while (!(NCR5380_read (INITIATOR_COMMAND_REG ) &ICR_ARBITRATION_PROGRESS ) - &&time_before (jiffies, timeout) && !hostdata->connected) - ; -if (time_after_eq (jiffies, timeout)) - { -printk ("scsi : arbitration timeout at %d\n" , __LINE__); -NCR5380_write (MODE_REG ,MR_BASE ); -NCR5380_write (SELECT_ENABLE_REG , hostdata->id_mask); -return -1 ; - } - } +while (!(NCR5380_read (INITIATOR_COMMAND_REG ) &ICR_ARBITRATION_PROGRESS ) && +time_before (jiffies, timeout) && !hostdata->connected) + ; +if (time_after_eq (jiffies, timeout)) { +printk ("scsi : arbitration timeout at %d\n" , __LINE__); +NCR5380_write (MODE_REG ,MR_BASE ); +NCR5380_write (SELECT_ENABLE_REG , hostdata->id_mask); +return -1 ; + } + }#else /* NCR_TIMEOUT */ -while (!(NCR5380_read (INITIATOR_COMMAND_REG ) &ICR_ARBITRATION_PROGRESS ) - && !hostdata->connected); +while (!(NCR5380_read (INITIATOR_COMMAND_REG ) &ICR_ARBITRATION_PROGRESS ) && + !hostdata->connected) + ;#endif -ARB_PRINTK ("scsi%d: arbitration complete\n" ,HOSTNO ); +ARB_PRINTK ("scsi%d: arbitration complete\n" ,HOSTNO ); -if (hostdata->connected) { -NCR5380_write (MODE_REG ,MR_BASE ); -return -1 ; - } -/* -* The arbitration delay is 2.2us, but this is a minimum and there is -* no maximum so we can safely sleep for ceil(2.2) usecs to accommodate -* the integral nature of udelay(). -* -*/ - -udelay (3 ); - -/* Check for lost arbitration */ -if ((NCR5380_read (INITIATOR_COMMAND_REG ) &ICR_ARBITRATION_LOST ) || - (NCR5380_read (CURRENT_SCSI_DATA_REG ) & hostdata->id_higher_mask) || - (NCR5380_read (INITIATOR_COMMAND_REG ) &ICR_ARBITRATION_LOST ) || - hostdata->connected) { -NCR5380_write (MODE_REG ,MR_BASE ); -ARB_PRINTK ("scsi%d: lost arbitration, deasserting MR_ARBITRATE\n" , -HOSTNO ); -return -1 ; - } - -/* after/during arbitration, BSY should be asserted. -IBM DPES-31080 Version S31Q works now */ -/* Tnx to [email protected] for finding this! (Roman) */ -NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE |ICR_ASSERT_SEL | -ICR_ASSERT_BSY ) ; - -if ((NCR5380_read (INITIATOR_COMMAND_REG ) &ICR_ARBITRATION_LOST ) || - hostdata->connected) { -NCR5380_write (MODE_REG ,MR_BASE ); -NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); -ARB_PRINTK ("scsi%d: lost arbitration, deasserting ICR_ASSERT_SEL\n" , -HOSTNO ); -return -1 ; - } - -/* -* Again, bus clear + bus settle time is 1.2us, however, this is -* a minimum so we'll udelay ceil(1.2) -*/ +if (hostdata->connected) { +NCR5380_write (MODE_REG ,MR_BASE ); +return -1 ; + } +/* +* The arbitration delay is 2.2us, but this is a minimum and there is +* no maximum so we can safely sleep for ceil(2.2) usecs to accommodate +* the integral nature of udelay(). +* +*/ + +udelay (3 ); + +/* Check for lost arbitration */ +if ((NCR5380_read (INITIATOR_COMMAND_REG ) &ICR_ARBITRATION_LOST ) || + (NCR5380_read (CURRENT_SCSI_DATA_REG ) & hostdata->id_higher_mask) || + (NCR5380_read (INITIATOR_COMMAND_REG ) &ICR_ARBITRATION_LOST ) || + hostdata->connected) { +NCR5380_write (MODE_REG ,MR_BASE ); +ARB_PRINTK ("scsi%d: lost arbitration, deasserting MR_ARBITRATE\n" , +HOSTNO ); +return -1 ; + } + +/* after/during arbitration, BSY should be asserted. +IBM DPES-31080 Version S31Q works now */ +/* Tnx to [email protected] for finding this! (Roman) */ +NCR5380_write (INITIATOR_COMMAND_REG , +ICR_BASE |ICR_ASSERT_SEL |ICR_ASSERT_BSY ); + +if ((NCR5380_read (INITIATOR_COMMAND_REG ) &ICR_ARBITRATION_LOST ) || + hostdata->connected) { +NCR5380_write (MODE_REG ,MR_BASE ); +NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); +ARB_PRINTK ("scsi%d: lost arbitration, deasserting ICR_ASSERT_SEL\n" , +HOSTNO ); +return -1 ; + } + +/* +* Again, bus clear + bus settle time is 1.2us, however, this is +* a minimum so we'll udelay ceil(1.2) +*/ #ifdef CONFIG_ATARI_SCSI_TOSHIBA_DELAY -/* ++roman: But some targets (see above :-) seem to need a bit more... */ -udelay (15 ); +/* ++roman: But some targets (see above :-) seem to need a bit more... */ +udelay (15 );#else -udelay (2 ); +udelay (2 );#endif - -if (hostdata->connected) { + +if (hostdata->connected) { +NCR5380_write (MODE_REG ,MR_BASE ); +NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); +return -1 ; + } + +ARB_PRINTK ("scsi%d: won arbitration\n" ,HOSTNO ); + +/* +* Now that we have won arbitration, start Selection process, asserting +* the host and target ID's on the SCSI bus. +*/ + +NCR5380_write (OUTPUT_DATA_REG , (hostdata->id_mask | (1 << cmd->device->id))); + +/* +* Raise ATN while SEL is true before BSY goes false from arbitration, +* since this is the only way to guarantee that we'll get a MESSAGE OUT +* phase immediately after selection. +*/ + +NCR5380_write (INITIATOR_COMMAND_REG , (ICR_BASE |ICR_ASSERT_BSY | +ICR_ASSERT_DATA |ICR_ASSERT_ATN |ICR_ASSERT_SEL ));NCR5380_write (MODE_REG ,MR_BASE ); -NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); -return -1 ; - } -ARB_PRINTK ("scsi%d: won arbitration\n" ,HOSTNO ); +/* +* Reselect interrupts must be turned off prior to the dropping of BSY, +* otherwise we will trigger an interrupt. +*/ + +if (hostdata->connected) { +NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); +return -1 ; + } + +NCR5380_write (SELECT_ENABLE_REG ,0 ); -/* -* Now that we have won arbitration, start Selection process, asserting -* the host and target ID's on the SCSI bus. -*/ - -NCR5380_write (OUTPUT_DATA_REG , (hostdata->id_mask | (1 << cmd->device->id))); - -/* -* Raise ATN while SEL is true before BSY goes false from arbitration, -* since this is the only way to guarantee that we'll get a MESSAGE OUT -* phase immediately after selection. -*/ - -NCR5380_write (INITIATOR_COMMAND_REG , (ICR_BASE |ICR_ASSERT_BSY | -ICR_ASSERT_DATA |ICR_ASSERT_ATN |ICR_ASSERT_SEL )); -NCR5380_write (MODE_REG ,MR_BASE ); - -/* -* Reselect interrupts must be turned off prior to the dropping of BSY, -* otherwise we will trigger an interrupt. -*/ +/* +* The initiator shall then wait at least two deskew delays and release +* the BSY signal. +*/ +udelay (1 );/* wingel -- wait two bus deskew delay >2*45ns */ -if (hostdata->connected) { -NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); -return -1 ; - } +/* Reset BSY */ +NCR5380_write (INITIATOR_COMMAND_REG , (ICR_BASE |ICR_ASSERT_DATA | +ICR_ASSERT_ATN |ICR_ASSERT_SEL )); + +/* +* Something weird happens when we cease to drive BSY - looks +* like the board/chip is letting us do another read before the +* appropriate propagation delay has expired, and we're confusing +* a BSY signal from ourselves as the target's response to SELECTION. +* +* A small delay (the 'C++' frontend breaks the pipeline with an +* unnecessary jump, making it work on my 386-33/Trantor T128, the +* tighter 'C' code breaks and requires this) solves the problem - +* the 1 us delay is arbitrary, and only used because this delay will +* be the same on other platforms and since it works here, it should +* work there. +* +* wingel suggests that this could be due to failing to wait +* one deskew delay. +*/ + +udelay (1 ); -NCR5380_write (SELECT_ENABLE_REG ,0 ); +SEL_PRINTK ("scsi%d: selecting target %d\n" ,HOSTNO , cmd->device->id); + +/* +* The SCSI specification calls for a 250 ms timeout for the actual +* selection. +*/ -/* -* The initiator shall then wait at least two deskew delays and release -* the BSY signal. -*/ -udelay (1 );/* wingel -- wait two bus deskew delay >2*45ns */ - -/* Reset BSY */ -NCR5380_write (INITIATOR_COMMAND_REG , (ICR_BASE |ICR_ASSERT_DATA | -ICR_ASSERT_ATN |ICR_ASSERT_SEL )); - -/* -* Something weird happens when we cease to drive BSY - looks -* like the board/chip is letting us do another read before the -* appropriate propagation delay has expired, and we're confusing -* a BSY signal from ourselves as the target's response to SELECTION. -* -* A small delay (the 'C++' frontend breaks the pipeline with an -* unnecessary jump, making it work on my 386-33/Trantor T128, the -* tighter 'C' code breaks and requires this) solves the problem - -* the 1 us delay is arbitrary, and only used because this delay will -* be the same on other platforms and since it works here, it should -* work there. -* -* wingel suggests that this could be due to failing to wait -* one deskew delay. -*/ - -udelay (1 ); - -SEL_PRINTK ("scsi%d: selecting target %d\n" ,HOSTNO , cmd->device->id); - -/* -* The SCSI specification calls for a 250 ms timeout for the actual -* selection. -*/ - - timeout = jiffies +25 ; - -/* -* XXX very interesting - we're seeing a bounce where the BSY we -* asserted is being reflected / still asserted (propagation delay?) -* and it's detecting as true. Sigh. -*/ + timeout = jiffies +25 ; + +/* +* XXX very interesting - we're seeing a bounce where the BSY we +* asserted is being reflected / still asserted (propagation delay?) +* and it's detecting as true. Sigh. +*/ #if 0 -/* ++roman: If a target conformed to the SCSI standard, it wouldn't assert -* IO while SEL is true. But again, there are some disks out the in the -* world that do that nevertheless. (Somebody claimed that this announces -* reselection capability of the target.) So we better skip that test and -* only wait for BSY... (Famous german words: Der Kl�gere gibt nach :-) -*/ - -while (time_before (jiffies, timeout) && !(NCR5380_read (STATUS_REG ) & - (SR_BSY |SR_IO ))); - -if ((NCR5380_read (STATUS_REG ) & (SR_SEL |SR_IO )) == - (SR_SEL |SR_IO )) { -NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); -NCR5380_reselect (instance); -printk (KERN_ERR "scsi%d: reselection after won arbitration?\n" , -HOSTNO ); -NCR5380_write (SELECT_ENABLE_REG , hostdata->id_mask); -return -1 ; - } +/* ++roman: If a target conformed to the SCSI standard, it wouldn't assert +* IO while SEL is true. But again, there are some disks out the in the +* world that do that nevertheless. (Somebody claimed that this announces +* reselection capability of the target.) So we better skip that test and +* only wait for BSY... (Famous german words: Der Klügere gibt nach :-) +*/ + +while (time_before (jiffies, timeout) && + !(NCR5380_read (STATUS_REG ) & (SR_BSY |SR_IO ))) + ; + +if ((NCR5380_read (STATUS_REG ) & (SR_SEL |SR_IO )) == (SR_SEL |SR_IO )) { +NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); +NCR5380_reselect (instance); +printk (KERN_ERR "scsi%d: reselection after won arbitration?\n" , +HOSTNO ); +NCR5380_write (SELECT_ENABLE_REG , hostdata->id_mask); +return -1 ; + }#else -while (time_before (jiffies, timeout) && !(NCR5380_read (STATUS_REG ) &SR_BSY )); +while (time_before (jiffies, timeout) && !(NCR5380_read (STATUS_REG ) &SR_BSY )) + ;#endif -/* -* No less than two deskew delays after the initiator detects the -* BSY signal is true, it shall release the SEL signal and may -* change the DATA BUS. -wingel -*/ +/* +* No less than two deskew delays after the initiator detects the +* BSY signal is true, it shall release the SEL signal and may +* change the DATA BUS. -wingel +*/ -udelay (1 ); +udelay (1 ); -NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE |ICR_ASSERT_ATN ); +NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE |ICR_ASSERT_ATN ); -if (!(NCR5380_read (STATUS_REG ) &SR_BSY )) { -NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); -if (hostdata->targets_present & (1 << cmd->device->id)) { -printk (KERN_ERR "scsi%d: weirdness\n" ,HOSTNO ); -if (hostdata->restart_select) -printk (KERN_NOTICE "\trestart select\n" ); -NCR_PRINT (NDEBUG_ANY ); -NCR5380_write (SELECT_ENABLE_REG , hostdata->id_mask); -return -1 ; - } - cmd->result =DID_BAD_TARGET <<16 ; +if (!(NCR5380_read (STATUS_REG ) &SR_BSY )) { +NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); +if (hostdata->targets_present & (1 << cmd->device->id)) { +printk (KERN_ERR "scsi%d: weirdness\n" ,HOSTNO ); +if (hostdata->restart_select) +printk (KERN_NOTICE "\trestart select\n" ); +NCR_PRINT (NDEBUG_ANY ); +NCR5380_write (SELECT_ENABLE_REG , hostdata->id_mask); +return -1 ; + } + cmd->result =DID_BAD_TARGET <<16 ;#ifdef NCR5380_STATS -collect_stats (hostdata, cmd); +collect_stats (hostdata, cmd);#endif #ifdef SUPPORT_TAGS -cmd_free_tag ( cmd ); +cmd_free_tag (cmd);#endif - cmd->scsi_done (cmd); -NCR5380_write (SELECT_ENABLE_REG , hostdata->id_mask); -SEL_PRINTK ("scsi%d: target did not respond within 250ms\n" ,HOSTNO ); -NCR5380_write (SELECT_ENABLE_REG , hostdata->id_mask); -return 0 ; - } + cmd->scsi_done (cmd); +NCR5380_write (SELECT_ENABLE_REG , hostdata->id_mask); +SEL_PRINTK ("scsi%d: target did not respond within 250ms\n" ,HOSTNO ); +NCR5380_write (SELECT_ENABLE_REG , hostdata->id_mask); +return 0 ; + } + + hostdata->targets_present |= (1 << cmd->device->id); - hostdata->targets_present |= (1 << cmd->device->id); +/* +* Since we followed the SCSI spec, and raised ATN while SEL +* was true but before BSY was false during selection, the information +* transfer phase should be a MESSAGE OUT phase so that we can send the +* IDENTIFY message. +* +* If SCSI-II tagged queuing is enabled, we also send a SIMPLE_QUEUE_TAG +* message (2 bytes) with a tag ID that we increment with every command +* until it wraps back to 0. +* +* XXX - it turns out that there are some broken SCSI-II devices, +* which claim to support tagged queuing but fail when more than +* some number of commands are issued at once. +*/ + +/* Wait for start of REQ/ACK handshake */ +while (!(NCR5380_read (STATUS_REG ) &SR_REQ )) + ; -/* -* Since we followed the SCSI spec, and raised ATN while SEL -* was true but before BSY was false during selection, the information -* transfer phase should be a MESSAGE OUT phase so that we can send the -* IDENTIFY message. -* -* If SCSI-II tagged queuing is enabled, we also send a SIMPLE_QUEUE_TAG -* message (2 bytes) with a tag ID that we increment with every command -* until it wraps back to 0. -* -* XXX - it turns out that there are some broken SCSI-II devices, -* which claim to support tagged queuing but fail when more than -* some number of commands are issued at once. -*/ - -/* Wait for start of REQ/ACK handshake */ -while (!(NCR5380_read (STATUS_REG ) &SR_REQ )); - -SEL_PRINTK ("scsi%d: target %d selected, going into MESSAGE OUT phase.\n" , -HOSTNO , cmd->device->id); - tmp[0 ] =IDENTIFY (1 , cmd->device->lun); +SEL_PRINTK ("scsi%d: target %d selected, going into MESSAGE OUT phase.\n" , +HOSTNO , cmd->device->id); + tmp[0 ] =IDENTIFY (1 , cmd->device->lun);#ifdef SUPPORT_TAGS -if (cmd->tag !=TAG_NONE ) { - tmp[1 ] = hostdata->last_message =SIMPLE_QUEUE_TAG ; - tmp[2 ] = cmd->tag; - len =3 ; - }else - len =1 ; +if (cmd->tag !=TAG_NONE ) { + tmp[1 ] = hostdata->last_message =SIMPLE_QUEUE_TAG ; + tmp[2 ] = cmd->tag; + len =3 ; + }else + len =1 ;#else - len =1 ; - cmd->tag=0 ; + len =1 ; + cmd->tag =0 ;#endif /* SUPPORT_TAGS */ -/* Send message(s) */ - data = tmp; - phase =PHASE_MSGOUT ; -NCR5380_transfer_pio (instance, &phase, &len, &data); -SEL_PRINTK ("scsi%d: nexus established.\n" ,HOSTNO ); -/* XXX need to handle errors here */ - hostdata->connected = cmd; +/* Send message(s) */ + data = tmp; + phase =PHASE_MSGOUT ; +NCR5380_transfer_pio (instance, &phase, &len, &data); +SEL_PRINTK ("scsi%d: nexus established.\n" ,HOSTNO ); +/* XXX need to handle errors here */ + hostdata->connected = cmd;#ifndef SUPPORT_TAGS - hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); -#endif - -initialize_SCp (cmd); + hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); +#endif +initialize_SCp (cmd); -return 0 ; +return 0 ; } -/* -* Function : int NCR5380_transfer_pio (struct Scsi_Host *instance, +/* +* Function : int NCR5380_transfer_pio (struct Scsi_Host *instance, * unsigned char *phase, int *count, unsigned char **data) * * Purpose : transfers data in given phase using polled I/O * -* Inputs : instance - instance of driver, *phase - pointer to -* what phase is expected, *count - pointer to number of +* Inputs : instance - instance of driver, *phase - pointer to +* what phase is expected, *count - pointer to number of * bytes to transfer, **data - pointer to data pointer. -* +* * Returns : -1 when different phase is entered without transferring * maximum number of bytes, 0 if all bytes are transfered or exit * is in same phase. * -* Also, *phase, *count, *data are modified in place. +* Also, *phase, *count, *data are modified in place. * * XXX Note : handling for bus free may be useful. */ /* -* Note : this code is not as quick as it could be, however it +* Note : this code is not as quick as it could be, however it * IS 100% reliable, and for the actual data transfer where speed * counts, we will always do a pseudo DMA or DMA transfer. */ -static int NCR5380_transfer_pio (struct Scsi_Host *instance, -unsigned char *phase,int *count, -unsigned char **data) -{ - registerunsigned char p = *phase, tmp; - registerint c = *count; - registerunsigned char *d = *data; - -/* -* The NCR5380 chip will only drive the SCSI bus when the -* phase specified in the appropriate bits of the TARGET COMMAND -* REGISTER match the STATUS REGISTER -*/ - -NCR5380_write (TARGET_COMMAND_REG ,PHASE_SR_TO_TCR (p)); - -do { -/* -* Wait for assertion of REQ, after which the phase bits will be -* valid -*/ -while (!((tmp =NCR5380_read (STATUS_REG )) &SR_REQ )); - -HSH_PRINTK ("scsi%d: REQ detected\n" ,HOSTNO ); - -/* Check for phase mismatch */ -if ((tmp &PHASE_MASK ) != p) { -PIO_PRINTK ("scsi%d: phase mismatch\n" ,HOSTNO ); -NCR_PRINT_PHASE (NDEBUG_PIO ); -break ; - } - -/* Do actual transfer from SCSI bus to / from memory */ -if (!(p &SR_IO )) -NCR5380_write (OUTPUT_DATA_REG , *d); -else - *d =NCR5380_read (CURRENT_SCSI_DATA_REG ); - - ++d; - -/* -* The SCSI standard suggests that in MSGOUT phase, the initiator -* should drop ATN on the last byte of the message phase -* after REQ has been asserted for the handshake but before -* the initiator raises ACK. -*/ - -if (!(p &SR_IO )) { -if (!((p &SR_MSG ) && c >1 )) { -NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE | -ICR_ASSERT_DATA ); -NCR_PRINT (NDEBUG_PIO ); -NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE | -ICR_ASSERT_DATA |ICR_ASSERT_ACK ); - }else { -NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE | -ICR_ASSERT_DATA |ICR_ASSERT_ATN ); -NCR_PRINT (NDEBUG_PIO ); -NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE | -ICR_ASSERT_DATA |ICR_ASSERT_ATN |ICR_ASSERT_ACK ); - } - }else { -NCR_PRINT (NDEBUG_PIO ); -NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE |ICR_ASSERT_ACK ); - } +static int NCR5380_transfer_pio (struct Scsi_Host *instance, +unsigned char *phase,int *count, +unsigned char **data) +{ + registerunsigned char p = *phase, tmp; + registerint c = *count; + registerunsigned char *d = *data; + +/* +* The NCR5380 chip will only drive the SCSI bus when the +* phase specified in the appropriate bits of the TARGET COMMAND +* REGISTER match the STATUS REGISTER +*/ -while (NCR5380_read (STATUS_REG ) &SR_REQ ); +NCR5380_write (TARGET_COMMAND_REG ,PHASE_SR_TO_TCR (p)); -HSH_PRINTK ("scsi%d: req false, handshake complete\n" ,HOSTNO ); +do { +/* +* Wait for assertion of REQ, after which the phase bits will be +* valid +*/ +while (!((tmp =NCR5380_read (STATUS_REG )) &SR_REQ )) + ; -/* -* We have several special cases to consider during REQ/ACK handshaking : -* 1. We were in MSGOUT phase, and we are on the last byte of the -* message. ATN must be dropped as ACK is dropped. -* -* 2. We are in a MSGIN phase, and we are on the last byte of the -* message. We must exit with ACK asserted, so that the calling -* code may raise ATN before dropping ACK to reject the message. -* -* 3. ACK and ATN are clear and the target may proceed as normal. -*/ -if (!(p ==PHASE_MSGIN && c ==1 )) { -if (p ==PHASE_MSGOUT && c >1 ) -NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE |ICR_ASSERT_ATN ); -else -NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); - } - }while (--c); +HSH_PRINTK ("scsi%d: REQ detected\n" ,HOSTNO ); -PIO_PRINTK ("scsi%d: residual %d\n" ,HOSTNO , c); +/* Check for phase mismatch */ +if ((tmp &PHASE_MASK ) != p) { +PIO_PRINTK ("scsi%d: phase mismatch\n" ,HOSTNO ); +NCR_PRINT_PHASE (NDEBUG_PIO ); +break ; + } - *count = c; - *data = d; - tmp =NCR5380_read (STATUS_REG ); -/* The phase read from the bus is valid if either REQ is (already) -* asserted or if ACK hasn't been released yet. The latter is the case if -* we're in MSGIN and all wanted bytes have been received. */ -if ((tmp &SR_REQ ) || (p ==PHASE_MSGIN && c ==0 )) - *phase = tmp &PHASE_MASK ; -else - *phase =PHASE_UNKNOWN ; +/* Do actual transfer from SCSI bus to / from memory */ +if (!(p &SR_IO )) +NCR5380_write (OUTPUT_DATA_REG , *d); +else + *d =NCR5380_read (CURRENT_SCSI_DATA_REG ); -if (!c || (*phase == p)) -return 0 ; -else -return -1 ; + ++d; + +/* +* The SCSI standard suggests that in MSGOUT phase, the initiator +* should drop ATN on the last byte of the message phase +* after REQ has been asserted for the handshake but before +* the initiator raises ACK. +*/ + +if (!(p &SR_IO )) { +if (!((p &SR_MSG ) && c >1 )) { +NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE |ICR_ASSERT_DATA ); +NCR_PRINT (NDEBUG_PIO ); +NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE | +ICR_ASSERT_DATA |ICR_ASSERT_ACK ); + }else { +NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE | +ICR_ASSERT_DATA |ICR_ASSERT_ATN ); +NCR_PRINT (NDEBUG_PIO ); +NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE | +ICR_ASSERT_DATA |ICR_ASSERT_ATN |ICR_ASSERT_ACK ); + } + }else { +NCR_PRINT (NDEBUG_PIO ); +NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE |ICR_ASSERT_ACK ); + } + +while (NCR5380_read (STATUS_REG ) &SR_REQ ) + ; + +HSH_PRINTK ("scsi%d: req false, handshake complete\n" ,HOSTNO ); + +/* +* We have several special cases to consider during REQ/ACK handshaking : +* 1. We were in MSGOUT phase, and we are on the last byte of the +* message. ATN must be dropped as ACK is dropped. +* +* 2. We are in a MSGIN phase, and we are on the last byte of the +* message. We must exit with ACK asserted, so that the calling +* code may raise ATN before dropping ACK to reject the message. +* +* 3. ACK and ATN are clear and the target may proceed as normal. +*/ +if (!(p ==PHASE_MSGIN && c ==1 )) { +if (p ==PHASE_MSGOUT && c >1 ) +NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE |ICR_ASSERT_ATN ); +else +NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE ); + } + }while (--c); + +PIO_PRINTK ("scsi%d: residual %d\n" ,HOSTNO , c); + + *count = c; + *data = d; + tmp =NCR5380_read (STATUS_REG ); +/* The phase read from the bus is valid if either REQ is (already) +* asserted or if ACK hasn't been released yet. The latter is the case if +* we're in MSGIN and all wanted bytes have been received. +*/ +if ((tmp &SR_REQ ) || (p ==PHASE_MSGIN && c ==0 )) + *phase = tmp &PHASE_MASK ; +else + *phase =PHASE_UNKNOWN ; + +if (!c || (*phase == p)) +return 0 ; +else +return -1 ; }/* * Function : do_abort (Scsi_Host *host) -* -* Purpose : abort the currently established nexus. Should only be -* called from a routine which can drop into a -* +* +* Purpose : abort the currently established nexus. Should only be +* called from a routine which can drop into a +* * Returns : 0 on success, -1 on failure. */ -static int do_abort (struct Scsi_Host *host) +static int do_abort (struct Scsi_Host *host) { -unsigned char tmp, *msgptr, phase; -int len; - -/* Request message out phase */ -NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE |ICR_ASSERT_ATN ); +unsigned char tmp, *msgptr, phase; +int len; -/* -* Wait for the target to indicate a valid phase by asserting -* REQ. Once this happens, we'll have either a MSGOUT phase -* and can immediately send the ABORT message, or we'll have some -* other phase and will have to source/sink data. -* -* We really don't care what value was on the bus or what value -* the target sees, so we just handshake. -*/ - -while (!(tmp =NCR5380_read (STATUS_REG )) &SR_REQ ); - -NCR5380_write (TARGET_COMMAND_REG ,PHASE_SR_TO_TCR (tmp)); - -if ((tmp &PHASE_MASK ) !=PHASE_MSGOUT ) { -NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE |ICR_ASSERT_ATN | -ICR_ASSERT_ACK ); -while (NCR5380_read (STATUS_REG ) &SR_REQ ); +/* Request message out phase */ NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE |ICR_ASSERT_ATN ); - } - - tmp =ABORT ; - msgptr = &tmp; - len =1 ; - phase =PHASE_MSGOUT ; -NCR5380_transfer_pio (host, &phase, &len, &msgptr); - -/* -* If we got here, and the command completed successfully, -* we're about to go into bus free state. -*/ -return len ?-1 :0 ; +/* +* Wait for the target to indicate a valid phase by asserting +* REQ. Once this happens, we'll have either a MSGOUT phase +* and can immediately send the ABORT message, or we'll have some +* other phase and will have to source/sink data. +* +* We really don't care what value was on the bus or what value +* the target sees, so we just handshake. +*/ + +while (!(tmp =NCR5380_read (STATUS_REG )) &SR_REQ ) + ; + +NCR5380_write (TARGET_COMMAND_REG ,PHASE_SR_TO_TCR (tmp)); + +if ((tmp &PHASE_MASK ) !=PHASE_MSGOUT ) { +NCR5380_write (INITIATOR_COMMAND_REG ,ICR_BASE |ICR_ASSERT_ATN | +ICR_ASSERT_ACK );
Lines of this file are not shown. View the raw message.
drivers/scsi/atari_scsi.c +176 -187
363 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Part of the diff is not shown here. View the raw message.
Geert Uytterhoeven
maintainerPATCH 3/33 m68k: Atari SCSI driver compile fixes
In reply to Geert UytterhoevenFrom: Roman Zippel <[email protected]>
Atari SCSI driver compile fixes
--- drivers/scsi/atari_NCR5380.c | 33 +++++---- drivers/scsi/atari_scsi.c | 6 - drivers/scsi/atari_scsi.h | 144 ++++++++----------------------------------- 3 files changed, 49 insertions(+), 134 deletions(-)
drivers/scsi/atari_NCR5380.c +17 -16
@@ -272,8 +272,9 @@ static struct scsi_host_template *the_te (struct NCR5380_hostdata *)(in)->hostdata#define HOSTDATA (in) ((struct NCR5380_hostdata *)(in)->hostdata) -#define NEXT (cmd) ((cmd)->host_scribble) -#define NEXTADDR (cmd) ((Scsi_Cmnd **)&((cmd)->host_scribble)) +#define NEXT (cmd) ((Scsi_Cmnd *)(cmd)->host_scribble) +#define SET_NEXT (cmd,next) ((cmd)->host_scribble = (void *)(next)) +#define NEXTADDR (cmd) ((Scsi_Cmnd **)&(cmd)->host_scribble)#define HOSTNO instance->host_no#define H_NO (cmd) (cmd)->device->host->host_no
@@ -479,7 +480,7 @@ static void merge_contiguous_buffers(Scsvirt_to_phys (page_address (cmd->SCp.buffer[1 ].page) + cmd->SCp.buffer[1].offset) == endaddr;) {MER_PRINTK ("VTOP(%p) == %08lx -> merging\n" , - cmd->SCp.buffer[1 ].address, endaddr); +page_address (cmd->SCp.buffer[1 ].page), endaddr);#if (NDEBUG &NDEBUG_MERGING ) ++cnt;#endif
@@ -1002,7 +1003,7 @@ static int NCR5380_queue_command(Scsi_Cm* in a queue */ -NEXT (cmd) =NULL ; +SET_NEXT (cmd,NULL ); cmd->scsi_done = done; cmd->result =0 ;
@@ -1034,14 +1035,14 @@ static int NCR5380_queue_command(Scsi_Cm }if (!(hostdata->issue_queue) || (cmd->cmnd[0 ] ==REQUEST_SENSE )) {LIST (cmd, hostdata->issue_queue); -NEXT (cmd) = hostdata->issue_queue; +SET_NEXT (cmd, hostdata->issue_queue); hostdata->issue_queue = cmd; }else {for (tmp = (Scsi_Cmnd *)hostdata->issue_queue;NEXT (tmp); tmp =NEXT (tmp)) ;LIST (cmd, tmp); -NEXT (tmp) = cmd; +SET_NEXT (tmp, cmd); }local_irq_restore (flags);
@@ -1149,12 +1150,12 @@ static void NCR5380_main(void *bl)local_irq_disable ();if (prev) {REMOVE (prev,NEXT (prev), tmp,NEXT (tmp)); -NEXT (prev) =NEXT (tmp); +SET_NEXT (prev,NEXT (tmp)); }else {REMOVE (-1 , hostdata->issue_queue, tmp,NEXT (tmp)); hostdata->issue_queue =NEXT (tmp); } -NEXT (tmp) =NULL ; +SET_NEXT (tmp,NULL ); falcon_dont_release++;/* reenable interrupts after finding one */
@@ -1192,7 +1193,7 @@ static void NCR5380_main(void *bl) }else {local_irq_disable ();LIST (tmp, hostdata->issue_queue); -NEXT (tmp) = hostdata->issue_queue; +SET_NEXT (tmp, hostdata->issue_queue); hostdata->issue_queue = tmp;#ifdef SUPPORT_TAGS cmd_free_tag (tmp);
@@ -2295,7 +2296,7 @@ static void NCR5380_information_transferlocal_irq_save (flags);LIST (cmd,hostdata->issue_queue); -NEXT (cmd) = hostdata->issue_queue; +SET_NEXT (cmd, hostdata->issue_queue); hostdata->issue_queue = (Scsi_Cmnd *) cmd;local_irq_restore (flags); QU_PRINTK("scsi%d: REQUEST SENSE added to head of "
@@ -2357,7 +2358,7 @@ static void NCR5380_information_transferlocal_irq_save (flags); cmd->device->disconnect =1 ;LIST (cmd,hostdata->disconnected_queue); -NEXT (cmd) = hostdata->disconnected_queue; +SET_NEXT (cmd, hostdata->disconnected_queue); hostdata->connected =NULL ; hostdata->disconnected_queue = cmd;local_irq_restore (flags);
@@ -2632,12 +2633,12 @@ static void NCR5380_reselect(struct Scsi falcon_dont_release++;if (prev) {REMOVE (prev,NEXT (prev), tmp,NEXT (tmp)); -NEXT (prev) =NEXT (tmp); +SET_NEXT (prev,NEXT (tmp)); }else {REMOVE (-1 , hostdata->disconnected_queue, tmp,NEXT (tmp)); hostdata->disconnected_queue =NEXT (tmp); } -NEXT (tmp) =NULL ; +SET_NEXT (tmp,NULL );break ; } }
@@ -2769,7 +2770,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)if (cmd == tmp) {REMOVE (5 , *prev, tmp,NEXT (tmp)); (*prev) =NEXT (tmp); -NEXT (tmp) =NULL ; +SET_NEXT (tmp,NULL ); tmp->result =DID_ABORT <<16 ;local_irq_restore (flags); ABRT_PRINTK("scsi%d: abort removed command from issue queue.\n",
@@ -2844,7 +2845,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)if (cmd == tmp) {REMOVE (5 , *prev, tmp,NEXT (tmp)); *prev =NEXT (tmp); -NEXT (tmp) =NULL ; +SET_NEXT (tmp,NULL ); tmp->result =DID_ABORT <<16 ;/* We must unlock the tag/LUN immediately here, since the * target goes to BUS FREE and doesn't send us another
@@ -2965,7 +2966,7 @@ static int NCR5380_bus_reset(Scsi_Cmnd *for (i =0 ; (cmd = disconnected_queue); ++i) { disconnected_queue =NEXT (cmd); -NEXT (cmd) =NULL ; +SET_NEXT (cmd,NULL ); cmd->result = (cmd->result &0xffff ) | (DID_RESET <<16 ); cmd->scsi_done (cmd); }
drivers/scsi/atari_scsi.c +3 -3
@@ -69,9 +69,9 @@#define NDEBUG (0) -#define NDEBUG_ABORT 0x800000 -#define NDEBUG_TAGS 0x1000000 -#define NDEBUG_MERGING 0x2000000 +#define NDEBUG_ABORT 0x00100000 +#define NDEBUG_TAGS 0x00200000 +#define NDEBUG_MERGING 0x00400000#define AUTOSENSE /* For the Atari version, use only polled IO or REAL_DMA */
drivers/scsi/atari_scsi.h +29 -115
173 lines not on this page · raw message
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 4/33 m68k: Atari keyboard and mouse support.
In reply to Geert UytterhoevenFrom: Michael Schmitz <[email protected]>
Atari keyboard and mouse support.
(reformating and Kconfig fixes by Roman Zippel)
--- arch/m68k/Kconfig | 3 arch/m68k/atari/Makefile | 1 arch/m68k/atari/atakeyb.c | 730 +++++++++++++++++++++++++++++++++++++++ drivers/input/keyboard/Kconfig | 11 drivers/input/keyboard/Makefile | 1 drivers/input/keyboard/atakbd.c | 134 +++++++ drivers/input/mouse/Kconfig | 11 drivers/input/mouse/Makefile | 1 drivers/input/mouse/atarimouse.c | 160 ++++++++ include/asm-m68k/atarikb.h | 6 include/linux/input.h | 1 11 files changed, 1059 insertions(+)
arch/m68k/Kconfig +3 -0
@@ -409,6 +409,9 @@ config STRAM_PROC help Say Y here to report ST-RAM usage statistics in /proc/stram. +config ATARI_KBD_CORE + bool + config HEARTBEAT bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40 default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300
arch/m68k/atari/Makefile +1 -0
@@ -8,3 +8,4 @@ obj-y := config.o time.o debug.o ataint ifeq ($(CONFIG_PCI),y) obj-$(CONFIG_HADES) += hades-pci.o endif +obj-$(CONFIG_ATARI_KBD_CORE) += atakeyb.o
arch/m68k/atari/atakeyb.c new file +730 -0
730 lines not on this page · raw message
drivers/input/keyboard/Kconfig +11 -0
@@ -164,6 +164,17 @@ config KEYBOARD_AMIGA To compile this driver as a module, choose M here: the module will be called amikbd. +config KEYBOARD_ATARI + tristate "Atari keyboard" + depends on ATARI + select ATARI_KBD_CORE + help + Say Y here if you are running Linux on any Atari and have a keyboard + attached. + + To compile this driver as a module, choose M here: the + module will be called atakbd. + config KEYBOARD_HIL_OLD tristate "HP HIL keyboard support (simple driver)" depends on GSC || HP300
drivers/input/keyboard/Makefile +1 -0
@@ -9,6 +9,7 @@ obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd obj-$(CONFIG_KEYBOARD_LKKBD) += lkkbd.o obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o +obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o obj-$(CONFIG_KEYBOARD_NEWTON) += newtonkbd.o obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o
drivers/input/keyboard/atakbd.c new file +134 -0
134 lines not on this page · raw message
drivers/input/mouse/Kconfig +11 -0
@@ -96,6 +96,17 @@ config MOUSE_AMIGA To compile this driver as a module, choose M here: the module will be called amimouse. +config MOUSE_ATARI + tristate "Atari mouse" + depends on ATARI + select ATARI_KBD_CORE + help + Say Y here if you have an Atari and want its native mouse + supported by the kernel. + + To compile this driver as a module, choose M here: the + module will be called atarimouse. + config MOUSE_RISCPC tristate "Acorn RiscPC mouse" depends on ARCH_ACORN
drivers/input/mouse/Makefile +1 -0
@@ -5,6 +5,7 @@ # Each configuration option enables a list of files. obj-$(CONFIG_MOUSE_AMIGA) += amimouse.o +obj-$(CONFIG_MOUSE_ATARI) += atarimouse.o obj-$(CONFIG_MOUSE_RISCPC) += rpcmouse.o obj-$(CONFIG_MOUSE_INPORT) += inport.o obj-$(CONFIG_MOUSE_LOGIBM) += logibm.o
drivers/input/mouse/atarimouse.c new file +160 -0
160 lines not on this page · raw message
include/asm-m68k/atarikb.h +6 -0
@@ -36,5 +36,11 @@ void ikbd_joystick_disable(void);extern void (*atari_MIDI_interrupt_hook) (void );/* Hook for mouse driver */ extern void (*atari_mouse_interrupt_hook) (char *); +/* Hook for keyboard inputdev driver */ +extern void (*atari_input_keyboard_interrupt_hook) (unsigned char ,char ); +/* Hook for mouse inputdev driver */ +extern void (*atari_input_mouse_interrupt_hook) (char *); + +int atari_keyb_init (void );#endif /* _LINUX_ATARIKB_H */
include/linux/input.h +1 -0
@@ -676,6 +676,7 @@ struct input_absinfo {#define BUS_I2C 0x18#define BUS_HOST 0x19#define BUS_GSC 0x1A +#define BUS_ATARI 0x1B/* * Values describing the status of a force-feedback effect
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Re: [patch 04/33] m68k: Atari keyboard and mouse support.
What's the reason for splitting this up? Things would be a quite a bit simpler if all the code was directly in atakeyb.c.
Quoted 2 lines
+/*
+ *linux/atari/atakeyb.c
This is a good reason why filename comments are a really bad idea :)
arch/m68k/atari/atakeyb.c line 51
Quoted 4 lines
arch/m68k/atari/atakeyb.c new file +4
-0+/* state: 0: off; >0: in progress; >1: 0xf1 received */ +static volatile int ikbd_self_test; +/* timestamp when last received a char */ +static volatile unsigned long self_test_last_rcv;
Please don't use volatile variable in kernel code. While linux/m68k doesn't support smp or preemptible kernels we should at least put in proper synchronization at the API level.
arch/m68k/atari/atakeyb.c line 53
Quoted 2 lines
arch/m68k/atari/atakeyb.c new file +2
-0+/* bitmap of keys reported as broken */ +static unsigned long broken_keys[128 /(sizeof (unsigned long )*8 )] = {0 , };
DECLARE_BITMAP()
arch/m68k/atari/atakeyb.c line 132
Quoted 11 lines
arch/m68k/atari/atakeyb.c new file +11
-0+typedef enum kb_state_t { +KEYBOARD ,AMOUSE ,RMOUSE ,JOYSTICK ,CLOCK ,RESYNC +}KB_STATE_T ; + +#define IS_SYNC_CODE (sc) ((sc) >= 0x04 && (sc) <= 0xfb) + +typedef struct keyboard_state { +unsigned char buf[6 ]; +int len; +KB_STATE_T state; +}KEYBOARD_STATE ;
Please kill the typedefs and shouting names.
drivers/input/mouse/atarimouse.c line 64
Quoted 3 lines
drivers/input/mouse/atarimouse.c new file +3
-0+#ifdef __MODULE__ +MODULE_PARM (mouse_threshold,"2i" ); +#endif
__MODULE__ is never true and even if it was a MODULE_PARM wouldn't compile. use an unconditional module_param instead.
include/linux/input.h struct input_absinfo { · line 679
Quoted 7 lines
include/linux/input.h +1
-0@@ -676,6 +676,7 @@ struct input_absinfo {#define BUS_I2C 0x18#define BUS_HOST 0x19#define BUS_GSC 0x1A +#define BUS_ATARI 0x1B
Is this really a separate bus? Should't we have a BUS_ONBOARD or so instead?
Dmitry Torokhov
maintainerRe: [patch 04/33] m68k: Atari keyboard and mouse support.
Quoted 10 lines · Christoph Hellwig
include/linux/input.h struct input_absinfo { · line 679
Quoted 8 lines
include/linux/input.h +1
-0@@ -676,6 +676,7 @@ struct input_absinfo {#define BUS_I2C 0x18#define BUS_HOST 0x19#define BUS_GSC 0x1A +#define BUS_ATARI 0x1BIs this really a separate bus? Should't we have a
BUS_ONBOARDor so instead?
BUS_HOST shoudl fit the bill.
Signature · 1 line
Dmitry
Re: [patch 04/33] m68k: Atari keyboard and mouse support.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
+#define
BUS_ATARI0x1BIs this really a separate bus? Should't we have a
BUS_ONBOARDor so instead?
BUS_HOSTshoudl fit the bill.
OK, I'll use that one.
Michael
Re: [patch 04/33] m68k: Atari keyboard and mouse support.
In reply to Christoph HellwigQuoted 2 lines · Christoph Hellwig
What's the reason for splitting this up? Things would be a quite a bit simpler if all the code was directly in
atakeyb.c.
Simple: I assumed that keeping the input driver code with the other input stuff was the Right Thing. I can move everything back to atakeyb.c if that's preferred.
Quoted 2 lines
Quoted 2 lines
+/*
+ *linux/atari/atakeyb.c
Shall I update that path, then? :-)
Honestly - no one had worked on the Atari code for years, and my number one priority was to get it back into functional state. I'll keep your suggestions in mind when merging the low-level and input parts.
Michael
Re: [patch 04/33] m68k: Atari keyboard and mouse support.
Quoted 8 lines · Michael Schmitz
Quoted 2 lines · Christoph Hellwig
What's the reason for splitting this up? Things would be a quite a bit simpler if all the code was directly in
atakeyb.c.Simple: I assumed that keeping the input driver code with the other input stuff was the Right Thing. I can move everything back to
atakeyb.cif that's preferred.
I think keeping it all under arch/ makes more sense. drivers/input/ makes a lot of sense where we have keyboard controllers that are used on various architectures with slightly different glue, or different controllers for the same busses. IF you have really totally architecture specific input devices that require intimate arch knowledge it probably makes more sense to keep them there.
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
+/*
+ *linux/atari/atakeyb.cShall I update that path, then? :-)
Just remove it.
Re: [patch 04/33] m68k: Atari keyboard and mouse support.
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
What's the reason for splitting this up? Things would be a quite a bit simpler if all the code was directly in
atakeyb.c.Simple: I assumed that keeping the input driver code with the other input stuff was the Right Thing. I can move everything back to
atakeyb.cif that's preferred.
Quoted 6 lines
I think keeping it all under
arch/makes more sense.drivers/input/makes a lot of sense where we have keyboard controllers that are used on various architectures with slightly different glue, or different controllers for the same busses. IF you have really totally architecture specific input devices that require intimate arch knowledge it probably makes more sense to keep them there.
The keyboard controller hardware is used nowhere else, so arch/m68k/atari/atakeyb.c it'll be.
Michael
Geert Uytterhoeven
maintainerPATCH 5/33 m68k: Atari fb revival
In reply to Geert UytterhoevenFrom: Michael Schmitz <[email protected]>
Update the atari fb to 2.6 by Michael Schmitz, Reformatting and rewrite of bit plane functions by Roman Zippel, A few more fixes by Geert Uytterhoeven.
--- drivers/video/Kconfig | 5 drivers/video/Makefile | 3 drivers/video/atafb.c | 2799 +++++++++++++++++++++-------------------- drivers/video/atafb.h | 36 drivers/video/atafb_iplan2p2.c | 293 ++++ drivers/video/atafb_iplan2p4.c | 308 ++++ drivers/video/atafb_iplan2p8.c | 345 +++++ drivers/video/atafb_mfb.c | 112 + drivers/video/atafb_utils.h | 400 +++++ 9 files changed, 2986 insertions(+), 1315 deletions(-)
drivers/video/Kconfig +4 -1
@@ -389,7 +389,10 @@ config FB_ARC config FB_ATARI bool "Atari native chipset support" - depends on (FB = y) && ATARI && BROKEN + depends on (FB = y) && ATARI + select FB_CFB_FILLRECT + select FB_CFB_COPYAREA + select FB_CFB_IMAGEBLIT help This is the frame buffer device driver for the builtin graphics chipset found in Ataris.
drivers/video/Makefile +2 -1
@@ -63,7 +63,8 @@ obj-$(CONFIG_FB_TCX) += tcx obj-$(CONFIG_FB_LEO) += leo.o sbuslib.o obj-$(CONFIG_FB_SGIVW) += sgivwfb.o obj-$(CONFIG_FB_ACORN) += acornfb.o -obj-$(CONFIG_FB_ATARI) += atafb.o +obj-$(CONFIG_FB_ATARI) += atafb.o c2p.o atafb_mfb.o \ + atafb_iplan2p2.o atafb_iplan2p4.o atafb_iplan2p8.o obj-$(CONFIG_FB_MAC) += macfb.o obj-$(CONFIG_FB_HGA) += hgafb.o obj-$(CONFIG_FB_IGA) += igafb.o
drivers/video/atafb.c +1486 -1313
2,980 lines not on this page · raw message
drivers/video/atafb.h new file +36 -0
Lines of this file are not shown. View the raw message.
drivers/video/atafb_iplan2p2.c new file +293 -0
293 lines not on this page · raw message
drivers/video/atafb_iplan2p4.c new file +308 -0
308 lines not on this page · raw message
drivers/video/atafb_iplan2p8.c new file +345 -0
345 lines not on this page · raw message
drivers/video/atafb_mfb.c new file +112 -0
112 lines not on this page · raw message
drivers/video/atafb_utils.h new file +400 -0
400 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Part of the diff is not shown here. View the raw message.
Re: [patch 05/33] m68k: Atari fb revival
Quoted 4 lines · Geert Uytterhoeven
plain text document attachment (636-atafb.diff)
From: Michael Schmitz <[email protected]>Update the atari fb to 2.6 by Michael Schmitz,
Finally :-). That leaves only pm3fb that needs porting.
It still contains remnants of 2.4 code though, ie, FBCON_HAS_*, but that's minor.
Quoted 6 lines
Reformatting and rewrite of bit plane functions by Roman Zippel, A few more fixes by Geert Uytterhoeven.
Signed-off-by Michael Schmitz <[email protected]>Signed-off-by Roman Zippel <[email protected]>Signed-off-by Geert Uytterhoeven <[email protected]>
Tony
James Simmons
Acked-byRe: [patch 05/33] m68k: Atari fb revival
Quoted 11 lines · Geert Uytterhoeven
Quoted 4 lines
plain text document attachment (636-atafb.diff)
From: Michael Schmitz <[email protected]>Update the atari fb to 2.6 by Michael Schmitz,
Finally :-). That leaves only pm3fb that needs porting.
It still contains remnants of 2.4 code though, ie, FBCON_HAS_*, but that's minor.
Yeah!!! Its a good step forward. Needs more cleanup down the road.
Quoted 7 lines
Quoted 6 lines
Reformatting and rewrite of bit plane functions by Roman Zippel, A few more fixes by Geert Uytterhoeven.
Signed-off-by Michael Schmitz <[email protected]>Signed-off-by Roman Zippel <[email protected]>Signed-off-by Geert Uytterhoeven <[email protected]>Acked-by Antonino Daplas <[email protected]>
Re: [patch 05/33] m68k: Atari fb revival
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Update the atari fb to 2.6 by Michael Schmitz,
Finally :-). That leaves only pm3fb that needs porting.
It still contains remnants of 2.4 code though, ie, FBCON_HAS_*, but that's minor.
Yeah!!! Its a good step forward. Needs more cleanup down the road.
You bet. I'll kill the old cruft when I get to the pixmap support. My keyboard and SCSI patches got trashed badly, so I'll need to work on those first.
Michael
Geert Uytterhoeven
maintainerPATCH 6/33 m68k: CROSS_COMPILE = m68k-linux-gnu-
In reply to Geert UytterhoevenRecent cross-compilers are called m68k-linux-gnu-gcc instead of m68k-linux-gcc
--- arch/m68k/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/Makefile +1 -1
@@ -21,7 +21,7 @@ AS += -m68020 LDFLAGS := -m m68kelf ifneq ($(COMPILE_ARCH),$(ARCH)) # prefix for cross-compiling binaries - CROSS_COMPILE = m68k-linux- + CROSS_COMPILE = m68k-linux-gnu- endif ifdef CONFIG_SUN3
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Re: [patch 06/33] m68k: CROSS_COMPILE = m68k-linux-gnu-
Quoted 10 lines · Geert Uytterhoeven
Recent cross-compilers are called m68k-linux-gnu-gcc instead of m68k-linux-gcc
Signed-off-by Geert Uytterhoeven <[email protected]>--- arch/m68k/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/Makefile AS += -m68020 · line 27
Quoted 8 lines
arch/m68k/Makefile +1
-1@@ -21,7 +21,7 @@ AS += -m68020 LDFLAGS := -m m68kelf ifneq ($(COMPILE_ARCH),$(ARCH)) # prefix for cross-compiling binaries - CROSS_COMPILE = m68k-linux- + CROSS_COMPILE = m68k-linux-gnu- endif ifdef CONFIG_SUN3
What about using ?= so the user can override it. I sent a patch doing just that but never got any response.
Signature · 3 lines
Ville Syrjälä [email protected] http://www.sci.fi/~syrjala/
Geert Uytterhoeven
maintainerRe: [patch 06/33] m68k: CROSS_COMPILE = m68k-linux-gnu-
Quoted 18 lines · Ville Syrj�l�
Quoted 17 lines · Geert Uytterhoeven
Recent cross-compilers are called m68k-linux-gnu-gcc instead of m68k-linux-gcc
Signed-off-by Geert Uytterhoeven <[email protected]>--- arch/m68k/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/m68k/Makefile +1
-1@@ -21,7 +21,7 @@ AS += -m68020 LDFLAGS := -m m68kelf ifneq ($(COMPILE_ARCH),$(ARCH)) # prefix for cross-compiling binaries - CROSS_COMPILE = m68k-linux- + CROSS_COMPILE = m68k-linux-gnu- endif
Quoted 4 lines
arch/m68k/Makefile AS += -m68020 · line 27
Quoted 1 line
arch/m68k/Makefile +0
-0ifdef CONFIG_SUN3What about using ?= so the user can override it. I sent a patch doing just that but never got any response.
I just gave it a try, and compilation failed because it used plain gcc instead of m68k-linux-gnu-gcc.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Re: [patch 06/33] m68k: CROSS_COMPILE = m68k-linux-gnu-
Quoted 19 lines · Geert Uytterhoeven
Quoted 18 lines · Ville Syrj?l?
Quoted 17 lines · Geert Uytterhoeven
Recent cross-compilers are called m68k-linux-gnu-gcc instead of m68k-linux-gcc
Signed-off-by Geert Uytterhoeven <[email protected]>--- arch/m68k/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/m68k/Makefile +1
-1@@ -21,7 +21,7 @@ AS += -m68020 LDFLAGS := -m m68kelf ifneq ($(COMPILE_ARCH),$(ARCH)) # prefix for cross-compiling binaries - CROSS_COMPILE = m68k-linux- + CROSS_COMPILE = m68k-linux-gnu- endif
Quoted 7 lines
Quoted 4 lines
arch/m68k/Makefile AS += -m68020 · line 27
Quoted 1 line
arch/m68k/Makefile +0
-0ifdef CONFIG_SUN3What about using ?= so the user can override it. I sent a patch doing just that but never got any response.
I just gave it a try, and compilation failed because it used plain gcc instead of m68k-linux-gnu-gcc.
Argh. You're correct of course. Apparently I never tried it without setting CROSS_COMPILE. The problem is in the top level Makefile:CROSS_COMPILE ?=
and
export CROSS_COMPILE
If I remove those it works, but I don't know if removing them is a good idea in general (especially the export). Maybe the ?= thing can be removed and the export can be moved after including the arch Makefile?
Signature · 3 lines
Ville Syrjälä [email protected] http://www.sci.fi/~syrjala/
Geert Uytterhoeven
maintainerPATCH 7/33 m68k: Mac89x0 Ethernet netif updates
In reply to Geert UytterhoevenFrom: Matthias Urlichs <[email protected]>
Macintosh CS89x0 Ethernet: Netif updates
Addition of netif_stop_queue() before transmission by Michael Schmitz skb_copy_{from,to}_linear_data() conversion by Geert Uytterhoeven
--- drivers/net/Kconfig | 2 - drivers/net/mac89x0.c | 92 ++++++++++++++++++-------------------------------- 2 files changed, 35 insertions(+), 59 deletions(-)
drivers/net/Kconfig +1 -1
@@ -311,7 +311,7 @@ config MAC8390 config MAC89x0 tristate "Macintosh CS89x0 based ethernet cards" - depends on NET_ETHERNET && MAC && BROKEN + depends on NET_ETHERNET && MAC ---help--- Support for CS89x0 chipset based Ethernet cards. If you have a Nubus or LC-PDS network (Ethernet) card of this type, say Y and
drivers/net/mac89x0.c +34 -58
144 lines not on this page · raw message
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Re: [patch 07/33] m68k: Mac89x0 Ethernet netif updates
Quoted 11 lines · Geert Uytterhoeven
From: Matthias Urlichs <[email protected]>
Macintosh CS89x0 Ethernet: Netif updates
Addition ofnetif_stop_queue()before transmission by Michael Schmitz skb_copy_{from,to}_linear_data() conversion by Geert UytterhoevenSigned-off-by Geert Uytterhoeven <[email protected]>--- drivers/net/Kconfig | 2 - drivers/net/mac89x0.c | 92 ++++++++++++++++++-------------------------------- 2 files changed, 35 insertions(+), 59 deletions(-)
The ethernet patches I've seen so far look sane to me... ACK.
Since they were addressed to Linus and Andrew, I will presume that one of those two penguins will apply your drivers/net/* patches.
Jeff
Geert Uytterhoeven
maintainerPATCH 8/33 lockdep: Add missing disable/enable irq variant
In reply to Geert UytterhoevenFrom: Roman Zippel <[email protected]>
Add missing disable/enable irq variant
--- include/linux/interrupt.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
include/linux/interrupt.h +5 -1
@@ -185,10 +185,14 @@ static inline int disable_irq_wake(unsig* validator need to define the methods below in their asm/irq.h * files, under an #ifdef CONFIG_LOCKDEP section. */ -# ifndef CONFIG_LOCKDEP +#ifndef CONFIG_LOCKDEP # define disable_irq_nosync_lockdep (irq) disable_irq_nosync(irq) +# define disable_irq_nosync_lockdep_irqsave (irq, flags) \ + disable_irq_nosync(irq)# define disable_irq_lockdep (irq) disable_irq(irq)# define enable_irq_lockdep (irq) enable_irq(irq) +# define enable_irq_lockdep_irqrestore (irq, flags) \ + enable_irq(irq)# endif #endif /* CONFIG_GENERIC_HARDIRQS */
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 9/33 m68k: reformat various m68k files
In reply to Geert UytterhoevenFrom: Roman Zippel <[email protected]>
Reformat various m68k files, so they actually look like Linux sources.
--- arch/m68k/amiga/config.c | 1062 +++++++++++++++++++++++------------------------ arch/m68k/atari/config.c | 983 ++++++++++++++++++++----------------------- arch/m68k/atari/debug.c | 470 ++++++++++---------- arch/m68k/kernel/entry.S | 2 arch/m68k/kernel/head.S | 2 arch/m68k/kernel/setup.c | 381 ++++++++-------- arch/m68k/mac/config.c | 161 +++---- arch/m68k/mac/debug.c | 331 +++++++------- arch/m68k/q40/config.c | 259 +++++------ arch/m68k/sun3x/prom.c | 121 ++--- 10 files changed, 1856 insertions(+), 1916 deletions(-)
arch/m68k/amiga/config.c +529 -533
@@ -22,9 +22,7 @@#include <linux/vt_kern.h> #include <linux/delay.h> #include <linux/interrupt.h> -#ifdef CONFIG_ZORRO #include <linux/zorro.h> -#endif #include <asm/bootinfo.h> #include <asm/setup.h>
@@ -62,21 +60,21 @@ static char s_cdtv[] __initdata = "CDTV"static char s_cd32[]__initdata ="CD32" ;static char s_draco[]__initdata ="Draco" ;static char *amiga_models[]__initdata = { - [AMI_500 -AMI_500 ] = s_a500, - [AMI_500PLUS -AMI_500 ] = s_a500p, - [AMI_600 -AMI_500 ] = s_a600, - [AMI_1000 -AMI_500 ] = s_a1000, - [AMI_1200 -AMI_500 ] = s_a1200, - [AMI_2000 -AMI_500 ] = s_a2000, - [AMI_2500 -AMI_500 ] = s_a2500, - [AMI_3000 -AMI_500 ] = s_a3000, - [AMI_3000T -AMI_500 ] = s_a3000t, - [AMI_3000PLUS -AMI_500 ] = s_a3000p, - [AMI_4000 -AMI_500 ] = s_a4000, - [AMI_4000T -AMI_500 ] = s_a4000t, - [AMI_CDTV -AMI_500 ] = s_cdtv, - [AMI_CD32 -AMI_500 ] = s_cd32, - [AMI_DRACO -AMI_500 ] = s_draco, + [AMI_500 -AMI_500 ] = s_a500, + [AMI_500PLUS -AMI_500 ] = s_a500p, + [AMI_600 -AMI_500 ] = s_a600, + [AMI_1000 -AMI_500 ] = s_a1000, + [AMI_1200 -AMI_500 ] = s_a1200, + [AMI_2000 -AMI_500 ] = s_a2000, + [AMI_2500 -AMI_500 ] = s_a2500, + [AMI_3000 -AMI_500 ] = s_a3000, + [AMI_3000T -AMI_500 ] = s_a3000t, + [AMI_3000PLUS -AMI_500 ] = s_a3000p, + [AMI_4000 -AMI_500 ] = s_a4000, + [AMI_4000T -AMI_500 ] = s_a4000t, + [AMI_CDTV -AMI_500 ] = s_cdtv, + [AMI_CD32 -AMI_500 ] = s_cd32, + [AMI_DRACO -AMI_500 ] = s_draco, };static char amiga_model_name[13 ] ="Amiga " ;
@@ -85,17 +83,17 @@ extern char m68k_debug_device[];static void amiga_sched_init (irq_handler_t handler);/* amiga specific irq functions */ -extern void amiga_init_IRQ (void ); +extern void amiga_init_IRQ (void );static void amiga_get_model (char *model);static int amiga_get_hardware_list (char *buffer);/* amiga specific timer functions */ -static unsigned long amiga_gettimeoffset (void ); -static int a3000_hwclk (int ,struct rtc_time *); -static int a2000_hwclk (int ,struct rtc_time *); -static int amiga_set_clock_mmss (unsigned long ); -static unsigned int amiga_get_ss (void ); -extern void amiga_mksound (unsigned int count,unsigned int ticks ); -static void amiga_reset (void ); +static unsigned long amiga_gettimeoffset (void ); +static int a3000_hwclk (int ,struct rtc_time *); +static int a2000_hwclk (int ,struct rtc_time *); +static int amiga_set_clock_mmss (unsigned long ); +static unsigned int amiga_get_ss (void ); +extern void amiga_mksound (unsigned int count,unsigned int ticks); +static void amiga_reset (void );extern void amiga_init_sound (void );static void amiga_savekmsg_init (void ); static void amiga_mem_console_write(struct console *co, const char *b,
@@ -108,9 +106,9 @@ static void amiga_heartbeat(int on);#endif static struct console amiga_console_driver = { - .name ="debug" , - .flags =CON_PRINTBUFFER , - .index =-1 , + .name ="debug" , + .flags =CON_PRINTBUFFER , + .index =-1 , };
@@ -119,24 +117,24 @@ static struct console amiga_console_driv*/ static struct { -struct resource _ciab, _ciaa, _custom, _kickstart; +struct resource _ciab, _ciaa, _custom, _kickstart; } mb_resources = { - ._ciab = { - .name ="CIA B" , .start =0x00bfd000 , .end =0x00bfdfff - }, - ._ciaa = { - .name ="CIA A" , .start =0x00bfe000 , .end =0x00bfefff - }, - ._custom = { - .name ="Custom I/O" , .start =0x00dff000 , .end =0x00dfffff - }, - ._kickstart = { - .name ="Kickstart ROM" , .start =0x00f80000 , .end =0x00ffffff - } + ._ciab = { + .name ="CIA B" , .start =0x00bfd000 , .end =0x00bfdfff + }, + ._ciaa = { + .name ="CIA A" , .start =0x00bfe000 , .end =0x00bfefff + }, + ._custom = { + .name ="Custom I/O" , .start =0x00dff000 , .end =0x00dfffff + }, + ._kickstart = { + .name ="Kickstart ROM" , .start =0x00f80000 , .end =0x00ffffff + } };static struct resource rtc_resource = { - .start =0x00dc0000 , .end =0x00dcffff + .start =0x00dc0000 , .end =0x00dcffff };static struct resource ram_resource[NUM_MEMINFO ];
@@ -148,57 +146,57 @@ static struct resource ram_resource[NUM_int amiga_parse_bootinfo (const struct bi_record *record) { -int unknown =0 ; -const unsigned long *data = record->data; +int unknown =0 ; +const unsigned long *data = record->data; -switch (record->tag) { +switch (record->tag) {case BI_AMIGA_MODEL : - amiga_model = *data; -break ; + amiga_model = *data; +break ;case BI_AMIGA_ECLOCK : - amiga_eclock = *data; -break ; + amiga_eclock = *data; +break ;case BI_AMIGA_CHIPSET : - amiga_chipset = *data; -break ; + amiga_chipset = *data; +break ;case BI_AMIGA_CHIP_SIZE : - amiga_chip_size = *(const int *)data; -break ; + amiga_chip_size = *(const int *)data; +break ;case BI_AMIGA_VBLANK : - amiga_vblank = *(const unsigned char *)data; -break ; + amiga_vblank = *(const unsigned char *)data; +break ;case BI_AMIGA_PSFREQ : - amiga_psfreq = *(const unsigned char *)data; -break ; + amiga_psfreq = *(const unsigned char *)data; +break ;case BI_AMIGA_AUTOCON :#ifdef CONFIG_ZORRO -if (zorro_num_autocon <ZORRO_NUM_AUTO ) { -const struct ConfigDev *cd = (struct ConfigDev *)data; -struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++]; - dev->rom = cd->cd_Rom; - dev->slotaddr = cd->cd_SlotAddr; - dev->slotsize = cd->cd_SlotSize; - dev->resource.start = (unsigned long )cd->cd_BoardAddr; - dev->resource.end = dev->resource.start+cd->cd_BoardSize-1 ; - }else -printk ("amiga_parse_bootinfo: too many AutoConfig devices\n" ); +if (zorro_num_autocon <ZORRO_NUM_AUTO ) { +const struct ConfigDev *cd = (struct ConfigDev *)data; +struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++]; + dev->rom = cd->cd_Rom; + dev->slotaddr = cd->cd_SlotAddr; + dev->slotsize = cd->cd_SlotSize; + dev->resource.start = (unsigned long )cd->cd_BoardAddr; + dev->resource.end = dev->resource.start + cd->cd_BoardSize -1 ; + }else +printk ("amiga_parse_bootinfo: too many AutoConfig devices\n" );#endif /* CONFIG_ZORRO */ -break ; +break ;case BI_AMIGA_SERPER : -/* serial port period: ignored here */ -break ; +/* serial port period: ignored here */ +break ;default : - unknown =1 ; - } -return (unknown); + unknown =1 ; + } +return unknown; }/*
@@ -207,159 +205,159 @@ int amiga_parse_bootinfo(const struct bistatic void __init amiga_identify (void ) { -/* Fill in some default values, if necessary */ -if (amiga_eclock ==0 ) - amiga_eclock =709379 ; - -memset (&amiga_hw_present,0 ,sizeof (amiga_hw_present)); - -printk ("Amiga hardware found: " ); -if (amiga_model >=AMI_500 && amiga_model <=AMI_DRACO ) { -printk ("[%s] " , amiga_models[amiga_model-AMI_500 ]); -strcat (amiga_model_name, amiga_models[amiga_model-AMI_500 ]); - } - -switch (amiga_model) { -case AMI_UNKNOWN : - goto Generic; - -case AMI_600 : -case AMI_1200 : -AMIGAHW_SET (A1200_IDE ); -AMIGAHW_SET (PCMCIA ); -case AMI_500 : -case AMI_500PLUS : -case AMI_1000 : -case AMI_2000 : -case AMI_2500 : -AMIGAHW_SET (A2000_CLK );/* Is this correct for all models? */ - goto Generic; - -case AMI_3000 : -case AMI_3000T : -AMIGAHW_SET (AMBER_FF ); -AMIGAHW_SET (MAGIC_REKICK ); -/* fall through */ -case AMI_3000PLUS : -AMIGAHW_SET (A3000_SCSI ); -AMIGAHW_SET (A3000_CLK ); -AMIGAHW_SET (ZORRO3 ); - goto Generic; - -case AMI_4000T : -AMIGAHW_SET (A4000_SCSI ); -/* fall through */ -case AMI_4000 : -AMIGAHW_SET (A4000_IDE ); -AMIGAHW_SET (A3000_CLK ); -AMIGAHW_SET (ZORRO3 ); - goto Generic; - -case AMI_CDTV : -case AMI_CD32 : -AMIGAHW_SET (CD_ROM ); -AMIGAHW_SET (A2000_CLK );/* Is this correct? */ - goto Generic; - - Generic: -AMIGAHW_SET (AMI_VIDEO ); -AMIGAHW_SET (AMI_BLITTER ); -AMIGAHW_SET (AMI_AUDIO ); -AMIGAHW_SET (AMI_FLOPPY ); -AMIGAHW_SET (AMI_KEYBOARD ); -AMIGAHW_SET (AMI_MOUSE ); -AMIGAHW_SET (AMI_SERIAL ); -AMIGAHW_SET (AMI_PARALLEL ); -AMIGAHW_SET (CHIP_RAM ); -AMIGAHW_SET (PAULA ); - -switch (amiga_chipset) { -case CS_OCS : -case CS_ECS : -case CS_AGA : -switch (amiga_custom.deniseid &0xf ) { -case 0x0c : -AMIGAHW_SET (DENISE_HR ); -break ; -case 0x08 : -AMIGAHW_SET (LISA ); -break ; - } -break ; -default : -AMIGAHW_SET (DENISE ); -break ; - } -switch ((amiga_custom.vposr>>8 ) &0x7f ) { -case 0x00 : -AMIGAHW_SET (AGNUS_PAL ); -break ; -case 0x10 : -AMIGAHW_SET (AGNUS_NTSC ); -break ; -case 0x20 : -case 0x21 : -AMIGAHW_SET (AGNUS_HR_PAL ); -break ; -case 0x30 : -case 0x31 : -AMIGAHW_SET (AGNUS_HR_NTSC ); -break ; -case 0x22 : -case 0x23 : -AMIGAHW_SET (ALICE_PAL ); -break ; -case 0x32 : -case 0x33 : -AMIGAHW_SET (ALICE_NTSC ); -break ; - } -AMIGAHW_SET (ZORRO ); -break ; - -case AMI_DRACO : -panic ("No support for Draco yet" ); - -default : -panic ("Unknown Amiga Model" ); - } +/* Fill in some default values, if necessary */ +if (amiga_eclock ==0 ) + amiga_eclock =709379 ; + +memset (&amiga_hw_present,0 ,sizeof (amiga_hw_present)); + +printk ("Amiga hardware found: " ); +if (amiga_model >=AMI_500 && amiga_model <=AMI_DRACO ) { +printk ("[%s] " , amiga_models[amiga_model-AMI_500 ]); +strcat (amiga_model_name, amiga_models[amiga_model-AMI_500 ]); + } + +switch (amiga_model) { +case AMI_UNKNOWN : + goto Generic; + +case AMI_600 : +case AMI_1200 : +AMIGAHW_SET (A1200_IDE ); +AMIGAHW_SET (PCMCIA ); +case AMI_500 : +case AMI_500PLUS : +case AMI_1000 : +case AMI_2000 : +case AMI_2500 : +AMIGAHW_SET (A2000_CLK );/* Is this correct for all models? */ + goto Generic; + +case AMI_3000 : +case AMI_3000T : +AMIGAHW_SET (AMBER_FF ); +AMIGAHW_SET (MAGIC_REKICK ); +/* fall through */ +case AMI_3000PLUS : +AMIGAHW_SET (A3000_SCSI ); +AMIGAHW_SET (A3000_CLK ); +AMIGAHW_SET (ZORRO3 ); + goto Generic; + +case AMI_4000T : +AMIGAHW_SET (A4000_SCSI ); +/* fall through */ +case AMI_4000 : +AMIGAHW_SET (A4000_IDE ); +AMIGAHW_SET (A3000_CLK ); +AMIGAHW_SET (ZORRO3 ); + goto Generic; + +case AMI_CDTV : +case AMI_CD32 : +AMIGAHW_SET (CD_ROM ); +AMIGAHW_SET (A2000_CLK );/* Is this correct? */ + goto Generic; + + Generic: +AMIGAHW_SET (AMI_VIDEO ); +AMIGAHW_SET (AMI_BLITTER ); +AMIGAHW_SET (AMI_AUDIO ); +AMIGAHW_SET (AMI_FLOPPY ); +AMIGAHW_SET (AMI_KEYBOARD ); +AMIGAHW_SET (AMI_MOUSE ); +AMIGAHW_SET (AMI_SERIAL ); +AMIGAHW_SET (AMI_PARALLEL ); +AMIGAHW_SET (CHIP_RAM ); +AMIGAHW_SET (PAULA ); + +switch (amiga_chipset) { +case CS_OCS : +case CS_ECS : +case CS_AGA : +switch (amiga_custom.deniseid &0xf ) { +case 0x0c : +AMIGAHW_SET (DENISE_HR ); +break ; +case 0x08 : +AMIGAHW_SET (LISA ); +break ; + } +break ; +default : +AMIGAHW_SET (DENISE ); +break ; + } +switch ((amiga_custom.vposr>>8 ) &0x7f ) { +case 0x00 : +AMIGAHW_SET (AGNUS_PAL ); +break ; +case 0x10 : +AMIGAHW_SET (AGNUS_NTSC ); +break ; +case 0x20 : +case 0x21 : +AMIGAHW_SET (AGNUS_HR_PAL ); +break ; +case 0x30 : +case 0x31 : +AMIGAHW_SET (AGNUS_HR_NTSC ); +break ; +case 0x22 : +case 0x23 : +AMIGAHW_SET (ALICE_PAL ); +break ; +case 0x32 : +case 0x33 : +AMIGAHW_SET (ALICE_NTSC ); +break ; + } +AMIGAHW_SET (ZORRO ); +break ; -#define AMIGAHW_ANNOUNCE (name, str) \ - if (AMIGAHW_PRESENT(name)) \ - printk(str) +case AMI_DRACO : +panic ("No support for Draco yet" ); + +default : +panic ("Unknown Amiga Model" ); + } -AMIGAHW_ANNOUNCE (AMI_VIDEO ,"VIDEO " ); -AMIGAHW_ANNOUNCE (AMI_BLITTER ,"BLITTER " ); -AMIGAHW_ANNOUNCE (AMBER_FF ,"AMBER_FF " ); -AMIGAHW_ANNOUNCE (AMI_AUDIO ,"AUDIO " ); -AMIGAHW_ANNOUNCE (AMI_FLOPPY ,"FLOPPY " ); -AMIGAHW_ANNOUNCE (A3000_SCSI ,"A3000_SCSI " ); -AMIGAHW_ANNOUNCE (A4000_SCSI ,"A4000_SCSI " ); -AMIGAHW_ANNOUNCE (A1200_IDE ,"A1200_IDE " ); -AMIGAHW_ANNOUNCE (A4000_IDE ,"A4000_IDE " ); -AMIGAHW_ANNOUNCE (CD_ROM ,"CD_ROM " ); -AMIGAHW_ANNOUNCE (AMI_KEYBOARD ,"KEYBOARD " ); -AMIGAHW_ANNOUNCE (AMI_MOUSE ,"MOUSE " ); -AMIGAHW_ANNOUNCE (AMI_SERIAL ,"SERIAL " ); -AMIGAHW_ANNOUNCE (AMI_PARALLEL ,"PARALLEL " ); -AMIGAHW_ANNOUNCE (A2000_CLK ,"A2000_CLK " ); -AMIGAHW_ANNOUNCE (A3000_CLK ,"A3000_CLK " ); -AMIGAHW_ANNOUNCE (CHIP_RAM ,"CHIP_RAM " ); -AMIGAHW_ANNOUNCE (PAULA ,"PAULA " ); -AMIGAHW_ANNOUNCE (DENISE ,"DENISE " ); -AMIGAHW_ANNOUNCE (DENISE_HR ,"DENISE_HR " ); -AMIGAHW_ANNOUNCE (LISA ,"LISA " ); -AMIGAHW_ANNOUNCE (AGNUS_PAL ,"AGNUS_PAL " ); -AMIGAHW_ANNOUNCE (AGNUS_NTSC ,"AGNUS_NTSC " ); -AMIGAHW_ANNOUNCE (AGNUS_HR_PAL ,"AGNUS_HR_PAL " ); -AMIGAHW_ANNOUNCE (AGNUS_HR_NTSC ,"AGNUS_HR_NTSC " ); -AMIGAHW_ANNOUNCE (ALICE_PAL ,"ALICE_PAL " ); -AMIGAHW_ANNOUNCE (ALICE_NTSC ,"ALICE_NTSC " ); -AMIGAHW_ANNOUNCE (MAGIC_REKICK ,"MAGIC_REKICK " ); -AMIGAHW_ANNOUNCE (PCMCIA ,"PCMCIA " ); -if (AMIGAHW_PRESENT (ZORRO )) -printk ("ZORRO%s " ,AMIGAHW_PRESENT (ZORRO3 ) ?"3" :"" ); -printk ("\n" ); +#define AMIGAHW_ANNOUNCE (name, str) \ + if (AMIGAHW_PRESENT(name)) \ + printk(str) + +AMIGAHW_ANNOUNCE (AMI_VIDEO ,"VIDEO " ); +AMIGAHW_ANNOUNCE (AMI_BLITTER ,"BLITTER " ); +AMIGAHW_ANNOUNCE (AMBER_FF ,"AMBER_FF " ); +AMIGAHW_ANNOUNCE (AMI_AUDIO ,"AUDIO " ); +AMIGAHW_ANNOUNCE (AMI_FLOPPY ,"FLOPPY " ); +AMIGAHW_ANNOUNCE (A3000_SCSI ,"A3000_SCSI " ); +AMIGAHW_ANNOUNCE (A4000_SCSI ,"A4000_SCSI " ); +AMIGAHW_ANNOUNCE (A1200_IDE ,"A1200_IDE " ); +AMIGAHW_ANNOUNCE (A4000_IDE ,"A4000_IDE " ); +AMIGAHW_ANNOUNCE (CD_ROM ,"CD_ROM " ); +AMIGAHW_ANNOUNCE (AMI_KEYBOARD ,"KEYBOARD " ); +AMIGAHW_ANNOUNCE (AMI_MOUSE ,"MOUSE " ); +AMIGAHW_ANNOUNCE (AMI_SERIAL ,"SERIAL " ); +AMIGAHW_ANNOUNCE (AMI_PARALLEL ,"PARALLEL " ); +AMIGAHW_ANNOUNCE (A2000_CLK ,"A2000_CLK " ); +AMIGAHW_ANNOUNCE (A3000_CLK ,"A3000_CLK " ); +AMIGAHW_ANNOUNCE (CHIP_RAM ,"CHIP_RAM " ); +AMIGAHW_ANNOUNCE (PAULA ,"PAULA " ); +AMIGAHW_ANNOUNCE (DENISE ,"DENISE " ); +AMIGAHW_ANNOUNCE (DENISE_HR ,"DENISE_HR " ); +AMIGAHW_ANNOUNCE (LISA ,"LISA " ); +AMIGAHW_ANNOUNCE (AGNUS_PAL ,"AGNUS_PAL " ); +AMIGAHW_ANNOUNCE (AGNUS_NTSC ,"AGNUS_NTSC " ); +AMIGAHW_ANNOUNCE (AGNUS_HR_PAL ,"AGNUS_HR_PAL " ); +AMIGAHW_ANNOUNCE (AGNUS_HR_NTSC ,"AGNUS_HR_NTSC " ); +AMIGAHW_ANNOUNCE (ALICE_PAL ,"ALICE_PAL " ); +AMIGAHW_ANNOUNCE (ALICE_NTSC ,"ALICE_NTSC " ); +AMIGAHW_ANNOUNCE (MAGIC_REKICK ,"MAGIC_REKICK " ); +AMIGAHW_ANNOUNCE (PCMCIA ,"PCMCIA " ); +if (AMIGAHW_PRESENT (ZORRO )) +printk ("ZORRO%s " ,AMIGAHW_PRESENT (ZORRO3 ) ?"3" :"" ); +printk ("\n" );#undef AMIGAHW_ANNOUNCE }
@@ -370,119 +368,117 @@ static void __init amiga_identify(void)void __init config_amiga (void ) { -int i; +int i; + +amiga_debug_init (); +amiga_identify (); -amiga_debug_init (); -amiga_identify (); +/* Yuk, we don't have PCI memory */ + iomem_resource.name ="Memory" ; +for (i =0 ; i <4 ; i++) +request_resource (&iomem_resource, &((struct resource *)&mb_resources)[i]); + + mach_sched_init = amiga_sched_init; + mach_init_IRQ = amiga_init_IRQ; + mach_get_model = amiga_get_model; + mach_get_hardware_list = amiga_get_hardware_list; + mach_gettimeoffset = amiga_gettimeoffset; +if (AMIGAHW_PRESENT (A3000_CLK )) { + mach_hwclk = a3000_hwclk; + rtc_resource.name ="A3000 RTC" ; +request_resource (&iomem_resource, &rtc_resource); + }else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ { + mach_hwclk = a2000_hwclk; + rtc_resource.name ="A2000 RTC" ; +request_resource (&iomem_resource, &rtc_resource); + } -/* Yuk, we don't have PCI memory */ - iomem_resource.name ="Memory" ; -for (i =0 ; i <4 ; i++) -request_resource (&iomem_resource, &((struct resource *)&mb_resources)[i]); - - mach_sched_init = amiga_sched_init; - mach_init_IRQ = amiga_init_IRQ; - mach_get_model = amiga_get_model; - mach_get_hardware_list = amiga_get_hardware_list; - mach_gettimeoffset = amiga_gettimeoffset; -if (AMIGAHW_PRESENT (A3000_CLK )){ - mach_hwclk = a3000_hwclk; - rtc_resource.name ="A3000 RTC" ; -request_resource (&iomem_resource, &rtc_resource); - } -else {/* if (AMIGAHW_PRESENT(A2000_CLK)) */ - mach_hwclk = a2000_hwclk; - rtc_resource.name ="A2000 RTC" ; -request_resource (&iomem_resource, &rtc_resource); - } - - mach_max_dma_address =0xffffffff ;/* -* default MAX_DMA=0xffffffff -* on all machines. If we don't -* do so, the SCSI code will not -* be able to allocate any mem -* for transfers, unless we are -* dealing with a Z2 mem only -* system. /Jes -*/ - - mach_set_clock_mmss = amiga_set_clock_mmss; - mach_get_ss = amiga_get_ss; - mach_reset = amiga_reset; +/* +* default MAX_DMA=0xffffffff on all machines. If we don't do so, the SCSI +* code will not be able to allocate any mem for transfers, unless we are +* dealing with a Z2 mem only system. /Jes +*/ + mach_max_dma_address =0xffffffff ; + + mach_set_clock_mmss = amiga_set_clock_mmss; + mach_get_ss = amiga_get_ss; + mach_reset = amiga_reset;#if defined(CONFIG_INPUT_M68K_BEEP ) || defined(CONFIG_INPUT_M68K_BEEP_MODULE ) - mach_beep = amiga_mksound; + mach_beep = amiga_mksound;#endif #ifdef CONFIG_HEARTBEAT - mach_heartbeat = amiga_heartbeat; + mach_heartbeat = amiga_heartbeat;#endif -/* Fill in the clock values (based on the 700 kHz E-Clock) */ - amiga_masterclock =40 *amiga_eclock;/* 28 MHz */ - amiga_colorclock =5 *amiga_eclock;/* 3.5 MHz */ - -/* clear all DMA bits */ - amiga_custom.dmacon =DMAF_ALL ; -/* ensure that the DMA master bit is set */ - amiga_custom.dmacon =DMAF_SETCLR |DMAF_MASTER ; - -/* don't use Z2 RAM as system memory on Z3 capable machines */ -if (AMIGAHW_PRESENT (ZORRO3 )) { -int i, j; -u32 disabled_z2mem =0 ; -for (i =0 ; i < m68k_num_memory; i++) -if (m68k_memory[i].addr <16 *1024 *1024 ) { -if (i ==0 ) { -/* don't cut off the branch we're sitting on */ -printk ("Warning: kernel runs in Zorro II memory\n" ); -continue ; - } - disabled_z2mem += m68k_memory[i].size; - m68k_num_memory--; -for (j = i; j < m68k_num_memory; j++) - m68k_memory[j] = m68k_memory[j+1 ]; - i--; - } -if (disabled_z2mem) -printk ("%dK of Zorro II memory will not be used as system memory\n" , - disabled_z2mem>>10 ); - } - -/* request all RAM */ -for (i =0 ; i < m68k_num_memory; i++) { - ram_resource[i].name = - (m68k_memory[i].addr >=0x01000000 ) ?"32-bit Fast RAM" : - (m68k_memory[i].addr <0x00c00000 ) ?"16-bit Fast RAM" : -"16-bit Slow RAM" ; - ram_resource[i].start = m68k_memory[i].addr; - ram_resource[i].end = m68k_memory[i].addr+m68k_memory[i].size-1 ; -request_resource (&iomem_resource, &ram_resource[i]); - } - -/* initialize chipram allocator */ -amiga_chip_init (); - -/* debugging using chipram */ -if (!strcmp ( m68k_debug_device,"mem" )){ -if (!AMIGAHW_PRESENT (CHIP_RAM )) -printk ("Warning: no chipram present for debugging\n" ); -else { -amiga_savekmsg_init (); - amiga_console_driver.write = amiga_mem_console_write; -register_console (&amiga_console_driver); - } - } - -/* our beloved beeper */ -if (AMIGAHW_PRESENT (AMI_AUDIO )) -amiga_init_sound (); - -/* -* if it is an A3000, set the magic bit that forces -* a hard rekick -*/ -if (AMIGAHW_PRESENT (MAGIC_REKICK )) - *(unsigned char *)ZTWO_VADDR (0xde0002 ) |=0x80 ; +/* Fill in the clock values (based on the 700 kHz E-Clock) */ + amiga_masterclock =40 *amiga_eclock;/* 28 MHz */ + amiga_colorclock =5 *amiga_eclock;/* 3.5 MHz */ + +/* clear all DMA bits */ + amiga_custom.dmacon =DMAF_ALL ; +/* ensure that the DMA master bit is set */ + amiga_custom.dmacon =DMAF_SETCLR |DMAF_MASTER ; + +/* don't use Z2 RAM as system memory on Z3 capable machines */ +if (AMIGAHW_PRESENT (ZORRO3 )) { +int i, j; +u32 disabled_z2mem =0 ; + +for (i =0 ; i < m68k_num_memory; i++) { +if (m68k_memory[i].addr <16 *1024 *1024 ) { +if (i ==0 ) { +/* don't cut off the branch we're sitting on */ +printk ("Warning: kernel runs in Zorro II memory\n" ); +continue ; + } + disabled_z2mem += m68k_memory[i].size; + m68k_num_memory--; +for (j = i; j < m68k_num_memory; j++) + m68k_memory[j] = m68k_memory[j+1 ]; + i--; + } + } +if (disabled_z2mem) +printk ("%dK of Zorro II memory will not be used as system memory\n" , + disabled_z2mem>>10 ); + } + +/* request all RAM */ +for (i =0 ; i < m68k_num_memory; i++) { + ram_resource[i].name = + (m68k_memory[i].addr >=0x01000000 ) ?"32-bit Fast RAM" : + (m68k_memory[i].addr <0x00c00000 ) ?"16-bit Fast RAM" : +"16-bit Slow RAM" ; + ram_resource[i].start = m68k_memory[i].addr; + ram_resource[i].end = m68k_memory[i].addr+m68k_memory[i].size-1 ; +request_resource (&iomem_resource, &ram_resource[i]); + } + +/* initialize chipram allocator */ +amiga_chip_init (); + +/* debugging using chipram */ +if (!strcmp (m68k_debug_device,"mem" )) { +if (!AMIGAHW_PRESENT (CHIP_RAM )) +printk ("Warning: no chipram present for debugging\n" ); +else { +amiga_savekmsg_init (); + amiga_console_driver.write = amiga_mem_console_write; +register_console (&amiga_console_driver); + } + } + +/* our beloved beeper */ +if (AMIGAHW_PRESENT (AMI_AUDIO )) +amiga_init_sound (); + +/* +* if it is an A3000, set the magic bit that forces +* a hard rekick +*/ +if (AMIGAHW_PRESENT (MAGIC_REKICK )) + *(unsigned char *)ZTWO_VADDR (0xde0002 ) |=0x80 ; }static unsigned short jiffy_ticks;
@@ -490,12 +486,12 @@ static unsigned short jiffy_ticks;static void __init amiga_sched_init (irq_handler_t timer_routine) {static struct resource sched_res = { - .name ="timer" , .start =0x00bfd400 , .end =0x00bfd5ff , + .name ="timer" , .start =0x00bfd400 , .end =0x00bfd5ff , }; jiffy_ticks = (amiga_eclock+HZ /2 )/HZ ;if (request_resource (&mb_resources._ciab, &sched_res)) -printk ("Cannot allocate ciab.ta{lo,hi}\n" ); +printk ("Cannot allocate ciab.ta{lo,hi}\n" ); ciab.cra &=0xC0 ;/* turn off timer A, continuous mode, from Eclk */ ciab.talo = jiffy_ticks %256 ; ciab.tahi = jiffy_ticks /256 ;
@@ -513,7 +509,7 @@ static void __init amiga_sched_init(irq_#define TICK_SIZE 10000/* This is always executed with interrupts disabled. */ -static unsigned long amiga_gettimeoffset (void ) +static unsigned long amiga_gettimeoffset (void ) {unsigned short hi, lo, hi2;unsigned long ticks, offset =0 ;
@@ -585,15 +581,15 @@ static int a2000_hwclk(int op, struct rt tod_2000.cntrl1 =TOD2000_CNTRL1_HOLD ; -while ((tod_2000.cntrl1 &TOD2000_CNTRL1_BUSY ) && cnt--) - { - tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD ; -udelay (70 ); - tod_2000.cntrl1 |=TOD2000_CNTRL1_HOLD ; +while ((tod_2000.cntrl1 &TOD2000_CNTRL1_BUSY ) && cnt--) { + tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD ; +udelay (70 ); + tod_2000.cntrl1 |=TOD2000_CNTRL1_HOLD ; }if (!cnt) -printk (KERN_INFO "hwclk: timed out waiting for RTC (0x%x)\n" , tod_2000.cntrl1); +printk (KERN_INFO "hwclk: timed out waiting for RTC (0x%x)\n" , + tod_2000.cntrl1);if (!op) {/* read */ t->tm_sec = tod_2000.second1 *10 + tod_2000.second2;
@@ -606,7 +602,7 @@ static int a2000_hwclk(int op, struct rtif (t->tm_year <=69 ) t->tm_year +=100 ; -if (!(tod_2000.cntrl3 &TOD2000_CNTRL3_24HMODE )){ +if (!(tod_2000.cntrl3 &TOD2000_CNTRL3_24HMODE )) {if (!(tod_2000.hour1 &TOD2000_HOUR1_PM ) && t->tm_hour ==12 ) t->tm_hour =0 ;else if ((tod_2000.hour1 &TOD2000_HOUR1_PM ) && t->tm_hour !=12 )
@@ -642,7 +638,7 @@ static int a2000_hwclk(int op, struct rtreturn 0 ; } -static int amiga_set_clock_mmss (unsigned long nowtime) +static int amiga_set_clock_mmss (unsigned long nowtime) {short real_seconds = nowtime %60 , real_minutes = (nowtime /60 ) %60 ;
@@ -660,8 +656,7 @@ static int amiga_set_clock_mmss (unsigne tod_2000.cntrl1 |=TOD2000_CNTRL1_HOLD ; -while ((tod_2000.cntrl1 &TOD2000_CNTRL1_BUSY ) && cnt--) - { +while ((tod_2000.cntrl1 &TOD2000_CNTRL1_BUSY ) && cnt--) { tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD ;udelay (70 ); tod_2000.cntrl1 |=TOD2000_CNTRL1_HOLD ;
@@ -681,7 +676,7 @@ static int amiga_set_clock_mmss (unsignereturn 0 ; } -static unsigned int amiga_get_ss (void ) +static unsigned int amiga_get_ss (void ) {unsigned int s;
@@ -695,71 +690,72 @@ static unsigned int amiga_get_ss( void )return s; } -static NORET_TYPE void amiga_reset( void ) +static NORET_TYPE void amiga_reset(void)ATTRIB_NORET ; -static void amiga_reset (void ) +static void amiga_reset (void ) { -unsigned long jmp_addr040 =virt_to_phys (&&jmp_addr_label040); -unsigned long jmp_addr =virt_to_phys (&&jmp_addr_label); - -local_irq_disable (); -if (CPU_IS_040_OR_060 ) -/* Setup transparent translation registers for mapping -* of 16 MB kernel segment before disabling translation -*/ - __asm__ __volatile__ - ("movel %0,%/d0\n\t" -"andl #0xff000000,%/d0\n\t" -"orw #0xe020,%/d0\n\t" /* map 16 MB, enable, cacheable */ -".chip 68040\n\t" -"movec %%d0,%%itt0\n\t" -"movec %%d0,%%dtt0\n\t" -".chip 68k\n\t" -"jmp %0@\n\t" - :/* no outputs */ - :"a" (jmp_addr040)); -else -/* for 680[23]0, just disable translation and jump to the physical -* address of the label -*/ - __asm__ __volatile__ - ("pmove %/tc,%@\n\t" -"bclr #7,%@\n\t" -"pmove %@,%/tc\n\t" -"jmp %0@\n\t" - :/* no outputs */ - :"a" (jmp_addr)); - jmp_addr_label040: -/* disable translation on '040 now */ - __asm__ __volatile__ - ("moveq #0,%/d0\n\t" -".chip 68040\n\t" -"movec %%d0,%%tc\n\t" /* disable MMU */ -".chip 68k\n\t" - :/* no outputs */ - :/* no inputs */ - :"d0" ); - - jmp_addr_label: -/* pickup reset address from AmigaOS ROM, reset devices and jump -* to reset address -*/ - __asm__ __volatile__ - ("movew #0x2700,%/sr\n\t" -"leal 0x01000000,%/a0\n\t" -"subl %/a0@(-0x14),%/a0\n\t" -"movel %/a0@(4),%/a0\n\t" -"subql #2,%/a0\n\t" -"bra 1f\n\t" -/* align on a longword boundary */ - __ALIGN_STR"\n" -"1:\n\t" -"reset\n\t" -"jmp %/a0@" :/* Just that gcc scans it for % escapes */ ); +unsigned long jmp_addr040 =virt_to_phys (&&jmp_addr_label040); +unsigned long jmp_addr =virt_to_phys (&&jmp_addr_label); -for (;;); +local_irq_disable (); +if (CPU_IS_040_OR_060 ) +/* Setup transparent translation registers for mapping +* of 16 MB kernel segment before disabling translation +*/ + asmvolatile ("\n" +" move.l %0,%%d0\n" +" and.l #0xff000000,%%d0\n" +" or.w #0xe020,%%d0\n" /* map 16 MB, enable, cacheable */ +" .chip 68040\n" +" movec %%d0,%%itt0\n" +" movec %%d0,%%dtt0\n" +" .chip 68k\n" +" jmp %0@\n" + :/* no outputs */ + :"a" (jmp_addr040) + :"d0" ); +else +/* for 680[23]0, just disable translation and jump to the physical +* address of the label +*/ + asmvolatile ("\n" +" pmove %%tc,%@\n" +" bclr #7,%@\n" +" pmove %@,%%tc\n" +" jmp %0@\n" + :/* no outputs */ + :"a" (jmp_addr)); +jmp_addr_label040: +/* disable translation on '040 now */ + asmvolatile ("\n" +" moveq #0,%%d0\n" +" .chip 68040\n" +" movec %%d0,%%tc\n" /* disable MMU */ +" .chip 68k\n" + :/* no outputs */ + :/* no inputs */ + :"d0" ); + + jmp_addr_label: +/* pickup reset address from AmigaOS ROM, reset devices and jump +* to reset address +*/ + asmvolatile ("\n" +" move.w #0x2700,%sr\n" +" lea 0x01000000,%a0\n" +" sub.l %a0@(-0x14),%a0\n" +" move.l %a0@(4),%a0\n" +" subq.l #2,%a0\n" +" jra 1f\n" +/* align on a longword boundary */ +" " __ALIGN_STR"\n" +"1:\n" +" reset\n" +" jmp %a0@" ); +for (;;) + ; }
@@ -773,11 +769,11 @@ static void amiga_reset (void)#define SAVEKMSG_MAGIC2 0x4B4D5347/* 'KMSG' */ struct savekmsg { -unsigned long magic1;/* SAVEKMSG_MAGIC1 */ -unsigned long magic2;/* SAVEKMSG_MAGIC2 */ -unsigned long magicptr;/* address of magic1 */ -unsigned long size; -char data[0 ]; +unsigned long magic1;/* SAVEKMSG_MAGIC1 */ +unsigned long magic2;/* SAVEKMSG_MAGIC2 */ +unsigned long magicptr;/* address of magic1 */ +unsigned long size; +char data[0 ]; };static struct savekmsg *savekmsg;
@@ -785,100 +781,100 @@ static struct savekmsg *savekmsg;static void amiga_mem_console_write (struct console *co,const char *s,unsigned int count) { -if (savekmsg->size+count <=SAVEKMSG_MAXMEM -sizeof (struct savekmsg )) { -memcpy (savekmsg->data+savekmsg->size, s, count); - savekmsg->size += count; - } +if (savekmsg->size + count <=SAVEKMSG_MAXMEM -sizeof (struct savekmsg )) { +memcpy (savekmsg->data + savekmsg->size, s, count); + savekmsg->size += count; + } }static void amiga_savekmsg_init (void ) { -static struct resource debug_res = { .name ="Debug" }; +static struct resource debug_res = { .name ="Debug" }; - savekmsg =amiga_chip_alloc_res (SAVEKMSG_MAXMEM , &debug_res); - savekmsg->magic1 =SAVEKMSG_MAGIC1 ; - savekmsg->magic2 =SAVEKMSG_MAGIC2 ; - savekmsg->magicptr =ZTWO_PADDR (savekmsg); - savekmsg->size =0 ; + savekmsg =amiga_chip_alloc_res (SAVEKMSG_MAXMEM , &debug_res); + savekmsg->magic1 =SAVEKMSG_MAGIC1 ; + savekmsg->magic2 =SAVEKMSG_MAGIC2 ; + savekmsg->magicptr =ZTWO_PADDR (savekmsg); + savekmsg->size =0 ; }static void amiga_serial_putc (char c) { - amiga_custom.serdat = (unsigned char )c |0x100 ; -while (!(amiga_custom.serdatr &0x2000 )) - ; + amiga_custom.serdat = (unsigned char )c |0x100 ; +while (!(amiga_custom.serdatr &0x2000 )) + ; }void amiga_serial_console_write (struct console *co,const char *s, -unsigned int count) +unsigned int count) { -while (count--) { -if (*s =='\n' ) -amiga_serial_putc ('\r' ); -amiga_serial_putc (*s++); - } +while (count--) { +if (*s =='\n' ) +amiga_serial_putc ('\r' ); +amiga_serial_putc (*s++); + } }#ifdef CONFIG_SERIAL_CONSOLE void amiga_serial_puts (const char *s) { -amiga_serial_console_write (NULL , s,strlen (s)); +amiga_serial_console_write (NULL , s,strlen (s)); }int amiga_serial_console_wait_key (struct console *co) { -int ch; +int ch; -while (!(amiga_custom.intreqr &IF_RBF )) -barrier (); - ch = amiga_custom.serdatr &0xff ; -/* clear the interrupt, so that another character can be read */ - amiga_custom.intreq =IF_RBF ; -return ch; +while (!(amiga_custom.intreqr &IF_RBF )) +barrier (); + ch = amiga_custom.serdatr &0xff ; +/* clear the interrupt, so that another character can be read */ + amiga_custom.intreq =IF_RBF ; +return ch; }void amiga_serial_gets (struct console *co,char *s,int len) { -int ch, cnt =0 ; +int ch, cnt =0 ; + +while (1 ) { + ch =amiga_serial_console_wait_key (co); -while (1 ) { - ch =amiga_serial_console_wait_key (co); +/* Check for backspace. */ +if (ch ==8 || ch ==127 ) { +if (cnt ==0 ) { +amiga_serial_putc ('\007' ); +continue ; + } + cnt--; +amiga_serial_puts ("\010 \010" ); +continue ; + } + +/* Check for enter. */ +if (ch ==10 || ch ==13 ) +break ; + +/* See if line is too long. */ +if (cnt >= len +1 ) { +amiga_serial_putc (7 ); + cnt--; +continue ; + } -/* Check for backspace. */ -if (ch ==8 || ch ==127 ) { -if (cnt ==0 ) { -amiga_serial_putc ('\007' ); -continue ; - } - cnt--; -amiga_serial_puts ("\010 \010" ); -continue ; - } - -/* Check for enter. */ -if (ch ==10 || ch ==13 ) -break ; - -/* See if line is too long. */ -if (cnt >= len +1 ) { -amiga_serial_putc (7 ); - cnt--; -continue ; - } - -/* Store and echo character. */ - s[cnt++] = ch; -amiga_serial_putc (ch); - } -/* Print enter. */ -amiga_serial_puts ("\r\n" ); - s[cnt] =0 ; +/* Store and echo character. */ + s[cnt++] = ch; +amiga_serial_putc (ch); + } +/* Print enter. */ +amiga_serial_puts ("\r\n" ); + s[cnt] =0 ; }#endif static void __init amiga_debug_init (void ) { -if (!strcmp ( m68k_debug_device,"ser" )) { +if (!strcmp (m68k_debug_device,"ser" )) {/* no initialization required (?) */ amiga_console_driver.write = amiga_serial_console_write;register_console (&amiga_console_driver);
@@ -888,10 +884,10 @@ static void __init amiga_debug_init(void#ifdef CONFIG_HEARTBEAT static void amiga_heartbeat (int on) { -if (on) - ciaa.pra &= ~2 ; -else - ciaa.pra |=2 ; +if (on) + ciaa.pra &= ~2 ; +else + ciaa.pra |=2 ; }#endif
@@ -901,81 +897,81 @@ static void amiga_heartbeat(int on)static void amiga_get_model (char *model) { -strcpy (model, amiga_model_name); +strcpy (model, amiga_model_name); }static int amiga_get_hardware_list (char *buffer) { -int len =0 ; +int len =0 ; -if (AMIGAHW_PRESENT (CHIP_RAM )) - len +=sprintf (buffer+len,"Chip RAM:\t%ldK\n" , amiga_chip_size>>10 ); - len +=sprintf (buffer+len,"PS Freq:\t%dHz\nEClock Freq:\t%ldHz\n" , - amiga_psfreq, amiga_eclock); -if (AMIGAHW_PRESENT (AMI_VIDEO )) { -char *type; -switch (amiga_chipset) { -case CS_OCS : - type ="OCS" ; -break ; -case CS_ECS : - type ="ECS" ; -break ; -case CS_AGA : - type ="AGA" ; -break ; -default : - type ="Old or Unknown" ; -break ; +if (AMIGAHW_PRESENT (CHIP_RAM )) + len +=sprintf (buffer+len,"Chip RAM:\t%ldK\n" , amiga_chip_size>>10 ); + len +=sprintf (buffer+len,"PS Freq:\t%dHz\nEClock Freq:\t%ldHz\n" , + amiga_psfreq, amiga_eclock); +if (AMIGAHW_PRESENT (AMI_VIDEO )) { +char *type; +switch (amiga_chipset) { +case CS_OCS : + type ="OCS" ; +break ; +case CS_ECS : + type ="ECS" ; +break ; +case CS_AGA : + type ="AGA" ; +break ; +default : + type ="Old or Unknown" ; +break ; + } + len +=sprintf (buffer+len,"Graphics:\t%s\n" , type); } - len +=sprintf (buffer+len,"Graphics:\t%s\n" , type); - }#define AMIGAHW_ANNOUNCE (name, str) \ - if (AMIGAHW_PRESENT(name)) \ - len += sprintf (buffer+len, "\t%s\n", str) + if (AMIGAHW_PRESENT(name)) \ + len += sprintf (buffer+len, "\t%s\n", str) - len +=sprintf (buffer + len,"Detected hardware:\n" ); + len +=sprintf (buffer + len,"Detected hardware:\n" ); -AMIGAHW_ANNOUNCE (AMI_VIDEO ,"Amiga Video" ); -AMIGAHW_ANNOUNCE (AMI_BLITTER ,"Blitter" ); -AMIGAHW_ANNOUNCE (AMBER_FF ,"Amber Flicker Fixer" ); -AMIGAHW_ANNOUNCE (AMI_AUDIO ,"Amiga Audio" ); -AMIGAHW_ANNOUNCE (AMI_FLOPPY ,"Floppy Controller" ); -AMIGAHW_ANNOUNCE (A3000_SCSI ,"SCSI Controller WD33C93 (A3000 style)" ); -AMIGAHW_ANNOUNCE (A4000_SCSI ,"SCSI Controller NCR53C710 (A4000T style)" ); -AMIGAHW_ANNOUNCE (A1200_IDE ,"IDE Interface (A1200 style)" ); -AMIGAHW_ANNOUNCE (A4000_IDE ,"IDE Interface (A4000 style)" ); -AMIGAHW_ANNOUNCE (CD_ROM ,"Internal CD ROM drive" ); -AMIGAHW_ANNOUNCE (AMI_KEYBOARD ,"Keyboard" ); -AMIGAHW_ANNOUNCE (AMI_MOUSE ,"Mouse Port" ); -AMIGAHW_ANNOUNCE (AMI_SERIAL ,"Serial Port" ); -AMIGAHW_ANNOUNCE (AMI_PARALLEL ,"Parallel Port" ); -AMIGAHW_ANNOUNCE (A2000_CLK ,"Hardware Clock (A2000 style)" ); -AMIGAHW_ANNOUNCE (A3000_CLK ,"Hardware Clock (A3000 style)" ); -AMIGAHW_ANNOUNCE (CHIP_RAM ,"Chip RAM" ); -AMIGAHW_ANNOUNCE (PAULA ,"Paula 8364" ); -AMIGAHW_ANNOUNCE (DENISE ,"Denise 8362" ); -AMIGAHW_ANNOUNCE (DENISE_HR ,"Denise 8373" ); -AMIGAHW_ANNOUNCE (LISA ,"Lisa 8375" ); -AMIGAHW_ANNOUNCE (AGNUS_PAL ,"Normal/Fat PAL Agnus 8367/8371" ); -AMIGAHW_ANNOUNCE (AGNUS_NTSC ,"Normal/Fat NTSC Agnus 8361/8370" ); -AMIGAHW_ANNOUNCE (AGNUS_HR_PAL ,"Fat Hires PAL Agnus 8372" ); -AMIGAHW_ANNOUNCE (AGNUS_HR_NTSC ,"Fat Hires NTSC Agnus 8372" ); -AMIGAHW_ANNOUNCE (ALICE_PAL ,"PAL Alice 8374" ); -AMIGAHW_ANNOUNCE (ALICE_NTSC ,"NTSC Alice 8374" ); -AMIGAHW_ANNOUNCE (MAGIC_REKICK ,"Magic Hard Rekick" ); -AMIGAHW_ANNOUNCE (PCMCIA ,"PCMCIA Slot" ); +AMIGAHW_ANNOUNCE (AMI_VIDEO ,"Amiga Video" ); +AMIGAHW_ANNOUNCE (AMI_BLITTER ,"Blitter" ); +AMIGAHW_ANNOUNCE (AMBER_FF ,"Amber Flicker Fixer" ); +AMIGAHW_ANNOUNCE (AMI_AUDIO ,"Amiga Audio" ); +AMIGAHW_ANNOUNCE (AMI_FLOPPY ,"Floppy Controller" ); +AMIGAHW_ANNOUNCE (A3000_SCSI ,"SCSI Controller WD33C93 (A3000 style)" ); +AMIGAHW_ANNOUNCE (A4000_SCSI ,"SCSI Controller NCR53C710 (A4000T style)" ); +AMIGAHW_ANNOUNCE (A1200_IDE ,"IDE Interface (A1200 style)" ); +AMIGAHW_ANNOUNCE (A4000_IDE ,"IDE Interface (A4000 style)" ); +AMIGAHW_ANNOUNCE (CD_ROM ,"Internal CD ROM drive" ); +AMIGAHW_ANNOUNCE (AMI_KEYBOARD ,"Keyboard" ); +AMIGAHW_ANNOUNCE (AMI_MOUSE ,"Mouse Port" ); +AMIGAHW_ANNOUNCE (AMI_SERIAL ,"Serial Port" ); +AMIGAHW_ANNOUNCE (AMI_PARALLEL ,"Parallel Port" ); +AMIGAHW_ANNOUNCE (A2000_CLK ,"Hardware Clock (A2000 style)" ); +AMIGAHW_ANNOUNCE (A3000_CLK ,"Hardware Clock (A3000 style)" ); +AMIGAHW_ANNOUNCE (CHIP_RAM ,"Chip RAM" ); +AMIGAHW_ANNOUNCE (PAULA ,"Paula 8364" ); +AMIGAHW_ANNOUNCE (DENISE ,"Denise 8362" ); +AMIGAHW_ANNOUNCE (DENISE_HR ,"Denise 8373" ); +AMIGAHW_ANNOUNCE (LISA ,"Lisa 8375" ); +AMIGAHW_ANNOUNCE (AGNUS_PAL ,"Normal/Fat PAL Agnus 8367/8371" ); +AMIGAHW_ANNOUNCE (AGNUS_NTSC ,"Normal/Fat NTSC Agnus 8361/8370" ); +AMIGAHW_ANNOUNCE (AGNUS_HR_PAL ,"Fat Hires PAL Agnus 8372" ); +AMIGAHW_ANNOUNCE (AGNUS_HR_NTSC ,"Fat Hires NTSC Agnus 8372" ); +AMIGAHW_ANNOUNCE (ALICE_PAL ,"PAL Alice 8374" ); +AMIGAHW_ANNOUNCE (ALICE_NTSC ,"NTSC Alice 8374" ); +AMIGAHW_ANNOUNCE (MAGIC_REKICK ,"Magic Hard Rekick" ); +AMIGAHW_ANNOUNCE (PCMCIA ,"PCMCIA Slot" );#ifdef CONFIG_ZORRO -if (AMIGAHW_PRESENT (ZORRO )) - len +=sprintf (buffer+len,"\tZorro II%s AutoConfig: %d Expansion " -"Device%s\n" , -AMIGAHW_PRESENT (ZORRO3 ) ?"I" :"" , - zorro_num_autocon, zorro_num_autocon ==1 ?"" :"s" ); +if (AMIGAHW_PRESENT (ZORRO )) + len +=sprintf (buffer+len,"\tZorro II%s AutoConfig: %d Expansion " +"Device%s\n" , +AMIGAHW_PRESENT (ZORRO3 ) ?"I" :"" , + zorro_num_autocon, zorro_num_autocon ==1 ?"" :"s" );#endif /* CONFIG_ZORRO */ #undef AMIGAHW_ANNOUNCE -return (len); +return len; }
arch/m68k/atari/config.c +469 -514
1,085 lines not on this page · raw message
arch/m68k/atari/debug.c +232 -238
549 lines not on this page · raw message
arch/m68k/kernel/entry.S +1 -1
@@ -692,7 +692,7 @@ sys_call_table: .long sys_tgkill /* 265 */ .long sys_utimes .long sys_fadvise64_64 - .long sys_mbind + .long sys_mbind .long sys_get_mempolicy .long sys_set_mempolicy /* 270 */ .long sys_mq_open
arch/m68k/kernel/head.S +1 -1
@@ -3195,7 +3195,7 @@ func_start serial_putc,%d0/%d1/%a0/%a1 jbra L(serial_putc_done) 3: #endif - + L(serial_putc_done): func_return serial_putc
arch/m68k/kernel/setup.c +192 -189
70 lines not on this page · raw message
arch/m68k/mac/config.c +81 -80
161 lines not on this page · raw message
arch/m68k/mac/debug.c +161 -170
331 lines not on this page · raw message
arch/m68k/q40/config.c +131 -128
259 lines not on this page · raw message
arch/m68k/sun3x/prom.c +59 -62
121 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Part of the diff is not shown here. View the raw message.
Geert Uytterhoeven
maintainerPATCH 10/33 hilkbd: Kill compiler warning and fix comment dyslexia
In reply to Geert Uytterhoevenhilkbd: Kill compiler warning and fix comment dyslexia
--- drivers/input/keyboard/hilkbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/hilkbd.c +1 -1
@@ -52,7 +52,7 @@ MODULE_LICENSE("GPL v2");#elif defined(CONFIG_HP300 ) -#define HILBASE 0xf0428000/* HP300 (m86k) port address */ +#define HILBASE 0xf0428000UL/* HP300 (m68k) port address */ #define HIL_DATA 0x1#define HIL_CMD 0x3#define HIL_IRQ 2
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
Geert Uytterhoeven
maintainerPATCH 10/33 hilkbd: Kill compiler warning and fix comment dyslexia
In reply to Geert Uytterhoevenhilkbd: Kill compiler warning and fix comment dyslexia
--- drivers/input/keyboard/hilkbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/hilkbd.c +1 -1
@@ -52,7 +52,7 @@ MODULE_LICENSE("GPL v2");#elif defined(CONFIG_HP300 ) -#define HILBASE 0xf0428000/* HP300 (m86k) port address */ +#define HILBASE 0xf0428000UL/* HP300 (m68k) port address */ #define HIL_DATA 0x1#define HIL_CMD 0x3#define HIL_IRQ 2
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 11/33 m68k: early parameter support
In reply to Geert UytterhoevenFrom: Roman Zippel <[email protected]>
Add early parameter support and convert current users to it.
--- arch/m68k/amiga/config.c | 41 ++++++++++++++++++++++------------------- arch/m68k/atari/config.c | 17 +++++++++-------- arch/m68k/atari/debug.c | 24 ++++++++++++++---------- arch/m68k/kernel/setup.c | 39 +-------------------------------------- arch/m68k/mac/config.c | 8 -------- arch/m68k/mac/debug.c | 20 ++++++++++---------- arch/m68k/q40/config.c | 23 ++++++++++++++--------- arch/m68k/sun3x/prom.c | 11 +++++++---- 8 files changed, 77 insertions(+), 106 deletions(-)
arch/m68k/amiga/config.c +22 -19
@@ -79,8 +79,6 @@ static char *amiga_models[] __initdata =static char amiga_model_name[13 ] ="Amiga " ; -extern char m68k_debug_device[]; -static void amiga_sched_init (irq_handler_t handler);/* amiga specific irq functions */ extern void amiga_init_IRQ (void );
@@ -95,12 +93,10 @@ static unsigned int amiga_get_ss(void);extern void amiga_mksound (unsigned int count,unsigned int ticks);static void amiga_reset (void );extern void amiga_init_sound (void ); -static void amiga_savekmsg_init (void );static void amiga_mem_console_write (struct console *co,const char *b,unsigned int count);void amiga_serial_console_write (struct console *co,const char *s,unsigned int count); -static void amiga_debug_init (void );#ifdef CONFIG_HEARTBEAT static void amiga_heartbeat (int on);#endif
@@ -370,7 +366,6 @@ void __init config_amiga(void) {int i; -amiga_debug_init ();amiga_identify ();/* Yuk, we don't have PCI memory */
@@ -458,17 +453,6 @@ void __init config_amiga(void)/* initialize chipram allocator */ amiga_chip_init (); -/* debugging using chipram */ -if (!strcmp (m68k_debug_device,"mem" )) { -if (!AMIGAHW_PRESENT (CHIP_RAM )) -printk ("Warning: no chipram present for debugging\n" ); -else { -amiga_savekmsg_init (); - amiga_console_driver.write = amiga_mem_console_write; -register_console (&amiga_console_driver); - } - } -/* our beloved beeper */ if (AMIGAHW_PRESENT (AMI_AUDIO ))amiga_init_sound ();
@@ -787,17 +771,33 @@ static void amiga_mem_console_write(stru } } -static void amiga_savekmsg_init (void ) +static int __init amiga_savekmsg_setup (char *arg) {static struct resource debug_res = { .name ="Debug" }; +if (!MACH_IS_AMIGA ||strcmp (arg,"mem" )) + goto done; + +if (!AMIGAHW_PRESENT (CHIP_RAM )) { +printk ("Warning: no chipram present for debugging\n" ); + goto done; + } + savekmsg =amiga_chip_alloc_res (SAVEKMSG_MAXMEM , &debug_res); savekmsg->magic1 =SAVEKMSG_MAGIC1 ; savekmsg->magic2 =SAVEKMSG_MAGIC2 ; savekmsg->magicptr =ZTWO_PADDR (savekmsg); savekmsg->size =0 ; + + amiga_console_driver.write = amiga_mem_console_write; +register_console (&amiga_console_driver); + +done: +return 0 ; } +early_param ("debug" , amiga_savekmsg_setup); +static void amiga_serial_putc (char c) { amiga_custom.serdat = (unsigned char )c |0x100 ;
@@ -872,15 +872,18 @@ void amiga_serial_gets(struct console *c }#endif -static void __init amiga_debug_init (void ) +static int __init amiga_debug_setup (char *arg) { -if (!strcmp (m68k_debug_device,"ser" )) { +if (MACH_IS_AMIGA && !strcmp (arg,"ser" )) {/* no initialization required (?) */ amiga_console_driver.write = amiga_serial_console_write;register_console (&amiga_console_driver); } +return 0 ; } +early_param ("debug" , amiga_debug_setup); +#ifdef CONFIG_HEARTBEAT static void amiga_heartbeat (int on) {
arch/m68k/atari/config.c +9 -8
@@ -69,9 +69,6 @@ extern int atari_tt_hwclk (int, struct rextern int atari_mste_set_clock_mmss (unsigned long );extern int atari_tt_set_clock_mmss (unsigned long ); -/* atari specific debug functions (in debug.c) */ -extern void atari_debug_init (void ); -/* ++roman: This is a more elaborate test for an SCC chip, since the plain * Medusa board generates DTACK at the SCC's standard addresses, but a SCC
@@ -137,15 +134,18 @@ int __init atari_parse_bootinfo(const st/* Parse the Atari-specific switches= option. */ -void __init atari_switches_setup (const char *str,unsigned len) +static int __init atari_switches_setup (char *str) { -char switches[len+1 ]; +char switches[strlen (str) +1 ];char *p;int ovsc_shift;char *args = switches; +if (!MACH_IS_ATARI ) +return 0 ; +/* copy string to local array, strsep works destructively... */ -strlcpy (switches, str,sizeof (switches)); +strcpy (switches, str); atari_switches =0 ;/* parse the options */
@@ -170,8 +170,11 @@ void __init atari_switches_setup(const c atari_switches |=ATARI_SWITCH_SND7 << ovsc_shift; } } +return 0 ; } +early_param ("switches" , atari_switches_setup); +/* * Setup the Atari configuration info
@@ -183,8 +186,6 @@ void __init config_atari(void)memset (&atari_hw_present,0 ,sizeof (atari_hw_present)); -atari_debug_init (); -/* Change size of I/O space from 64KB to 4GB. */ ioport_resource.end =0xFFFFFFFF ;
arch/m68k/atari/debug.c +14 -10
@@ -19,8 +19,6 @@#include <asm/atarihw.h> #include <asm/atariints.h> -extern char m68k_debug_device[]; -/* Flag that Modem1 port is already initialized and used */ int atari_MFP_init_done;/* Flag that Modem1 port is already initialized and used */
@@ -305,26 +303,28 @@ void atari_init_midi_port(int cflag) ACIA_RHTID : ACIA_RLTID); } -void __init atari_debug_init (void ) +static int __init atari_debug_setup (char *arg) { -if (!strcmp (m68k_debug_device,"ser" )) { +if (!MACH_IS_ATARI ) +return 0 ; + +if (!strcmp (arg,"ser" ))/* defaults to ser2 for a Falcon and ser1 otherwise */ -strcpy (m68k_debug_device,MACH_IS_FALCON ?"ser2" :"ser1" ); - } + arg =MACH_IS_FALCON ?"ser2" :"ser1" ; -if (!strcmp (m68k_debug_device,"ser1" )) { +if (!strcmp (arg,"ser1" )) {/* ST-MFP Modem1 serial port */ atari_init_mfp_port (B9600 |CS8 ); atari_console_driver.write = atari_mfp_console_write; - }else if (!strcmp (m68k_debug_device,"ser2" )) { + }else if (!strcmp (arg,"ser2" )) {/* SCC Modem2 serial port */ atari_init_scc_port (B9600 |CS8 ); atari_console_driver.write = atari_scc_console_write; - }else if (!strcmp (m68k_debug_device,"midi" )) { + }else if (!strcmp (arg,"midi" )) {/* MIDI port */ atari_init_midi_port (B9600 |CS8 ); atari_console_driver.write = atari_midi_console_write; - }else if (!strcmp (m68k_debug_device,"par" )) { + }else if (!strcmp (arg,"par" )) {/* parallel printer */ atari_turnoff_irq (IRQ_MFP_BUSY );/* avoid ints */ sound_ym.rd_data_reg_sel =7 ;/* select mixer control */
@@ -337,4 +337,8 @@ void __init atari_debug_init(void) }if (atari_console_driver.write)register_console (&atari_console_driver); + +return 0 ; } + +early_param ("debug" , atari_debug_setup);
arch/m68k/kernel/setup.c +1 -38
@@ -71,9 +71,6 @@ static struct mem_info m68k_ramdisk;static char m68k_command_line[CL_SIZE ]; -char m68k_debug_device[6 ] ="" ; -EXPORT_SYMBOL (m68k_debug_device); -void (*mach_sched_init) (irq_handler_t handler)__initdata =NULL ;/* machine dependent irq functions */ void (*mach_init_IRQ) (void )__initdata =NULL ;
@@ -215,7 +212,6 @@ void __init setup_arch(char **cmdline_p)unsigned long endmem, startmem;#endif int i; -char *p, *q;/* The bootinfo is located right after the kernel bss */ m68k_parse_bootinfo ((const struct bi_record *)&_end);
@@ -258,40 +254,7 @@ void __init setup_arch(char **cmdline_p) *cmdline_p = m68k_command_line;memcpy (boot_command_line, *cmdline_p,CL_SIZE ); -/* Parse the command line for arch-specific options. -* For the m68k, this is currently only "debug=xxx" to enable printing -* certain kernel messages to some machine-specific device. -*/ -for (p = *cmdline_p; p && *p;) { - i =0 ; -if (!strncmp (p,"debug=" ,6 )) { -strlcpy (m68k_debug_device, p+6 ,sizeof (m68k_debug_device)); - q =strchr (m68k_debug_device,' ' ); -if (q) - *q =0 ; - i =1 ; - } -#ifdef CONFIG_ATARI -/* This option must be parsed very early */ -if (!strncmp (p,"switches=" ,9 )) { -extern void atari_switches_setup (const char *,int ); - q =strchr (p +9 ,' ' ); -atari_switches_setup (p +9 , q ? (q - (p +9 )) :strlen (p +9 )); - i =1 ; - } -#endif - -if (i) { -/* option processed, delete it */ -if ((q =strchr (p,' ' ))) -strcpy (p, q +1 ); -else - *p =0 ; - }else { -if ((p =strchr (p,' ' ))) - ++p; - } - } +parse_early_param ();#ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con;
arch/m68k/mac/config.c +0 -8
@@ -82,10 +82,6 @@ extern void mac_mksound(unsigned int, unextern void nubus_sweep_video (void ); -/* Mac specific debug functions (in debug.c) */ -extern void mac_debug_init (void ); -extern void mac_debugging_long (int ,long ); -static void mac_get_model (char *str);static void mac_sched_init (irq_handler_t vector)
@@ -180,9 +176,6 @@ void __init config_mac(void) mach_halt = mac_poweroff; mach_power_off = mac_poweroff; mach_max_dma_address =0xffffffff ; -#if 0 - mach_debug_init = mac_debug_init; -#endif #if defined(CONFIG_INPUT_M68K_BEEP ) || defined(CONFIG_INPUT_M68K_BEEP_MODULE ) mach_beep = mac_mksound;#endif
@@ -802,7 +795,6 @@ void mac_identify(void)/* the serial ports set to "Faster" mode in MacOS. */ iop_preinit (); -mac_debug_init ();printk (KERN_INFO "Detected Macintosh model: %d \n" , model);
arch/m68k/mac/debug.c +10 -10
@@ -27,10 +27,6 @@#include <asm/machw.h> #include <asm/macints.h> -extern char m68k_debug_device[]; - -extern struct compat_bootinfo compat_boot_info; -extern unsigned long mac_videobase;extern unsigned long mac_videodepth;extern unsigned long mac_rowbytes;
@@ -360,16 +356,18 @@ void mac_init_sccb_port(int cflag)mac_init_scc_port (cflag,1 ); } -void __init mac_debug_init (void ) +static int __init mac_debug_setup (char *arg) { +if (!MACH_IS_MAC ) +return 0 ; +#ifdef DEBUG_SERIAL -if (!strcmp (m68k_debug_device,"ser" ) || - !strcmp (m68k_debug_device,"ser1" )) { +if (!strcmp (arg,"ser" ) || !strcmp (arg,"ser1" )) {/* Mac modem port */ mac_init_scc_port (B9600 |CS8 ,0 ); mac_console_driver.write = mac_scca_console_write; scc_port =0 ; - }else if (!strcmp (m68k_debug_device,"ser2" )) { + }else if (!strcmp (arg,"ser2" )) {/* Mac printer port */ mac_init_scc_port (B9600 |CS8 ,1 ); mac_console_driver.write = mac_sccb_console_write;
@@ -377,12 +375,14 @@ void __init mac_debug_init(void) }#endif #ifdef DEBUG_HEADS -if (!strcmp (m68k_debug_device,"scn" ) || - !strcmp (m68k_debug_device,"con" )) { +if (!strcmp (arg,"scn" ) || !strcmp (arg,"con" )) {/* display, using head.S console routines */ mac_console_driver.write = mac_debug_console_write; }#endif if (mac_console_driver.write)register_console (&mac_console_driver); +return 0 ; } + +early_param ("debug" , mac_debug_setup);
arch/m68k/q40/config.c +14 -9
@@ -54,7 +54,6 @@ void q40_set_vectors(void);extern void q40_mksound (unsigned int /*freq*/ ,unsigned int /*ticks*/ ); -extern char m68k_debug_device[];static void q40_mem_console_write (struct console *co,const char *b,unsigned int count);
@@ -62,6 +61,7 @@ extern int ql_ticks;static struct console q40_console_driver = { .name ="debug" , + .write = q40_mem_console_write, .flags =CON_PRINTBUFFER , .index =-1 , };
@@ -85,6 +85,19 @@ static void q40_mem_console_write(struct } } +static int __init q40_debug_setup (char *arg) +{ +/* useful for early debugging stages - writes kernel messages into SRAM */ +if (MACH_IS_Q40 && !strncmp (arg,"mem" ,3 )) { +/*printk("using NVRAM debug, q40_mem_cptr=%p\n",q40_mem_cptr);*/ + _cpleft =2000 - ((long )q40_mem_cptr-0xff020000 ) /4 ; +register_console (&q40_console_driver); + } +return 0 ; +} + +early_param ("debug" , q40_debug_setup); +#if 0 void printq40 (char *str) {
@@ -194,14 +207,6 @@ void __init config_q40(void)* all physical RAM fits into the boundary - otherwise * allocator may play costly and useless tricks */ mach_max_dma_address =1024 *1024 *1024 ; - -/* useful for early debugging stages - writes kernel messages into SRAM */ -if (!strncmp ( m68k_debug_device,"mem" ,3 )) { -/*printk("using NVRAM debug, q40_mem_cptr=%p\n",q40_mem_cptr);*/ - _cpleft =2000 - ((long )q40_mem_cptr-0xff020000 ) /4 ; - q40_console_driver.write = q40_mem_console_write; -register_console (&q40_console_driver); - } }
arch/m68k/sun3x/prom.c +7 -4
@@ -73,8 +73,6 @@ void sun3x_reboot(void) (*romvec->pv_reboot)("vmlinux" ); } -extern char m68k_debug_device[]; -static void sun3x_prom_write (struct console *co,const char *s,unsigned int count) {
@@ -119,13 +117,18 @@ void sun3x_prom_init(void)* XXX this is futile since we restore the vbr first - oops */ vectors[VEC_TRAP14 ] = sun3x_prom_abort; +} +static int __init sun3x_debug_setup (char *arg) +{/* If debug=prom was specified, start the debug console */ - -if (!strcmp (m68k_debug_device,"prom" )) +if (MACH_IS_SUN3X && !strcmp (arg,"prom" ))register_console (&sun3x_debug); +return 0 ; } +early_param ("debug" , sun3x_debug_setup); +/* some prom functions to export */ int prom_getintdefault (int node,char *property,int deflt) {
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 12/33 m68k: make Atari IDE lock reentrant
In reply to Geert UytterhoevenQuoted 1 line
From Roman Zippel <[email protected]>
Make the Atari IDE lock reentrant, as the new request is started in the interrupt before the last one is completely released.
--- include/asm-m68k/ide.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
include/asm-m68k/ide.h +4 -4
@@ -117,8 +117,8 @@ static __inline__ void ide_release_lockprintk ("ide_release_lock: bug\n" );return ; } - falconide_intr_lock =0 ; -stdma_release (); +if (!--falconide_intr_lock) +stdma_release (); } }
@@ -126,12 +126,12 @@ static __inline__ void ide_get_lock(irq_handler_t handler, void *data) {if (MACH_IS_ATARI ) { -if (falconide_intr_lock ==0 ) { +if (!falconide_intr_lock) {if (in_interrupt () >0 )panic ("Falcon IDE hasn't ST-DMA lock in interrupt" );stdma_lock (handler, data); - falconide_intr_lock =1 ; } + falconide_intr_lock++; } }#endif /* CONFIG_BLK_DEV_FALCON_IDE */
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 13/33 m68k: Correct number of interrupts for Sun3
In reply to Geert UytterhoevenFrom: Sam Creasey <[email protected]>
Only attempt to initialize the amount of interrupts a sun3 actually has...
--- arch/m68k/sun3/sun3ints.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/sun3/sun3ints.c +1 -1
@@ -103,7 +103,7 @@ void sun3_init_IRQ(void)m68k_setup_auto_interrupt (sun3_inthandle);m68k_setup_irq_controller (&sun3_irq_controller,IRQ_AUTO_1 ,7 ); -m68k_setup_user_interrupt (VEC_USER ,192 ,NULL ); +m68k_setup_user_interrupt (VEC_USER ,128 ,NULL );request_irq (IRQ_AUTO_5 , sun3_int5,0 ,"int5" ,NULL );request_irq (IRQ_AUTO_7 , sun3_int7,0 ,"int7" ,NULL );
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 14/33 m68k: Atari SCSI workqueue updates
In reply to Geert UytterhoevenWorkqueue updates for the Atari SCSI driver
--- drivers/scsi/atari_NCR5380.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/atari_NCR5380.c +2 -2
@@ -657,7 +657,7 @@ static inline void NCR5380_print_phase(s#include <linux/interrupt.h> static volatile int main_running; -static DECLARE_WORK(NCR5380_tqueue, (void (*)(void *))NCR5380_main, NULL); +static DECLARE_WORK(NCR5380_tqueue, NCR5380_main);static inline void queue_main (void ) {
@@ -1075,7 +1075,7 @@ static int NCR5380_queue_command(Scsi_Cm* reenable them. This prevents reentrancy and kernel stack overflow. */ -static void NCR5380_main (void *bl) +static void NCR5380_main (struct work_struct *work) {Scsi_Cmnd *tmp, *prev;struct Scsi_Host *instance = first_instance;
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 15/33 m68k: pmu_queue_request() declaration conflict
In reply to Geert UytterhoevenFrom: Finn Thain <[email protected]>
Fixes a "static qualifier follows non-static qualifier" error from gcc 4.
--- drivers/macintosh/via-pmu68k.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/macintosh/via-pmu68k.c +1 -2
@@ -111,7 +111,6 @@ static int pmu_send_request(struct adb_rstatic int pmu_autopoll (int devs);void pmu_poll (void );static int pmu_reset_bus (void ); -static int pmu_queue_request (struct adb_request *req);static void pmu_start (void );static void send_byte (int x);
@@ -475,7 +474,7 @@ pmu_request(struct adb_request *req, voireturn pmu_queue_request (req); } -static int +int pmu_queue_request (struct adb_request *req) {unsigned long flags;
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 16/33 m68k: Amiga A2065 and Ariadne TX statistics
In reply to Geert UytterhoevenAdd missing code to the Amiga A2065 and Ariadne drivers to update net_device_stats.tx_bytes.
--- drivers/net/a2065.c | 4 +--- drivers/net/ariadne.c | 1 + 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/net/a2065.c +1 -3
@@ -562,7 +562,6 @@ static int lance_start_xmit (struct sk_bvolatile struct lance_init_block *ib = lp->init_block;int entry, skblen, len;int status =0 ; -static int outs;unsigned long flags; skblen = skb->len;
@@ -607,8 +606,7 @@ static int lance_start_xmit (struct sk_b/* Now, give the packet to the lance */ ib->btx_ring [entry].tmd1_bits = (LE_T1_POK |LE_T1_OWN ); lp->tx_new = (lp->tx_new+1 ) & lp->tx_ring_mod_mask; - - outs++; + lp->stats.tx_bytes += skblen;if (TX_BUFFS_AVAIL <=0 )netif_stop_queue (dev);
drivers/net/ariadne.c +1 -0
@@ -677,6 +677,7 @@ static int ariadne_start_xmit(struct sk_ priv->cur_tx -=TX_RING_SIZE ; priv->dirty_tx -=TX_RING_SIZE ; } + priv->stats.tx_bytes += len;/* Trigger an immediate send poll. */ lance->RAP =CSR0 ;/* PCnet-ISA Controller Status */
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 17/33 m68k: remove unused adb.h
In reply to Geert UytterhoevenFrom: Finn Thain <[email protected]>
The asm-m68k/adb.h header is unused. Some definitions are wrong and the rest are duplicated in linux/adb.h. Remove it.
include/asm-m68k/adb.h deleted +0 -75
@@ -1,75 +0,0 @@ -/* -* Definitions for talking to ADB and CUDA. The CUDA is a microcontroller -* which controls the ADB, system power, RTC, and various other things on -* later Macintoshes -* -* Copyright (C) 1996 Paul Mackerras. -*/ - -/* First byte sent to or received from CUDA */ -#define ADB_PACKET 0 -#define CUDA_PACKET 1 -#define ERROR_PACKET 2 -#define TIMER_PACKET 3 -#define POWER_PACKET 4 -#define MACIIC_PACKET 5 - -/* ADB commands (2nd byte) */ -#define ADB_BUSRESET 0 -#define ADB_FLUSH (id) (1 + ((id) << 4)) -#define ADB_WRITEREG (id, reg) (8 + (reg) + ((id) << 4)) -#define ADB_READREG (id, reg) (0xc + (reg) + ((id) << 4)) - -/* ADB default device IDs (upper 4 bits of 2nd byte) */ -#define ADB_DONGLE 1/* "software execution control" devices */ -#define ADB_KEYBOARD 2 -#define ADB_MOUSE 3 -#define ADB_TABLET 4 -#define ADB_MODEM 5 -#define ADB_MISC 7/* maybe a monitor */ - -/* CUDA commands (2nd byte) */ -#define CUDA_WARM_START 0 -#define CUDA_AUTOPOLL 1 -#define CUDA_GET_6805_ADDR 2 -#define CUDA_GET_TIME 3 -#define CUDA_GET_PRAM 7 -#define CUDA_SET_6805_ADDR 8 -#define CUDA_SET_TIME 9 -#define CUDA_POWERDOWN 0xa -#define CUDA_POWERUP_TIME 0xb -#define CUDA_SET_PRAM 0xc -#define CUDA_MS_RESET 0xd -#define CUDA_SEND_DFAC 0xe -#define CUDA_RESET_SYSTEM 0x11 -#define CUDA_SET_IPL 0x12 -#define CUDA_SET_AUTO_RATE 0x14 -#define CUDA_GET_AUTO_RATE 0x16 -#define CUDA_SET_DEVICE_LIST 0x19 -#define CUDA_GET_DEVICE_LIST 0x1a -#define CUDA_GET_SET_IIC 0x22 - -#ifdef __KERNEL__ - -struct adb_request { -unsigned char data[16 ]; -int nbytes; -unsigned char reply[16 ]; -int reply_len; -unsigned char reply_expected; -unsigned char sent; -unsigned char got_reply; -void (*done)(struct adb_request *); -void *arg; -struct adb_request *next; -}; - -void via_adb_init (void ); -int adb_request (struct adb_request *req, -void (*done)(struct adb_request *),int nbytes, ...); -int adb_send_request (struct adb_request *req); -void adb_poll (void ); -int adb_register (int default_id, -void (*handler)(unsigned char *,int ,struct pt_regs *)); - -#endif /* __KERNEL */
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 18/33 m68k: Mac interrupt priorities
In reply to Geert UytterhoevenFrom: Finn Thain <[email protected]>
Add some more machines that support A/UX interrupt priorities. There are probably others as well, but I've only tested these ones so far.
--- arch/m68k/mac/via.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/m68k/mac/via.c +6 -0
@@ -193,8 +193,14 @@ void __init via_init(void)/* that the IIfx emulates this alternate mapping using the OSS. */ switch (macintosh_config->ident) { +case MAC_MODEL_P475 : +case MAC_MODEL_P475F : +case MAC_MODEL_P575 : +case MAC_MODEL_Q605 : +case MAC_MODEL_Q605_ACC :case MAC_MODEL_C610 :case MAC_MODEL_Q610 : +case MAC_MODEL_Q630 :case MAC_MODEL_C650 :case MAC_MODEL_Q650 :case MAC_MODEL_Q700 :
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 19/33 NuBus header update
In reply to Geert UytterhoevenFrom: Finn Thain <[email protected]>
Sync the nubus defines with the latest code in the mac68k repo. Some of these are needed for DP8390 driver update in the next patch.
--- drivers/net/macsonic.c | 2 include/linux/nubus.h | 126 +++++++++++++++++++++++++++++-------------------- 2 files changed, 76 insertions(+), 52 deletions(-)
drivers/net/macsonic.c +1 -1
@@ -402,7 +402,7 @@ int __init macsonic_ident(struct nubus_d ndev->dr_sw == NUBUS_DRSW_DAYNA)return MACSONIC_DAYNA ; -if (ndev->dr_hw ==NUBUS_DRHW_SONIC_LC && +if (ndev->dr_hw ==NUBUS_DRHW_APPLE_SONIC_LC && ndev->dr_sw ==0 ) {/* huh? */ return MACSONIC_APPLE16 ; }
include/linux/nubus.h +75 -51
187 lines not on this page · raw message
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Re: [patch 19/33] NuBus header update
Will we see nubus ported over to the driver model soon :-)
Re: [patch 19/33] NuBus header update
Quoted 1 line · James Simmons
Will we see nubus ported over to the driver model soon :-)
I think it will happen eventually. However, my first priority personally is to get the macio code working on non-PCI macs to get the onboard stuff onto the driver model. I did look at it, and NuBus does lend itself to this conversion due to the fact that it does in general have devices that can be detected at runtime and a lot of generic infrastructure. It's just a matter of priorities and a lack of time all around.
Brad Boyer
[email protected]
Geert Uytterhoeven
maintainerPATCH 20/33 m68k: Mac DP8390 update
In reply to Geert UytterhoevenFrom: Finn Thain <[email protected]>
Fix the support for C/NET nubus ethernet cards etc. Sync up the DP8390 driver with the latest code in the mac68k repo.
--- drivers/net/mac8390.c | 245 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 175 insertions(+), 70 deletions(-)
drivers/net/mac8390.c +175 -70
@@ -14,6 +14,8 @@/* 2001-05-15: support for Cabletron ported from old daynaport driver * and fixed access to Sonic Sys card which masquerades as a Farallon * by [email protected] */ +/* 2002-12-30: Try to support more cards, some clues from NetBSD driver */ +/* 2003-12-26: Make sure Asante cards always work. */ #include <linux/module.h> #include <linux/kernel.h>
@@ -61,25 +63,21 @@ static char version[] =#define DAYNA_8390_BASE 0x80000#define DAYNA_8390_MEM 0x00000 -#define KINETICS_8390_BASE 0x80000 -#define KINETICS_8390_MEM 0x00000 -#define CABLETRON_8390_BASE 0x90000#define CABLETRON_8390_MEM 0x00000 +#define INTERLAN_8390_BASE 0xE0000 +#define INTERLAN_8390_MEM 0xD0000 +enum mac8390_type {MAC8390_NONE =-1 ,MAC8390_APPLE ,MAC8390_ASANTE , -MAC8390_FARALLON ,/* Apple, Asante, and Farallon are all compatible */ +MAC8390_FARALLON ,MAC8390_CABLETRON ,MAC8390_DAYNA ,MAC8390_INTERLAN ,MAC8390_KINETICS , -MAC8390_FOCUS , -MAC8390_SONICSYS , -MAC8390_DAYNA2 , -MAC8390_DAYNA3 , };static const char * cardname[] = {
@@ -90,10 +88,6 @@ static const char * cardname[] = {"dayna" ,"interlan" , "kinetics", -"focus" , -"sonic systems" , -"dayna2" , - "dayna_lc", }; static int word16[] = {
@@ -104,10 +98,6 @@ static int word16[] = {0 ,/* dayna */ 1 ,/* interlan */ 0, /* kinetics */ -1 ,/* focus (??) */ -1 ,/* sonic systems */ -1 ,/* dayna2 */ - 1, /* dayna-lc */ };/* on which cards do we use NuBus resources? */
@@ -119,10 +109,12 @@ static int useresources[] = {0 ,/* dayna */ 0 ,/* interlan */ 0, /* kinetics */ -0 ,/* focus (??) */ -1 ,/* sonic systems */ -1 ,/* dayna2 */ - 1, /* dayna-lc */ +}; + +enum mac8390_access { +ACCESS_UNKNOWN =0 , +ACCESS_32 , +ACCESS_16 , };extern enum mac8390_type mac8390_ident (struct nubus_dev * dev);
@@ -134,8 +126,9 @@ static int mac8390_initdev(struct net_destatic int mac8390_open (struct net_device * dev);static int mac8390_close (struct net_device * dev);static void mac8390_no_reset (struct net_device *dev); +static void interlan_reset (struct net_device *dev); -/* Sane (32-bit chunk memory read/write) - Apple/Asante/Farallon do this*/ +/* Sane (32-bit chunk memory read/write) - Some Farallon and Apple do this*/ static void sane_get_8390_hdr (struct net_device *dev,struct e8390_pkt_hdr *hdr,int ring_page); static void sane_block_input(struct net_device * dev, int count,
@@ -172,23 +165,93 @@ static void word_memcpy_fromcard(void *tenum mac8390_type __init mac8390_ident (struct nubus_dev * dev) { -if (dev->dr_sw ==NUBUS_DRSW_ASANTE ) -return MAC8390_ASANTE ; -if (dev->dr_sw ==NUBUS_DRSW_FARALLON ) -return MAC8390_FARALLON ; -if (dev->dr_sw ==NUBUS_DRSW_KINETICS ) -return MAC8390_KINETICS ; -if (dev->dr_sw ==NUBUS_DRSW_DAYNA ) -return MAC8390_DAYNA ; -if (dev->dr_sw ==NUBUS_DRSW_DAYNA2 ) -return MAC8390_DAYNA2 ; -if (dev->dr_sw ==NUBUS_DRSW_DAYNA_LC ) -return MAC8390_DAYNA3 ; -if (dev->dr_hw ==NUBUS_DRHW_CABLETRON ) -return MAC8390_CABLETRON ; +switch (dev->dr_sw) { +case NUBUS_DRSW_3COM : +switch (dev->dr_hw) { +case NUBUS_DRHW_APPLE_SONIC_NB : +case NUBUS_DRHW_APPLE_SONIC_LC : +case NUBUS_DRHW_SONNET : +return MAC8390_NONE ; +break ; +default : +return MAC8390_APPLE ; +break ; + } +break ; + +case NUBUS_DRSW_APPLE : +switch (dev->dr_hw) { +case NUBUS_DRHW_ASANTE_LC : +return MAC8390_NONE ; +break ; +case NUBUS_DRHW_CABLETRON : +return MAC8390_CABLETRON ; +break ; +default : +return MAC8390_APPLE ; +break ; + } +break ; + +case NUBUS_DRSW_ASANTE : +return MAC8390_ASANTE ; +break ; + +case NUBUS_DRSW_TECHWORKS : +case NUBUS_DRSW_DAYNA2 : +case NUBUS_DRSW_DAYNA_LC : +if (dev->dr_hw ==NUBUS_DRHW_CABLETRON ) +return MAC8390_CABLETRON ; +else +return MAC8390_APPLE ; +break ; + +case NUBUS_DRSW_FARALLON : +return MAC8390_FARALLON ; +break ; + +case NUBUS_DRSW_KINETICS : +switch (dev->dr_hw) { +case NUBUS_DRHW_INTERLAN : +return MAC8390_INTERLAN ; +break ; +default : +return MAC8390_KINETICS ; +break ; + } +break ; + +case NUBUS_DRSW_DAYNA : +// These correspond to Dayna Sonic cards +// which use the macsonic driver +if (dev->dr_hw ==NUBUS_DRHW_SMC9194 || + dev->dr_hw ==NUBUS_DRHW_INTERLAN ) +return MAC8390_NONE ; +else +return MAC8390_DAYNA ; +break ; + }return MAC8390_NONE ; } +enum mac8390_access __init mac8390_testio (volatile unsigned long membase) +{ +unsigned long outdata =0xA5A0B5B0 ; +unsigned long indata =0x00000000 ; +/* Try writing 32 bits */ +memcpy ((char *)membase, (char *)&outdata,4 ); +/* Now compare them */ +if (memcmp ((char *)&outdata, (char *)membase,4 ) ==0 ) +return ACCESS_32 ; +/* Write 16 bit output */ +word_memcpy_tocard ((char *)membase, (char *)&outdata,4 ); +/* Now read it back */ +word_memcpy_fromcard ((char *)&indata, (char *)membase,4 ); +if (outdata == indata) +return ACCESS_16 ; +return ACCESS_UNKNOWN ; +} +int __init mac8390_memsize (unsigned long membase) {unsigned long flags;
@@ -287,14 +350,6 @@ struct net_device * __init mac8390_probecontinue ; }else {nubus_get_rsrc_mem (dev->dev_addr, &ent,6 ); -/* Some Sonic Sys cards masquerade as Farallon */ -if (cardtype ==MAC8390_FARALLON && - dev->dev_addr[0 ] ==0x0 && - dev->dev_addr[1 ] ==0x40 && - dev->dev_addr[2 ] ==0x10 ) { -/* This is really Sonic Sys card */ - cardtype =MAC8390_SONICSYS ; - } }if (useresources[cardtype] ==1 ) {
@@ -334,6 +389,17 @@ struct net_device * __init mac8390_probe dev->mem_start +mac8390_memsize (dev->mem_start);break ; +case MAC8390_INTERLAN : + dev->base_addr = + (int )(ndev->board->slot_addr + +INTERLAN_8390_BASE ); + dev->mem_start = + (int )(ndev->board->slot_addr + +INTERLAN_8390_MEM ); + dev->mem_end = + dev->mem_start + +mac8390_memsize (dev->mem_start); +break ;case MAC8390_CABLETRON : dev->base_addr = (int)(ndev->board->slot_addr +
@@ -356,8 +422,8 @@ struct net_device * __init mac8390_probedefault :printk (KERN_ERR "Card type %s is" -" unsupported, sorry\n" , - cardname[cardtype]); +" unsupported, sorry\n" , + ndev->board->name);continue ; } }
@@ -438,7 +504,7 @@ static int __init mac8390_initdev(struct 24, 26, 28, 30 }; -int access_bitmode; +int access_bitmode =0 ;/* Now fill in our stuff */ dev->open = &mac8390_open;
@@ -468,29 +534,47 @@ static int __init mac8390_initdev(struct/* Fill in model-specific information and functions */ switch (type) { -case MAC8390_SONICSYS : -/* 16 bit card, register map is reversed */ - ei_status.reset_8390 = &mac8390_no_reset; - ei_status.block_input = &slow_sane_block_input; - ei_status.block_output = &slow_sane_block_output; - ei_status.get_8390_hdr = &slow_sane_get_8390_hdr; - ei_status.reg_offset = back4_offsets; - access_bitmode =0 ; -break ;case MAC8390_FARALLON :case MAC8390_APPLE : +switch (mac8390_testio (dev->mem_start)) { +case ACCESS_UNKNOWN : +printk ("Don't know how to access card memory!\n" ); +return -ENODEV ; +break ; + +case ACCESS_16 : +/* 16 bit card, register map is reversed */ + ei_status.reset_8390 = &mac8390_no_reset; + ei_status.block_input = &slow_sane_block_input; + ei_status.block_output = &slow_sane_block_output; + ei_status.get_8390_hdr = &slow_sane_get_8390_hdr; + ei_status.reg_offset = back4_offsets; +break ; + +case ACCESS_32 : +/* 32 bit card, register map is reversed */ + ei_status.reset_8390 = &mac8390_no_reset; + ei_status.block_input = &sane_block_input; + ei_status.block_output = &sane_block_output; + ei_status.get_8390_hdr = &sane_get_8390_hdr; + ei_status.reg_offset = back4_offsets; + access_bitmode =1 ; +break ; + } +break ; +case MAC8390_ASANTE : -case MAC8390_DAYNA2 : -case MAC8390_DAYNA3 : -/* 32 bit card, register map is reversed */ -/* sane */ +/* Some Asante cards pass the 32 bit test +* but overwrite system memory when run at 32 bit. +* so we run them all at 16 bit. +*/ ei_status.reset_8390 = &mac8390_no_reset; - ei_status.block_input = &sane_block_input; - ei_status.block_output = &sane_block_output; - ei_status.get_8390_hdr = &sane_get_8390_hdr; + ei_status.block_input = &slow_sane_block_input; + ei_status.block_output = &slow_sane_block_output; + ei_status.get_8390_hdr = &slow_sane_get_8390_hdr; ei_status.reg_offset = back4_offsets; - access_bitmode =1 ;break ; +case MAC8390_CABLETRON :/* 16 bit card, register map is short forward */ ei_status.reset_8390 = &mac8390_no_reset;
@@ -498,21 +582,30 @@ static int __init mac8390_initdev(struct ei_status.block_output = &slow_sane_block_output; ei_status.get_8390_hdr = &slow_sane_get_8390_hdr; ei_status.reg_offset = fwrd2_offsets; - access_bitmode =0 ;break ; +case MAC8390_DAYNA :case MAC8390_KINETICS : -/* 16 bit memory */ +/* 16 bit memory, register map is forward */ /* dayna and similar */ ei_status.reset_8390 = &mac8390_no_reset; ei_status.block_input = &dayna_block_input; ei_status.block_output = &dayna_block_output; ei_status.get_8390_hdr = &dayna_get_8390_hdr; ei_status.reg_offset = fwrd4_offsets; - access_bitmode =0 ;break ; + +case MAC8390_INTERLAN : +/* 16 bit memory, register map is forward */ + ei_status.reset_8390 = &interlan_reset; + ei_status.block_input = &slow_sane_block_input; + ei_status.block_output = &slow_sane_block_output; + ei_status.get_8390_hdr = &slow_sane_get_8390_hdr; + ei_status.reg_offset = fwrd4_offsets; +break ; +default : -printk (KERN_ERR "Card type %s is unsupported, sorry\n" , cardname[type]); +printk (KERN_ERR "Card type %s is unsupported, sorry\n" , ndev->board->name);return -ENODEV ; }
@@ -530,9 +623,9 @@ static int __init mac8390_initdev(structprintk (":" ); } } -printk (" IRQ %d, shared memory at %#lx-%#lx, %d-bit access.\n" , - dev->irq, dev->mem_start, dev->mem_end-1 , - access_bitmode?32 :16 ); +printk (" IRQ %d, %d KB shared memory at %#lx, %d-bit access.\n" , + dev->irq, (int )((dev->mem_end - dev->mem_start)/0x1000 ) *4 , + dev->mem_start, access_bitmode?32 :16 );return 0 ; }
@@ -561,6 +654,18 @@ static void mac8390_no_reset(struct net_return ; } +static void interlan_reset (struct net_device *dev) +{ +unsigned char *target=nubus_slot_addr (IRQ2SLOT (dev->irq)); +if (ei_debug >1 ) +printk ("Need to reset the NS8390 t=%lu..." , jiffies); + ei_status.txing =0 ; + target[0xC0000 ] =0 ; +if (ei_debug >1 ) +printk ("reset complete\n" ); +return ; +} +/* dayna_memcpy_fromio/dayna_memcpy_toio */ /* directly from daynaport.c by Alan Cox */ static void dayna_memcpy_fromcard (struct net_device *dev,void *to,int from,int count)
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 21/33 m68k: reverse Mac IRQ damage
In reply to Geert UytterhoevenFrom: Finn Thain <[email protected]>
Reverse the last of a monumental brown-paper-bag commit that went into the 2.3 kernel.
--- arch/m68k/mac/baboon.c | 2 +- arch/m68k/mac/oss.c | 6 +++--- arch/m68k/mac/psc.c | 2 +- arch/m68k/mac/via.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
arch/m68k/mac/baboon.c +1 -1
@@ -81,9 +81,9 @@ irqreturn_t baboon_irq(int irq, void *defor (i =0 , irq_bit =1 ; i <3 ; i++, irq_bit <<=1 ) {if (events & irq_bit/* & baboon_active*/ ) { baboon_active &= ~irq_bit; + baboon->mb_ifr &= ~irq_bit;m68k_handle_int (IRQ_BABOON_0 + i); baboon_active |= irq_bit; - baboon->mb_ifr &= ~irq_bit; } }#if 0
arch/m68k/mac/oss.c +3 -3
@@ -109,12 +109,12 @@ irqreturn_t oss_irq(int irq, void *dev_i/* FIXME: how do you clear a pending IRQ? */ if (events &OSS_IP_SOUND ) { -/* FIXME: call sound handler */ oss->irq_pending &= ~OSS_IP_SOUND ; +/* FIXME: call sound handler */ }else if (events &OSS_IP_SCSI ) { oss->irq_level[OSS_SCSI ] =OSS_IRQLEV_DISABLED ; -m68k_handle_int (IRQ_MAC_SCSI ); oss->irq_pending &= ~OSS_IP_SCSI ; +m68k_handle_int (IRQ_MAC_SCSI ); oss->irq_level[OSS_SCSI ] =OSS_IRQLEV_SCSI ; }else {/* FIXME: error check here? */
@@ -146,8 +146,8 @@ irqreturn_t oss_nubus_irq(int irq, voidfor (i =0 , irq_bit =1 ; i <6 ; i++, irq_bit <<=1 ) {if (events & irq_bit) { oss->irq_level[i] =OSS_IRQLEV_DISABLED ; -m68k_handle_int (NUBUS_SOURCE_BASE + i); oss->irq_pending &= ~irq_bit; +m68k_handle_int (NUBUS_SOURCE_BASE + i); oss->irq_level[i] =OSS_IRQLEV_NUBUS ; } }
arch/m68k/mac/psc.c +1 -1
@@ -149,8 +149,8 @@ irqreturn_t psc_irq(int irq, void *dev_ifor (i =0 , irq_bit =1 ; i <4 ; i++, irq_bit <<=1 ) {if (events & irq_bit) {psc_write_byte (pIER, irq_bit); -m68k_handle_int (base_irq + i);psc_write_byte (pIFR, irq_bit); +m68k_handle_int (base_irq + i);psc_write_byte (pIER, irq_bit |0x80 ); } }
arch/m68k/mac/via.c +1 -1
@@ -430,8 +430,8 @@ irqreturn_t via1_irq(int irq, void *dev_for (i =0 , irq_bit =1 ; i <7 ; i++, irq_bit <<=1 )if (events & irq_bit) { via1[vIER] = irq_bit; -m68k_handle_int (VIA1_SOURCE_BASE + i); via1[vIFR] = irq_bit; +m68k_handle_int (VIA1_SOURCE_BASE + i); via1[vIER] = irq_bit |0x80 ; }
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 22/33 m68k: Mac IRQ prep
In reply to Geert UytterhoevenFrom: Finn Thain <[email protected]>
Make sure that there are no slot IRQs asserted before leaving the nubus handler. If there are and we don't then the nubus gets wedged because this prevents a CA1 transition, which means no more nubus IRQs.
Make the interrupt dispatch loops terminate sooner.
Explicitly initialise the VIA latches to make the code more easily understood.
Also some cleanups.
--- arch/m68k/mac/baboon.c | 12 ++-- arch/m68k/mac/oss.c | 8 ++ arch/m68k/mac/psc.c | 19 +++--- arch/m68k/mac/via.c | 139 ++++++++++++++++++++++++++++++------------------- 4 files changed, 110 insertions(+), 68 deletions(-)
arch/m68k/mac/baboon.c +8 -4
@@ -66,7 +66,7 @@ void __init baboon_register_interrupts(virqreturn_t baboon_irq (int irq,void *dev_id) { -int irq_bit,i; +int irq_bit, irq_num;unsigned char events;#ifdef DEBUG_IRQS
@@ -78,14 +78,18 @@ irqreturn_t baboon_irq(int irq, void *deif (!(events = baboon->mb_ifr &0x07 ))return IRQ_NONE ; -for (i =0 , irq_bit =1 ; i <3 ; i++, irq_bit <<=1 ) { + irq_num =IRQ_BABOON_0 ; + irq_bit =1 ; +do {if (events & irq_bit/* & baboon_active*/ ) { baboon_active &= ~irq_bit; baboon->mb_ifr &= ~irq_bit; -m68k_handle_int (IRQ_BABOON_0 + i); +m68k_handle_int (irq_num); baboon_active |= irq_bit; } - } + irq_bit <<=1 ; + irq_num++; + }while (events >= irq_bit);#if 0 if (baboon->mb_ifr &0x02 )macide_ack_intr (NULL );/* for now we need to smash all interrupts */
arch/m68k/mac/oss.c +6 -2
@@ -143,14 +143,18 @@ irqreturn_t oss_nubus_irq(int irq, void#endif /* There are only six slots on the OSS, not seven */ -for (i =0 , irq_bit =1 ; i <6 ; i++, irq_bit <<=1 ) { + i =6 ; + irq_bit =0x40 ; +do { + --i; + irq_bit >>=1 ;if (events & irq_bit) { oss->irq_level[i] =OSS_IRQLEV_DISABLED ; oss->irq_pending &= ~irq_bit;m68k_handle_int (NUBUS_SOURCE_BASE + i); oss->irq_level[i] =OSS_IRQLEV_NUBUS ; } - } + }while (events & (irq_bit -1 ));return IRQ_HANDLED ; }
arch/m68k/mac/psc.c +10 -9
@@ -131,11 +131,8 @@ irqreturn_t psc_irq(int irq, void *dev_i {int pIFR = pIFRbase + ((int ) dev_id);int pIER = pIERbase + ((int ) dev_id); -int base_irq; -int irq_bit,i; -unsigned char events; - - base_irq = irq <<3 ; +int irq_num; +unsigned char irq_bit, events;#ifdef DEBUG_IRQS printk("psc_irq: irq %d pIFR = 0x%02X pIER = 0x%02X\n",
@@ -146,14 +143,18 @@ irqreturn_t psc_irq(int irq, void *dev_iif (!events)return IRQ_NONE ; -for (i =0 , irq_bit =1 ; i <4 ; i++, irq_bit <<=1 ) { -if (events & irq_bit) { + irq_num = irq <<3 ; + irq_bit =1 ; +do { +if (events & irq_bit) {psc_write_byte (pIER, irq_bit);psc_write_byte (pIFR, irq_bit); -m68k_handle_int (base_irq + i); +m68k_handle_int (irq_num);psc_write_byte (pIER, irq_bit |0x80 ); } - } + irq_num++; + irq_bit <<=1 ; + }while (events >= irq_bit);return IRQ_HANDLED ; }
arch/m68k/mac/via.c +86 -53
242 lines not on this page · raw message
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 23/33 m68k: Mac nubus IRQ fixes (plan E)
In reply to Geert UytterhoevenFrom: Finn Thain <[email protected]>
Some Macs lack a slot interrupt enable register. So the existing code makes disabled and unregistered slot IRQ lines outputs set high. This seems to work on quadras, but does not work on genuine VIAs (perhaps the card still succeeds in pulling the line low, or perhaps because this increases the settle time on the port A input, meaning that the CA1 IRQ could fire before the slot line reads active).
Because of this, the nubus_active flags were used to mask IRQs, which is actually worse than the problem it tries to solve. Any interrupt masked by nubus_active will remain asserted and prevent further transitions on CA1. And so the nubus gets wedged regardless of hardware (emulated VIA ASIC, real VIA chip or RBV).
The best solution to this hardware limitation of genuine VIAs is to disable the umbrella SLOTS IRQ when disabling a slot on those machines. Unfortunately, this means all slot IRQs get disabled when any slot IRQ is disabled. But it is only a problem when there's more than 1 device using nubus interrupts.
Another potential problem for genuine VIAs is an unregistered nubus IRQ. Eventually it will be possible to enable the CA1 interrupt by installing its handler only _after_ all nubus drivers have loaded but _before_ the kernel needs them, at which time this last problem can be fixed. For now it can be worked around:
- disable MacOS extensions
- don't boot MacOS (use the Emile bootloader instead)
- get the bootloaders to disable ROM drivers (Penguin does this for video cards already, don't know about Emile)
- physically remove unsupported cards
--- arch/m68k/mac/via.c | 141 +++++++++++++++++++++++++++++----------------------- 1 file changed, 80 insertions(+), 61 deletions(-)
arch/m68k/mac/via.c +80 -61
@@ -64,7 +64,19 @@ static int gIER,gIFR,gBufA,gBufB;#define MAC_CLOCK_LOW (MAC_CLOCK_TICK&0xFF)#define MAC_CLOCK_HIGH (MAC_CLOCK_TICK>>8) -static int nubus_active; +/* To disable a NuBus slot on Quadras we make the slot IRQ lines outputs, set +* high. On RBV we just use the slot interrupt enable register. On Macs with +* genuine VIA chips we must use nubus_disabled to keep track of disabled slot +* interrupts. When any slot IRQ is disabled we mask the (edge triggered) CA1 +* or "SLOTS" interrupt. When no slot is disabled, we unmask the CA1 interrupt. +* So, on genuine VIAs, having more than one NuBus IRQ can mean trouble, +* because closing one of those drivers can mask all of the NuBus interrupts. +* Also, since we can't mask the unregistered slot IRQs on genuine VIAs, it's +* possible to get interrupts from cards that MacOS or the ROM has configured +* but we have not. FWIW, "Designing Cards and Drivers for Macintosh II and +* Macintosh SE", page 9-8, says, a slot IRQ with no driver would crash MacOS. +*/ +static u8 nubus_disabled;void via_debug_dump (void );irqreturn_t via1_irq (int ,void *);
@@ -383,9 +395,6 @@ int via_get_cache_disable(void)void __init via_nubus_init (void ) { -/* don't set nubus_active = 0 here, it kills the Baboon */ -/* interrupt that we've already registered. */ -/* unlock nubus transactions */ if ((macintosh_config->adb_type != MAC_ADB_PB1) &&
@@ -399,28 +408,35 @@ void __init via_nubus_init(void) via2[gBufB] |=0x02 ; } -/* disable nubus slot interrupts. */ -if (rbv_present) { +/* Disable all the slot interrupts (where possible). */ + +switch (macintosh_config->via_type) { +case MAC_VIA_II : +/* Just make the port A lines inputs. */ +switch (macintosh_config->ident) { +case MAC_MODEL_II : +case MAC_MODEL_IIX : +case MAC_MODEL_IICX : +case MAC_MODEL_SE30 : +/* The top two bits are RAM size outputs. */ + via2[vDirA] &=0xC0 ; +break ; +default : + via2[vDirA] &=0x80 ; + } +break ; +case MAC_VIA_IIci: +/* RBV. Disable all the slot interrupts. SIER works like IER. */ via2[rSIER] =0x7F ; - via2[rSIER] = nubus_active |0x80 ; - }else { -/* These are ADB bits on PMU */ +break ; +case MAC_VIA_QUADRA : +/* Disable the inactive slot interrupts by making those lines outputs. */ if ((macintosh_config->adb_type !=MAC_ADB_PB1 ) && - (macintosh_config->adb_type !=MAC_ADB_PB2 )) { -switch (macintosh_config->ident) - { -case MAC_MODEL_II : -case MAC_MODEL_IIX : -case MAC_MODEL_IICX : -case MAC_MODEL_SE30 : - via2[vBufA] |=0x3F ; - via2[vDirA] = ~nubus_active |0xc0 ; -break ; -default : - via2[vBufA] =0xFF ; - via2[vDirA] = ~nubus_active; - } + (macintosh_config->adb_type !=MAC_ADB_PB2 )) { + via2[vBufA] |=0x7F ; + via2[vDirA] |=0x7F ; } +break ; } }
@@ -489,7 +505,8 @@ irqreturn_t via2_irq(int irq, void *dev_ via2[gIER] = irq_bit; via2[gIFR] = irq_bit | rbv_clear;m68k_handle_int (irq_num); - via2[gIER] = irq_bit |0x80 ; +if (irq_num !=IRQ_MAC_NUBUS || nubus_disabled ==0 ) + via2[gIER] = irq_bit |0x80 ; } ++irq_num; irq_bit <<=1 ;
@@ -511,7 +528,7 @@ irqreturn_t via_nubus_irq(int irq, voidif (rbv_present) events &= via2[rSIER];else - events &= nubus_active; + events &= ~via2[vDirA];if (!events)return IRQ_NONE ;
@@ -533,7 +550,7 @@ irqreturn_t via_nubus_irq(int irq, voidif (rbv_present) events &= via2[rSIER];else - events &= nubus_active; + events &= ~via2[vDirA]; }while (events);return IRQ_HANDLED ; }
@@ -541,38 +558,38 @@ irqreturn_t via_nubus_irq(int irq, voidvoid via_irq_enable (int irq) {int irq_src =IRQ_SRC (irq);int irq_idx =IRQ_IDX (irq); -int irq_bit =1 << irq_idx;#ifdef DEBUG_IRQUSE printk (KERN_DEBUG "via_irq_enable(%d)\n" , irq);#endif if (irq_src ==1 ) { - via1[vIER] = irq_bit |0x80 ; + via1[vIER] =IER_SET_BIT (irq_idx); }else if (irq_src ==2 ) { - via2[gIER] = irq_bit |0x80 ; +if (irq !=IRQ_MAC_NUBUS || nubus_disabled ==0 ) + via2[gIER] =IER_SET_BIT (irq_idx); }else if (irq_src ==7 ) { - nubus_active |= irq_bit; -if (rbv_present) { -/* enable the slot interrupt. SIER works like IER. */ +switch (macintosh_config->via_type) { +case MAC_VIA_II : + nubus_disabled &= ~(1 << irq_idx); +/* Enable the CA1 interrupt when no slot is disabled. */ +if (!nubus_disabled) + via2[gIER] =IER_SET_BIT (1 ); +break ; +case MAC_VIA_IIci: +/* On RBV, enable the slot interrupt. +* SIER works like IER. +*/ via2[rSIER] =IER_SET_BIT (irq_idx); - }else { -/* Make sure the bit is an input, to enable the irq */ -/* But not on PowerBooks, that's ADB... */ +break ; +case MAC_VIA_QUADRA : +/* Make the port A line an input to enable the slot irq. +* But not on PowerBooks, that's ADB. +*/ if ((macintosh_config->adb_type !=MAC_ADB_PB1 ) && - (macintosh_config->adb_type !=MAC_ADB_PB2 )) { -switch (macintosh_config->ident) - { -case MAC_MODEL_II : -case MAC_MODEL_IIX : -case MAC_MODEL_IICX : -case MAC_MODEL_SE30 : - via2[vDirA] &= (~irq_bit |0xc0 ); -break ; -default : - via2[vDirA] &= ~irq_bit; - } - } + (macintosh_config->adb_type !=MAC_ADB_PB2 )) + via2[vDirA] &= ~(1 << irq_idx); +break ; } } }
@@ -580,29 +597,31 @@ void via_irq_enable(int irq) {void via_irq_disable (int irq) {int irq_src =IRQ_SRC (irq);int irq_idx =IRQ_IDX (irq); -int irq_bit =1 << irq_idx;#ifdef DEBUG_IRQUSE printk (KERN_DEBUG "via_irq_disable(%d)\n" , irq);#endif if (irq_src ==1 ) { - via1[vIER] = irq_bit &0x7F ; + via1[vIER] =IER_CLR_BIT (irq_idx); }else if (irq_src ==2 ) { - via2[gIER] = irq_bit &0x7F ; + via2[gIER] =IER_CLR_BIT (irq_idx); }else if (irq_src ==7 ) { -if (rbv_present) { -/* disable the slot interrupt. SIER works like IER. */ +switch (macintosh_config->via_type) { +case MAC_VIA_II : + nubus_disabled |=1 << irq_idx; +if (nubus_disabled) + via2[gIER] =IER_CLR_BIT (1 ); +break ; +case MAC_VIA_IIci: via2[rSIER] =IER_CLR_BIT (irq_idx); - }else { -/* disable the nubus irq by changing dir to output */ -/* except on PMU */ +break ; +case MAC_VIA_QUADRA :if ((macintosh_config->adb_type !=MAC_ADB_PB1 ) && - (macintosh_config->adb_type !=MAC_ADB_PB2 )) { - via2[vDirA] |= irq_bit; - } + (macintosh_config->adb_type !=MAC_ADB_PB2 )) + via2[vDirA] |=1 << irq_idx; +break ; } - nubus_active &= ~irq_bit; } }
@@ -638,7 +657,7 @@ int via_irq_pending(int irq) }else if (irq_src ==2 ) {return via2[gIFR] & irq_bit; }else if (irq_src ==7 ) { -/* FIXME: this can't work while a slot irq is disabled! */ +/* Always 0 for MAC_VIA_QUADRA if the slot irq is disabled. */ return ~via2[gBufA] & irq_bit; }return 0 ;
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 24/33 m68k: Mac IRQ cleanup
In reply to Geert UytterhoevenFrom: Finn Thain <[email protected]>
There are no slow IRQs on Macs since Roman Zippel's IRQ reorganisation that went into 2.6.16 and removed mac_irq_list[] and the do_mac_irq_list() dispatcher. (They were implemented in do_mac_irq_list() by lowering the IPL.) Hence there's no more use for mutual exclusion in the Mac interrupt dispatchers. Remove it.
--- arch/m68k/mac/baboon.c | 20 +++++++------------- arch/m68k/mac/oss.c | 4 ---- arch/m68k/mac/psc.c | 2 -- arch/m68k/mac/via.c | 10 ---------- 4 files changed, 7 insertions(+), 29 deletions(-)
arch/m68k/mac/baboon.c +7 -13
@@ -22,7 +22,7 @@/* #define DEBUG_BABOON */ /* #define DEBUG_IRQS */ -int baboon_present,baboon_active; +int baboon_present;volatile struct baboon *baboon;irqreturn_t baboon_irq (int ,void *);
@@ -45,7 +45,6 @@ void __init baboon_init(void) baboon = (struct baboon *)BABOON_BASE ; baboon_present =1 ; - baboon_active =0 ;printk ("Baboon detected at %p\n" , baboon); }
@@ -70,9 +69,9 @@ irqreturn_t baboon_irq(int irq, void *deunsigned char events;#ifdef DEBUG_IRQS -printk ("baboon_irq: mb_control %02X mb_ifr %02X mb_status %02X active %02X\n" , +printk ("baboon_irq: mb_control %02X mb_ifr %02X mb_status %02X\n" , (uint ) baboon->mb_control, (uint ) baboon->mb_ifr, - (uint ) baboon->mb_status, baboon_active); + (uint ) baboon->mb_status);#endif if (!(events = baboon->mb_ifr &0x07 ))
@@ -81,11 +80,9 @@ irqreturn_t baboon_irq(int irq, void *de irq_num =IRQ_BABOON_0 ; irq_bit =1 ; do { - if (events & irq_bit/* & baboon_active*/) { - baboon_active &= ~irq_bit; + if (events & irq_bit) { baboon->mb_ifr &= ~irq_bit; m68k_handle_int(irq_num); - baboon_active |= irq_bit; } irq_bit <<= 1; irq_num++;
@@ -99,21 +96,18 @@ irqreturn_t baboon_irq(int irq, void *de }void baboon_irq_enable (int irq) { -int irq_idx =IRQ_IDX (irq); -#ifdef DEBUG_IRQUSE printk ("baboon_irq_enable(%d)\n" , irq);#endif - baboon_active |= (1 << irq_idx); +/* FIXME: figure out how to mask and unmask baboon interrupt sources */ +enable_irq (IRQ_NUBUS_C ); }void baboon_irq_disable (int irq) { -int irq_idx =IRQ_IDX (irq); -#ifdef DEBUG_IRQUSE printk ("baboon_irq_disable(%d)\n" , irq);#endif - baboon_active &= ~(1 << irq_idx); +disable_irq (IRQ_NUBUS_C ); }void baboon_irq_clear (int irq) {
arch/m68k/mac/oss.c +0 -4
@@ -112,10 +112,8 @@ irqreturn_t oss_irq(int irq, void *dev_i oss->irq_pending &= ~OSS_IP_SOUND ;/* FIXME: call sound handler */ }else if (events &OSS_IP_SCSI ) { - oss->irq_level[OSS_SCSI ] =OSS_IRQLEV_DISABLED ; oss->irq_pending &= ~OSS_IP_SCSI ;m68k_handle_int (IRQ_MAC_SCSI ); - oss->irq_level[OSS_SCSI ] =OSS_IRQLEV_SCSI ; }else {/* FIXME: error check here? */ }
@@ -149,10 +147,8 @@ irqreturn_t oss_nubus_irq(int irq, void --i; irq_bit >>=1 ;if (events & irq_bit) { - oss->irq_level[i] =OSS_IRQLEV_DISABLED ; oss->irq_pending &= ~irq_bit;m68k_handle_int (NUBUS_SOURCE_BASE + i); - oss->irq_level[i] =OSS_IRQLEV_NUBUS ; } }while (events & (irq_bit -1 ));return IRQ_HANDLED ;
arch/m68k/mac/psc.c +0 -2
@@ -147,10 +147,8 @@ irqreturn_t psc_irq(int irq, void *dev_i irq_bit =1 ; do { if (events & irq_bit) { - psc_write_byte(pIER, irq_bit); psc_write_byte(pIFR, irq_bit); m68k_handle_int(irq_num); - psc_write_byte(pIER, irq_bit | 0x80); } irq_num++; irq_bit <<= 1;
arch/m68k/mac/via.c +0 -10
@@ -443,11 +443,6 @@ void __init via_nubus_init(void)/* * The generic VIA interrupt routines (shamelessly stolen from Alan Cox's * via6522.c :-), disable/pending masks added. -* -* The new interrupt architecture in macints.c takes care of a lot of the -* gruntwork for us, including tallying the interrupts and calling the -* handlers on the linked list. All we need to do here is basically generate -* the machspec interrupt number after clearing the interrupt. */ irqreturn_t via1_irq (int irq,void *dev_id)
@@ -463,10 +458,8 @@ irqreturn_t via1_irq(int irq, void *dev_ irq_bit =1 ; do { if (events & irq_bit) { - via1[vIER] = irq_bit; via1[vIFR] = irq_bit; m68k_handle_int(irq_num); - via1[vIER] = irq_bit | 0x80; } ++irq_num; irq_bit <<= 1;
@@ -502,11 +495,8 @@ irqreturn_t via2_irq(int irq, void *dev_ irq_bit =1 ; do { if (events & irq_bit) { - via2[gIER] = irq_bit; via2[gIFR] = irq_bit | rbv_clear; m68k_handle_int(irq_num); - if (irq_num != IRQ_MAC_NUBUS || nubus_disabled == 0) - via2[gIER] = irq_bit | 0x80; } ++irq_num; irq_bit <<= 1;
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 25/33 m68k: Mac II ADB fixes
In reply to Geert UytterhoevenFrom: Finn Thain <[email protected]>
Fix a crash caused by requests placed in the queue with the completed flag already set. This lead to some ADB_SYNC requests returning early and their request structs being popped off the stack while still queued. Stack corruption ensued or an invalid request callback pointer was invoked or both. Eliminate macii_retransmit() and its buggy implementation of macii_write(). Have macii_queue_poll() fully initialise the request queues.
Fix a bug in macii_queue_poll() where the last_req pointer was not being set. This caused some requests to leave the queue before being completed (and would also corrupt the stack under certain conditions).
Fix a race in macii_start that could set the state machine to "reading" while current_req was null.
No longer send poll commands with the ADBREQ_REPLY flag -- doing that caused the replies to be stored in the request buffer where they were forgotten about.
Don't autopoll by continuously sending new Talk commands. Get the controller to do that for us. This reduces the ADB interrupt rate on an idle bus to about 5 per second. Only autopoll the devices that were probed.
Explicitly clear the interrupt flag when polling.
Use disable_irq rather than local_irq_save when polling.
Remove excess local_irq_save/restore pairs.
Improve bus timeout and service request detection.
Remove unused code (last_reply, adb_dir etc) and unneeded code (prefix_len, first_byte etc).
Change TIP and TACK to their correct names on this ADB controller (ST_EVEN and ST_ODD).
Add some commentry.
Add a generous quantity of sanity checks (BUG_ONs).
Let m68k macs use the adb_sync boot param too.
Tested on Mac II, Mac IIci, Quadra 650, Quadra 700 etc.
--- arch/m68k/kernel/setup.c | 10 drivers/macintosh/via-macii.c | 582 +++++++++++++++++------------------------- 2 files changed, 251 insertions(+), 341 deletions(-)
arch/m68k/kernel/setup.c +10 -0
@@ -513,3 +513,13 @@ void check_bugs(void) }#endif /* !CONFIG_M68KFPU_EMU */ } + +#ifdef CONFIG_ADB +static int __init adb_probe_sync_enable (char *str) { +extern int __adb_probe_sync; + __adb_probe_sync =1 ; +return 1 ; +} + +__setup ("adb_sync" , adb_probe_sync_enable); +#endif /* CONFIG_ADB */
drivers/macintosh/via-macii.c +241 -341
786 lines not on this page · raw message
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 26/33 CUDA ADB fixes
In reply to Geert UytterhoevenFrom: Finn Thain <[email protected]>
Fix the flakiness in the CUDA ADB driver on m68k macs (keypresses getting wedged down or ADB just going AWOL altogether).
The only IRQ used by this driver is the VIA shift register IRQ. The PowerMac conditional code disables the other VIA IRQ sources, so don't mess with the other IRQ flags in the common code -- m68k macs need them.
When polling, don't disable local interrupts when we only need to disable the CUDA interrupt.
Unless polling, don't clear the shift register IRQ flag. On m68k macs this creates a race that often breaks CUDA ADB.
Tested on Quadra 840av and LC630 (both m68k); also Beige G3 (powerpc).
--- drivers/macintosh/via-cuda.c | 58 +++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 26 deletions(-)
drivers/macintosh/via-cuda.c +32 -26
@@ -82,6 +82,7 @@ static unsigned char cuda_rbuf[16];static unsigned char *reply_ptr;static int reading_reply;static int data_index; +static int cuda_irq;#ifdef CONFIG_PPC static struct device_node *vias;#endif
@@ -160,10 +161,8 @@ int __init find_via_cuda(void)/* Clear and enable interrupts, but only on PPC. On 68K it's done */ /* for us by the main VIA driver in arch/m68k/mac/via.c */ -#ifndef CONFIG_MAC out_8 (&via[IFR ],0x7f );/* clear interrupts by writing 1s */ out_8 (&via[IER ],IER_SET |SR_INT );/* enable interrupt from SR */ -#endif /* enable autopoll */ cuda_request (&req,NULL ,3 ,CUDA_PACKET ,CUDA_AUTOPOLL ,1 );
@@ -181,24 +180,22 @@ int __init find_via_cuda(void)static int __init via_cuda_start (void ) { -unsigned int irq; -if (via ==NULL )return -ENODEV ;#ifdef CONFIG_MAC - irq =IRQ_MAC_ADB ; + cuda_irq =IRQ_MAC_ADB ;#else /* CONFIG_MAC */ - irq =irq_of_parse_and_map (vias,0 ); -if (irq ==NO_IRQ ) { + cuda_irq =irq_of_parse_and_map (vias,0 ); +if (cuda_irq ==NO_IRQ ) {printk (KERN_ERR "via-cuda: can't map interrupts for %s\n" , vias->full_name);return -ENODEV ; } -#endif /* CONFIG_MAP */ +#endif /* CONFIG_MAC */ -if (request_irq (irq, cuda_interrupt,0 ,"ADB" , cuda_interrupt)) { -printk (KERN_ERR "via-cuda: can't request irq %d\n" , irq); +if (request_irq (cuda_irq, cuda_interrupt,0 ,"ADB" , cuda_interrupt)) { +printk (KERN_ERR "via-cuda: can't request irq %d\n" , cuda_irq);return -EAGAIN ; }
@@ -238,6 +235,7 @@ cuda_init(void)printk (KERN_ERR "cuda_init_via() failed\n" ); return -ENODEV; } +out_8 (&via[IER ],IER_SET |SR_INT );/* enable interrupt from SR */ return via_cuda_start ();#endif
@@ -263,15 +261,17 @@ cuda_init_via(void)out_8 (&via[B ],in_8 (&via[B ]) |TACK |TIP );/* negate them */ out_8 (&via[ACR ] ,(in_8 (&via[ACR ]) & ~SR_CTRL ) |SR_EXT );/* SR data in */ (void )in_8 (&via[SR ]);/* clear any left-over data */ -#ifndef CONFIG_MAC +#ifdef CONFIG_PPC out_8 (&via[IER ],0x7f );/* disable interrupts from VIA */ (void )in_8 (&via[IER ]); +#else +out_8 (&via[IER ],SR_INT );/* disable SR interrupt from VIA */ #endif /* delay 4ms and then clear any pending interrupt */ mdelay (4 ); (void )in_8 (&via[SR ]); -out_8 (&via[IFR ],in_8 (&via[IFR ]) &0x7f ); +out_8 (&via[IFR ],SR_INT );/* sync with the CUDA - assert TACK without TIP */ out_8 (&via[B ],in_8 (&via[B ]) & ~TACK );
@@ -282,7 +282,7 @@ cuda_init_via(void)/* wait for the interrupt and then clear it */ WAIT_FOR (in_8 (&via[IFR ]) &SR_INT ,"CUDA response to sync (2)" ); (void )in_8 (&via[SR ]); -out_8 (&via[IFR ],in_8 (&via[IFR ]) &0x7f ); +out_8 (&via[IFR ],SR_INT );/* finish the sync by negating TACK */ out_8 (&via[B ],in_8 (&via[B ]) |TACK );
@@ -291,7 +291,7 @@ cuda_init_via(void)WAIT_FOR (in_8 (&via[B ]) &TREQ ,"CUDA response to sync (3)" );WAIT_FOR (in_8 (&via[IFR ]) &SR_INT ,"CUDA response to sync (4)" ); (void )in_8 (&via[SR ]); -out_8 (&via[IFR ],in_8 (&via[IFR ]) &0x7f ); +out_8 (&via[IFR ],SR_INT );out_8 (&via[B ],in_8 (&via[B ]) |TIP );/* should be unnecessary */ return 0 ;
@@ -428,16 +428,12 @@ cuda_start(void)void cuda_poll (void ) { -unsigned long flags; -/* cuda_interrupt only takes a normal lock, we disable * interrupts here to avoid re-entering and thus deadlocking. -* An option would be to disable only the IRQ source with -* disable_irq(), would that work on m68k ? --BenH */ -local_irq_save (flags); +disable_irq (cuda_irq);cuda_interrupt (0 ,NULL ); -local_irq_restore (flags); +enable_irq (cuda_irq); } static irqreturn_t
@@ -448,15 +444,25 @@ cuda_interrupt(int irq, void *arg)unsigned char ibuf[16 ];int ibuf_len =0 ;int complete =0 ; -unsigned char virq;spin_lock (&cuda_lock); - virq =in_8 (&via[IFR ]) &0x7f ; -out_8 (&via[IFR ], virq); -if ((virq &SR_INT ) ==0 ) { -spin_unlock (&cuda_lock); -return IRQ_NONE ; +/* On powermacs, this handler is registered for the VIA IRQ. But it uses +* just the shift register IRQ -- other VIA interrupt sources are disabled. +* On m68k macs, the VIA IRQ sources are dispatched individually. Unless +* we are polling, the shift register IRQ flag has already been cleared. +*/ + +#ifdef CONFIG_MAC + if (!arg) +#endif + { +if ((in_8 (&via[IFR ]) &SR_INT ) ==0 ) { +spin_unlock (&cuda_lock); +return IRQ_NONE ; + }else { +out_8 (&via[IFR ],SR_INT ); + } } status = (~in_8 (&via[B ]) & (TIP |TREQ )) | (in_8 (&via[ACR ]) &SR_OUT );
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 27/33 m68k: macmace fixes
In reply to Geert UytterhoevenFrom: Finn Thain <[email protected]>
Fix a race condition in the transmit code, where the dma interrupt could update the free tx buffer count concurrently and wedge the tx queue.
Fix the misuse of the rx frame status and rx frame length registers: no more "fifo overrun" errors caused by the OFLOW bit being tested in the frame length register (instead of the status register), and no more missed packets due to incorrect length taken from status register (instead of the frame length register).
Fix a panic (skb_over_panic BUG) caused by allocating and then copying an incoming packet while the packet length register was changing.
Cut-and-paste the reset code from the powermac mace driver (mace.c), so the NIC functions when MacOS does not initialise it (important for anyone wanting to use the Emile boot loader).
Cut-and-paste the error counting and timeout recovery code from mace.c.
Fix over allocation of rx buffer memory (it's page order, not page count).
Converted to driver model.
Converted to DMA API.
Since I've run out of ways to make it fail, and since it performs well now, promote the driver from EXPERIMENTAL status. Tested on both quadra 840av and 660av.
--- drivers/net/Kconfig | 4 drivers/net/Space.c | 4 drivers/net/macmace.c | 589 ++++++++++++++++++++++++++++++-------------------- 3 files changed, 363 insertions(+), 234 deletions(-)
drivers/net/Kconfig +2 -2
@@ -337,8 +337,8 @@ config MACSONIC be called macsonic. config MACMACE - bool "Macintosh (AV) onboard MACE ethernet (EXPERIMENTAL)" - depends on NET_ETHERNET && MAC && EXPERIMENTAL + bool "Macintosh (AV) onboard MACE ethernet" + depends on NET_ETHERNET && MAC select CRC32 help Support for the onboard AMD 79C940 MACE Ethernet controller used in
drivers/net/Space.c +0 -4
@@ -83,7 +83,6 @@ extern struct net_device *bagetlance_proextern struct net_device *mvme147lance_probe (int unit);extern struct net_device *tc515_probe (int unit);extern struct net_device *lance_probe (int unit); -extern struct net_device *mace_probe (int unit);extern struct net_device *mac8390_probe (int unit);extern struct net_device *mac89x0_probe (int unit);extern struct net_device *mc32_probe (int unit);
@@ -274,9 +273,6 @@ static struct devprobe2 m68k_probes[] __ #ifdef CONFIG_MVME147_NET /* MVME147 internal Ethernet */ {mvme147lance_probe, 0}, #endif -#ifdef CONFIG_MACMACE /* Mac 68k Quadra AV builtin Ethernet */ - {mace_probe, 0}, -#endif #ifdef CONFIG_MAC8390 /* NuBus NS8390-based cards */ {mac8390_probe, 0}, #endif
drivers/net/macmace.c +361 -228
850 lines not on this page · raw message
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Btw, is there any chance you could update m68k to use the generic irq code? The only architectures that don't have a conversion in progress are m68k, m68knommu and arm26
Hi,
Quoted 3 lines · Christoph Hellwig
Btw, is there any chance you could update m68k to use the generic irq code? The only architectures that don't have a conversion in progress are m68k, m68knommu and arm26
I haven't looked seriously into it since it was pretty much rewritten. What I need is very close control over the lowlevel handling to minimize the number of indirect calls and to get the interrupt delivered as fast as possible. (E.g. we even patch the assembler entry, so the basic flow control is pretty much fixed after boot.)
I don't mind the if the general management is a bit more complex, but how do I get rid of all the useless code?
At a bit closer look e.g. irq_desc would need a serious diet, it can produce a pretty large table...
bye, Roman
Geert Uytterhoeven
maintainerPATCH 28/33 SONIC: small fix and cleanup
In reply to Geert UytterhoevenFrom: Finn Thain <[email protected]>
Fix a potential problem in the timeout handling: don't free the DMA buffers before resetting the chip.
Also a trivial cleanup. Bring macsonic and jazzsonic into sync.
--- drivers/net/jazzsonic.c | 4 ++-- drivers/net/macsonic.c | 17 ++++++++--------- drivers/net/sonic.c | 7 ++++++- 3 files changed, 16 insertions(+), 12 deletions(-)
drivers/net/jazzsonic.c +2 -2
@@ -269,11 +269,11 @@ static int __devexit jazz_sonic_device_rstruct net_device *dev =platform_get_drvdata (pdev);struct sonic_local * lp =netdev_priv (dev); -unregister_netdev (dev); +unregister_netdev (dev);dma_free_coherent (lp->device,SIZEOF_SONIC_DESC *SONIC_BUS_SCALE (lp->dma_bitmode), lp->descriptors, lp->descriptors_laddr);release_region (dev->base_addr,SONIC_MEM_SIZE ); -free_netdev (dev); +free_netdev (dev);return 0 ; }
drivers/net/macsonic.c +8 -9
@@ -522,7 +522,7 @@ int __init mac_nubus_sonic_probe(structreturn macsonic_init (dev); } -static int __init mac_sonic_probe (struct platform_device *device) +static int __init mac_sonic_probe (struct platform_device *pdev) {struct net_device *dev;struct sonic_local *lp;
@@ -534,8 +534,8 @@ static int __init mac_sonic_probe(structreturn -ENOMEM ; lp =netdev_priv (dev); - lp->device = &device->dev; -SET_NETDEV_DEV (dev, &device->dev); + lp->device = &pdev->dev; +SET_NETDEV_DEV (dev, &pdev->dev);SET_MODULE_OWNER (dev);/* This will catch fatal stuff like -ENOMEM as well as success */
@@ -576,15 +576,15 @@ MODULE_PARM_DESC(sonic_debug, "macsonic#include "sonic.c" -static int __devexit mac_sonic_device_remove (struct platform_device *device) +static int __devexit mac_sonic_device_remove (struct platform_device *pdev) { -struct net_device *dev =platform_get_drvdata (device); +struct net_device *dev =platform_get_drvdata (pdev);struct sonic_local * lp =netdev_priv (dev); -unregister_netdev (dev); +unregister_netdev (dev);dma_free_coherent (lp->device,SIZEOF_SONIC_DESC *SONIC_BUS_SCALE (lp->dma_bitmode), lp->descriptors, lp->descriptors_laddr); -free_netdev (dev); +free_netdev (dev);return 0 ; }
@@ -607,9 +607,8 @@ static int __init mac_sonic_init_module( } mac_sonic_device =platform_device_alloc (mac_sonic_string,0 ); -if (!mac_sonic_device) { +if (!mac_sonic_device) goto out_unregister; - }if (platform_device_add (mac_sonic_device)) {platform_device_put (mac_sonic_device);
drivers/net/sonic.c +6 -1
@@ -178,8 +178,13 @@ static void sonic_tx_timeout(struct net_ {struct sonic_local *lp =netdev_priv (dev);int i; -/* Stop the interrupts for this */ +/* +* put the Sonic into software-reset mode and +* disable all interrupts before releasing DMA buffers +*/ SONIC_WRITE (SONIC_IMR ,0 ); +SONIC_WRITE (SONIC_ISR ,0x7fff ); +SONIC_WRITE (SONIC_CMD ,SONIC_CR_RST );/* We could resend the original skbs. Easier to re-initialise. */ for (i =0 ; i <SONIC_NUM_TDS ; i++) {if (lp->tx_laddr[i]) {
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 29/33 SONIC interrupt handling
In reply to Geert UytterhoevenFrom: Finn Thain <[email protected]>
Install the built-in macsonic interrupt handler on both IRQs when using via_alt_mapping. Otherwise the rare interrupt that still comes from the nubus slot will wedge the nubus.
$ cat /proc/interrupts auto 2: 89176 via2 auto 3: 744367 sonic auto 4: 0 scc auto 6: 318363 via1 auto 7: 0 NMI mac 9: 119413 framebuffer vbl mac 10: 1971 ADB mac 14: 198517 timer mac 17: 89104 nubus mac 19: 72 Mac ESP SCSI mac 56: 629 sonic mac 62: 1142593 ide0
Version 1 of this patch had a bug where a nubus sonic card would register two interrupt handlers. Only a built-in sonic needs both.
Version 2 needed some cleanups, as Raylynn Knight pointed out (thanks).
--- drivers/net/jazzsonic.c | 21 +++++++++++++++++---- drivers/net/macsonic.c | 43 +++++++++++++++++++++++++++++++++++++++---- drivers/net/sonic.c | 25 ------------------------- 3 files changed, 56 insertions(+), 33 deletions(-)
drivers/net/jazzsonic.c +17 -4
@@ -88,6 +88,21 @@ static unsigned short known_revisions[] 0xffff /* end of list */ }; +static int jazzsonic_open (struct net_device * dev) { +if (request_irq (dev->irq, &sonic_interrupt,IRQF_DISABLED ,"sonic" , dev)) { +printk (KERN_ERR "\n%s: unable to get IRQ %d.\n" , dev->name, dev->irq); +return -EAGAIN ; + } +return sonic_open (dev); +} + +static int jazzsonic_close (struct net_device * dev) { +int err; + err =sonic_close (dev); +free_irq (dev->irq, dev); +return err; +} +static int __init sonic_probe1 (struct net_device *dev) {static unsigned version_printed;
@@ -169,8 +184,8 @@ static int __init sonic_probe1(struct ne lp->rra_laddr = lp->rda_laddr + (SIZEOF_SONIC_RD *SONIC_NUM_RDS *SONIC_BUS_SCALE (lp->dma_bitmode)); - dev->open = sonic_open; - dev->stop = sonic_close; + dev->open = jazzsonic_open; + dev->stop = jazzsonic_close; dev->hard_start_xmit = sonic_send_packet; dev->get_stats = sonic_get_stats; dev->set_multicast_list = &sonic_multicast_list;
@@ -260,8 +275,6 @@ MODULE_DESCRIPTION("Jazz SONIC ethernetmodule_param (sonic_debug, int,0 );MODULE_PARM_DESC (sonic_debug,"jazzsonic debug level (1-4)" ); -#define SONIC_IRQ_FLAG IRQF_DISABLED -#include "sonic.c" static int __devexit jazz_sonic_device_remove (struct platform_device *pdev)
drivers/net/macsonic.c +39 -4
61 lines not on this page · raw message
drivers/net/sonic.c +0 -25
@@ -50,29 +50,6 @@ static int sonic_open(struct net_deviceif (sonic_debug >2 )printk ("sonic_open: initializing sonic driver.\n" ); -/* -* We don't need to deal with auto-irq stuff since we -* hardwire the sonic interrupt. -*/ -/* -* XXX Horrible work around: We install sonic_interrupt as fast interrupt. -* This means that during execution of the handler interrupt are disabled -* covering another bug otherwise corrupting data. This doesn't mean -* this glue works ok under all situations. -* -* Note (dhd): this also appears to prevent lockups on the Macintrash -* when more than one Ethernet card is installed (knock on wood) -* -* Note (fthain): whether the above is still true is anyones guess. Certainly -* the buffer handling algorithms will not tolerate re-entrance without some -* mutual exclusion added. Anyway, the memcpy has now been eliminated from the -* rx code to make this a faster "fast interrupt". -*/ -if (request_irq (dev->irq, &sonic_interrupt,SONIC_IRQ_FLAG ,"sonic" , dev)) { -printk (KERN_ERR "\n%s: unable to get IRQ %d .\n" , dev->name, dev->irq); -return -EAGAIN ; - } -for (i =0 ; i <SONIC_NUM_RRS ; i++) {struct sk_buff *skb =dev_alloc_skb (SONIC_RBSIZE +2 );if (skb ==NULL ) {
@@ -169,8 +146,6 @@ static int sonic_close(struct net_device } } -free_irq (dev->irq, dev);/* release the IRQ */ -return 0 ; }
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Re: [patch 29/33] SONIC interrupt handling
drivers/net/jazzsonic.c static unsigned short known_revisions[] · line 97
Quoted 7 lines · Geert Uytterhoeven
drivers/net/jazzsonic.c +7
-0+static int jazzsonic_open (struct net_device * dev) { +if (request_irq (dev->irq, &sonic_interrupt,IRQF_DISABLED ,"sonic" , dev)) { +printk (KERN_ERR "\n%s: unable to get IRQ %d.\n" , dev->name, dev->irq); +return -EAGAIN ; + } +return sonic_open (dev); +}
Opening brace for a function on a line of it's own please.
Also starting a printk with '\n' seems rather odd.
Re: [patch 29/33] SONIC interrupt handling, v4
Install the built-in macsonic interrupt handler on both IRQs when using via_alt_mapping. Otherwise the rare interrupt that still comes from the nubus slot will wedge the nubus.
$ cat /proc/interrupts auto 2: 89176 via2 auto 3: 744367 sonic auto 4: 0 scc auto 6: 318363 via1 auto 7: 0 NMI mac 9: 119413 framebuffer vbl mac 10: 1971 ADB mac 14: 198517 timer mac 17: 89104 nubus mac 19: 72 Mac ESP SCSI mac 56: 629 sonic mac 62: 1142593 ide0
Version 1 of this patch had a bug where a nubus sonic card would register two interrupt handlers. Only a built-in sonic needs both.
Versions 2 and 3 needed some cleanups, as Raylynn Knight and Christoph Hellwig pointed out (thanks).
drivers/net/jazzsonic.c | 23 +++++++++++++++++++---- drivers/net/macsonic.c | 46 ++++++++++++++++++++++++++++++++++++++++++---- drivers/net/sonic.c | 25 ------------------------- 3 files changed, 61 insertions(+), 33 deletions(-)
drivers/net/jazzsonic.c +19 -4
@@ -88,6 +88,23 @@ static unsigned short known_revisions[] 0xffff /* end of list */ }; +static int jazzsonic_open (struct net_device * dev) +{ +if (request_irq (dev->irq, &sonic_interrupt,IRQF_DISABLED ,"sonic" , dev)) { +printk (KERN_ERR "%s: unable to get IRQ %d.\n" , dev->name, dev->irq); +return -EAGAIN ; + } +return sonic_open (dev); +} + +static int jazzsonic_close (struct net_device * dev) +{ +int err; + err =sonic_close (dev); +free_irq (dev->irq, dev); +return err; +} +static int __init sonic_probe1 (struct net_device *dev) {static unsigned version_printed;
@@ -169,8 +186,8 @@ static int __init sonic_probe1(struct ne lp->rra_laddr = lp->rda_laddr + (SIZEOF_SONIC_RD *SONIC_NUM_RDS *SONIC_BUS_SCALE (lp->dma_bitmode)); - dev->open = sonic_open; - dev->stop = sonic_close; + dev->open = jazzsonic_open; + dev->stop = jazzsonic_close; dev->hard_start_xmit = sonic_send_packet; dev->get_stats = sonic_get_stats; dev->set_multicast_list = &sonic_multicast_list;
@@ -260,8 +277,6 @@ MODULE_DESCRIPTION("Jazz SONIC ethernetmodule_param (sonic_debug, int,0 );MODULE_PARM_DESC (sonic_debug,"jazzsonic debug level (1-4)" ); -#define SONIC_IRQ_FLAG IRQF_DISABLED -#include "sonic.c" static int __devexit jazz_sonic_device_remove (struct platform_device *pdev)
drivers/net/macsonic.c +42 -4
64 lines not on this page · raw message
drivers/net/sonic.c +0 -25
@@ -50,29 +50,6 @@ static int sonic_open(struct net_deviceif (sonic_debug >2 )printk ("sonic_open: initializing sonic driver.\n" ); -/* -* We don't need to deal with auto-irq stuff since we -* hardwire the sonic interrupt. -*/ -/* -* XXX Horrible work around: We install sonic_interrupt as fast interrupt. -* This means that during execution of the handler interrupt are disabled -* covering another bug otherwise corrupting data. This doesn't mean -* this glue works ok under all situations. -* -* Note (dhd): this also appears to prevent lockups on the Macintrash -* when more than one Ethernet card is installed (knock on wood) -* -* Note (fthain): whether the above is still true is anyones guess. Certainly -* the buffer handling algorithms will not tolerate re-entrance without some -* mutual exclusion added. Anyway, the memcpy has now been eliminated from the -* rx code to make this a faster "fast interrupt". -*/ -if (request_irq (dev->irq, &sonic_interrupt,SONIC_IRQ_FLAG ,"sonic" , dev)) { -printk (KERN_ERR "\n%s: unable to get IRQ %d .\n" , dev->name, dev->irq); -return -EAGAIN ; - } -for (i =0 ; i <SONIC_NUM_RRS ; i++) {struct sk_buff *skb =dev_alloc_skb (SONIC_RBSIZE +2 );if (skb ==NULL ) {
@@ -170,8 +147,6 @@ static int sonic_close(struct net_device } } -free_irq (dev->irq, dev);/* release the IRQ */ -return 0 ; }
Geert Uytterhoeven
maintainerPATCH 30/33 Amiga Zorro bus: kill resource_size_t warnings
In reply to Geert UytterhoevenKill resource_size_t warnings by casting resource_size_t to unsigned long when formatting Zorro bus resources, as they are always 32-bit.
--- drivers/zorro/proc.c | 5 +++-- drivers/zorro/zorro-sysfs.c | 3 ++- drivers/zorro/zorro.c | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-)
drivers/zorro/proc.c +3 -2
@@ -90,8 +90,9 @@ get_zorro_dev_info(char *buf, char **stafor (slot = cnt =0 ; slot < zorro_num_autocon && count > cnt; slot++) {struct zorro_dev *z = &zorro_autocon[slot]; len =sprintf (buf,"%02x\t%08x\t%08lx\t%08lx\t%02x\n" , slot, - z->id,zorro_resource_start (z), -zorro_resource_len (z), z->rom.er_Type); + z->id, (unsigned long )zorro_resource_start (z), + (unsigned long )zorro_resource_len (z), + z->rom.er_Type); at += len;if (at >= pos) {if (!*start) {
drivers/zorro/zorro-sysfs.c +2 -1
@@ -42,7 +42,8 @@ static ssize_t zorro_show_resource(strucstruct zorro_dev *z =to_zorro_dev (dev);return sprintf (buf,"0x%08lx 0x%08lx 0x%08lx\n" , -zorro_resource_start (z),zorro_resource_end (z), + (unsigned long )zorro_resource_start (z), + (unsigned long )zorro_resource_end (z),zorro_resource_flags (z)); }
drivers/zorro/zorro.c +2 -1
@@ -164,7 +164,8 @@ static int __init zorro_init(void)if (request_resource (zorro_find_parent_resource (z), &z->resource))printk (KERN_ERR "Zorro: Address space collision on device %s " "[%lx:%lx]\n" , - z->name,zorro_resource_start (z),zorro_resource_end (z)); + z->name, (unsigned long )zorro_resource_start (z), + (unsigned long )zorro_resource_end (z));sprintf (z->dev.bus_id,"%02x" , i); z->dev.parent = &zorro_bus.dev; z->dev.bus = &zorro_bus_type;
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 31/33 m68k: kill skb_copy_from_linear_data compiler warnings
In reply to Geert UytterhoevenThe recent conversion from memcpy' to skb_copy_from_linear_data' removed a few casts, which were needed to silence compiler warnings. Re-add them.
--- drivers/net/7990.c | 6 +++--- drivers/net/a2065.c | 4 ++-- drivers/net/sun3_82586.c | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-)
drivers/net/7990.c +3 -3
@@ -565,9 +565,9 @@ int lance_start_xmit (struct sk_buff *sk ib->btx_ring [entry].length = (-len) |0xf000 ; ib->btx_ring [entry].misc =0 ; -if (skb->len <ETH_ZLEN ) -memset ((char *)&ib->tx_buf[entry][0 ],0 ,ETH_ZLEN ); -skb_copy_from_linear_data (skb, &ib->tx_buf[entry][0 ], skblen); +if (skb->len <ETH_ZLEN ) +memset ((void *)&ib->tx_buf[entry][0 ],0 ,ETH_ZLEN ); +skb_copy_from_linear_data (skb, (void *)&ib->tx_buf[entry][0 ], skblen);/* Now, give the packet to the lance */ ib->btx_ring [entry].tmd1_bits = (LE_T1_POK |LE_T1_OWN );
drivers/net/a2065.c +2 -2
@@ -597,11 +597,11 @@ static int lance_start_xmit (struct sk_b ib->btx_ring [entry].length = (-len) |0xf000 ; ib->btx_ring [entry].misc =0 ; -skb_copy_from_linear_data (skb, &ib->tx_buf [entry][0 ], skblen); +skb_copy_from_linear_data (skb, (void *)&ib->tx_buf [entry][0 ], skblen);/* Clear the slack of the packet, do I need this? */ if (len != skblen) -memset ((char *) &ib->tx_buf [entry][skblen],0 , len - skblen); +memset ((void *) &ib->tx_buf [entry][skblen],0 , len - skblen);/* Now, give the packet to the lance */ ib->btx_ring [entry].tmd1_bits = (LE_T1_POK |LE_T1_OWN );
drivers/net/sun3_82586.c +3 -2
@@ -1023,10 +1023,11 @@ static int sun3_82586_send_packet(struct { len = skb->len;if (len <ETH_ZLEN ) { -memset ((char *)p->xmit_cbuffs[p->xmit_count],0 ,ETH_ZLEN ); +memset ((void *)p->xmit_cbuffs[p->xmit_count],0 , +ETH_ZLEN ); len =ETH_ZLEN ; } -skb_copy_from_linear_data (skb, p->xmit_cbuffs[p->xmit_count], skb->len); +skb_copy_from_linear_data (skb, (void *)p->xmit_cbuffs[p->xmit_count], skb->len);#if (NUM_XMIT_BUFFS ==1 )# ifdef NO_NOPCOMMANDS
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 32/33 m68k: export csum_partial_copy_from_user
In reply to Geert Uytterhoevennet/rxrpc/af-rxrpc.ko needs csum_partial_copy_from_user
--- arch/m68k/lib/checksum.c | 3 +++ 1 file changed, 3 insertions(+)
arch/m68k/lib/checksum.c +3 -0
@@ -320,6 +320,9 @@ csum_partial_copy_from_user(const void _return (sum); } +EXPORT_SYMBOL (csum_partial_copy_from_user); + +/* * copy from kernel space while checksumming, otherwise like csum_partial */
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerPATCH 33/33 Convert non-highmem kmap_atomic() to static inline function
In reply to Geert UytterhoevenConvert kmap_atomic() in the non-highmem case from a macro to a static inline function, for better type-checking and the ability to pass void pointers instead of struct page pointers.
--- include/linux/highmem.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
include/linux/highmem.h +8 -2
@@ -42,8 +42,14 @@ static inline void *kmap(struct page *pa#define kunmap (page) do { (void) (page); } while (0) -#define kmap_atomic (page, idx) \ - ({ pagefault_disable(); page_address(page); }) +#include <asm/kmap_types.h> + +static inline void *kmap_atomic (struct page *page,enum km_type idx) +{ +pagefault_disable (); +return page_address (page); +} +#define kunmap_atomic (addr, idx) do { pagefault_enable(); } while (0)#define kmap_atomic_pfn (pfn, idx) kmap_atomic(pfn_to_page(pfn), (idx))#define kmap_atomic_to_page (ptr) virt_to_page(ptr)
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds