Deleted Added
full compact
sbp.c (108642) sbp.c (108712)
1/*
2 * Copyright (c) 1998,1999,2000,2001 Katsushi Kobayashi and Hidetosh 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,1999,2000,2001 Katsushi Kobayashi and Hidetosh 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/sbp.c 108642 2003-01-04 06:40:57Z simokawa $
33 * $FreeBSD: head/sys/dev/firewire/sbp.c 108712 2003-01-05 14:58:45Z simokawa $
34 *
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/module.h>
40#include <sys/bus.h>
41#include <sys/mbuf.h>

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

1348 && sbp_status->status == 0);
1349
1350SBP_DEBUG(0)
1351 if (!status_valid || debug > 1){
1352 int status;
1353
1354 sbp_show_sdev_info(sdev, 2);
1355 printf("ORB status src:%x resp:%x dead:%x"
34 *
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/module.h>
40#include <sys/bus.h>
41#include <sys/mbuf.h>

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

1348 && sbp_status->status == 0);
1349
1350SBP_DEBUG(0)
1351 if (!status_valid || debug > 1){
1352 int status;
1353
1354 sbp_show_sdev_info(sdev, 2);
1355 printf("ORB status src:%x resp:%x dead:%x"
1356#if __FreeBSD_version >= 500000
1356 " len:%x stat:%x orb:%x%08x\n",
1357 " len:%x stat:%x orb:%x%08x\n",
1358#else
1359 " len:%x stat:%x orb:%x%08lx\n",
1360#endif
1357 sbp_status->src, sbp_status->resp, sbp_status->dead,
1358 sbp_status->len, sbp_status->status,
1359 ntohs(sbp_status->orb_hi), ntohl(sbp_status->orb_lo));
1360 sbp_show_sdev_info(sdev, 2);
1361 status = sbp_status->status;
1362 switch(sbp_status->resp) {
1363 case 0:
1364 if (status > MAX_ORB_STATUS0)

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

2019 /* direct pointer */
2020 ocb->orb[3] = htonl(segments[0].ds_addr);
2021 ocb->orb[4] |= htonl(segments[0].ds_len);
2022 } else if(seg > 1) {
2023 /* page table */
2024SBP_DEBUG(1)
2025 printf("sbp_execute_ocb: seg %d", seg);
2026 for (i = 0; i < seg; i++)
1361 sbp_status->src, sbp_status->resp, sbp_status->dead,
1362 sbp_status->len, sbp_status->status,
1363 ntohs(sbp_status->orb_hi), ntohl(sbp_status->orb_lo));
1364 sbp_show_sdev_info(sdev, 2);
1365 status = sbp_status->status;
1366 switch(sbp_status->resp) {
1367 case 0:
1368 if (status > MAX_ORB_STATUS0)

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

2023 /* direct pointer */
2024 ocb->orb[3] = htonl(segments[0].ds_addr);
2025 ocb->orb[4] |= htonl(segments[0].ds_len);
2026 } else if(seg > 1) {
2027 /* page table */
2028SBP_DEBUG(1)
2029 printf("sbp_execute_ocb: seg %d", seg);
2030 for (i = 0; i < seg; i++)
2031#if __FreeBSD_version >= 500000
2027 printf(", %tx:%zd", segments[i].ds_addr,
2032 printf(", %tx:%zd", segments[i].ds_addr,
2033#else
2034 printf(", %x:%zd", segments[i].ds_addr,
2035#endif
2028 segments[i].ds_len);
2029 printf("\n");
2030END_DEBUG
2031 for (i = 0; i < seg; i++) {
2032 s = &segments[i];
2033#if 1 /* XXX LSI Logic "< 16 byte" bug might be hit */
2034 if (s->ds_len < 16)
2035 printf("sbp_execute_ocb: warning, "

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

2063 struct sbp_ocb *next;
2064 int s = splfw(), order = 0;
2065 int flags;
2066
2067 for (ocb = STAILQ_FIRST(&sdev->ocbs); ocb != NULL; ocb = next) {
2068 next = STAILQ_NEXT(ocb, ocb);
2069 flags = ocb->flags;
2070SBP_DEBUG(1)
2036 segments[i].ds_len);
2037 printf("\n");
2038END_DEBUG
2039 for (i = 0; i < seg; i++) {
2040 s = &segments[i];
2041#if 1 /* XXX LSI Logic "< 16 byte" bug might be hit */
2042 if (s->ds_len < 16)
2043 printf("sbp_execute_ocb: warning, "

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

2071 struct sbp_ocb *next;
2072 int s = splfw(), order = 0;
2073 int flags;
2074
2075 for (ocb = STAILQ_FIRST(&sdev->ocbs); ocb != NULL; ocb = next) {
2076 next = STAILQ_NEXT(ocb, ocb);
2077 flags = ocb->flags;
2078SBP_DEBUG(1)
2079#if __FreeBSD_version >= 500000
2071 printf("orb: 0x%tx next: 0x%x, flags %x\n",
2080 printf("orb: 0x%tx next: 0x%x, flags %x\n",
2081#else
2082 printf("orb: 0x%x next: 0x%lx, flags %x\n",
2083#endif
2072 vtophys(&ocb->orb[0]), ntohl(ocb->orb[1]), flags);
2073END_DEBUG
2074 if (vtophys(&ocb->orb[0]) == orb_lo) {
2075 /* found */
2076 if (ocb->flags & OCB_RESERVED)
2077 ocb->flags |= OCB_DONE;
2078 else
2079 STAILQ_REMOVE(&sdev->ocbs, ocb, sbp_ocb, ocb);

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

2109static struct sbp_ocb *
2110sbp_enqueue_ocb(struct sbp_dev *sdev, struct sbp_ocb *ocb)
2111{
2112 int s = splfw();
2113 struct sbp_ocb *prev;
2114
2115SBP_DEBUG(2)
2116 sbp_show_sdev_info(sdev, 2);
2084 vtophys(&ocb->orb[0]), ntohl(ocb->orb[1]), flags);
2085END_DEBUG
2086 if (vtophys(&ocb->orb[0]) == orb_lo) {
2087 /* found */
2088 if (ocb->flags & OCB_RESERVED)
2089 ocb->flags |= OCB_DONE;
2090 else
2091 STAILQ_REMOVE(&sdev->ocbs, ocb, sbp_ocb, ocb);

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

2121static struct sbp_ocb *
2122sbp_enqueue_ocb(struct sbp_dev *sdev, struct sbp_ocb *ocb)
2123{
2124 int s = splfw();
2125 struct sbp_ocb *prev;
2126
2127SBP_DEBUG(2)
2128 sbp_show_sdev_info(sdev, 2);
2129#if __FreeBSD_version >= 500000
2117 printf("sbp_enqueue_ocb orb=0x%tx in physical memory\n", vtophys(&ocb->orb[0]));
2130 printf("sbp_enqueue_ocb orb=0x%tx in physical memory\n", vtophys(&ocb->orb[0]));
2131#else
2132 printf("sbp_enqueue_ocb orb=0x%x in physical memory\n", vtophys(&ocb->orb[0]));
2133#endif
2118END_DEBUG
2119 prev = STAILQ_LAST(&sdev->ocbs, sbp_ocb, ocb);
2120 STAILQ_INSERT_TAIL(&sdev->ocbs, ocb, ocb);
2121
2122 if (ocb->ccb != NULL)
2123 ocb->ccb->ccb_h.timeout_ch = timeout(sbp_timeout, (caddr_t)ocb,
2124 (ocb->ccb->ccb_h.timeout * hz) / 1000);
2125
2126 if (prev != NULL
2127 && ((prev->flags & OCB_ACT_MASK) == OCB_ACT_CMD)
2128 && ((ocb->flags & OCB_ACT_MASK) == OCB_ACT_CMD)) {
2129SBP_DEBUG(1)
2134END_DEBUG
2135 prev = STAILQ_LAST(&sdev->ocbs, sbp_ocb, ocb);
2136 STAILQ_INSERT_TAIL(&sdev->ocbs, ocb, ocb);
2137
2138 if (ocb->ccb != NULL)
2139 ocb->ccb->ccb_h.timeout_ch = timeout(sbp_timeout, (caddr_t)ocb,
2140 (ocb->ccb->ccb_h.timeout * hz) / 1000);
2141
2142 if (prev != NULL
2143 && ((prev->flags & OCB_ACT_MASK) == OCB_ACT_CMD)
2144 && ((ocb->flags & OCB_ACT_MASK) == OCB_ACT_CMD)) {
2145SBP_DEBUG(1)
2146#if __FreeBSD_version >= 500000
2130 printf("linking chain 0x%tx -> 0x%tx\n", vtophys(&prev->orb[0]),
2147 printf("linking chain 0x%tx -> 0x%tx\n", vtophys(&prev->orb[0]),
2148#else
2149 printf("linking chain 0x%x -> 0x%x\n", vtophys(&prev->orb[0]),
2150#endif
2131 vtophys(&ocb->orb[0]));
2132END_DEBUG
2133 prev->flags |= OCB_RESERVED;
2134 prev->orb[1] = htonl(vtophys(&ocb->orb[0]));
2135 prev->orb[0] = 0;
2136 } else {
2137 prev = NULL;
2138 }

--- 105 unchanged lines hidden ---
2151 vtophys(&ocb->orb[0]));
2152END_DEBUG
2153 prev->flags |= OCB_RESERVED;
2154 prev->orb[1] = htonl(vtophys(&ocb->orb[0]));
2155 prev->orb[0] = 0;
2156 } else {
2157 prev = NULL;
2158 }

--- 105 unchanged lines hidden ---