2 * +++ THIS DRIVER IS ORPHANED AND UNSUPPORTED +++
4 * aic5800.c - Adaptec AIC-5800 PCI-IEEE1394 chip driver
5 * Copyright (C)1999 Emanuel Pirker <epirker@edu.uni-klu.ac.at>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include <linux/kernel.h>
23 #include <linux/slab.h>
24 #include <linux/interrupt.h>
25 #include <linux/wait.h>
26 #include <linux/errno.h>
27 #include <linux/module.h>
28 #include <linux/pci.h>
30 #include <linux/poll.h>
31 #include <linux/delay.h>
32 #include <asm/byteorder.h>
33 #include <asm/atomic.h>
35 #include <asm/uaccess.h>
37 #include "ieee1394_types.h"
39 #include "ieee1394_core.h"
45 /// print general (card independent) information
46 #define PRINT_G(level, fmt, args...) printk(level "aic5800: " fmt "\n" , ## args)
47 /// print card specific information
48 #define PRINT(level, card, fmt, args...) printk(level "aic5800-%d: " fmt "\n" , card , ## args)
51 static struct aic5800 cards
[MAX_AIC5800_CARDS
];
52 /// holds the number of installed aic5800 cards
53 static int num_of_cards
= 0;
55 static int add_card(struct pci_dev
*dev
);
56 static void remove_card(struct aic5800
*aic
);
57 static int init_driver(void);
60 /*****************************************************************
61 * Auxiliary functions needed to read the EEPROM
63 *****************************************************************/
71 #define CLOCK_PULSE() {\
73 while(cnt-->0 && reg_read(aic, misc_SEEPCTL) & SEEPBUSY);\
74 if (reg_read(aic, misc_SEEPCTL) & SEEPBUSY) printk("BUSY ");\
77 static inline unsigned short read_seeprom_word(struct aic5800
*aic
,
82 unsigned char read_cmd
[3] = {1,1,0};
85 // send chip select for one clock cycle.
86 reg_write(aic
, misc_SEEPCTL
, SEEPSK
|SEEPCS
);
89 // write start bit (1) & READ op-code (10b)
90 for (i
=0; i
<sizeof(read_cmd
); i
++) {
91 temp
= SEEPCS
| SEEPCYC
| read_cmd
[i
];
92 reg_write(aic
, misc_SEEPCTL
, temp
);
95 reg_write(aic
, misc_SEEPCTL
, temp
);
98 // write 8 bit address (MSB --> LSB)
99 for (i
=7; i
>=0; i
--) {
101 temp
= (temp
>> i
) & 1;
102 temp
= SEEPCS
| SEEPCYC
| temp
;
103 reg_write(aic
, misc_SEEPCTL
, temp
);
105 temp
= temp
^ SEEPSK
;
106 reg_write(aic
, misc_SEEPCTL
, temp
);
109 // read 16 bit (MSB --> LSB)
111 for (i
=0; i
<=16; i
++) {
112 temp
= SEEPCS
| SEEPCYC
;
113 reg_write(aic
, misc_SEEPCTL
, temp
);
115 temp
= temp
^ SEEPSK
;
116 rd
= (rd
<< 1) | (unsigned short)((reg_read(aic
, misc_SEEPCTL
)
118 reg_write(aic
, misc_SEEPCTL
, temp
);
122 // reset chip select for the next command cycle
123 reg_write(aic
, misc_SEEPCTL
, SEEPCYC
);
125 reg_write(aic
, misc_SEEPCTL
, SEEPCYC
| SEEPSK
);
127 reg_write(aic
, misc_SEEPCTL
, SEEPCYC
);
130 reg_write(aic
, misc_SEEPCTL
, 0);
138 /** Read 64-bit GUID (Global Unique ID) from SEEPROM
140 * It works well on AHA-8945.
141 * On AHA-8920 it works well only on first time, It returns ffff... on
143 *****************************************************************/
144 static unsigned long long read_guid(struct aic5800
*aic
)
147 unsigned long long guid
;
151 printk("SEEPCTL value = 0x%x\n", reg_read(aic
, misc_SEEPCTL
));
156 for (i
=0x10; i
<0x14; i
++)
157 guid
= (guid
<< 16) | read_seeprom_word(aic
,i
);
161 printk("%x ", (unsigned int) read_seeprom_word(aic
,i
));
164 printk("%x ", (unsigned int)(guid
>>(16*i
))&0xffff);
166 printk("\nSEEPCTL value = 0x%x\n", reg_read(aic
, misc_SEEPCTL
));
173 static int aic_detect(struct hpsb_host_template
*tmpl
)
175 struct hpsb_host
*host
;
180 for (i
= 0; i
< num_of_cards
; i
++) {
181 host
= hpsb_get_host(tmpl
, 0);
183 /* simply don't init more after out of mem */
186 host
->hostdata
= &cards
[i
];
187 cards
[i
].host
= host
;
193 static int aic_devctl(struct hpsb_host
*host
, enum devctl_cmd cmd
, int arg
)
195 struct aic5800
*aic
= host
->hostdata
;
198 struct hpsb_packet
*packet
, *lastpacket
;
202 reg_write(aic
, misc_PhyControl
, 0x00004140 );
205 case GET_CYCLE_COUNTER
:
206 arg
= reg_read(aic
, misc_CycleTimer
);
209 case SET_CYCLE_COUNTER
:
210 reg_write(aic
, misc_CycleTimer
, arg
);
214 reg_clear_bits(aic
, misc_NodeID
, 0xFFC0);
215 reg_set_bits(aic
, misc_NodeID
, (arg
<<6));
218 case ACT_CYCLE_MASTER
:
220 /* enable cycleMaster */
221 reg_set_bits(aic
, misc_Control
, 0x20000);
223 /* disable cycleMaster */
224 reg_clear_bits(aic
, misc_Control
, 0x20000);
228 case CANCEL_REQUESTS
:
229 spin_lock_irqsave(&aic
->async_queue_lock
, flags
);
230 /* stop any chip activity */
231 reg_write( aic
, AT_ChannelControl
, 0x80000000);
232 packet
= aic
->async_queue
;
233 aic
->async_queue
= NULL
;
234 spin_unlock_irqrestore(&aic
->async_queue_lock
, flags
);
236 while (packet
!= NULL
) {
238 packet
= packet
->xnext
;
239 hpsb_packet_sent(host
, lastpacket
, ACKX_ABORTED
);
254 PRINT(KERN_INFO
, aic
->id
, AIC5800_DRIVER_NAME
);
255 PRINT(KERN_INFO
, aic
->id
, " Register MMIO base: 0x%p\n",
257 PRINT(KERN_INFO
, aic
->id
, " NodeID: 0x%x\n",
258 reg_read(aic
, misc_NodeID
) );
259 PRINT(KERN_INFO
,aic
->id
, " #Intr: %lu BusResets: %lu\n",
260 aic
->NumInterrupts
, aic
->NumBusResets
);
261 PRINT(KERN_INFO
, aic
->id
, " TxPackets: %lu RxPackets: %lu\n",
262 aic
->TxPackets
, aic
->RxPackets
);
263 PRINT(KERN_INFO
,aic
->id
, " TxRdy: %lu ATErr: %lu HdrErr: %lu TcodeErr: %lu SendRej: %lu\n",
264 aic
->TxRdy
, aic
->ATError
, aic
->HdrErr
,
265 aic
->TCodeErr
, aic
->SendRej
);
270 PRINT(KERN_ERR
, aic
->id
, "unknown devctl command %d", cmd
);
278 /** Initialize the host adapter chip and corresponding data
279 structures. We reset the chip, enable transmitter, receiver,
280 the physical DMA units, cycle timer, cycle source, reception
281 of selfid packets and initialize several other registers. */
282 static int aic_initialize(struct hpsb_host
*host
)
285 struct aic5800
*aic
= host
->hostdata
;
287 /* Reset data structures */
288 aic
->async_queue
= NULL
;
289 spin_lock_init(&aic
->async_queue_lock
);
292 reg_write( aic
, misc_Reset
, 0x37);
294 reg_write( aic
, misc_Reset
, 0);
296 /* Enable Transmitter/Receiver, enable physDMA,
297 * enable CycleTimer, cycleSource */
298 reg_write( aic
, misc_Control
, 0x82050003);
300 /* Enable reception of SelfID packets */
301 reg_set_bits(aic
, misc_PacketControl
, 0x20);
303 reg_write(aic
, AT_InterruptSelect
, 0x00F0001);
304 reg_write(aic
, AT_BranchSelect
, 0x0100010);
305 reg_write(aic
, AT_WaitSelect
, 0x00F0001);
306 reg_write(aic
, misc_ATRetries
, reg_read(aic
, misc_ATRetries
) | 0x7);
308 /* initialize AR DMA */
311 reg_write( aic
, AR_ChannelControl
, 0x80000000);
313 /* here we should have 0 iterations because of the code
314 in the DmaAR handler. However, to be sure we do it */
316 while (reg_read(aic
, AR_ChannelStatus
) & 0x400) {
319 PRINT(KERN_ERR
, aic
->id
,
320 "Huh! Can't set AR_ChannelControl... card can not receive!");
325 (aic
->AR_program
)->control
= ( DMA_CMD_INPUTLAST
| DMA_KEY_STREAM0
326 | DMA_INTR_ALWAYS
| DMA_BRANCH_ALWAYS
)
327 + AIC5800_ARFIFO_SIZE
;
328 (aic
->AR_program
)->address
= virt_to_bus(aic
->rcv_page
);
329 (aic
->AR_program
)->branchAddress
= virt_to_bus(aic
->AR_program
);
330 (aic
->AR_program
)->status
= AIC5800_ARFIFO_SIZE
;
332 (aic
->AR_program
+1)->control
= DMA_CMD_STOP
;
333 (aic
->AR_program
+1)->address
= 0;
334 (aic
->AR_program
+1)->branchAddress
= 0;
335 (aic
->AR_program
+1)->status
= 0;
337 reg_write( aic
, AR_CommandPtr
, (u32
) virt_to_bus(aic
->AR_program
));
338 reg_write( aic
, AR_ChannelControl
, 0x80008000);
340 /* Enable Interrupts */
341 reg_write(aic
, misc_InterruptClear
, 0xFFFFFFFF);
342 reg_write(aic
, misc_InterruptMask
, 0xFFFFFFFF);
343 /*reg_write(aic, misc_InterruptMask, 0x00F1F03F);*/
348 static void aic_release(struct hpsb_host
*host
)
353 aic
= host
->hostdata
;
358 /* This must be called with the async_queue_lock held. */
359 static void send_next_async(struct aic5800
*aic
)
362 struct hpsb_packet
*packet
= aic
->async_queue
;
364 /* stop the channel program if it's still running */
365 reg_write( aic
, AT_ChannelControl
, 0x80000000);
367 /* re-format packet header for AIC-5800 chip */
368 packet
->header
[1] = (packet
->header
[1] & 0xFFFF) |
369 (packet
->header
[0] & 0xFFFF0000);
370 packet
->header
[0] = (packet
->header
[0] & 0xFFFF);
373 /* Packet must be byte-swapped in non-big-endian environments,
374 * see AIC-5800 specification...
377 for ( i
= 0 ; i
< packet
->header_size
/sizeof(u32
) ; i
++ )
378 packet
->header
[i
] = cpu_to_be32( packet
->header
[i
] );
379 for ( i
= 0 ; i
< packet
->data_size
/sizeof(u32
) ; i
++ )
380 packet
->data
[i
] = cpu_to_be32( packet
->data
[i
] );
385 /* typically we use only a few iterations here */
387 while (reg_read(aic
, AT_ChannelStatus
) & 0x400) {
390 PRINT(KERN_ERR
, aic
->id
,
391 "runaway loop 1 in send_next_async() - bailing out...");
396 /* set data buffer address and packet length */
397 memset(aic
->AT_program
, 0, MAX_AT_PROGRAM_SIZE
* sizeof(struct dma_cmd
));
399 if (packet
->data_size
) {
400 aic
->AT_program
[0].control
= ( DMA_CMD_OUTPUTMORE
| DMA_KEY_STREAM0
) +
401 packet
-> header_size
;
402 aic
->AT_program
[0].address
= virt_to_bus( packet
->header
);
403 aic
->AT_program
[1].control
= ( DMA_CMD_OUTPUTLAST
| DMA_KEY_STREAM0
405 + packet
-> data_size
;
406 aic
->AT_program
[1].address
= virt_to_bus( packet
->data
);
408 aic
->AT_program
[2].control
= DMA_CMD_STOP
;
411 aic
->AT_program
[0].control
= ( DMA_CMD_OUTPUTLAST
| DMA_INTR_ALWAYS
|
413 packet
-> header_size
;
414 aic
->AT_program
[0].address
= virt_to_bus( packet
->header
);
416 aic
->AT_program
[1].control
= DMA_CMD_STOP
;
419 /* set program start address */
420 reg_write(aic
, AT_CommandPtr
, (unsigned int) virt_to_bus(aic
->AT_program
));
422 /* typically we use only a few iterations here */
424 while (reg_read(aic
, AT_CommandPtr
) != (unsigned int)
425 virt_to_bus(aic
->AT_program
)) {
428 PRINT(KERN_ERR
, aic
->id
,
429 "runaway loop 2 in send_next_async() - bailing out...");
435 reg_write( aic
, AT_ChannelControl
, 0x80008000);
439 static int aic_transmit(struct hpsb_host
*host
, struct hpsb_packet
*packet
)
441 struct aic5800
*aic
= host
->hostdata
;
442 struct hpsb_packet
*p
;
445 if (packet
->data_size
>= 4096) {
446 PRINT(KERN_ERR
, aic
->id
, "transmit packet data too big (%d)",
451 packet
->xnext
= NULL
;
453 spin_lock_irqsave(&aic
->async_queue_lock
, flags
);
455 if (aic
->async_queue
== NULL
) {
456 aic
->async_queue
= packet
;
457 send_next_async(aic
);
459 p
= aic
->async_queue
;
460 while (p
->xnext
!= NULL
) {
467 spin_unlock_irqrestore(&aic
->async_queue_lock
, flags
);
472 static int get_phy_reg(struct aic5800
*aic
, int addr
)
479 PRINT(KERN_ERR
, aic
->id
, __FUNCTION__
480 ": PHY register address %d out of range", addr
);
484 /* request data from PHY */
485 reg_write(aic
, misc_PhyControl
, LINK_PHY_READ
| LINK_PHY_ADDR(addr
));
487 /* read data from PhyControl register */
488 /* note that we have to wait until the register is updated */
490 retval
= reg_read(aic
, misc_PhyControl
);
493 PRINT(KERN_ERR
, aic
->id
, __FUNCTION__
494 ": runaway loop, aborting");
499 } while ((retval
& 0xf000000) != LINK_PHY_RADDR(addr
));
501 /* we don't want a PhyInt interrupt */
502 reg_write(aic
, misc_InterruptClear
, INT_PhyInt
);
505 return ((retval
& 0xff0000)>>16);
511 static quadlet_t
generate_own_selfid(struct aic5800
*aic
, int phyid
)
517 for (i
= 1; i
< 7; i
++) {
518 phyreg
[i
] = get_phy_reg(aic
, i
);
521 /* Standard PHY register map */
522 lsid
= 0x80400000 | (phyid
<< 24);
523 lsid
|= (phyreg
[1] & 0x3f) << 16; /* gap count */
524 lsid
|= (phyreg
[2] & 0xc0) << 8; /* max speed */
525 lsid
|= (phyreg
[6] & 0x01) << 11; /* contender (phy dep) */
526 lsid
|= (phyreg
[6] & 0x10) >> 3; /* initiated reset */
528 for (i
= 0; i
< (phyreg
[2] & 0x1f); i
++) { /* ports */
529 if (phyreg
[3 + i
] & 0x4) {
530 lsid
|= (((phyreg
[3 + i
] & 0x8) | 0x10) >> 3)
533 lsid
|= 1 << (6 - i
*2);
540 /* moved out to make interrupt routine more readable */
541 inline static void handle_selfid(struct aic5800
*aic
, struct hpsb_host
*host
,
542 int phyid
, int isroot
, size_t size
)
544 quadlet_t
*q
= aic
->rcv_page
;
547 /* we need our own self-id packet */
548 lsid
= generate_own_selfid(aic
, phyid
);
550 /* unconnected state? only begin and end marker in rcv_page */
552 hpsb_selfid_received(host
, lsid
);
555 /* process buffer... AIC's FIFO often contains some strangenesses */
571 /* correct self-id */
573 if ((q
[0] & 0x3f800000) == ((phyid
+ 1) << 24)) {
574 /* its our turn now! */
576 // aic->id, "selfid packet 0x%x included", lsid);
578 hpsb_selfid_received(host
, lsid
);
581 //PRINT(KERN_INFO, aic->id, "selfid packet 0x%x rcvd", q[0]);
582 hpsb_selfid_received(host
, q
[0]);
589 /* if we are root, our self-id packet is last */
590 if (isroot
&& phyid
!= 0) {
591 hpsb_selfid_received(host
, lsid
);
594 hpsb_selfid_complete(host
, phyid
, isroot
);
597 static void aic_irq_handler(int irq
, void *dev_id
, struct pt_regs
*regs
)
599 struct aic5800
*aic
= (struct aic5800
*)dev_id
;
600 struct hpsb_host
*host
= aic
->host
;
601 quadlet_t
*q
= aic
->rcv_page
;
603 int phyid
= -1, isroot
= 0;
605 u32 interruptEvent
= reg_read(aic
, misc_InterruptEvents
);
606 reg_write(aic
, misc_InterruptClear
, interruptEvent
);
608 //printk("InterruptEvent 0x%x\n", interruptEvent);
609 if ( (interruptEvent
& 0x3f) == 0x3f ) {
610 PRINT(KERN_INFO
, aic
->id
, "Dma Engine Error");
613 if ( interruptEvent
& INT_DmaAT
) {
614 if (aic
->AT_program
[0].status
& 0xFFFF)
615 PRINT(KERN_INFO
, aic
->id
, "AT: could not transfer %d bytes",
616 aic
->AT_program
[0].status
& 0xFFFF);
619 if ( interruptEvent
& INT_PhyInt
) {
620 PRINT(KERN_INFO
, aic
->id
, "PhyInt");
623 if ( interruptEvent
& INT_DmaAR
) {
627 /* we calculate the number of received bytes from the
628 residual count field */
629 rcv_bytes
= AIC5800_ARFIFO_SIZE
- (aic
->AR_program
->status
& 0xFFFF);
631 //PRINT(KERN_INFO, aic->id, "AR_status 0x%x, %d bytes read", aic->AR_program->status, rcv_bytes);
633 if ((aic
->AR_program
->status
& 0x84000000)
634 && (aic
->AR_program
->status
& 0xFFFF) >= 8 ) {
637 /* we have to do byte-swapping on non-bigendian architectures */
638 for (i
=0; i
< (rcv_bytes
/ sizeof(quadlet_t
)); i
++) {
639 *q
= be32_to_cpu(*q
);
646 phyid
= reg_read(aic
, misc_NodeID
);
647 isroot
= phyid
& 0x800000;
648 phyid
= phyid
& 0x3F;
649 handle_selfid(aic
, host
, phyid
, isroot
, rcv_bytes
);
651 hpsb_packet_received(host
, aic
->rcv_page
, rcv_bytes
, 0);
654 PRINT(KERN_ERR
, aic
->id
,
655 "AR DMA program status value 0x%x is incorrect!",
656 aic
->AR_program
->status
);
659 if ( interruptEvent
& INT_BusReset
) {
660 PRINT(KERN_INFO
, aic
->id
, "bus reset occured");
661 if (!host
->in_bus_reset
) {
662 hpsb_bus_reset(host
);
664 reg_set_bits(aic
, misc_Control
, 0x1);
668 if (interruptEvent
& INT_RcvData
) {
672 if (interruptEvent
& INT_TxRdy
) {
673 /* async packet sent - transmitter ready */
675 struct hpsb_packet
*packet
;
677 if (aic
->async_queue
) {
679 spin_lock(&aic
->async_queue_lock
);
682 ack
= reg_read(aic
, AT_ChannelStatus
) & 0xF;
684 packet
= aic
->async_queue
;
685 aic
->async_queue
= packet
->xnext
;
687 if (aic
->async_queue
!= NULL
) {
688 send_next_async(aic
);
690 spin_unlock(&aic
->async_queue_lock
);
691 PRINT(KERN_INFO
,aic
->id
,"packet sent with ack code %d",ack
);
692 hpsb_packet_sent(host
, packet
, ack
);
694 //PRINT(KERN_INFO,aic->id,"packet sent without async_queue (self-id?)");
698 if (interruptEvent
& INT_ATError
) {
699 PRINT(KERN_INFO
,aic
->id
,"ATError");
702 if (interruptEvent
& INT_SendRej
) {
705 if (interruptEvent
& INT_HdrErr
) {
708 if (interruptEvent
& INT_TCodeErr
) {
709 PRINT(KERN_INFO
,aic
->id
,"TCodeErr");
713 aic
->NumInterrupts
++;
717 inline static void * quadquadalign(void *buf
)
719 if ((unsigned int) buf
% 0x10 != 0) {
720 return (void *)(((unsigned int)buf
+ 0x10) & 0xFFFFFFF0);
726 static int add_card(struct pci_dev
*dev
)
728 #define FAIL(fmt, args...) do {\
729 PRINT_G(KERN_ERR, fmt , ## args); \
732 return 1; } while (0)
734 struct aic5800
*aic
; /* shortcut to currently handled device */
737 if (pci_enable_device(dev
))
740 if (num_of_cards
== MAX_AIC5800_CARDS
) {
741 PRINT_G(KERN_WARNING
, "cannot handle more than %d cards. "
742 "Adjust MAX_AIC5800_CARDS in aic5800.h.",
747 aic
= &cards
[num_of_cards
++];
749 aic
->id
= num_of_cards
-1;
752 if (!request_irq(dev
->irq
, aic_irq_handler
, SA_SHIRQ
,
753 AIC5800_DRIVER_NAME
, aic
)) {
754 PRINT(KERN_INFO
, aic
->id
, "allocated interrupt %d", dev
->irq
);
756 FAIL("failed to allocate shared interrupt %d", dev
->irq
);
759 page
= get_free_page(GFP_KERNEL
);
761 aic
->rcv_page
= phys_to_virt(page
);
763 FAIL("failed to allocate receive buffer");
766 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13)
767 aic
->registers
= ioremap_nocache(dev
->base_address
[0],
768 AIC5800_REGSPACE_SIZE
);
770 aic
->registers
= ioremap_nocache(dev
->resource
[0].start
,
771 AIC5800_REGSPACE_SIZE
);
774 if (aic
->registers
== NULL
) {
775 FAIL("failed to remap registers - card not accessible");
778 PRINT(KERN_INFO
, aic
->id
, "remapped memory space reg 0x%p",
781 aic
->pbuf
= kmalloc(AIC5800_PBUF_SIZE
, GFP_KERNEL
);
784 FAIL("failed to allocate program buffer");
787 aic
->AT_program
= quadquadalign(aic
->pbuf
);
788 aic
->AT_program
[2].control
= DMA_CMD_STOP
;
790 aic
->AR_program
= aic
->AT_program
+ MAX_AT_PROGRAM_SIZE
*
791 sizeof(struct dma_cmd
);
797 static void remove_card(struct aic5800
*aic
)
799 /* Disable interrupts of this controller */
800 reg_write(aic
, misc_InterruptMask
, 0);
802 free_page(virt_to_phys(aic
->rcv_page
));
803 /* Free channel program buffer */
805 /* Free interrupt request */
806 free_irq(aic
->dev
->irq
, aic
);
807 /* Unmap register space */
808 iounmap(aic
->registers
);
811 static int init_driver()
813 struct pci_dev
*dev
= NULL
;
817 PRINT_G(KERN_DEBUG
, __PRETTY_FUNCTION__
" called again");
821 while ((dev
= pci_find_device(PCI_VENDOR_ID_ADAPTEC
,
822 PCI_DEVICE_ID_ADAPTEC_5800
, dev
))
824 if (add_card(dev
) == 0) {
830 PRINT_G(KERN_WARNING
, "no operable AIC-5800 based cards found");
837 /** Prepare our local CSR ROM. This is done by using the software-stored
838 ROM and inserting the GUID read from the EEPROM */
839 static size_t get_aic_rom(struct hpsb_host
*host
, const quadlet_t
**ptr
)
841 struct aic5800
*aic
= host
-> hostdata
;
844 /* Read the GUID from the card's EEPROM and put it into the right
845 place in the CONFIG ROM. */
846 guid
= read_guid(aic
);
847 aic5800_csr_rom
[15] = (u32
) (guid
>> 32);
848 aic5800_csr_rom
[16] = (u32
) (guid
& 0xFFFF);
850 *ptr
= aic5800_csr_rom
;
852 return sizeof(aic5800_csr_rom
);
855 struct hpsb_host_template
*get_aic_template(void)
857 static struct hpsb_host_template tmpl
;
858 static int initialized
= 0;
861 /* Initialize by field names so that a template structure
862 * reorganization does not influence this code. */
863 tmpl
.name
= "aic5800";
865 tmpl
.detect_hosts
= aic_detect
;
866 tmpl
.initialize_host
= aic_initialize
;
867 tmpl
.release_host
= aic_release
;
868 tmpl
.get_rom
= get_aic_rom
;
869 tmpl
.transmit_packet
= aic_transmit
;
870 tmpl
.devctl
= aic_devctl
;
880 /* EXPORT_NO_SYMBOLS; */
882 MODULE_AUTHOR("Emanuel Pirker <epirker@edu.uni-klu.ac.at>");
883 MODULE_DESCRIPTION("Adaptec AIC-5800 PCI-to-IEEE1394 controller driver");
884 MODULE_SUPPORTED_DEVICE("aic5800");
886 void cleanup_module(void)
888 hpsb_unregister_lowlevel(get_aic_template());
889 PRINT_G(KERN_INFO
, "removed " AIC5800_DRIVER_NAME
" module");
892 int init_module(void)
894 if (hpsb_register_lowlevel(get_aic_template())) {
895 PRINT_G(KERN_ERR
, "registering failed");