Deleted Added
sdiff udiff text old ( 153072 ) new ( 155521 )
full compact
1/* $FreeBSD: head/sys/dev/mpt/mpt.h 153072 2005-12-04 02:12:43Z ru $ */
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/bus.h>
90#include <machine/clock.h>
91#include <machine/cpu.h>
92#include <machine/resource.h>
93
94#include <sys/rman.h>
95
96#include "opt_ddb.h"
97
98/**************************** Register Definitions ****************************/
99#include <dev/mpt/mpt_reg.h>
100
101/******************************* MPI Definitions ******************************/
102#include <dev/mpt/mpilib/mpi_type.h>
103#include <dev/mpt/mpilib/mpi.h>

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

242 uint16_t index; /* Index of this entry */
243 uint16_t IOCStatus; /* Completion status */
244 union ccb *ccb; /* CAM request */
245 void *req_vbuf; /* Virtual Address of Entry */
246 void *sense_vbuf; /* Virtual Address of sense data */
247 bus_addr_t req_pbuf; /* Physical Address of Entry */
248 bus_addr_t sense_pbuf; /* Physical Address of sense data */
249 bus_dmamap_t dmap; /* DMA map for data buffer */
250};
251
252/**************************** Handler Registration ****************************/
253/*
254 * Global table of registered reply handlers. The
255 * handler is indicated by byte 3 of the request
256 * index submitted to the IOC. This allows the
257 * driver core to perform generic processing without

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

371 device_t dev;
372#if __FreeBSD_version < 500000
373 int mpt_splsaved;
374 uint32_t mpt_islocked;
375#else
376 struct mtx mpt_lock;
377#endif
378 uint32_t mpt_pers_mask;
379 uint32_t : 15,
380 raid_mwce_set : 1,
381 getreqwaiter : 1,
382 shutdwn_raid : 1,
383 shutdwn_recovery: 1,
384 unit : 8,
385 outofbeer : 1,
386 mpt_locksetup : 1,
387 disabled : 1,

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

392
393 /*
394 * IOC Facts
395 */
396 uint16_t mpt_global_credits;
397 uint16_t request_frame_size;
398 uint8_t mpt_max_devices;
399 uint8_t mpt_max_buses;
400
401 /*
402 * Port Facts
403 * XXX - Add multi-port support!.
404 */
405 uint16_t mpt_ini_id;
406 uint16_t mpt_port_type;
407 uint16_t mpt_proto_flags;

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

481 bus_addr_t reply_phys; /* BusAddr of reply memory */
482
483 bus_dma_tag_t buffer_dmat; /* DMA tag for buffers */
484 bus_dma_tag_t request_dmat; /* DMA tag for request memroy */
485 bus_dmamap_t request_dmap; /* DMA map for request memroy */
486 uint8_t *request; /* KVA of Request memory */
487 bus_addr_t request_phys; /* BusADdr of request memory */
488
489 u_int reset_cnt;
490
491 /*
492 * CAM && Software Management
493 */
494 request_t *request_pool;
495 struct req_queue request_free_list;
496 struct req_queue request_pending_list;

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

653
654static __inline uint32_t
655mpt_pio_read(struct mpt_softc *mpt, int offset)
656{
657 return (bus_space_read_4(mpt->pci_pio_st, mpt->pci_pio_sh, offset));
658}
659/*********************** Reply Frame/Request Management ***********************/
660/* Max MPT Reply we are willing to accept (must be power of 2) */
661#define MPT_REPLY_SIZE 128
662
663#define MPT_MAX_REQUESTS(mpt) ((mpt)->is_fc ? 1024 : 256)
664#define MPT_REQUEST_AREA 512
665#define MPT_SENSE_SIZE 32 /* included in MPT_REQUEST_SIZE */
666#define MPT_REQ_MEM_SIZE(mpt) (MPT_MAX_REQUESTS(mpt) * MPT_REQUEST_AREA)
667
668#define MPT_CONTEXT_CB_SHIFT (16)
669#define MPT_CBI(handle) (handle >> MPT_CONTEXT_CB_SHIFT)
670#define MPT_CBI_TO_HID(cbi) ((cbi) << MPT_CONTEXT_CB_SHIFT)
671#define MPT_CONTEXT_TO_CBI(x) \
672 (((x) >> MPT_CONTEXT_CB_SHIFT) & (MPT_NUM_REPLY_HANDLERS - 1))
673#define MPT_CONTEXT_REQI_MASK 0xFFFF

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

709mpt_pop_reply_queue(struct mpt_softc *mpt)
710{
711 return mpt_read(mpt, MPT_OFFSET_REPLY_Q);
712}
713
714void mpt_complete_request_chain(struct mpt_softc *mpt,
715 struct req_queue *chain, u_int iocstatus);
716/************************** Scatter Gather Managment **************************/
717/*
718 * We cannot tell prior to getting IOC facts how big the IOC's request
719 * area is. Because of this we cannot tell at compile time how many
720 * simple SG elements we can fit within an IOC request prior to having
721 * to put in a chain element.
722 *
723 * Experimentally we know that the Ultra4 parts have a 96 byte request
724 * element size and the Fibre Channel units have a 144 byte request
725 * element size. Therefore, if we have 512-32 (== 480) bytes of request
726 * area to play with, we have room for between 3 and 5 request sized
727 * regions- the first of which is the command plus a simple SG list,
728 * the rest of which are chained continuation SG lists. Given that the
729 * normal request we use is 48 bytes w/o the first SG element, we can
730 * assume we have 480-48 == 432 bytes to have simple SG elements and/or
731 * chain elements. If we assume 32 bit addressing, this works out to
732 * 54 SG or chain elements. If we assume 5 chain elements, then we have
733 * a maximum of 49 seperate actual SG segments.
734 */
735#define MPT_SGL_MAX 49
736
737#define MPT_RQSL(mpt) (mpt->request_frame_size << 2)
738#define MPT_NSGL(mpt) (MPT_RQSL(mpt) / sizeof (SGE_SIMPLE32))
739
740#define MPT_NSGL_FIRST(mpt) \
741 (((mpt->request_frame_size << 2) - \
742 sizeof (MSG_SCSI_IO_REQUEST) - \
743 sizeof (SGE_IO_UNION)) / sizeof (SGE_SIMPLE32))
744
745/***************************** IOC Initialization *****************************/
746int mpt_reset(struct mpt_softc *, int /*reinit*/);
747
748/****************************** Debugging/Logging *****************************/
749typedef struct mpt_decode_entry {
750 char *name;
751 u_int value;
752 u_int mask;

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

758
759enum {
760 MPT_PRT_ALWAYS,
761 MPT_PRT_FATAL,
762 MPT_PRT_ERROR,
763 MPT_PRT_WARN,
764 MPT_PRT_INFO,
765 MPT_PRT_DEBUG,
766 MPT_PRT_TRACE
767};
768
769#define mpt_lprt(mpt, level, ...) \
770do { \
771 if (level <= (mpt)->verbose) \
772 mpt_prt(mpt, __VA_ARGS__); \
773} while (0)
774

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

845void mpt_print_reply(void *vmsg);
846void mpt_print_db(uint32_t mb);
847void mpt_print_config_reply(void *vmsg);
848char *mpt_ioc_diag(uint32_t diag);
849void mpt_req_state(mpt_req_state_t state);
850void mpt_print_config_request(void *vmsg);
851void mpt_print_request(void *vmsg);
852void mpt_print_scsi_io_request(MSG_SCSI_IO_REQUEST *msg);
853#endif /* _MPT_H_ */