1/* 2 * Generic driver for the Advanced Systems Inc. SCSI controllers 3 * Product specific probe and attach routines can be found in: 4 * 5 * i386/isa/adv_isa.c ABP5140, ABP542, ABP5150, ABP842, ABP852 6 * i386/eisa/adv_eisa.c ABP742, ABP752 7 * pci/adv_pci.c ABP920, ABP930, ABP930U, ABP930UA, ABP940, ABP940U, 8 * ABP940UA, ABP950, ABP960, ABP960U, ABP960UA, --- 18 unchanged lines hidden (view full) --- 27 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * |
35 * $FreeBSD: head/sys/dev/advansys/advansys.c 59082 2000-04-07 11:32:42Z nyan $ |
36 */ 37/* 38 * Ported from: 39 * advansys.c - Linux Host Driver for AdvanSys SCSI Adapters 40 * 41 * Copyright (c) 1995-1997 Advanced System Products, Inc. 42 * All Rights Reserved. 43 * --- 7 unchanged lines hidden (view full) --- 51#include <sys/systm.h> 52#include <sys/malloc.h> 53#include <sys/buf.h> 54#include <sys/kernel.h> 55 56#include <machine/bus_pio.h> 57#include <machine/bus.h> 58#include <machine/clock.h> |
59#include <machine/resource.h> 60#include <sys/bus.h> 61#include <sys/rman.h> |
62 63#include <cam/cam.h> 64#include <cam/cam_ccb.h> 65#include <cam/cam_sim.h> 66#include <cam/cam_xpt_sim.h> 67#include <cam/cam_xpt_periph.h> 68#include <cam/cam_debug.h> 69 70#include <cam/scsi/scsi_all.h> 71#include <cam/scsi/scsi_message.h> 72 73#include <vm/vm.h> 74#include <vm/vm_param.h> 75#include <vm/pmap.h> 76 77#include <dev/advansys/advansys.h> 78 |
79static void adv_action(struct cam_sim *sim, union ccb *ccb); 80static void adv_execute_ccb(void *arg, bus_dma_segment_t *dm_segs, 81 int nsegments, int error); 82static void adv_poll(struct cam_sim *sim); 83static void adv_run_doneq(struct adv_softc *adv); 84static struct adv_ccb_info * 85 adv_alloc_ccb_info(struct adv_softc *adv); 86static void adv_destroy_ccb_info(struct adv_softc *adv, 87 struct adv_ccb_info *cinfo); 88static __inline struct adv_ccb_info * 89 adv_get_ccb_info(struct adv_softc *adv); 90static __inline void adv_free_ccb_info(struct adv_softc *adv, 91 struct adv_ccb_info *cinfo); 92static __inline void adv_set_state(struct adv_softc *adv, adv_state state); 93static __inline void adv_clear_state(struct adv_softc *adv, union ccb* ccb); 94static void adv_clear_state_really(struct adv_softc *adv, union ccb* ccb); 95 |
96static __inline struct adv_ccb_info * 97adv_get_ccb_info(struct adv_softc *adv) 98{ 99 struct adv_ccb_info *cinfo; 100 int opri; 101 102 opri = splcam(); 103 if ((cinfo = SLIST_FIRST(&adv->free_ccb_infos)) != NULL) { --- 619 unchanged lines hidden (view full) --- 723 ccb->ccb_h.status |= CAM_CMD_TIMEOUT; 724 adv_reset_bus(adv, /*initiate_reset*/TRUE); 725 } 726 adv_start_execution(adv); 727 splx(s); 728} 729 730struct adv_softc * |
731adv_alloc(device_t dev, bus_space_tag_t tag, bus_space_handle_t bsh) |
732{ |
733 struct adv_softc *adv = device_get_softc(dev); |
734 735 /* 736 * Allocate a storage area for us 737 */ |
738 LIST_INIT(&adv->pending_ccbs); 739 SLIST_INIT(&adv->free_ccb_infos); |
740 adv->dev = dev; 741 adv->unit = device_get_unit(dev); |
742 adv->tag = tag; 743 adv->bsh = bsh; 744 745 return(adv); 746} 747 748void 749adv_free(struct adv_softc *adv) --- 19 unchanged lines hidden (view full) --- 769 bus_dma_tag_destroy(adv->buffer_dmat); 770 case 2: 771 bus_dma_tag_destroy(adv->parent_dmat); 772 case 1: 773 free(adv->ccb_infos, M_DEVBUF); 774 case 0: 775 break; 776 } |
777} 778 779int 780adv_init(struct adv_softc *adv) 781{ 782 struct adv_eeprom_config eeprom_config; 783 int checksum, i; 784 int max_sync; --- 646 unchanged lines hidden --- |