2 * Copyright (c) 2009 Yahoo! Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * $FreeBSD: src/sys/dev/mps/mpsvar.h,v 1.9 2012/01/26 18:17:21 ken Exp $
29 * Copyright (c) 2011 LSI Corp.
30 * All rights reserved.
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.
41 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53 * LSI MPT-Fusion Host Adapter FreeBSD
55 * $FreeBSD: src/sys/dev/mps/mpsvar.h,v 1.9 2012/01/26 18:17:21 ken Exp $
61 #define MPS_DRIVER_VERSION "13.00.00.02-fbsd"
63 #define MPS_DB_MAX_WAIT 2500
65 #define MPS_REQ_FRAMES 1024
66 #define MPS_EVT_REPLY_FRAMES 32
67 #define MPS_REPLY_FRAMES MPS_REQ_FRAMES
68 #define MPS_CHAIN_FRAMES 2048
69 #define MPS_SENSE_LEN SSD_FULL_SIZE
70 #define MPS_MSI_COUNT 1
71 #define MPS_SGE64_SIZE 12
72 #define MPS_SGE32_SIZE 8
73 #define MPS_SGC_SIZE 8
78 #define MPS_PERIODIC_DELAY 1 /* 1 second heartbeat/watchdog check */
80 #define MPS_SCSI_RI_INVALID_FRAME (0x00000002)
81 #define MPS_STRING_LENGTH 64
84 * host mapping related macro definitions
86 #define MPS_MAPTABLE_BAD_IDX 0xFFFFFFFF
87 #define MPS_DPM_BAD_IDX 0xFFFF
88 #define MPS_ENCTABLE_BAD_IDX 0xFF
89 #define MPS_MAX_MISSING_COUNT 0x0F
90 #define MPS_DEV_RESERVED 0x20000000
91 #define MPS_MAP_IN_USE 0x10000000
92 #define MPS_RAID_CHANNEL 1
93 #define MPS_MAP_BAD_ID 0xFFFFFFFF
96 * WarpDrive controller
98 #define MPS_CHIP_WD_DEVICE_ID 0x007E
99 #define MPS_WD_LSI_OEM 0x80
100 #define MPS_WD_HIDE_EXPOSE_MASK 0x03
101 #define MPS_WD_HIDE_ALWAYS 0x00
102 #define MPS_WD_EXPOSE_ALWAYS 0x01
103 #define MPS_WD_HIDE_IF_VOLUME 0x02
104 #define MPS_WD_RETRY 0x01
105 #define MPS_MAN_PAGE10_SIZE 0x5C /* Hardcode for now */
106 #define MPS_MAX_DISKS_IN_VOL 10
109 * WarpDrive Event Logging
111 #define MPI2_WD_LOG_ENTRY 0x8002
112 #define MPI2_WD_SSD_THROTTLING 0x0041
113 #define MPI2_WD_DRIVE_LIFE_WARN 0x0043
114 #define MPI2_WD_DRIVE_LIFE_DEAD 0x0044
115 #define MPI2_WD_RAIL_MON_FAIL 0x004D
118 typedef uint16_t u16;
119 typedef uint32_t u32;
120 typedef uint64_t u64;
123 * struct dev_mapping_table - device mapping information
124 * @physical_id: SAS address for drives or WWID for RAID volumes
125 * @device_info: bitfield provides detailed info about the device
126 * @phy_bits: bitfields indicating controller phys
127 * @dpm_entry_num: index of this device in device persistent map table
128 * @dev_handle: device handle for the device pointed by this entry
129 * @channel: target channel
131 * @missing_count: number of times the device not detected by driver
132 * @hide_flag: Hide this physical disk/not (foreign configuration)
133 * @init_complete: Whether the start of the day checks completed or not
135 struct dev_mapping_table {
151 * struct enc_mapping_table - mapping information about an enclosure
152 * @enclosure_id: Logical ID of this enclosure
153 * @start_index: index to the entry in dev_mapping_table
154 * @phy_bits: bitfields indicating controller phys
155 * @dpm_entry_num: index of this enclosure in device persistent map table
156 * @enc_handle: device handle for the enclosure pointed by this entry
157 * @num_slots: number of slots in the enclosure
158 * @start_slot: Starting slot id
159 * @missing_count: number of times the device not detected by driver
160 * @removal_flag: used to mark the device for removal
161 * @skip_search: used as a flag to include/exclude enclosure for search
162 * @init_complete: Whether the start of the day checks completed or not
164 struct enc_mapping_table {
179 * struct map_removal_table - entries to be removed from mapping table
180 * @dpm_entry_num: index of this device in device persistent map table
181 * @dev_handle: device handle for the device pointed by this entry
183 struct map_removal_table{
188 typedef struct mps_fw_diagnostic_buffer {
190 uint8_t extended_type;
192 uint8_t force_release;
193 uint32_t product_specific[23];
197 uint8_t owned_by_firmware;
199 } mps_fw_diagnostic_buffer_t;
205 struct mpssas_target;
206 struct mps_column_map;
208 MALLOC_DECLARE(M_MPT2);
210 typedef void mps_evt_callback_t(struct mps_softc *, uintptr_t,
211 MPI2_EVENT_NOTIFICATION_REPLY *reply);
212 typedef void mps_command_callback_t(struct mps_softc *, struct mps_command *cm);
215 TAILQ_ENTRY(mps_chain) chain_link;
216 MPI2_SGE_IO_UNION *chain;
217 uint32_t chain_busaddr;
221 * This needs to be at least 2 to support SMP passthrough.
223 #define MPS_IOVEC_COUNT 2
226 TAILQ_ENTRY(mps_command) cm_link;
227 TAILQ_ENTRY(mps_command) cm_recovery;
228 struct mps_softc *cm_sc;
234 struct iovec cm_iovec[MPS_IOVEC_COUNT];
237 MPI2_SGE_IO_UNION *cm_sge;
240 uint32_t cm_reply_data;
241 mps_command_callback_t *cm_complete;
242 void *cm_complete_data;
243 struct mpssas_target *cm_targ;
244 MPI2_REQUEST_DESCRIPTOR_UNION cm_desc;
247 #define MPS_CM_FLAGS_POLLED (1 << 0)
248 #define MPS_CM_FLAGS_COMPLETE (1 << 1)
249 #define MPS_CM_FLAGS_SGE_SIMPLE (1 << 2)
250 #define MPS_CM_FLAGS_DATAOUT (1 << 3)
251 #define MPS_CM_FLAGS_DATAIN (1 << 4)
252 #define MPS_CM_FLAGS_WAKEUP (1 << 5)
253 #define MPS_CM_FLAGS_DD_IO (1 << 6)
254 #define MPS_CM_FLAGS_USE_UIO (1 << 7)
255 #define MPS_CM_FLAGS_SMP_PASS (1 << 8)
256 #define MPS_CM_FLAGS_CHAIN_FAILED (1 << 9)
257 #define MPS_CM_FLAGS_ERROR_MASK MPS_CM_FLAGS_CHAIN_FAILED
259 #define MPS_CM_STATE_FREE 0
260 #define MPS_CM_STATE_BUSY 1
261 #define MPS_CM_STATE_TIMEDOUT 2
262 bus_dmamap_t cm_dmamap;
263 struct scsi_sense_data *cm_sense;
264 TAILQ_HEAD(, mps_chain) cm_chain_list;
265 uint32_t cm_req_busaddr;
266 uint32_t cm_sense_busaddr;
267 struct callout cm_callout;
270 struct mps_column_map {
272 uint8_t phys_disk_num;
275 struct mps_event_handle {
276 TAILQ_ENTRY(mps_event_handle) eh_list;
277 mps_evt_callback_t *callback;
284 struct cdev *mps_cdev;
286 #define MPS_FLAGS_INTX (1 << 0)
287 #define MPS_FLAGS_MSI (1 << 1)
288 #define MPS_FLAGS_BUSY (1 << 2)
289 #define MPS_FLAGS_SHUTDOWN (1 << 3)
290 #define MPS_FLAGS_DIAGRESET (1 << 4)
291 #define MPS_FLAGS_ATTACH_DONE (1 << 5)
292 #define MPS_FLAGS_WD_AVAILABLE (1 << 6)
294 #if 0 /* XXX swildner */
300 int io_cmds_highwater;
303 int chain_free_lowwater;
304 #if __FreeBSD_version >= 900030
305 uint64_t chain_alloc_fail;
307 struct sysctl_ctx_list sysctl_ctx;
308 struct sysctl_oid *sysctl_tree;
310 struct mps_command *commands;
311 struct mps_chain *chains;
312 struct callout periodic;
314 struct mpssas_softc *sassc;
316 char tmp_string[MPS_STRING_LENGTH];
317 TAILQ_HEAD(, mps_command) req_list;
318 TAILQ_HEAD(, mps_command) high_priority_req_list;
319 TAILQ_HEAD(, mps_chain) chain_list;
320 TAILQ_HEAD(, mps_command) tm_list;
324 struct resource *mps_regs_resource;
325 bus_space_handle_t mps_bhandle;
326 bus_space_tag_t mps_btag;
329 bus_dma_tag_t mps_parent_dmat;
330 bus_dma_tag_t buffer_dmat;
332 MPI2_IOC_FACTS_REPLY *facts;
333 MPI2_PORT_FACTS_REPLY *pfacts;
336 int fqdepth; /* Free queue */
337 int pqdepth; /* Post queue */
339 uint8_t event_mask[16];
340 TAILQ_HEAD(, mps_event_handle) event_list;
341 struct mps_event_handle *mps_log_eh;
343 struct lock mps_lock;
344 struct intr_config_hook mps_ich;
345 struct resource *mps_irq[MPS_MSI_COUNT];
346 void *mps_intrhand[MPS_MSI_COUNT];
347 int mps_irq_rid[MPS_MSI_COUNT];
348 int mps_irq_type[MPS_MSI_COUNT];
351 bus_addr_t req_busaddr;
352 bus_dma_tag_t req_dmat;
353 bus_dmamap_t req_map;
355 uint8_t *reply_frames;
356 bus_addr_t reply_busaddr;
357 bus_dma_tag_t reply_dmat;
358 bus_dmamap_t reply_map;
360 struct scsi_sense_data *sense_frames;
361 bus_addr_t sense_busaddr;
362 bus_dma_tag_t sense_dmat;
363 bus_dmamap_t sense_map;
365 uint8_t *chain_frames;
366 bus_addr_t chain_busaddr;
367 bus_dma_tag_t chain_dmat;
368 bus_dmamap_t chain_map;
370 MPI2_REPLY_DESCRIPTORS_UNION *post_queue;
371 bus_addr_t post_busaddr;
372 uint32_t *free_queue;
373 bus_addr_t free_busaddr;
374 bus_dma_tag_t queues_dmat;
375 bus_dmamap_t queues_map;
377 uint8_t *fw_diag_buffer;
378 bus_addr_t fw_diag_busaddr;
379 bus_dma_tag_t fw_diag_dmat;
380 bus_dmamap_t fw_diag_map;
384 /* static config pages */
385 Mpi2IOCPage8_t ioc_pg8;
387 /* host mapping support */
388 struct dev_mapping_table *mapping_table;
389 struct enc_mapping_table *enclosure_table;
390 struct map_removal_table *removal_table;
391 uint8_t *dpm_entry_used;
392 uint8_t *dpm_flush_entry;
393 Mpi2DriverMappingPage0_t *dpm_pg0;
394 uint16_t max_devices;
395 uint16_t max_enclosures;
396 uint16_t max_expanders;
398 uint8_t num_enc_table_entries;
399 uint8_t num_rsvd_entries;
400 uint8_t num_channels;
401 uint16_t max_dpm_entries;
402 uint8_t is_dpm_enable;
403 uint8_t track_mapping_events;
404 uint32_t pending_map_events;
405 uint8_t mt_full_retry;
406 uint8_t mt_add_device_failed;
408 /* FW diag Buffer List */
409 mps_fw_diagnostic_buffer_t
410 fw_diag_buffer_list[MPI2_DIAG_BUF_TYPE_COUNT];
412 /* Event Recording IOCTL support */
413 uint32_t events_to_record[4];
414 mps_event_entry_t recorded_events[MPS_EVENT_QUEUE_SIZE];
416 uint32_t event_number;
418 /* EEDP and TLR support */
419 uint8_t eedp_enabled;
422 /* Shutdown Event Handler */
423 eventhandler_tag shutdown_eh;
425 /* To track topo events during reset */
426 #define MPS_DIAG_RESET_TIMEOUT 300000
427 uint8_t wait_for_port_enable;
428 uint8_t port_enable_complete;
431 uint8_t WD_valid_config;
432 uint8_t WD_hide_expose;
434 /* Direct Drive for WarpDrive */
435 uint8_t DD_num_phys_disks;
436 uint16_t DD_dev_handle;
437 uint32_t DD_stripe_size;
438 uint32_t DD_stripe_exponent;
439 uint32_t DD_block_size;
440 uint16_t DD_block_exponent;
442 struct mps_column_map DD_column_map[MPS_MAX_DISKS_IN_VOL];
445 struct mps_config_params {
446 MPI2_CONFIG_EXT_PAGE_HEADER_UNION hdr;
448 u_int page_address; /* Attributes, not a phys address */
453 void (*callback)(struct mps_softc *, struct mps_config_params *);
457 struct scsi_read_capacity_eedp
464 static __inline uint32_t
465 mps_regread(struct mps_softc *sc, uint32_t offset)
467 return (bus_space_read_4(sc->mps_btag, sc->mps_bhandle, offset));
471 mps_regwrite(struct mps_softc *sc, uint32_t offset, uint32_t val)
473 bus_space_write_4(sc->mps_btag, sc->mps_bhandle, offset, val);
477 mps_free_reply(struct mps_softc *sc, uint32_t busaddr)
479 if (++sc->replyfreeindex >= sc->fqdepth)
480 sc->replyfreeindex = 0;
481 sc->free_queue[sc->replyfreeindex] = busaddr;
482 mps_regwrite(sc, MPI2_REPLY_FREE_HOST_INDEX_OFFSET, sc->replyfreeindex);
485 static __inline struct mps_chain *
486 mps_alloc_chain(struct mps_softc *sc)
488 struct mps_chain *chain;
490 if ((chain = TAILQ_FIRST(&sc->chain_list)) != NULL) {
491 TAILQ_REMOVE(&sc->chain_list, chain, chain_link);
493 if (sc->chain_free < sc->chain_free_lowwater)
494 sc->chain_free_lowwater = sc->chain_free;
496 #if __FreeBSD_version >= 900030
498 sc->chain_alloc_fail++;
504 mps_free_chain(struct mps_softc *sc, struct mps_chain *chain)
507 bzero(chain->chain, 128);
510 TAILQ_INSERT_TAIL(&sc->chain_list, chain, chain_link);
514 mps_free_command(struct mps_softc *sc, struct mps_command *cm)
516 struct mps_chain *chain, *chain_temp;
518 if (cm->cm_reply != NULL)
519 mps_free_reply(sc, cm->cm_reply_data);
522 cm->cm_complete = NULL;
523 cm->cm_complete_data = NULL;
528 cm->cm_state = MPS_CM_STATE_FREE;
535 TAILQ_FOREACH_MUTABLE(chain, &cm->cm_chain_list, chain_link, chain_temp) {
536 TAILQ_REMOVE(&cm->cm_chain_list, chain, chain_link);
537 mps_free_chain(sc, chain);
539 TAILQ_INSERT_TAIL(&sc->req_list, cm, cm_link);
542 static __inline struct mps_command *
543 mps_alloc_command(struct mps_softc *sc)
545 struct mps_command *cm;
547 cm = TAILQ_FIRST(&sc->req_list);
551 TAILQ_REMOVE(&sc->req_list, cm, cm_link);
552 KASSERT(cm->cm_state == MPS_CM_STATE_FREE, ("mps: Allocating busy command"));
553 cm->cm_state = MPS_CM_STATE_BUSY;
558 mps_free_high_priority_command(struct mps_softc *sc, struct mps_command *cm)
560 struct mps_chain *chain, *chain_temp;
562 if (cm->cm_reply != NULL)
563 mps_free_reply(sc, cm->cm_reply_data);
566 cm->cm_complete = NULL;
567 cm->cm_complete_data = NULL;
571 cm->cm_state = MPS_CM_STATE_FREE;
572 TAILQ_FOREACH_MUTABLE(chain, &cm->cm_chain_list, chain_link, chain_temp) {
573 TAILQ_REMOVE(&cm->cm_chain_list, chain, chain_link);
574 mps_free_chain(sc, chain);
576 TAILQ_INSERT_TAIL(&sc->high_priority_req_list, cm, cm_link);
579 static __inline struct mps_command *
580 mps_alloc_high_priority_command(struct mps_softc *sc)
582 struct mps_command *cm;
584 cm = TAILQ_FIRST(&sc->high_priority_req_list);
588 TAILQ_REMOVE(&sc->high_priority_req_list, cm, cm_link);
589 KASSERT(cm->cm_state == MPS_CM_STATE_FREE, ("mps: Allocating busy command"));
590 cm->cm_state = MPS_CM_STATE_BUSY;
595 mps_lock(struct mps_softc *sc)
597 lockmgr(&sc->mps_lock, LK_EXCLUSIVE);
601 mps_unlock(struct mps_softc *sc)
603 lockmgr(&sc->mps_lock, LK_RELEASE);
606 #define MPS_INFO (1 << 0)
607 #define MPS_TRACE (1 << 1)
608 #define MPS_FAULT (1 << 2)
609 #define MPS_EVENT (1 << 3)
610 #define MPS_LOG (1 << 4)
612 #define mps_printf(sc, args...) \
613 device_printf((sc)->mps_dev, ##args)
615 #define mps_vprintf(sc, args...) \
618 mps_printf(sc, ##args); \
621 #define mps_dprint(sc, level, msg, args...) \
623 if (sc->mps_debug & level) \
624 device_printf(sc->mps_dev, msg, ##args); \
627 #define mps_dprint_field(sc, level, msg, args...) \
629 if (sc->mps_debug & level) \
630 kprintf("\t" msg, ##args); \
633 #define MPS_PRINTFIELD_START(sc, tag...) \
634 mps_dprint((sc), MPS_INFO, ##tag); \
635 mps_dprint_field((sc), MPS_INFO, ":\n")
636 #define MPS_PRINTFIELD_END(sc, tag) \
637 mps_dprint((sc), MPS_INFO, tag "\n")
638 #define MPS_PRINTFIELD(sc, facts, attr, fmt) \
639 mps_dprint_field((sc), MPS_INFO, #attr ": " #fmt "\n", (facts)->attr)
641 #define MPS_EVENTFIELD_START(sc, tag...) \
642 mps_dprint((sc), MPS_EVENT, ##tag); \
643 mps_dprint_field((sc), MPS_EVENT, ":\n")
644 #define MPS_EVENTFIELD(sc, facts, attr, fmt) \
645 mps_dprint_field((sc), MPS_EVENT, #attr ": " #fmt "\n", (facts)->attr)
648 mps_from_u64(uint64_t data, U64 *mps)
650 (mps)->High = htole32((uint32_t)((data) >> 32));
651 (mps)->Low = htole32((uint32_t)((data) & 0xffffffff));
654 static __inline uint64_t
655 mps_to_u64(U64 *data)
657 return (((uint64_t)le32toh(data->High) << 32) | le32toh(data->Low));
661 mps_mask_intr(struct mps_softc *sc)
665 mask = mps_regread(sc, MPI2_HOST_INTERRUPT_MASK_OFFSET);
666 mask |= MPI2_HIM_REPLY_INT_MASK;
667 mps_regwrite(sc, MPI2_HOST_INTERRUPT_MASK_OFFSET, mask);
671 mps_unmask_intr(struct mps_softc *sc)
675 mask = mps_regread(sc, MPI2_HOST_INTERRUPT_MASK_OFFSET);
676 mask &= ~MPI2_HIM_REPLY_INT_MASK;
677 mps_regwrite(sc, MPI2_HOST_INTERRUPT_MASK_OFFSET, mask);
680 int mps_pci_setup_interrupts(struct mps_softc *sc);
681 int mps_pci_restore(struct mps_softc *sc);
683 int mps_attach(struct mps_softc *sc);
684 int mps_free(struct mps_softc *sc);
685 void mps_intr(void *);
686 void mps_intr_msi(void *);
687 void mps_intr_locked(void *);
688 int mps_register_events(struct mps_softc *, uint8_t *, mps_evt_callback_t *,
689 void *, struct mps_event_handle **);
690 int mps_restart(struct mps_softc *);
691 int mps_update_events(struct mps_softc *, struct mps_event_handle *, uint8_t *);
692 int mps_deregister_events(struct mps_softc *, struct mps_event_handle *);
693 int mps_push_sge(struct mps_command *, void *, size_t, int);
694 int mps_add_dmaseg(struct mps_command *, vm_paddr_t, size_t, u_int, int);
695 int mps_attach_sas(struct mps_softc *sc);
696 int mps_detach_sas(struct mps_softc *sc);
697 int mps_read_config_page(struct mps_softc *, struct mps_config_params *);
698 int mps_write_config_page(struct mps_softc *, struct mps_config_params *);
699 void mps_memaddr_cb(void *, bus_dma_segment_t *, int , int );
700 void mpi_init_sge(struct mps_command *cm, void *req, void *sge);
701 int mps_attach_user(struct mps_softc *);
702 void mps_detach_user(struct mps_softc *);
703 void mpssas_record_event(struct mps_softc *sc,
704 MPI2_EVENT_NOTIFICATION_REPLY *event_reply);
706 int mps_map_command(struct mps_softc *sc, struct mps_command *cm);
707 int mps_wait_command(struct mps_softc *sc, struct mps_command *cm, int timeout);
708 int mps_request_polled(struct mps_softc *sc, struct mps_command *cm);
710 int mps_config_get_bios_pg3(struct mps_softc *sc, Mpi2ConfigReply_t
711 *mpi_reply, Mpi2BiosPage3_t *config_page);
712 int mps_config_get_raid_volume_pg0(struct mps_softc *sc, Mpi2ConfigReply_t
713 *mpi_reply, Mpi2RaidVolPage0_t *config_page, u32 page_address);
714 int mps_config_get_ioc_pg8(struct mps_softc *sc, Mpi2ConfigReply_t *,
716 int mps_config_get_man_pg10(struct mps_softc *sc, Mpi2ConfigReply_t *mpi_reply);
717 int mps_config_get_sas_device_pg0(struct mps_softc *, Mpi2ConfigReply_t *,
718 Mpi2SasDevicePage0_t *, u32 , u16 );
719 int mps_config_get_dpm_pg0(struct mps_softc *, Mpi2ConfigReply_t *,
720 Mpi2DriverMappingPage0_t *, u16 );
721 int mps_config_get_raid_volume_pg1(struct mps_softc *sc,
722 Mpi2ConfigReply_t *mpi_reply, Mpi2RaidVolPage1_t *config_page, u32 form,
724 int mps_config_get_volume_wwid(struct mps_softc *sc, u16 volume_handle,
726 int mps_config_get_raid_pd_pg0(struct mps_softc *sc,
727 Mpi2ConfigReply_t *mpi_reply, Mpi2RaidPhysDiskPage0_t *config_page,
729 void mpssas_ir_shutdown(struct mps_softc *sc);
731 int mps_reinit(struct mps_softc *sc);
732 void mpssas_handle_reinit(struct mps_softc *sc);
734 void mps_base_static_config_pages(struct mps_softc *sc);
735 void mps_wd_config_pages(struct mps_softc *sc);
737 int mps_mapping_initialize(struct mps_softc *);
738 void mps_mapping_topology_change_event(struct mps_softc *,
739 Mpi2EventDataSasTopologyChangeList_t *);
740 int mps_mapping_is_reinit_required(struct mps_softc *);
741 void mps_mapping_free_memory(struct mps_softc *sc);
742 int mps_config_set_dpm_pg0(struct mps_softc *, Mpi2ConfigReply_t *,
743 Mpi2DriverMappingPage0_t *, u16 );
744 void mps_mapping_exit(struct mps_softc *);
745 void mps_mapping_check_devices(struct mps_softc *, int);
746 int mps_mapping_allocate_memory(struct mps_softc *sc);
747 unsigned int mps_mapping_get_sas_id(struct mps_softc *, uint64_t , u16);
748 unsigned int mps_mapping_get_sas_id_from_handle(struct mps_softc *sc,
750 unsigned int mps_mapping_get_raid_id(struct mps_softc *sc, u64 wwid,
752 unsigned int mps_mapping_get_raid_id_from_handle(struct mps_softc *sc,
754 void mps_mapping_enclosure_dev_status_change_event(struct mps_softc *,
755 Mpi2EventDataSasEnclDevStatusChange_t *event_data);
756 void mps_mapping_ir_config_change_event(struct mps_softc *sc,
757 Mpi2EventDataIrConfigChangeList_t *event_data);
759 void mpssas_evt_handler(struct mps_softc *sc, uintptr_t data,
760 MPI2_EVENT_NOTIFICATION_REPLY *event);
761 void mpssas_prepare_remove(struct mpssas_softc *sassc, uint16_t handle);
762 void mpssas_prepare_volume_remove(struct mpssas_softc *sassc, uint16_t handle);
763 int mpssas_startup(struct mps_softc *sc);
764 struct mpssas_target * mpssas_find_target_by_handle(struct mpssas_softc *, int, uint16_t);
766 SYSCTL_DECL(_hw_mps);
768 #define mps_kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \
769 kthread_create(func, farg, proc_ptr, fmtstr, arg)
770 #define mps_kproc_exit(arg) kthread_exit()
772 #if defined(CAM_PRIORITY_XPT)
773 #define MPS_PRIORITY_XPT CAM_PRIORITY_XPT
775 #define MPS_PRIORITY_XPT 5