debloat aic7xxx and aic79xx drivers
Subsystems (2)
cover debloat aic7xxx and aic79xx drivers
Hi,
Following patches debloat drivers/scsi/aic7xxx/*. I also had to add prototypes for ahc_lookup_scb and ahd_lookup_scb to .h files.
1-debloat.patch
Deinlines and moves big functions from .h to .c files. Adds prototypes for ahc_lookup_scb and ahd_lookup_scb to .h files.
2-addstatic.patch
Adds statics, #ifdefs out huge amount of unused code, adds consts
3-addconst.patch
Adds more consts
Driver code/data size reductions:
Build with debugging on (CONFIG_AIC7XXX_DEBUG_ENABLE=y):
text data bss dec hex filename
310865 49922 1204 361991 58607 linux-2.6.23.t/drivers/scsi/aic7xxx/built-in.o 221987 2754 1204 225945 37299 linux-2.6.23-aic-3-addconst.t/drivers/scsi/aic7xxx/built-in.o
With debugging off:
text data bss dec hex filename
298896 42754 1172 342822 53b26 linux-2.6.23.tt/drivers/scsi/aic7xxx/built-in.o 216068 2754 1172 219994 35b5a linux-2.6.23-aic-3-addconst.tt/drivers/scsi/aic7xxx/built-in.o
make namespacecheck goes from 400+ functions to:
drivers/scsi/aic7xxx/aic79xx_core.o
ahd_inq
ahd_inw
ahd_outq
ahd_outw
drivers/scsi/aic7xxx/aic79xx_osm.o
ahd_insb
drivers/scsi/aic7xxx/aic7xxx_core.o
ahc_inq
ahc_outq
drivers/scsi/aic7xxx/aic7xxx_osm.o
ahc_insb
None of these patches touch any logic, code changes are pretty minimal.
Compile tested and applies cleanly to 2.6.23.
I don't have this hardware anymore and cannot run test these patches.
Please apply.
--
vda
PATCH 1/3 debloat aic7xxx and aic79xx drivers
Deinlines and moves big functions from .h to .c files. Adds prototypes for ahc_lookup_scb and ahd_lookup_scb to .h files.
--
vda
drivers/scsi/aic7xxx/aic79xx_core.c +764 -2
@@ -266,8 +266,752 @@ static int ahd_match_scb(struct ahd_sof int target, char channel, int lun, u_int tag, role_t role); -/******************************** Private Inlines *****************************/ +/************************ Sequencer Execution Control *************************/ +void +ahd_set_modes (struct ahd_softc *ahd,ahd_mode src,ahd_mode dst) +{ +if (ahd->src_mode == src && ahd->dst_mode == dst) +return ; +#ifdef AHD_DEBUG +if (ahd->src_mode ==AHD_MODE_UNKNOWN + || ahd->dst_mode ==AHD_MODE_UNKNOWN ) +panic ("Setting mode prior to saving it.\n" ); +if ((ahd_debug &AHD_SHOW_MODEPTR ) !=0 ) +printf ("%s: Setting mode 0x%x\n" ,ahd_name (ahd), +ahd_build_mode_state (ahd, src, dst)); +#endif +ahd_outb (ahd,MODE_PTR ,ahd_build_mode_state (ahd, src, dst)); + ahd->src_mode = src; + ahd->dst_mode = dst; +} + +void +ahd_update_modes (struct ahd_softc *ahd) +{ +ahd_mode_state mode_ptr; +ahd_mode src; +ahd_mode dst; + + mode_ptr =ahd_inb (ahd,MODE_PTR ); +#ifdef AHD_DEBUG +if ((ahd_debug &AHD_SHOW_MODEPTR ) !=0 ) +printf ("Reading mode 0x%x\n" , mode_ptr); +#endif +ahd_extract_mode_state (ahd, mode_ptr, &src, &dst); +ahd_known_modes (ahd, src, dst); +} + +void +ahd_assert_modes (struct ahd_softc *ahd,ahd_mode srcmode, +ahd_mode dstmode,const char *file,int line) +{ +#ifdef AHD_DEBUG +if ((srcmode &AHD_MK_MSK (ahd->src_mode)) ==0 + || (dstmode &AHD_MK_MSK (ahd->dst_mode)) ==0 ) { +panic ("%s:%s:%d: Mode assertion failed.\n" , +ahd_name (ahd), file, line); + } +#endif +} + +#define AHD_ASSERT_MODES (ahd, source, dest) \ + ahd_assert_modes(ahd, source, dest, __FILE__, __LINE__); + +ahd_mode_state +ahd_save_modes (struct ahd_softc *ahd) +{ +if (ahd->src_mode ==AHD_MODE_UNKNOWN + || ahd->dst_mode ==AHD_MODE_UNKNOWN ) +ahd_update_modes (ahd); + +return (ahd_build_mode_state (ahd, ahd->src_mode, ahd->dst_mode)); +} + +void +ahd_restore_modes (struct ahd_softc *ahd,ahd_mode_state state) +{ +ahd_mode src; +ahd_mode dst; + +ahd_extract_mode_state (ahd, state, &src, &dst); +ahd_set_modes (ahd, src, dst); +} + +/* +* Determine whether the sequencer has halted code execution. +* Returns non-zero status if the sequencer is stopped. +*/ +int +ahd_is_paused (struct ahd_softc *ahd) +{ +return ((ahd_inb (ahd,HCNTRL ) &PAUSE ) !=0 ); +} + +/* +* Request that the sequencer stop and wait, indefinitely, for it +* to stop. The sequencer will only acknowledge that it is paused +* once it has reached an instruction boundary and PAUSEDIS is +* cleared in the SEQCTL register. The sequencer may use PAUSEDIS +* for critical sections. +*/ +void +ahd_pause (struct ahd_softc *ahd) +{ +ahd_outb (ahd,HCNTRL , ahd->pause); + +/* +* Since the sequencer can disable pausing in a critical section, we +* must loop until it actually stops. +*/ +while (ahd_is_paused (ahd) ==0 ) + ; +} + +/* +* Allow the sequencer to continue program execution. +* We check here to ensure that no additional interrupt +* sources that would cause the sequencer to halt have been +* asserted. If, for example, a SCSI bus reset is detected +* while we are fielding a different, pausing, interrupt type, +* we don't want to release the sequencer before going back +* into our interrupt handler and dealing with this new +* condition. +*/ +void +ahd_unpause (struct ahd_softc *ahd) +{ +/* +* Automatically restore our modes to those saved +* prior to the first change of the mode. +*/ +if (ahd->saved_src_mode !=AHD_MODE_UNKNOWN + && ahd->saved_dst_mode !=AHD_MODE_UNKNOWN ) { +if ((ahd->flags &AHD_UPDATE_PEND_CMDS ) !=0 ) +ahd_reset_cmds_pending (ahd); +ahd_set_modes (ahd, ahd->saved_src_mode, ahd->saved_dst_mode); + } + +if ((ahd_inb (ahd,INTSTAT ) & ~CMDCMPLT ) ==0 ) +ahd_outb (ahd,HCNTRL , ahd->unpause); + +ahd_known_modes (ahd,AHD_MODE_UNKNOWN ,AHD_MODE_UNKNOWN ); +} + +/*********************** Scatter Gather List Handling *************************/ +void * +ahd_sg_setup (struct ahd_softc *ahd,struct scb *scb, +void *sgptr,dma_addr_t addr,bus_size_t len,int last) +{ + scb->sg_count++; +if (sizeof (dma_addr_t) >4 + && (ahd->flags &AHD_64BIT_ADDRESSING ) !=0 ) { +struct ahd_dma64_seg *sg; + + sg = (struct ahd_dma64_seg *)sgptr; + sg->addr =ahd_htole64 (addr); + sg->len =ahd_htole32 (len | (last ?AHD_DMA_LAST_SEG :0 )); +return (sg +1 ); + }else { +struct ahd_dma_seg *sg; + + sg = (struct ahd_dma_seg *)sgptr; + sg->addr =ahd_htole32 (addr &0xFFFFFFFF ); + sg->len =ahd_htole32 (len | ((addr >>8 ) &0x7F000000 ) + | (last ?AHD_DMA_LAST_SEG :0 )); +return (sg +1 ); + } +} + +void +ahd_setup_scb_common (struct ahd_softc *ahd,struct scb *scb) +{ +/* XXX Handle target mode SCBs. */ + scb->crc_retry_count =0 ; +if ((scb->flags &SCB_PACKETIZED ) !=0 ) { +/* XXX what about ACA?? It is type 4, but TAG_TYPE == 0x3. */ + scb->hscb->task_attribute = scb->hscb->control &SCB_TAG_TYPE ; + }else { +if (ahd_get_transfer_length (scb) &0x01 ) + scb->hscb->task_attribute =SCB_XFERLEN_ODD ; +else + scb->hscb->task_attribute =0 ; + } + +if (scb->hscb->cdb_len <=MAX_CDB_LEN_WITH_SENSE_ADDR + || (scb->hscb->cdb_len &SCB_CDB_LEN_PTR ) !=0 ) + scb->hscb->shared_data.idata.cdb_plus_saddr.sense_addr = +ahd_htole32 (scb->sense_busaddr); +} + +void +ahd_setup_data_scb (struct ahd_softc *ahd,struct scb *scb) +{ +/* +* Copy the first SG into the "current" data ponter area. +*/ +if ((ahd->flags &AHD_64BIT_ADDRESSING ) !=0 ) { +struct ahd_dma64_seg *sg; + + sg = (struct ahd_dma64_seg *)scb->sg_list; + scb->hscb->dataptr = sg->addr; + scb->hscb->datacnt = sg->len; + }else { +struct ahd_dma_seg *sg; +uint32_t *dataptr_words; + + sg = (struct ahd_dma_seg *)scb->sg_list; + dataptr_words = (uint32_t *)&scb->hscb->dataptr; + dataptr_words[0 ] = sg->addr; + dataptr_words[1 ] =0 ; +if ((ahd->flags &AHD_39BIT_ADDRESSING ) !=0 ) { +uint64_t high_addr; + + high_addr =ahd_le32toh (sg->len) &0x7F000000 ; + scb->hscb->dataptr |=ahd_htole64 (high_addr <<8 ); + } + scb->hscb->datacnt = sg->len; + } +/* +* Note where to find the SG entries in bus space. +* We also set the full residual flag which the +* sequencer will clear as soon as a data transfer +* occurs. +*/ + scb->hscb->sgptr =ahd_htole32 (scb->sg_list_busaddr|SG_FULL_RESID ); +} + +void +ahd_setup_noxfer_scb (struct ahd_softc *ahd,struct scb *scb) +{ + scb->hscb->sgptr =ahd_htole32 (SG_LIST_NULL ); + scb->hscb->dataptr =0 ; + scb->hscb->datacnt =0 ; +} + +/************************** Memory mapping routines ***************************/ +void * +ahd_sg_bus_to_virt (struct ahd_softc *ahd,struct scb *scb,uint32_t sg_busaddr) +{ +dma_addr_t sg_offset; + +/* sg_list_phys points to entry 1, not 0 */ + sg_offset = sg_busaddr - (scb->sg_list_busaddr -ahd_sg_size (ahd)); +return ((uint8_t *)scb->sg_list + sg_offset); +} + +uint32_t +ahd_sg_virt_to_bus (struct ahd_softc *ahd,struct scb *scb,void *sg) +{ +dma_addr_t sg_offset; + +/* sg_list_phys points to entry 1, not 0 */ + sg_offset = ((uint8_t *)sg - (uint8_t *)scb->sg_list) + -ahd_sg_size (ahd); + +return (scb->sg_list_busaddr + sg_offset); +} + +void +ahd_sync_scb (struct ahd_softc *ahd,struct scb *scb,int op) +{ +ahd_dmamap_sync (ahd, ahd->scb_data.hscb_dmat, + scb->hscb_map->dmamap, +/*offset*/ (uint8_t *)scb->hscb - scb->hscb_map->vaddr, +/*len*/ sizeof (*scb->hscb), op); +} + +void +ahd_sync_sglist (struct ahd_softc *ahd,struct scb *scb,int op) +{ +if (scb->sg_count ==0 ) +return ; + +ahd_dmamap_sync (ahd, ahd->scb_data.sg_dmat, + scb->sg_map->dmamap, +/*offset*/ scb->sg_list_busaddr -ahd_sg_size (ahd), +/*len*/ ahd_sg_size (ahd) * scb->sg_count, op); +} + +void +ahd_sync_sense (struct ahd_softc *ahd,struct scb *scb,int op) +{ +ahd_dmamap_sync (ahd, ahd->scb_data.sense_dmat, + scb->sense_map->dmamap, +/*offset*/ scb->sense_busaddr, +/*len*/ AHD_SENSE_BUFSIZE , op); +} + +uint32_t +ahd_targetcmd_offset (struct ahd_softc *ahd,u_int index) +{ +return (((uint8_t *)&ahd->targetcmds[index]) + - (uint8_t *)ahd->qoutfifo); +} + +/*********************** Miscelaneous Support Functions ***********************/ +/* +* Return pointers to the transfer negotiation information +* for the specified our_id/remote_id pair. +*/ +struct ahd_initiator_tinfo * +ahd_fetch_transinfo (struct ahd_softc *ahd,char channel,u_int our_id, +u_int remote_id,struct ahd_tmode_tstate **tstate) +{ +/* +* Transfer data structures are stored from the perspective +* of the target role. Since the parameters for a connection +* in the initiator role to a given target are the same as +* when the roles are reversed, we pretend we are the target. +*/ +if (channel =='B' ) + our_id +=8 ; + *tstate = ahd->enabled_targets[our_id]; +return (&(*tstate)->transinfo[remote_id]); +} + +uint16_t +ahd_inw (struct ahd_softc *ahd,u_int port) +{ +/* +* Read high byte first as some registers increment +* or have other side effects when the low byte is +* read. +*/ +uint16_t r =ahd_inb (ahd, port+1 ) <<8 ; +return r |ahd_inb (ahd, port); +} + +void +ahd_outw (struct ahd_softc *ahd,u_int port,u_int value) +{ +/* +* Write low byte first to accomodate registers +* such as PRGMCNT where the order maters. +*/ +ahd_outb (ahd, port, value &0xFF ); +ahd_outb (ahd, port+1 , (value >>8 ) &0xFF ); +} + +uint32_t +ahd_inl (struct ahd_softc *ahd,u_int port) +{ +return ((ahd_inb (ahd, port)) + | (ahd_inb (ahd, port+1 ) <<8 ) + | (ahd_inb (ahd, port+2 ) <<16 ) + | (ahd_inb (ahd, port+3 ) <<24 )); +} + +void +ahd_outl (struct ahd_softc *ahd,u_int port,uint32_t value) +{ +ahd_outb (ahd, port, (value) &0xFF ); +ahd_outb (ahd, port+1 , ((value) >>8 ) &0xFF ); +ahd_outb (ahd, port+2 , ((value) >>16 ) &0xFF ); +ahd_outb (ahd, port+3 , ((value) >>24 ) &0xFF ); +} + +uint64_t +ahd_inq (struct ahd_softc *ahd,u_int port) +{ +return ((ahd_inb (ahd, port)) + | (ahd_inb (ahd, port+1 ) <<8 ) + | (ahd_inb (ahd, port+2 ) <<16 ) + | (ahd_inb (ahd, port+3 ) <<24 ) + | (((uint64_t )ahd_inb (ahd, port+4 )) <<32 ) + | (((uint64_t )ahd_inb (ahd, port+5 )) <<40 ) + | (((uint64_t )ahd_inb (ahd, port+6 )) <<48 ) + | (((uint64_t )ahd_inb (ahd, port+7 )) <<56 )); +} + +void +ahd_outq (struct ahd_softc *ahd,u_int port,uint64_t value) +{ +ahd_outb (ahd, port, value &0xFF ); +ahd_outb (ahd, port+1 , (value >>8 ) &0xFF ); +ahd_outb (ahd, port+2 , (value >>16 ) &0xFF ); +ahd_outb (ahd, port+3 , (value >>24 ) &0xFF ); +ahd_outb (ahd, port+4 , (value >>32 ) &0xFF ); +ahd_outb (ahd, port+5 , (value >>40 ) &0xFF ); +ahd_outb (ahd, port+6 , (value >>48 ) &0xFF ); +ahd_outb (ahd, port+7 , (value >>56 ) &0xFF ); +} + +u_int +ahd_get_scbptr (struct ahd_softc *ahd) +{ +AHD_ASSERT_MODES (ahd, ~(AHD_MODE_UNKNOWN_MSK |AHD_MODE_CFG_MSK ), + ~(AHD_MODE_UNKNOWN_MSK |AHD_MODE_CFG_MSK )); +return (ahd_inb (ahd,SCBPTR ) | (ahd_inb (ahd,SCBPTR +1 ) <<8 )); +} + +void +ahd_set_scbptr (struct ahd_softc *ahd,u_int scbptr) +{ +AHD_ASSERT_MODES (ahd, ~(AHD_MODE_UNKNOWN_MSK |AHD_MODE_CFG_MSK ), + ~(AHD_MODE_UNKNOWN_MSK |AHD_MODE_CFG_MSK )); +ahd_outb (ahd,SCBPTR , scbptr &0xFF ); +ahd_outb (ahd,SCBPTR +1 , (scbptr >>8 ) &0xFF ); +} + +u_int +ahd_get_hnscb_qoff (struct ahd_softc *ahd) +{ +return (ahd_inw_atomic (ahd,HNSCB_QOFF )); +} + +void +ahd_set_hnscb_qoff (struct ahd_softc *ahd,u_int value) +{ +ahd_outw_atomic (ahd,HNSCB_QOFF , value); +} + +u_int +ahd_get_hescb_qoff (struct ahd_softc *ahd) +{ +return (ahd_inb (ahd,HESCB_QOFF )); +} + +void +ahd_set_hescb_qoff (struct ahd_softc *ahd,u_int value) +{ +ahd_outb (ahd,HESCB_QOFF , value); +} + +u_int +ahd_get_snscb_qoff (struct ahd_softc *ahd) +{ +u_int oldvalue; + +AHD_ASSERT_MODES (ahd,AHD_MODE_CCHAN_MSK ,AHD_MODE_CCHAN_MSK ); + oldvalue =ahd_inw (ahd,SNSCB_QOFF ); +ahd_outw (ahd,SNSCB_QOFF , oldvalue); +return (oldvalue); +} + +void +ahd_set_snscb_qoff (struct ahd_softc *ahd,u_int value) +{ +AHD_ASSERT_MODES (ahd,AHD_MODE_CCHAN_MSK ,AHD_MODE_CCHAN_MSK ); +ahd_outw (ahd,SNSCB_QOFF , value); +} + +u_int +ahd_get_sescb_qoff (struct ahd_softc *ahd) +{ +AHD_ASSERT_MODES (ahd,AHD_MODE_CCHAN_MSK ,AHD_MODE_CCHAN_MSK ); +return (ahd_inb (ahd,SESCB_QOFF )); +} + +void +ahd_set_sescb_qoff (struct ahd_softc *ahd,u_int value) +{ +AHD_ASSERT_MODES (ahd,AHD_MODE_CCHAN_MSK ,AHD_MODE_CCHAN_MSK ); +ahd_outb (ahd,SESCB_QOFF , value); +} + +u_int +ahd_get_sdscb_qoff (struct ahd_softc *ahd) +{ +AHD_ASSERT_MODES (ahd,AHD_MODE_CCHAN_MSK ,AHD_MODE_CCHAN_MSK ); +return (ahd_inb (ahd,SDSCB_QOFF ) | (ahd_inb (ahd,SDSCB_QOFF +1 ) <<8 )); +} + +void +ahd_set_sdscb_qoff (struct ahd_softc *ahd,u_int value) +{ +AHD_ASSERT_MODES (ahd,AHD_MODE_CCHAN_MSK ,AHD_MODE_CCHAN_MSK ); +ahd_outb (ahd,SDSCB_QOFF , value &0xFF ); +ahd_outb (ahd,SDSCB_QOFF +1 , (value >>8 ) &0xFF ); +} + +u_int +ahd_inb_scbram (struct ahd_softc *ahd,u_int offset) +{ +u_int value; +/* +* Workaround PCI-X Rev A. hardware bug. +* After a host read of SCB memory, the chip +* may become confused into thinking prefetch +* was required. This starts the discard timer +* running and can cause an unexpected discard +* timer interrupt. The work around is to read +* a normal register prior to the exhaustion of +* the discard timer. The mode pointer register +* has no side effects and so serves well for +* this purpose. +* +* Razor #528 +*/ + value =ahd_inb (ahd, offset); +if ((ahd->bugs &AHD_PCIX_SCBRAM_RD_BUG ) !=0 ) +ahd_inb (ahd,MODE_PTR ); +return (value); +} + +u_int +ahd_inw_scbram (struct ahd_softc *ahd,u_int offset) +{ +return (ahd_inb_scbram (ahd, offset) + | (ahd_inb_scbram (ahd, offset+1 ) <<8 )); +} + +uint32_t +ahd_inl_scbram (struct ahd_softc *ahd,u_int offset) +{ +return (ahd_inw_scbram (ahd, offset) + | (ahd_inw_scbram (ahd, offset+2 ) <<16 )); +} + +uint64_t +ahd_inq_scbram (struct ahd_softc *ahd,u_int offset) +{ +return (ahd_inl_scbram (ahd, offset) + | ((uint64_t )ahd_inl_scbram (ahd, offset+4 )) <<32 ); +} + +struct scb * +ahd_lookup_scb (struct ahd_softc *ahd,u_int tag) +{ +struct scb * scb; + +if (tag >=AHD_SCB_MAX ) +return (NULL ); + scb = ahd->scb_data.scbindex[tag]; +if (scb !=NULL ) +ahd_sync_scb (ahd, scb, +BUS_DMASYNC_POSTREAD |BUS_DMASYNC_POSTWRITE ); +return (scb); +} + +void +ahd_swap_with_next_hscb (struct ahd_softc *ahd,struct scb *scb) +{ +struct hardware_scb *q_hscb; +struct map_node *q_hscb_map; +uint32_t saved_hscb_busaddr; + +/* +* Our queuing method is a bit tricky. The card +* knows in advance which HSCB (by address) to download, +* and we can't disappoint it. To achieve this, the next +* HSCB to download is saved off in ahd->next_queued_hscb. +* When we are called to queue "an arbitrary scb", +* we copy the contents of the incoming HSCB to the one +* the sequencer knows about, swap HSCB pointers and +* finally assign the SCB to the tag indexed location +* in the scb_array. This makes sure that we can still +* locate the correct SCB by SCB_TAG. +*/ + q_hscb = ahd->next_queued_hscb; + q_hscb_map = ahd->next_queued_hscb_map; + saved_hscb_busaddr = q_hscb->hscb_busaddr; +memcpy (q_hscb, scb->hscb,sizeof (*scb->hscb)); + q_hscb->hscb_busaddr = saved_hscb_busaddr; + q_hscb->next_hscb_busaddr = scb->hscb->hscb_busaddr; + +/* Now swap HSCB pointers. */ + ahd->next_queued_hscb = scb->hscb; + ahd->next_queued_hscb_map = scb->hscb_map; + scb->hscb = q_hscb; + scb->hscb_map = q_hscb_map; + +/* Now define the mapping from tag to SCB in the scbindex */ + ahd->scb_data.scbindex[SCB_GET_TAG (scb)] = scb; +} + +/* +* Tell the sequencer about a new transaction to execute. +*/ +void +ahd_queue_scb (struct ahd_softc *ahd,struct scb *scb) +{ +ahd_swap_with_next_hscb (ahd, scb); + +if (SCBID_IS_NULL (SCB_GET_TAG (scb))) +panic ("Attempt to queue invalid SCB tag %x\n" , +SCB_GET_TAG (scb)); + +/* +* Keep a history of SCBs we've downloaded in the qinfifo. +*/ + ahd->qinfifo[AHD_QIN_WRAP (ahd->qinfifonext)] =SCB_GET_TAG (scb); + ahd->qinfifonext++; + +if (scb->sg_count !=0 ) +ahd_setup_data_scb (ahd, scb); +else +ahd_setup_noxfer_scb (ahd, scb); +ahd_setup_scb_common (ahd, scb); + +/* +* Make sure our data is consistent from the +* perspective of the adapter. +*/ +ahd_sync_scb (ahd, scb,BUS_DMASYNC_PREREAD |BUS_DMASYNC_PREWRITE ); + +#ifdef AHD_DEBUG +if ((ahd_debug &AHD_SHOW_QUEUE ) !=0 ) { +uint64_t host_dataptr; + + host_dataptr =ahd_le64toh (scb->hscb->dataptr); +printf ("%s: Queueing SCB %d:0x%x bus addr 0x%x - 0x%x%x/0x%x\n" , +ahd_name (ahd), +SCB_GET_TAG (scb), scb->hscb->scsiid, +ahd_le32toh (scb->hscb->hscb_busaddr), + (u_int)((host_dataptr >>32 ) &0xFFFFFFFF ), + (u_int)(host_dataptr &0xFFFFFFFF ), +ahd_le32toh (scb->hscb->datacnt)); + } +#endif +/* Tell the adapter about the newly queued SCB */ +ahd_set_hnscb_qoff (ahd, ahd->qinfifonext); +} + +/************************** Interrupt Processing ******************************/ +void +ahd_sync_qoutfifo (struct ahd_softc *ahd,int op) +{ +ahd_dmamap_sync (ahd, ahd->shared_data_dmat, ahd->shared_data_map.dmamap, +/*offset*/ 0 , +/*len*/ AHD_SCB_MAX *sizeof (struct ahd_completion ), op); +} + +void +ahd_sync_tqinfifo (struct ahd_softc *ahd,int op) +{ +#ifdef AHD_TARGET_MODE +if ((ahd->flags &AHD_TARGETROLE ) !=0 ) { +ahd_dmamap_sync (ahd, ahd->shared_data_dmat, + ahd->shared_data_map.dmamap, +ahd_targetcmd_offset (ahd,0 ), +sizeof (struct target_cmd ) *AHD_TMODE_CMDS , + op); + } +#endif +} + +/* +* See if the firmware has posted any completed commands +* into our in-core command complete fifos. +*/ +#define AHD_RUN_QOUTFIFO 0x1 +#define AHD_RUN_TQINFIFO 0x2 +u_int +ahd_check_cmdcmpltqueues (struct ahd_softc *ahd) +{ +u_int retval; + + retval =0 ; +ahd_dmamap_sync (ahd, ahd->shared_data_dmat, ahd->shared_data_map.dmamap, +/*offset*/ ahd->qoutfifonext *sizeof (*ahd->qoutfifo), +/*len*/ sizeof (*ahd->qoutfifo),BUS_DMASYNC_POSTREAD ); +if (ahd->qoutfifo[ahd->qoutfifonext].valid_tag + == ahd->qoutfifonext_valid_tag) + retval |=AHD_RUN_QOUTFIFO ; +#ifdef AHD_TARGET_MODE +if ((ahd->flags &AHD_TARGETROLE ) !=0 + && (ahd->flags &AHD_TQINFIFO_BLOCKED ) ==0 ) { +ahd_dmamap_sync (ahd, ahd->shared_data_dmat, + ahd->shared_data_map.dmamap, +ahd_targetcmd_offset (ahd, ahd->tqinfifofnext), +/*len*/ sizeof (struct target_cmd ), +BUS_DMASYNC_POSTREAD ); +if (ahd->targetcmds[ahd->tqinfifonext].cmd_valid !=0 ) + retval |=AHD_RUN_TQINFIFO ; + } +#endif +return (retval); +} + +/* +* Catch an interrupt from the adapter +*/ +int +ahd_intr (struct ahd_softc *ahd) +{ +u_int intstat; + +if ((ahd->pause &INTEN ) ==0 ) { +/* +* Our interrupt is not enabled on the chip +* and may be disabled for re-entrancy reasons, +* so just return. This is likely just a shared +* interrupt. +*/ +return (0 ); + } + +/* +* Instead of directly reading the interrupt status register, +* infer the cause of the interrupt by checking our in-core +* completion queues. This avoids a costly PCI bus read in +* most cases. +*/ +if ((ahd->flags &AHD_ALL_INTERRUPTS ) ==0 + && (ahd_check_cmdcmpltqueues (ahd) !=0 )) + intstat =CMDCMPLT ; +else + intstat =ahd_inb (ahd,INTSTAT ); + +if ((intstat &INT_PEND ) ==0 ) +return (0 ); + +if (intstat &CMDCMPLT ) { +ahd_outb (ahd,CLRINT ,CLRCMDINT ); + +/* +* Ensure that the chip sees that we've cleared +* this interrupt before we walk the output fifo. +* Otherwise, we may, due to posted bus writes, +* clear the interrupt after we finish the scan, +* and after the sequencer has added new entries +* and asserted the interrupt again. +*/ +if ((ahd->bugs &AHD_INTCOLLISION_BUG ) !=0 ) { +if (ahd_is_paused (ahd)) { +/* +* Potentially lost SEQINT. +* If SEQINTCODE is non-zero, +* simulate the SEQINT. +*/ +if (ahd_inb (ahd,SEQINTCODE ) !=NO_SEQINT ) + intstat |=SEQINT ; + } + }else { +ahd_flush_device_writes (ahd); + } +ahd_run_qoutfifo (ahd); + ahd->cmdcmplt_counts[ahd->cmdcmplt_bucket]++; + ahd->cmdcmplt_total++; +#ifdef AHD_TARGET_MODE +if ((ahd->flags &AHD_TARGETROLE ) !=0 ) +ahd_run_tqinfifo (ahd,/*paused*/ FALSE); +#endif + } + +/* +* Handle statuses that may invalidate our cached +* copy of INTSTAT separately. +*/ +if (intstat ==0xFF && (ahd->features &AHD_REMOVABLE ) !=0 ) { +/* Hot eject. Do nothing */ + }else if (intstat &HWERRINT ) { +ahd_handle_hwerrint (ahd); + }else if ((intstat & (PCIINT |SPLTINT )) !=0 ) { + ahd->bus_intr (ahd); + }else { + +if ((intstat &SEQINT ) !=0 ) +ahd_handle_seqint (ahd, intstat); + +if ((intstat &SCSIINT ) !=0 ) +ahd_handle_scsiint (ahd, intstat); + } +return (1 ); +} + +/******************************** Private Inlines *****************************/ static __inlinevoid ahd_assert_atn (struct ahd_softc *ahd) {
@@ -280,7 +1024,7 @@ ahd_assert_atn(struct ahd_softc *ahd)* are currently in a packetized transfer. We could * just as easily be sending or receiving a message. */ -static __inlineint +static int ahd_currently_packetized (struct ahd_softc *ahd) {ahd_mode_state saved_modes;
@@ -6272,6 +7016,24 @@ static const char *termstat_strings[] = "Not Configured" }; +/***************************** Timer Facilities *******************************/ +#define ahd_timer_init init_timer +#define ahd_timer_stop del_timer_sync +typedef void ahd_linux_callback_t (u_long ); + +static void +ahd_timer_reset (ahd_timer_t *timer,int usec,ahd_callback_t *func,void *arg) +{ +struct ahd_softc *ahd; + + ahd = (struct ahd_softc *)arg; +del_timer (timer); + timer->data = (u_long )arg; + timer->expires = jiffies + (usec *HZ )/1000000 ; + timer->function = (ahd_linux_callback_t *)func; +add_timer (timer); +} +/* * Start the board, ready for normal operation */
drivers/scsi/aic7xxx/aic79xx_inline.h +86 -817
944 lines not on this page · raw message
drivers/scsi/aic7xxx/aic79xx_osm.c +159 -3
176 lines not on this page · raw message
drivers/scsi/aic7xxx/aic79xx_osm.h +9 -167
204 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_core.c +504 -0
510 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_inline.h +56 -554
381 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_osm.c +73 -4
77 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_osm.h +11 -126
137 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +51 -0
51 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
PATCH 2/3 debloat aic7xxx and aic79xx drivers
Adds statics, #ifdefs out huge amount of unused code, adds consts
--
vda
drivers/scsi/aic7xxx/aic79xx.h +3 -14
@@ -1307,7 +1307,7 @@ typedef int (ahd_device_setup_t)(structstruct ahd_pci_identity {uint64_t full_id;uint64_t id_mask; -char *name; +const char *name;ahd_device_setup_t *setup; };
@@ -1315,7 +1315,7 @@ struct ahd_pci_identity {struct aic7770_identity {uint32_t full_id;uint32_t id_mask; -char *name; +const char *name;ahd_device_setup_t *setup; };extern struct aic7770_identity aic7770_ident_table [];
@@ -1326,7 +1326,6 @@ extern const int ahd_num_aic7770_devs;/*************************** Function Declarations ****************************/ /******************************************************************************/ -void ahd_reset_cmds_pending (struct ahd_softc *ahd);/***************************** PCI Front End *********************************/ struct ahd_pci_identity *ahd_find_pci_device (ahd_dev_softc_t );
@@ -1362,16 +1361,6 @@ int ahd_write_flexport(struct ahd_sofint ahd_read_flexport (struct ahd_softc *ahd,u_int addr,uint8_t *value); -/*************************** Interrupt Services *******************************/ -void ahd_run_qoutfifo (struct ahd_softc *ahd); -#ifdef AHD_TARGET_MODE -void ahd_run_tqinfifo (struct ahd_softc *ahd,int paused); -#endif -void ahd_handle_hwerrint (struct ahd_softc *ahd); -void ahd_handle_seqint (struct ahd_softc *ahd,u_int intstat); -void ahd_handle_scsiint (struct ahd_softc *ahd, -u_int intstat); -/***************************** Error Recovery *********************************/ typedef enum { SEARCH_COMPLETE,
@@ -1465,7 +1454,7 @@ extern uint32_t ahd_debug;void ahd_print_devinfo (struct ahd_softc *ahd,struct ahd_devinfo *devinfo);void ahd_dump_card_state (struct ahd_softc *ahd); -int ahd_print_register(ahd_reg_parse_entry_t *table, +int ahd_print_register(const ahd_reg_parse_entry_t *table, u_int num_entries, const char *name, u_int address,
drivers/scsi/aic7xxx/aic79xx_core.c +55 -33
293 lines not on this page · raw message
drivers/scsi/aic7xxx/aic79xx_inline.h +0 -44
78 lines not on this page · raw message
drivers/scsi/aic7xxx/aic79xx_osm.c +3 -2
@@ -388,7 +388,6 @@ ahd_delay(long usec)/***************************** Low Level I/O **********************************/ uint8_t ahd_inb (struct ahd_softc * ahd,long port); -uint16_t ahd_inw_atomic (struct ahd_softc * ahd,long port);void ahd_outb (struct ahd_softc * ahd,long port,uint8_t val);void ahd_outw_atomic (struct ahd_softc * ahd,long port,uint16_t val);
@@ -411,7 +410,8 @@ ahd_inb(struct ahd_softc * ahd, long porreturn (x); } -uint16_t +#if 0 /* unused */ +static uint16_t ahd_inw_atomic (struct ahd_softc * ahd,long port) {uint8_t x;
@@ -424,6 +424,7 @@ ahd_inw_atomic(struct ahd_softc * ahd, lmb (); return (x); } +#endif void ahd_outb (struct ahd_softc * ahd,long port,uint8_t val)
drivers/scsi/aic7xxx/aic79xx_osm.h +0 -1
@@ -374,7 +374,6 @@ void ahd_delay(long);/***************************** Low Level I/O **********************************/ uint8_t ahd_inb (struct ahd_softc * ahd,long port); -uint16_t ahd_inw_atomic (struct ahd_softc * ahd,long port);void ahd_outb (struct ahd_softc * ahd,long port,uint8_t val);void ahd_outw_atomic (struct ahd_softc * ahd,long port,uint16_t val);
drivers/scsi/aic7xxx/aic79xx_pci.c +1 -1
@@ -97,7 +97,7 @@ static ahd_device_setup_t ahd_aic7901A_sstatic ahd_device_setup_t ahd_aic7902_setup;static ahd_device_setup_t ahd_aic790X_setup; -static struct ahd_pci_identity ahd_pci_ident_table [] = +static struct ahd_pci_identity ahd_pci_ident_table[] = {/* aic7901 based controllers */ {
drivers/scsi/aic7xxx/aic79xx_reg.h_shipped +341 -337
894 lines not on this page · raw message
drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped +873 -871
1,650 lines not on this page · raw message
drivers/scsi/aic7xxx/aic79xx_seq.h_shipped +1 -1
Lines of this file are not shown. View the raw message.
drivers/scsi/aic7xxx/aic7xxx.h +5 -44
49 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_core.c +124 -56
180 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_inline.h +0 -55
55 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped +164 -160
324 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped +439 -436
875 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_seq.h_shipped +1 -1
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
PATCH 3/3 debloat aic7xxx and aic79xx drivers
Adds more consts
--
vda
drivers/scsi/aic7xxx/aic79xx.h +5 -5
@@ -813,9 +813,9 @@ struct ahd_tmode_tstate {* to parity errors in each phase table. */ struct ahd_phase_table_entry { -uint8_t phase; -uint8_t mesg_out;/* Message response to parity errors */ -char *phasemsg; +uint8_t phase; +uint8_t mesg_out;/* Message response to parity errors */ +const char *phasemsg; };/************************** Serial EEPROM Format ******************************/
@@ -1328,9 +1328,9 @@ extern const int ahd_num_aic7770_devs;/******************************************************************************/ /***************************** PCI Front End *********************************/ -struct ahd_pci_identity *ahd_find_pci_device (ahd_dev_softc_t ); +const struct ahd_pci_identity *ahd_find_pci_device (ahd_dev_softc_t );int ahd_pci_config (struct ahd_softc *, -struct ahd_pci_identity *); +const struct ahd_pci_identity *);int ahd_pci_test_register_access (struct ahd_softc *);/************************** SCB and SCB queue management **********************/
drivers/scsi/aic7xxx/aic79xx_core.c +15 -15
@@ -52,7 +52,7 @@/***************************** Lookup Tables **********************************/ -static char *ahd_chip_names[] = +static const char *const ahd_chip_names[] = {"NONE" ,"aic7901" ,
@@ -65,11 +65,11 @@ static const u_int num_chip_names = ARRA* Hardware error codes. */ struct ahd_hard_error_entry { -uint8_t errno; -char *errmesg; +uint8_t errno; +const char *errmesg; }; -static struct ahd_hard_error_entry ahd_hard_errors[] = { +static const struct ahd_hard_error_entry ahd_hard_errors[] = { {DSCTMOUT ,"Discard Timer has timed out" }, {ILLOPCODE ,"Illegal Opcode in sequencer program" }, {SQPARERR ,"Sequencer Parity Error" },
@@ -79,7 +79,7 @@ static struct ahd_hard_error_entry ahd_h };static const u_int num_errors =ARRAY_SIZE (ahd_hard_errors); -static struct ahd_phase_table_entry ahd_phase_table[] = +static const struct ahd_phase_table_entry ahd_phase_table[] = { {P_DATAOUT ,MSG_NOOP ,"in Data-out phase" }, {P_DATAIN ,MSG_INITIATOR_DET_ERR ,"in Data-in phase" },
@@ -213,7 +213,7 @@ static void ahd_dumpseq(struct ahd_soft#endif static void ahd_loadseq (struct ahd_softc *ahd);static int ahd_check_patch (struct ahd_softc *ahd, -struct patch **start_patch, +const struct patch **start_patch,u_int start_instr,u_int *skip_addr);static u_int ahd_resolve_seqaddr (struct ahd_softc *ahd,u_int address);
@@ -254,7 +254,7 @@ static void ahd_freeze_devq(struct ahd_ struct scb *scb);static void ahd_handle_scb_status (struct ahd_softc *ahd,struct scb *scb); -static struct ahd_phase_table_entry *ahd_lookup_phase_entry (int phase); +static const struct ahd_phase_table_entry *ahd_lookup_phase_entry (int phase);static void ahd_shutdown (void *arg); static void ahd_update_coalescing_values(struct ahd_softc *ahd, u_int timer,
@@ -4337,11 +4337,11 @@ ahd_print_devinfo(struct ahd_softc *ahd, devinfo->target, devinfo->lun); } -static struct ahd_phase_table_entry * +static const struct ahd_phase_table_entry *ahd_lookup_phase_entry (int phase) { -struct ahd_phase_table_entry *entry; -struct ahd_phase_table_entry *last_entry; +const struct ahd_phase_table_entry *entry; +const struct ahd_phase_table_entry *last_entry;/* * num_phases doesn't include the default entry which
@@ -9358,7 +9358,7 @@ ahd_loadseq(struct ahd_softc *ahd)struct cs cs_table[num_critical_sections];u_int begin_set[num_critical_sections];u_int end_set[num_critical_sections]; -struct patch *cur_patch; +const struct patch *cur_patch;u_int cs_count;u_int cur_cs;u_int i;
@@ -9513,11 +9513,11 @@ ahd_loadseq(struct ahd_softc *ahd) }static int -ahd_check_patch (struct ahd_softc *ahd,struct patch **start_patch, +ahd_check_patch (struct ahd_softc *ahd,const struct patch **start_patch,u_int start_instr,u_int *skip_addr) { -struct patch *cur_patch; -struct patch *last_patch; +const struct patch *cur_patch; +const struct patch *last_patch;u_int num_patches; num_patches =ARRAY_SIZE (patches);
@@ -9551,7 +9551,7 @@ ahd_check_patch(struct ahd_softc *ahd, sstatic u_int ahd_resolve_seqaddr (struct ahd_softc *ahd,u_int address) { -struct patch *cur_patch; +const struct patch *cur_patch;int address_offset;u_int skip_addr;u_int i;
drivers/scsi/aic7xxx/aic79xx_osm.c +8 -10
@@ -193,7 +193,7 @@ struct ahd_linux_iocell_opts#define AIC79XX_PRECOMP_INDEX 0#define AIC79XX_SLEWRATE_INDEX 1#define AIC79XX_AMPLITUDE_INDEX 2 -static struct ahd_linux_iocell_opts aic79xx_iocell_info[] = +static const struct ahd_linux_iocell_opts aic79xx_iocell_info[] = {AIC79XX_DEFAULT_IOOPTS ,AIC79XX_DEFAULT_IOOPTS ,
@@ -557,13 +557,11 @@ ahd_linux_info(struct Scsi_Host *host) bp = &buffer[0 ]; ahd = *(struct ahd_softc **)host->hostdata;memset (bp,0 ,sizeof (buffer)); -strcpy (bp,"Adaptec AIC79XX PCI-X SCSI HBA DRIVER, Rev " ); -strcat (bp,AIC79XX_DRIVER_VERSION ); -strcat (bp,"\n" ); -strcat (bp," <" ); +strcpy (bp,"Adaptec AIC79XX PCI-X SCSI HBA DRIVER, Rev " AIC79XX_DRIVER_VERSION "\n" +" <" );strcat (bp, ahd->description); -strcat (bp,">\n" ); -strcat (bp," " ); +strcat (bp,">\n" +" " );ahd_controller_info (ahd, ahd_info);strcat (bp, ahd_info);
@@ -1148,7 +1146,7 @@ aic79xx_setup(char *s)char *p;char *end; -static struct { +static const struct {const char *name;uint32_t *flag; } options[] = {
@@ -1380,7 +1378,7 @@ ahd_platform_init(struct ahd_softc *ahd)* Lookup and commit any modified IO Cell options. */ if (ahd->unit <ARRAY_SIZE (aic79xx_iocell_info)) { -struct ahd_linux_iocell_opts *iocell_opts; +const struct ahd_linux_iocell_opts *iocell_opts; iocell_opts = &aic79xx_iocell_info[ahd->unit];if (iocell_opts->precomp !=AIC79XX_DEFAULT_PRECOMP )
@@ -2767,7 +2765,7 @@ static void ahd_linux_set_pcomp_en(strucuint8_t precomp;if (ahd->unit <ARRAY_SIZE (aic79xx_iocell_info)) { -struct ahd_linux_iocell_opts *iocell_opts; +const struct ahd_linux_iocell_opts *iocell_opts; iocell_opts = &aic79xx_iocell_info[ahd->unit]; precomp = iocell_opts->precomp;
drivers/scsi/aic7xxx/aic79xx_osm_pci.c +2 -2
@@ -58,7 +58,7 @@ static void ahd_linux_pci_dev_remove(strID2C (x), \ID2C (IDIROC (x )) -static struct pci_device_id ahd_linux_pci_id_table[] = { +static const struct pci_device_id ahd_linux_pci_id_table[] = {/* aic7901 based controllers */ ID (ID_AHA_29320A ),ID (ID_AHA_29320ALP ),
@@ -129,7 +129,7 @@ ahd_linux_pci_dev_probe(struct pci_dev *char buf[80 ];struct ahd_softc *ahd;ahd_dev_softc_t pci; -struct ahd_pci_identity *entry; +const struct ahd_pci_identity *entry;char *name;int error;struct device *dev = &pdev->dev;
drivers/scsi/aic7xxx/aic79xx_pci.c +4 -4
@@ -97,7 +97,7 @@ static ahd_device_setup_t ahd_aic7901A_sstatic ahd_device_setup_t ahd_aic7902_setup;static ahd_device_setup_t ahd_aic790X_setup; -static struct ahd_pci_identity ahd_pci_ident_table[] = +static const struct ahd_pci_identity ahd_pci_ident_table[] = {/* aic7901 based controllers */ {
@@ -253,7 +253,7 @@ static void ahd_configure_termination(ststatic void ahd_pci_split_intr (struct ahd_softc *ahd,u_int intstat);static void ahd_pci_intr (struct ahd_softc *ahd); -struct ahd_pci_identity * +const struct ahd_pci_identity *ahd_find_pci_device (ahd_dev_softc_t pci) {uint64_t full_id;
@@ -261,7 +261,7 @@ ahd_find_pci_device(ahd_dev_softc_t pci)uint16_t vendor;uint16_t subdevice;uint16_t subvendor; -struct ahd_pci_identity *entry; +const struct ahd_pci_identity *entry;u_int i; vendor =ahd_pci_read_config (pci,PCIR_DEVVENDOR ,/*bytes*/ 2 );
@@ -292,7 +292,7 @@ ahd_find_pci_device(ahd_dev_softc_t pci) }int -ahd_pci_config (struct ahd_softc *ahd,struct ahd_pci_identity *entry) +ahd_pci_config (struct ahd_softc *ahd,const struct ahd_pci_identity *entry) {struct scb_data *shared_scb_data;u_int command;
drivers/scsi/aic7xxx/aic79xx_proc.c +1 -1
@@ -57,7 +57,7 @@ static int ahd_proc_write_seeprom(struct* Table of syncrates that don't follow the "divisible by 4" * rule. This table will be expanded in future SCSI specs. */ -static struct { +static const struct {u_int period_factor;u_int period;/* in 100ths of ns */ } scsi_syncrates[] = {
drivers/scsi/aic7xxx/aic79xx_seq.h_shipped +2 -2
@@ -1027,7 +1027,7 @@ ahd_patch0_func(struct ahd_softc *ahd) return (0); } -static struct patch { +static const struct patch { ahd_patch_func_t *patch_func; uint32_t begin :10, skip_instr :10,
@@ -1166,7 +1166,7 @@ static struct patch { { ahd_patch23_func, 815, 11, 1 } }; -static struct cs { +static const struct cs { uint16_t begin; uint16_t end; } critical_sections[] = {
drivers/scsi/aic7xxx/aic7xxx.h +5 -5
@@ -759,8 +759,8 @@ struct ahc_syncrate {* to parity errors in each phase table. */ struct ahc_phase_table_entry { -uint8_t phase; -uint8_t mesg_out;/* Message response to parity errors */ +uint8_t phase; +uint8_t mesg_out;/* Message response to parity errors */ char *phasemsg; };
@@ -1124,7 +1124,7 @@ typedef int (ahc_device_setup_t)(structstruct ahc_pci_identity {uint64_t full_id;uint64_t id_mask; -char *name; +const char *name;ahc_device_setup_t *setup; };
@@ -1145,9 +1145,9 @@ extern const int ahc_num_aic7770_devs;/******************************************************************************/ /***************************** PCI Front End *********************************/ -struct ahc_pci_identity *ahc_find_pci_device (ahc_dev_softc_t ); +const struct ahc_pci_identity *ahc_find_pci_device (ahc_dev_softc_t );int ahc_pci_config (struct ahc_softc *, -struct ahc_pci_identity *); +const struct ahc_pci_identity *);int ahc_pci_test_register_access (struct ahc_softc *);/*************************** EISA/VL Front End ********************************/
drivers/scsi/aic7xxx/aic7xxx_93cx6.c +8 -8
@@ -84,16 +84,16 @@ struct seeprom_cmd { };/* Short opcodes for the c46 */ -static struct seeprom_cmd seeprom_ewen = {9 , {1 ,0 ,0 ,1 ,1 ,0 ,0 ,0 ,0 }}; -static struct seeprom_cmd seeprom_ewds = {9 , {1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 }}; +static const struct seeprom_cmd seeprom_ewen = {9 , {1 ,0 ,0 ,1 ,1 ,0 ,0 ,0 ,0 }}; +static const struct seeprom_cmd seeprom_ewds = {9 , {1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 }};/* Long opcodes for the C56/C66 */ -static struct seeprom_cmd seeprom_long_ewen = {11 , {1 ,0 ,0 ,1 ,1 ,0 ,0 ,0 ,0 }}; -static struct seeprom_cmd seeprom_long_ewds = {11 , {1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 }}; +static const struct seeprom_cmd seeprom_long_ewen = {11 , {1 ,0 ,0 ,1 ,1 ,0 ,0 ,0 ,0 }}; +static const struct seeprom_cmd seeprom_long_ewds = {11 , {1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 }};/* Common opcodes */ -static struct seeprom_cmd seeprom_write = {3 , {1 ,0 ,1 }}; -static struct seeprom_cmd seeprom_read = {3 , {1 ,1 ,0 }}; +static const struct seeprom_cmd seeprom_write = {3 , {1 ,0 ,1 }}; +static const struct seeprom_cmd seeprom_read = {3 , {1 ,1 ,0 }};/* * Wait for the SEERDY to go high; about 800 ns.
@@ -108,7 +108,7 @@ static struct seeprom_cmd seeprom_read* Send a START condition and the given command */ static void -send_seeprom_cmd (struct seeprom_descriptor *sd,struct seeprom_cmd *cmd) +send_seeprom_cmd (struct seeprom_descriptor *sd,const struct seeprom_cmd *cmd) {uint8_t temp;int i =0 ;
@@ -227,7 +227,7 @@ int ahc_write_seeprom(struct seeprom_descriptor *sd, uint16_t *buf, u_int start_addr, u_int count) { - struct seeprom_cmd *ewen, *ewds; + const struct seeprom_cmd *ewen, *ewds;uint16_t v;uint8_t temp;int i, k;
drivers/scsi/aic7xxx/aic7xxx_core.c +7 -7
@@ -73,7 +73,7 @@ static const u_int num_chip_names = ARRA* Hardware error codes. */ struct ahc_hard_error_entry { -uint8_t errno; +uint8_t errno;const char *errmesg; };
@@ -221,7 +221,7 @@ static void ahc_dumpseq(struct ahc_soft#endif static int ahc_loadseq (struct ahc_softc *ahc);static int ahc_check_patch (struct ahc_softc *ahc, -struct patch **start_patch, +const struct patch **start_patch,u_int start_instr,u_int *skip_addr);static void ahc_download_instr (struct ahc_softc *ahc,u_int instrptr,uint8_t *dconsts);
@@ -6849,7 +6849,7 @@ ahc_loadseq(struct ahc_softc *ahc)struct cs cs_table[num_critical_sections];u_int begin_set[num_critical_sections];u_int end_set[num_critical_sections]; -struct patch *cur_patch; +const struct patch *cur_patch;u_int cs_count;u_int cur_cs;u_int i;
@@ -6954,11 +6954,11 @@ ahc_loadseq(struct ahc_softc *ahc) }static int -ahc_check_patch (struct ahc_softc *ahc,struct patch **start_patch, +ahc_check_patch (struct ahc_softc *ahc,const struct patch **start_patch,u_int start_instr,u_int *skip_addr) { -struct patch *cur_patch; -struct patch *last_patch; +const struct patch *cur_patch; +const struct patch *last_patch;u_int num_patches; num_patches =ARRAY_SIZE (patches);
@@ -7017,7 +7017,7 @@ ahc_download_instr(struct ahc_softc *ahccase AIC_OP_JE :case AIC_OP_JZ : { -struct patch *cur_patch; +const struct patch *cur_patch;int address_offset;u_int address;u_int skip_addr;
drivers/scsi/aic7xxx/aic7xxx_osm.c +5 -7
@@ -511,13 +511,11 @@ ahc_linux_info(struct Scsi_Host *host) bp = &buffer[0 ]; ahc = *(struct ahc_softc **)host->hostdata;memset (bp,0 ,sizeof (buffer)); -strcpy (bp,"Adaptec AIC7XXX EISA/VLB/PCI SCSI HBA DRIVER, Rev " ); -strcat (bp,AIC7XXX_DRIVER_VERSION ); -strcat (bp,"\n" ); -strcat (bp," <" ); +strcpy (bp,"Adaptec AIC7XXX EISA/VLB/PCI SCSI HBA DRIVER, Rev " AIC7XXX_DRIVER_VERSION "\n" +" <" );strcat (bp, ahc->description); -strcat (bp,">\n" ); -strcat (bp," " ); +strcat (bp,">\n" +" " );ahc_controller_info (ahc, ahc_info);strcat (bp, ahc_info);strcat (bp,"\n" );
@@ -1033,7 +1031,7 @@ aic7xxx_setup(char *s)char *p;char *end; -static struct { +static const struct {const char *name;uint32_t *flag; } options[] = {
drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +2 -2
@@ -55,7 +55,7 @@ static void ahc_linux_pci_dev_remove(str*/ #define ID (x) ID_C(x, PCI_CLASS_STORAGE_SCSI) -static struct pci_device_id ahc_linux_pci_id_table[] = { +static const struct pci_device_id ahc_linux_pci_id_table[] = {/* aic7850 based controllers */ ID (ID_AHA_2902_04_10_15_20C_30C ),/* aic7860 based controllers */
@@ -231,7 +231,7 @@ ahc_linux_pci_dev_probe(struct pci_dev *const uint64_t mask_39bit =0x7FFFFFFFFFULL ;struct ahc_softc *ahc;ahc_dev_softc_t pci; -struct ahc_pci_identity *entry; +const struct ahc_pci_identity *entry;char *name;int error;struct device *dev = &pdev->dev;
drivers/scsi/aic7xxx/aic7xxx_pci.c +4 -5
@@ -168,8 +168,7 @@ static ahc_device_setup_t ahc_aha394XX_sstatic ahc_device_setup_t ahc_aha494XX_setup;static ahc_device_setup_t ahc_aha398XX_setup; -static struct ahc_pci_identity ahc_pci_ident_table [] = -{ +static const struct ahc_pci_identity ahc_pci_ident_table[] = {/* aic7850 based controllers */ {ID_AHA_2902_04_10_15_20C_30C ,
@@ -670,7 +669,7 @@ ahc_9005_subdevinfo_valid(uint16_t devicreturn (result); } -struct ahc_pci_identity * +const struct ahc_pci_identity *ahc_find_pci_device (ahc_dev_softc_t pci) {uint64_t full_id;
@@ -678,7 +677,7 @@ ahc_find_pci_device(ahc_dev_softc_t pci)uint16_t vendor;uint16_t subdevice;uint16_t subvendor; -struct ahc_pci_identity *entry; +const struct ahc_pci_identity *entry;u_int i; vendor =ahc_pci_read_config (pci,PCIR_DEVVENDOR ,/*bytes*/ 2 );
@@ -712,7 +711,7 @@ ahc_find_pci_device(ahc_dev_softc_t pci) }int -ahc_pci_config (struct ahc_softc *ahc,struct ahc_pci_identity *entry) +ahc_pci_config (struct ahc_softc *ahc,const struct ahc_pci_identity *entry) {u_int command;u_int our_id;
drivers/scsi/aic7xxx/aic7xxx_proc.c +1 -1
@@ -58,7 +58,7 @@ static int ahc_proc_write_seeprom(struct* Table of syncrates that don't follow the "divisible by 4" * rule. This table will be expanded in future SCSI specs. */ -static struct { +static const struct {u_int period_factor;u_int period;/* in 100ths of ns */ } scsi_syncrates[] = {
drivers/scsi/aic7xxx/aic7xxx_seq.h_shipped +2 -2
@@ -1081,7 +1081,7 @@ ahc_patch0_func(struct ahc_softc *ahc) return (0); } -static struct patch { +static const struct patch { ahc_patch_func_t *patch_func; uint32_t begin :10, skip_instr :10,
@@ -1291,7 +1291,7 @@ static struct patch { { ahc_patch4_func, 865, 12, 1 } }; -static struct cs { +static const struct cs { uint16_t begin; uint16_t end; } critical_sections[] = {
drivers/scsi/aic7xxx/aicasm/aicasm.c +2 -2
@@ -415,7 +415,7 @@ output_code() }fprintf (ofile, -"static struct patch {\n" +"static const struct patch {\n" " %spatch_func_t *patch_func;\n" " uint32_t begin :10,\n" " skip_instr :10,\n"
@@ -435,7 +435,7 @@ output_code()fprintf (ofile,"\n};\n\n" );fprintf (ofile, -"static struct cs {\n" +"static const struct cs {\n" " uint16_t begin;\n" " uint16_t end;\n" "} critical_sections[] = {\n" );
Quoted 1 line · Denys Vlasenko
Hi,
Hi,
Quoted 2 lines
Compile tested and applies cleanly to 2.6.23.
I don't have this hardware anymore and cannot run test these patches.
I can test these patches on an aic7892 controller later on today if you want.
BTW while you seems to care about this driver could you have a look at :
http://bugzilla.kernel.org/show_bug.cgi?id=3062 ?!?
Regards,
Gabriel C
Quoted 4 lines · Gabriel C
Quoted 2 lines
Compile tested and applies cleanly to 2.6.23.
I don't have this hardware anymore and cannot run test these patches.I can test these patches on an aic7892 controller later on today if you want.
I'd appreciate that.
Do you, by any chance, use aic94xx driver too (drivers/scsi/aic94xx/*)? After i'm done with aic7xxx, I may attack this one.
Quoted 3 lines
BTW while you seems to care about this driver could you have a look at :
I am a desktop Linux user, so far I don't use suspend at all. Sorry. --
vda
Quoted 4 lines
Quoted 2 lines
Compile tested and applies cleanly to 2.6.23.
I don't have this hardware anymore and cannot run test these patches.I can test these patches on an aic7892 controller later on today if you want.
Works fine for me tested on :
03:0e.0 SCSI storage controller [0100]: Adaptec AIC-7892P U160/m [9005:008f] (rev 02)
Gabriel
Quoted 9 lines · Denys Vlasenko
Quoted 3 lines · Gabriel C
Quoted 2 lines
Compile tested and applies cleanly to 2.6.23.
I don't have this hardware anymore and cannot run test these patches.I can test these patches on an aic7892 controller later on today if you want.
I'd appreciate that.
Do you, by any chance, use aic94xx driver too (
drivers/scsi/aic94xx/*)? After i'm done with aic7xxx, I may attack this one.
Sorry I don't have any box uses this one , but I'll ask some friends maybe someone has :)
Quoted 6 lines
Quoted 4 lines
BTW while you seems to care about this driver could you have a look at :
I am a desktop Linux user, so far I don't use suspend at all. Sorry.
Ok , no problem maybe one 'day' the SCSI folks cares ( where the 'day' may be never ), I dunno :(
Quoted 3 lines
--
vda
Gabriel
Hi Andrew, James,
Quoted 8 lines · Gabriel C
Quoted 4 lines
Quoted 2 lines
Compile tested and applies cleanly to 2.6.23.
I don't have this hardware anymore and cannot run test these patches.I can test these patches on an aic7892 controller later on today if you want.
Works fine for me tested on :
03:0e.0 SCSI storage controller [0100]: Adaptec AIC-7892P U160/m [9005:008f] (rev 02)
I hope this is enough for these patches to be accepted.
If it is not, please let me know what do I need to do more. --
vda
Quoted 6 lines · Denys Vlasenko
Hi,
Following patches debloat
drivers/scsi/aic7xxx/*.
I also had to add prototypes forahc_lookup_scb
andahd_lookup_scbto .h files.
Sorry for the late replay, but.. working fine on
annwn:~# lspci | grep Adap 03:02.0 SCSI storage controller: Adaptec ASC-29320 U320 (rev 03) 03:02.1 SCSI storage controller: Adaptec ASC-29320 U320 (rev 03) annwn:~# lsscsi -H [1] aic79xx [2] aic79xx
with
annwn:~# lsscsi [2:0:0:0] disk SEAGATE ST336807LW 0C01 /dev/sdb [2:0:1:0] disk SEAGATE ST336807LW 0C01 /dev/sdc [2:0:2:0] disk SEAGATE ST336807LW 0C01 /dev/sdd [2:0:3:0] disk SEAGATE ST336807LW 0C01 /dev/sde
and giving up to 200Mb/s on a pretty old mobo (see cached reads) with raid5:
annwn:~# hdparm -tT /dev/sd[bcde]
/dev/sdb:
Timing cached reads: 950 MB in 2.00 seconds = 474.23 MB/sec
Timing buffered disk reads: 228 MB in 3.00 seconds = 75.93 MB/sec
/dev/sdc:
Timing cached reads: 1020 MB in 2.00 seconds = 510.01 MB/sec
Timing buffered disk reads: 228 MB in 3.01 seconds = 75.76 MB/sec
/dev/sdd:
Timing cached reads: 1022 MB in 2.00 seconds = 510.69 MB/sec
Timing buffered disk reads: 228 MB in 3.01 seconds = 75.79 MB/sec
/dev/sde:
Timing cached reads: 1016 MB in 2.00 seconds = 507.92 MB/sec
Timing buffered disk reads: 228 MB in 3.02 seconds = 75.48 MB/sec
annwn:~# hdparm -tT /dev/md0
/dev/md0:
Timing cached reads: 1020 MB in 2.00 seconds = 509.96 MB/sec
Timing buffered disk reads: 602 MB in 3.01 seconds = 199.84 MB/sec
--
J.A. Magallon <jamagallon()ono!com> \ Software is like sex:
\ It's better when it's free
Mandriva Linux release 2008.1 (Cooker) for i586
Linux 2.6.23-jam01 (gcc 4.2.2 20070909 (4.2.2-0.RC.1mdv2008.0)) SMP PREEMPT 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
Quoted 2 lines · Denys Vlasenko
Deinlines and moves big functions from .h to .c files. Adds prototypes for
ahc_lookup_scbandahd_lookup_scbto .h files.
Adds trailing whitespace.
.dotest/patch:216: * We also set the full residual flag which the
Adds trailing whitespace.
.dotest/patch:2383:{
warning: 2 lines add trailing whitespaces.
Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."
Quoted 1 line · Denys Vlasenko
Adds more consts
error: patch failed: drivers/scsi/aic7xxx/aic79xx.h:1328
error: drivers/scsi/aic7xxx/aic79xx.h: patch does not apply
error: patch failed: drivers/scsi/aic7xxx/aic7xxx.h:1145
error: drivers/scsi/aic7xxx/aic7xxx.h: patch does not apply
Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."
Quoted 7 lines · On Thu, 1 Nov 2007 16:16:04 -0600 Matthew Wilcox wrote:
Quoted 1 line · Denys Vlasenko
Adds more consts
error: patch failed:
drivers/scsi/aic7xxx/aic79xx.h:1328
error:drivers/scsi/aic7xxx/aic79xx.h: patch does not apply
error: patch failed:drivers/scsi/aic7xxx/aic7xxx.h:1145
error:drivers/scsi/aic7xxx/aic7xxx.h: patch does not apply
when attempting to apply to scsi-misc or linus-git or ... ?
Thanks,
---
~Randy
Quoted 1 line · Randy Dunlap
when attempting to apply to scsi-misc or linus-git or ... ?
scsi-misc
Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."
Quoted 9 lines · Matthew Wilcox
Quoted 2 lines · Denys Vlasenko
Deinlines and moves big functions from .h to .c files. Adds prototypes for
ahc_lookup_scbandahd_lookup_scbto .h files.Adds trailing whitespace.
.dotest/patch:216: * We also set the full residual flag which the
Adds trailing whitespace.
.dotest/patch:2383:{
warning: 2 lines add trailing whitespaces.
This is caused by the fact that blocks of code which I moved around verbatim already contained trailing whitespace.
Here are these three patched with these problems fixe, and rediffed against current scsi-misc-2.6 git tree.
Compressing them in order to not spam linux-scsi with big mails. Sorry. Do I need to send them separately instead?
Signature · 1 line
vda