isp_library.c (167821) | isp_library.c (168240) |
---|---|
1/*- 2 * Copyright (c) 1997-2007 by Matthew Jacob 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 * --- 20 unchanged lines hidden (view full) --- 29 */ 30#ifdef __NetBSD__ 31#include <sys/cdefs.h> 32__KERNEL_RCSID(0, "$NetBSD$"); 33#include <dev/ic/isp_netbsd.h> 34#endif 35#ifdef __FreeBSD__ 36#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1997-2007 by Matthew Jacob 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 * --- 20 unchanged lines hidden (view full) --- 29 */ 30#ifdef __NetBSD__ 31#include <sys/cdefs.h> 32__KERNEL_RCSID(0, "$NetBSD$"); 33#include <dev/ic/isp_netbsd.h> 34#endif 35#ifdef __FreeBSD__ 36#include <sys/cdefs.h> |
37__FBSDID("$FreeBSD: head/sys/dev/isp/isp_library.c 167821 2007-03-22 23:38:32Z mjacob $"); | 37__FBSDID("$FreeBSD: head/sys/dev/isp/isp_library.c 168240 2007-04-02 01:04:20Z mjacob $"); |
38#include <dev/isp/isp_freebsd.h> 39#endif 40#ifdef __OpenBSD__ 41#include <dev/ic/isp_openbsd.h> 42#endif 43#ifdef __linux__ 44#include "isp_linux.h" 45#endif --- 1448 unchanged lines hidden (view full) --- 1494 isp->isp_tgtlist[i] = xs; 1495 *handlep = (i+1) | 0x8000; 1496 return (0); 1497} 1498 1499void * 1500isp_find_xs_tgt(ispsoftc_t *isp, uint32_t handle) 1501{ | 38#include <dev/isp/isp_freebsd.h> 39#endif 40#ifdef __OpenBSD__ 41#include <dev/ic/isp_openbsd.h> 42#endif 43#ifdef __linux__ 44#include "isp_linux.h" 45#endif --- 1448 unchanged lines hidden (view full) --- 1494 isp->isp_tgtlist[i] = xs; 1495 *handlep = (i+1) | 0x8000; 1496 return (0); 1497} 1498 1499void * 1500isp_find_xs_tgt(ispsoftc_t *isp, uint32_t handle) 1501{ |
1502 if (handle == 0 || (handle & 0x8000) == 0 || 1503 (handle & 0x7fff) > isp->isp_maxcmds) { | 1502 if (handle == 0 || IS_TARGET_HANDLE(handle) == 0 || 1503 (handle & ISP_HANDLE_MASK) > isp->isp_maxcmds) { |
1504 isp_prt(isp, ISP_LOGERR, "bad handle in isp_find_xs_tgt"); 1505 return (NULL); 1506 } else { | 1504 isp_prt(isp, ISP_LOGERR, "bad handle in isp_find_xs_tgt"); 1505 return (NULL); 1506 } else { |
1507 return (isp->isp_tgtlist[(handle & 0x7fff) - 1]); | 1507 return (isp->isp_tgtlist[(handle & ISP_HANDLE_MASK) - 1]); |
1508 } 1509} 1510 1511uint32_t 1512isp_find_tgt_handle(ispsoftc_t *isp, void *xs) 1513{ 1514 int i; 1515 if (xs != NULL) { 1516 for (i = 0; i < isp->isp_maxcmds; i++) { 1517 if (isp->isp_tgtlist[i] == xs) { | 1508 } 1509} 1510 1511uint32_t 1512isp_find_tgt_handle(ispsoftc_t *isp, void *xs) 1513{ 1514 int i; 1515 if (xs != NULL) { 1516 for (i = 0; i < isp->isp_maxcmds; i++) { 1517 if (isp->isp_tgtlist[i] == xs) { |
1518 return ((i+1) & 0x7fff); | 1518 return ((i+1) & ISP_HANDLE_MASK); |
1519 } 1520 } 1521 } 1522 return (0); 1523} 1524 1525void 1526isp_destroy_tgt_handle(ispsoftc_t *isp, uint32_t handle) 1527{ | 1519 } 1520 } 1521 } 1522 return (0); 1523} 1524 1525void 1526isp_destroy_tgt_handle(ispsoftc_t *isp, uint32_t handle) 1527{ |
1528 if (handle == 0 || (handle & 0x8000) == 0 || 1529 (handle & 0x7fff) > isp->isp_maxcmds) { | 1528 if (handle == 0 || IS_TARGET_HANDLE(handle) == 0 || 1529 (handle & ISP_HANDLE_MASK) > isp->isp_maxcmds) { |
1530 isp_prt(isp, ISP_LOGERR, 1531 "bad handle in isp_destroy_tgt_handle"); 1532 } else { | 1530 isp_prt(isp, ISP_LOGERR, 1531 "bad handle in isp_destroy_tgt_handle"); 1532 } else { |
1533 isp->isp_tgtlist[(handle & 0x7fff) - 1] = NULL; | 1533 isp->isp_tgtlist[(handle & ISP_HANDLE_MASK) - 1] = NULL; |
1534 } 1535} 1536 1537void 1538isp_put_atio(ispsoftc_t *isp, at_entry_t *src, at_entry_t *dst) 1539{ 1540 int i; 1541 isp_put_hdr(isp, &src->at_header, &dst->at_header); --- 1360 unchanged lines hidden --- | 1534 } 1535} 1536 1537void 1538isp_put_atio(ispsoftc_t *isp, at_entry_t *src, at_entry_t *dst) 1539{ 1540 int i; 1541 isp_put_hdr(isp, &src->at_header, &dst->at_header); --- 1360 unchanged lines hidden --- |