1/* $FreeBSD: head/sys/dev/mpt/mpt.h 155521 2006-02-11 01:35:29Z mjacob $ */ |
2/*- 3 * Generic defines for LSI '909 FC adapters. 4 * FreeBSD Version. 5 * 6 * Copyright (c) 2000, 2001 by Greg Ansley 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 71 unchanged lines hidden (view full) --- 81#include <sys/malloc.h> 82#include <sys/mutex.h> 83#include <sys/condvar.h> 84#endif 85#include <sys/proc.h> 86#include <sys/bus.h> 87#include <sys/module.h> 88 |
89#include <machine/clock.h> 90#include <machine/cpu.h> 91#include <machine/resource.h> 92 93#include <sys/rman.h> 94 |
95#if __FreeBSD_version < 500000 96#include <pci/pcireg.h> 97#include <pci/pcivar.h> 98#else 99#include <dev/pci/pcireg.h> 100#include <dev/pci/pcivar.h> 101#endif 102 103#include <machine/bus.h> |
104#include "opt_ddb.h" 105 106/**************************** Register Definitions ****************************/ 107#include <dev/mpt/mpt_reg.h> 108 109/******************************* MPI Definitions ******************************/ 110#include <dev/mpt/mpilib/mpi_type.h> 111#include <dev/mpt/mpilib/mpi.h> --- 138 unchanged lines hidden (view full) --- 250 uint16_t index; /* Index of this entry */ 251 uint16_t IOCStatus; /* Completion status */ 252 union ccb *ccb; /* CAM request */ 253 void *req_vbuf; /* Virtual Address of Entry */ 254 void *sense_vbuf; /* Virtual Address of sense data */ 255 bus_addr_t req_pbuf; /* Physical Address of Entry */ 256 bus_addr_t sense_pbuf; /* Physical Address of sense data */ 257 bus_dmamap_t dmap; /* DMA map for data buffer */ |
258 struct req_entry *chain; /* for SGE overallocations */ |
259}; 260 261/**************************** Handler Registration ****************************/ 262/* 263 * Global table of registered reply handlers. The 264 * handler is indicated by byte 3 of the request 265 * index submitted to the IOC. This allows the 266 * driver core to perform generic processing without --- 113 unchanged lines hidden (view full) --- 380 device_t dev; 381#if __FreeBSD_version < 500000 382 int mpt_splsaved; 383 uint32_t mpt_islocked; 384#else 385 struct mtx mpt_lock; 386#endif 387 uint32_t mpt_pers_mask; |
388 uint32_t : 14, 389 is_sas : 1, |
390 raid_mwce_set : 1, 391 getreqwaiter : 1, 392 shutdwn_raid : 1, 393 shutdwn_recovery: 1, 394 unit : 8, 395 outofbeer : 1, 396 mpt_locksetup : 1, 397 disabled : 1, --- 4 unchanged lines hidden (view full) --- 402 403 /* 404 * IOC Facts 405 */ 406 uint16_t mpt_global_credits; 407 uint16_t request_frame_size; 408 uint8_t mpt_max_devices; 409 uint8_t mpt_max_buses; |
410 uint8_t ioc_facts_flags; |
411 412 /* 413 * Port Facts 414 * XXX - Add multi-port support!. 415 */ 416 uint16_t mpt_ini_id; 417 uint16_t mpt_port_type; 418 uint16_t mpt_proto_flags; --- 73 unchanged lines hidden (view full) --- 492 bus_addr_t reply_phys; /* BusAddr of reply memory */ 493 494 bus_dma_tag_t buffer_dmat; /* DMA tag for buffers */ 495 bus_dma_tag_t request_dmat; /* DMA tag for request memroy */ 496 bus_dmamap_t request_dmap; /* DMA map for request memroy */ 497 uint8_t *request; /* KVA of Request memory */ 498 bus_addr_t request_phys; /* BusADdr of request memory */ 499 |
500 uint32_t max_seg_cnt; /* calculated after IOC facts */ 501 502 /* 503 * Hardware management 504 */ |
505 u_int reset_cnt; 506 507 /* 508 * CAM && Software Management 509 */ 510 request_t *request_pool; 511 struct req_queue request_free_list; 512 struct req_queue request_pending_list; --- 156 unchanged lines hidden (view full) --- 669 670static __inline uint32_t 671mpt_pio_read(struct mpt_softc *mpt, int offset) 672{ 673 return (bus_space_read_4(mpt->pci_pio_st, mpt->pci_pio_sh, offset)); 674} 675/*********************** Reply Frame/Request Management ***********************/ 676/* Max MPT Reply we are willing to accept (must be power of 2) */ |
677#define MPT_REPLY_SIZE 256 |
678 |
679#define MPT_MAX_REQUESTS(mpt) 512 680#define MPT_REQUEST_AREA 512 681#define MPT_SENSE_SIZE 32 /* included in MPT_REQUEST_AREA */ |
682#define MPT_REQ_MEM_SIZE(mpt) (MPT_MAX_REQUESTS(mpt) * MPT_REQUEST_AREA) 683 684#define MPT_CONTEXT_CB_SHIFT (16) 685#define MPT_CBI(handle) (handle >> MPT_CONTEXT_CB_SHIFT) 686#define MPT_CBI_TO_HID(cbi) ((cbi) << MPT_CONTEXT_CB_SHIFT) 687#define MPT_CONTEXT_TO_CBI(x) \ 688 (((x) >> MPT_CONTEXT_CB_SHIFT) & (MPT_NUM_REPLY_HANDLERS - 1)) 689#define MPT_CONTEXT_REQI_MASK 0xFFFF --- 35 unchanged lines hidden (view full) --- 725mpt_pop_reply_queue(struct mpt_softc *mpt) 726{ 727 return mpt_read(mpt, MPT_OFFSET_REPLY_Q); 728} 729 730void mpt_complete_request_chain(struct mpt_softc *mpt, 731 struct req_queue *chain, u_int iocstatus); 732/************************** Scatter Gather Managment **************************/ |
733/* MPT_RQSL- size of request frame, in bytes */ |
734#define MPT_RQSL(mpt) (mpt->request_frame_size << 2) |
735 |
736/* MPT_NSGL- how many SG entries can fit in a request frame size */ 737#define MPT_NSGL(mpt) (MPT_RQSL(mpt) / sizeof (SGE_IO_UNION)) |
738 |
739/* MPT_NRFM- how many request frames can fit in each request alloc we make */ 740#define MPT_NRFM(mpt) (MPT_REQUEST_AREA / MPT_RQSL(mpt)) 741 742/* 743 * MPT_NSGL_FIRST- # of SG elements that can fit after 744 * an I/O request but still within the request frame. 745 * Do this safely based upon SGE_IO_UNION. 746 * 747 * Note that the first element is *within* the SCSI request. 748 */ 749#define MPT_NSGL_FIRST(mpt) \ 750 ((MPT_RQSL(mpt) - sizeof (MSG_SCSI_IO_REQUEST) + sizeof (SGE_IO_UNION)) / \ 751 sizeof (SGE_IO_UNION)) 752 |
753/***************************** IOC Initialization *****************************/ 754int mpt_reset(struct mpt_softc *, int /*reinit*/); 755 756/****************************** Debugging/Logging *****************************/ 757typedef struct mpt_decode_entry { 758 char *name; 759 u_int value; 760 u_int mask; --- 5 unchanged lines hidden (view full) --- 766 767enum { 768 MPT_PRT_ALWAYS, 769 MPT_PRT_FATAL, 770 MPT_PRT_ERROR, 771 MPT_PRT_WARN, 772 MPT_PRT_INFO, 773 MPT_PRT_DEBUG, |
774 MPT_PRT_TRACE, 775 MPT_PRT_NONE=100 |
776}; 777 778#define mpt_lprt(mpt, level, ...) \ 779do { \ 780 if (level <= (mpt)->verbose) \ 781 mpt_prt(mpt, __VA_ARGS__); \ 782} while (0) 783 --- 70 unchanged lines hidden (view full) --- 854void mpt_print_reply(void *vmsg); 855void mpt_print_db(uint32_t mb); 856void mpt_print_config_reply(void *vmsg); 857char *mpt_ioc_diag(uint32_t diag); 858void mpt_req_state(mpt_req_state_t state); 859void mpt_print_config_request(void *vmsg); 860void mpt_print_request(void *vmsg); 861void mpt_print_scsi_io_request(MSG_SCSI_IO_REQUEST *msg); |
862void mpt_dump_sgl(SGE_IO_UNION *se, int offset); |
863#endif /* _MPT_H_ */ |