Deleted Added
full compact
fwohci.c (111956) fwohci.c (112523)
1/*
2 * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 *
1/*
2 * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 *
33 * $FreeBSD: head/sys/dev/firewire/fwohci.c 111956 2003-03-07 02:51:59Z simokawa $
33 * $FreeBSD: head/sys/dev/firewire/fwohci.c 112523 2003-03-24 04:06:21Z simokawa $
34 *
35 */
36
37#define ATRQ_CH 0
38#define ATRS_CH 1
39#define ARRQ_CH 2
40#define ARRS_CH 3
41#define ITX_CH 4

--- 122 unchanged lines hidden (view full) ---

164 */
165#define DMA_PROG_ALLOC (8 * PAGE_SIZE)
166
167/* #define NDB 1024 */
168#define NDB FWMAXQUEUE
169#define NDVDB (DVBUF * NDB)
170
171#define OHCI_VERSION 0x00
34 *
35 */
36
37#define ATRQ_CH 0
38#define ATRS_CH 1
39#define ARRQ_CH 2
40#define ARRS_CH 3
41#define ITX_CH 4

--- 122 unchanged lines hidden (view full) ---

164 */
165#define DMA_PROG_ALLOC (8 * PAGE_SIZE)
166
167/* #define NDB 1024 */
168#define NDB FWMAXQUEUE
169#define NDVDB (DVBUF * NDB)
170
171#define OHCI_VERSION 0x00
172#define OHCI_ATRETRY 0x08
172#define OHCI_CROMHDR 0x18
173#define OHCI_BUS_OPT 0x20
174#define OHCI_BUSIRMC (1 << 31)
175#define OHCI_BUSCMC (1 << 30)
176#define OHCI_BUSISC (1 << 29)
177#define OHCI_BUSBMC (1 << 28)
178#define OHCI_BUSPMC (1 << 27)
179#define OHCI_BUSFNC OHCI_BUSIRMC | OHCI_BUSCMC | OHCI_BUSISC |\

--- 625 unchanged lines hidden (view full) ---

805 ohcifp = (volatile struct fwohci_txpkthdr *) db_tr->db[1].db.immed;
806 info = &tinfo[tcode];
807 hdr_len = hdr_off = info->hdr_len;
808 /* fw_asyreq must pass valid send.len */
809 len = xfer->send.len;
810 for( i = 0 ; i < hdr_off ; i+= 4){
811 ohcifp->mode.ld[i/4] = ntohl(fp->mode.ld[i/4]);
812 }
173#define OHCI_CROMHDR 0x18
174#define OHCI_BUS_OPT 0x20
175#define OHCI_BUSIRMC (1 << 31)
176#define OHCI_BUSCMC (1 << 30)
177#define OHCI_BUSISC (1 << 29)
178#define OHCI_BUSBMC (1 << 28)
179#define OHCI_BUSPMC (1 << 27)
180#define OHCI_BUSFNC OHCI_BUSIRMC | OHCI_BUSCMC | OHCI_BUSISC |\

--- 625 unchanged lines hidden (view full) ---

806 ohcifp = (volatile struct fwohci_txpkthdr *) db_tr->db[1].db.immed;
807 info = &tinfo[tcode];
808 hdr_len = hdr_off = info->hdr_len;
809 /* fw_asyreq must pass valid send.len */
810 len = xfer->send.len;
811 for( i = 0 ; i < hdr_off ; i+= 4){
812 ohcifp->mode.ld[i/4] = ntohl(fp->mode.ld[i/4]);
813 }
814 /* XXX payload must be network byte order */
815 if (tcode == FWTCODE_WREQQ || tcode == FWTCODE_RRESQ) {
816 ohcifp->mode.ld[3] = htonl(ohcifp->mode.ld[3]);
817 }
813 ohcifp->mode.common.spd = xfer->spd;
814 if (tcode == FWTCODE_STREAM ){
815 hdr_len = 8;
816 ohcifp->mode.stream.len = ntohs(fp->mode.stream.len);
817 } else if (tcode == FWTCODE_PHY) {
818 hdr_len = 12;
819 ohcifp->mode.ld[1] = ntohl(fp->mode.ld[1]);
820 ohcifp->mode.ld[2] = ntohl(fp->mode.ld[2]);

--- 1056 unchanged lines hidden (view full) ---

1877 /* Enable bus reset interrupt */
1878 OWRITE(sc, FWOHCI_INTMASK, OHCI_INT_PHY_BUS_R);
1879 /* Allow async. request to us */
1880 OWRITE(sc, OHCI_AREQHI, 1 << 31);
1881 /* XXX insecure ?? */
1882 OWRITE(sc, OHCI_PREQHI, 0x7fffffff);
1883 OWRITE(sc, OHCI_PREQLO, 0xffffffff);
1884 OWRITE(sc, OHCI_PREQUPPER, 0x10000);
818 ohcifp->mode.common.spd = xfer->spd;
819 if (tcode == FWTCODE_STREAM ){
820 hdr_len = 8;
821 ohcifp->mode.stream.len = ntohs(fp->mode.stream.len);
822 } else if (tcode == FWTCODE_PHY) {
823 hdr_len = 12;
824 ohcifp->mode.ld[1] = ntohl(fp->mode.ld[1]);
825 ohcifp->mode.ld[2] = ntohl(fp->mode.ld[2]);

--- 1056 unchanged lines hidden (view full) ---

1882 /* Enable bus reset interrupt */
1883 OWRITE(sc, FWOHCI_INTMASK, OHCI_INT_PHY_BUS_R);
1884 /* Allow async. request to us */
1885 OWRITE(sc, OHCI_AREQHI, 1 << 31);
1886 /* XXX insecure ?? */
1887 OWRITE(sc, OHCI_PREQHI, 0x7fffffff);
1888 OWRITE(sc, OHCI_PREQLO, 0xffffffff);
1889 OWRITE(sc, OHCI_PREQUPPER, 0x10000);
1890 /* Set ATRetries register */
1891 OWRITE(sc, OHCI_ATRETRY, 1<<(13+16) | 0xfff);
1885/*
1886** Checking whether the node is root or not. If root, turn on
1887** cycle master.
1888*/
1889 device_printf(fc->dev, "node_id = 0x%08x, ", OREAD(sc, FWOHCI_NODEID));
1890 if(!(OREAD(sc, FWOHCI_NODEID) & OHCI_NODE_VALID)){
1891 printf("Bus reset failure\n");
1892 goto sidout;

--- 897 unchanged lines hidden (view full) ---

2790 if( buf != NULL){
2791/* DMA result-code will be written at the tail of packet */
2792 stat = ((struct fwohci_trailer *)(ld - sizeof(struct fwohci_trailer)))->stat;
2793 spd = (stat >> 5) & 0x3;
2794 stat &= 0x1f;
2795 switch(stat){
2796 case FWOHCIEV_ACKPEND:
2797#if 0
1892/*
1893** Checking whether the node is root or not. If root, turn on
1894** cycle master.
1895*/
1896 device_printf(fc->dev, "node_id = 0x%08x, ", OREAD(sc, FWOHCI_NODEID));
1897 if(!(OREAD(sc, FWOHCI_NODEID) & OHCI_NODE_VALID)){
1898 printf("Bus reset failure\n");
1899 goto sidout;

--- 897 unchanged lines hidden (view full) ---

2797 if( buf != NULL){
2798/* DMA result-code will be written at the tail of packet */
2799 stat = ((struct fwohci_trailer *)(ld - sizeof(struct fwohci_trailer)))->stat;
2800 spd = (stat >> 5) & 0x3;
2801 stat &= 0x1f;
2802 switch(stat){
2803 case FWOHCIEV_ACKPEND:
2804#if 0
2798 printf("fwohci_arcv: ack pending..\n");
2805 printf("fwohci_arcv: ack pending tcode=0x%x..\n", fp->mode.common.tcode);
2799#endif
2800 /* fall through */
2801 case FWOHCIEV_ACKCOMPL:
2802 if( poff != 0 )
2803 bcopy(buf+poff, buf, plen - 4);
2804 fw_rcv(&sc->fc, buf, plen - sizeof(struct fwohci_trailer), 0, 0, spd);
2805 break;
2806 case FWOHCIEV_BUSRST:

--- 36 unchanged lines hidden ---
2806#endif
2807 /* fall through */
2808 case FWOHCIEV_ACKCOMPL:
2809 if( poff != 0 )
2810 bcopy(buf+poff, buf, plen - 4);
2811 fw_rcv(&sc->fc, buf, plen - sizeof(struct fwohci_trailer), 0, 0, spd);
2812 break;
2813 case FWOHCIEV_BUSRST:

--- 36 unchanged lines hidden ---