265 }
266 ddi_put8(mpt->m_acc_req_frame_hdl, &request->Header.PageNumber,
267 config->page_number);
268 ddi_put32(mpt->m_acc_req_frame_hdl, &request->PageAddress,
269 config->page_address);
270 flagslength = ((uint32_t)(MPI2_SGE_FLAGS_LAST_ELEMENT |
271 MPI2_SGE_FLAGS_END_OF_BUFFER |
272 MPI2_SGE_FLAGS_SIMPLE_ELEMENT |
273 MPI2_SGE_FLAGS_SYSTEM_ADDRESS |
274 MPI2_SGE_FLAGS_64_BIT_ADDRESSING |
275 direction |
276 MPI2_SGE_FLAGS_END_OF_LIST) << MPI2_SGE_FLAGS_SHIFT);
277 flagslength |= length;
278 ddi_put32(mpt->m_acc_req_frame_hdl, &sge->FlagsLength, flagslength);
279
280 (void) ddi_dma_sync(mpt->m_dma_req_frame_hdl, 0, 0,
281 DDI_DMA_SYNC_FORDEV);
282 request_desc_low = (cmd->cmd_slot << 16) +
283 MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
284 cmd->cmd_rfm = NULL;
285 mpt->m_active->m_slot[cmd->cmd_slot] = cmd;
286 MPTSAS_START_CMD(mpt, request_desc_low, 0);
287 if ((mptsas_check_dma_handle(mpt->m_dma_req_frame_hdl) !=
288 DDI_SUCCESS) ||
289 (mptsas_check_acc_handle(mpt->m_acc_req_frame_hdl) !=
290 DDI_SUCCESS)) {
291 ddi_fm_service_impact(mpt->m_dip, DDI_SERVICE_UNAFFECTED);
292 }
293 }
294
295 int
296 mptsas_access_config_page(mptsas_t *mpt, uint8_t action, uint8_t page_type,
297 uint8_t page_number, uint32_t page_address, int (*callback) (mptsas_t *,
298 caddr_t, ddi_acc_handle_t, uint16_t, uint32_t, va_list), ...)
299 {
300 va_list ap;
301 ddi_dma_attr_t attrs;
302 ddi_dma_cookie_t cookie;
303 ddi_acc_handle_t accessp;
304 size_t len = 0;
305 mptsas_config_request_t config;
1307 MPI2_SGE_FLAGS_END_OF_BUFFER |
1308 MPI2_SGE_FLAGS_SIMPLE_ELEMENT |
1309 MPI2_SGE_FLAGS_SYSTEM_ADDRESS |
1310 MPI2_SGE_FLAGS_64_BIT_ADDRESSING |
1311 MPI2_SGE_FLAGS_HOST_TO_IOC |
1312 MPI2_SGE_FLAGS_END_OF_LIST) << MPI2_SGE_FLAGS_SHIFT);
1313 ddi_put32(mpt->m_acc_req_frame_hdl, &sge->FlagsLength, flagslength);
1314 ddi_put32(mpt->m_acc_req_frame_hdl, &sge->Address.Low,
1315 flsh_cookie.dmac_address);
1316 ddi_put32(mpt->m_acc_req_frame_hdl, &sge->Address.High,
1317 (uint32_t)(flsh_cookie.dmac_laddress >> 32));
1318
1319 /*
1320 * Start command
1321 */
1322 (void) ddi_dma_sync(mpt->m_dma_req_frame_hdl, 0, 0,
1323 DDI_DMA_SYNC_FORDEV);
1324 request_desc_low = (cmd->cmd_slot << 16) +
1325 MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
1326 cmd->cmd_rfm = NULL;
1327 mpt->m_active->m_slot[cmd->cmd_slot] = cmd;
1328 MPTSAS_START_CMD(mpt, request_desc_low, 0);
1329
1330 rvalue = 0;
1331 (void) cv_reltimedwait(&mpt->m_fw_cv, &mpt->m_mutex,
1332 drv_usectohz(60 * MICROSEC), TR_CLOCK_TICK);
1333 if (!(cmd->cmd_flags & CFLAG_FINISHED)) {
1334 mpt->m_softstate &= ~MPTSAS_SS_MSG_UNIT_RESET;
1335 if ((mptsas_restart_ioc(mpt)) == DDI_FAILURE) {
1336 mptsas_log(mpt, CE_WARN, "mptsas_restart_ioc failed");
1337 }
1338 rvalue = -1;
1339 }
1340 mptsas_remove_cmd(mpt, cmd);
1341 mptsas_dma_addr_destroy(&flsh_dma_handle, &flsh_accessp);
1342
1343 return (rvalue);
1344 }
1345
1346 static int
1347 mptsas_sasdevpage_0_cb(mptsas_t *mpt, caddr_t page_memp,
|
265 }
266 ddi_put8(mpt->m_acc_req_frame_hdl, &request->Header.PageNumber,
267 config->page_number);
268 ddi_put32(mpt->m_acc_req_frame_hdl, &request->PageAddress,
269 config->page_address);
270 flagslength = ((uint32_t)(MPI2_SGE_FLAGS_LAST_ELEMENT |
271 MPI2_SGE_FLAGS_END_OF_BUFFER |
272 MPI2_SGE_FLAGS_SIMPLE_ELEMENT |
273 MPI2_SGE_FLAGS_SYSTEM_ADDRESS |
274 MPI2_SGE_FLAGS_64_BIT_ADDRESSING |
275 direction |
276 MPI2_SGE_FLAGS_END_OF_LIST) << MPI2_SGE_FLAGS_SHIFT);
277 flagslength |= length;
278 ddi_put32(mpt->m_acc_req_frame_hdl, &sge->FlagsLength, flagslength);
279
280 (void) ddi_dma_sync(mpt->m_dma_req_frame_hdl, 0, 0,
281 DDI_DMA_SYNC_FORDEV);
282 request_desc_low = (cmd->cmd_slot << 16) +
283 MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
284 cmd->cmd_rfm = NULL;
285 MPTSAS_START_CMD(mpt, request_desc_low, 0);
286 if ((mptsas_check_dma_handle(mpt->m_dma_req_frame_hdl) !=
287 DDI_SUCCESS) ||
288 (mptsas_check_acc_handle(mpt->m_acc_req_frame_hdl) !=
289 DDI_SUCCESS)) {
290 ddi_fm_service_impact(mpt->m_dip, DDI_SERVICE_UNAFFECTED);
291 }
292 }
293
294 int
295 mptsas_access_config_page(mptsas_t *mpt, uint8_t action, uint8_t page_type,
296 uint8_t page_number, uint32_t page_address, int (*callback) (mptsas_t *,
297 caddr_t, ddi_acc_handle_t, uint16_t, uint32_t, va_list), ...)
298 {
299 va_list ap;
300 ddi_dma_attr_t attrs;
301 ddi_dma_cookie_t cookie;
302 ddi_acc_handle_t accessp;
303 size_t len = 0;
304 mptsas_config_request_t config;
1306 MPI2_SGE_FLAGS_END_OF_BUFFER |
1307 MPI2_SGE_FLAGS_SIMPLE_ELEMENT |
1308 MPI2_SGE_FLAGS_SYSTEM_ADDRESS |
1309 MPI2_SGE_FLAGS_64_BIT_ADDRESSING |
1310 MPI2_SGE_FLAGS_HOST_TO_IOC |
1311 MPI2_SGE_FLAGS_END_OF_LIST) << MPI2_SGE_FLAGS_SHIFT);
1312 ddi_put32(mpt->m_acc_req_frame_hdl, &sge->FlagsLength, flagslength);
1313 ddi_put32(mpt->m_acc_req_frame_hdl, &sge->Address.Low,
1314 flsh_cookie.dmac_address);
1315 ddi_put32(mpt->m_acc_req_frame_hdl, &sge->Address.High,
1316 (uint32_t)(flsh_cookie.dmac_laddress >> 32));
1317
1318 /*
1319 * Start command
1320 */
1321 (void) ddi_dma_sync(mpt->m_dma_req_frame_hdl, 0, 0,
1322 DDI_DMA_SYNC_FORDEV);
1323 request_desc_low = (cmd->cmd_slot << 16) +
1324 MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
1325 cmd->cmd_rfm = NULL;
1326 MPTSAS_START_CMD(mpt, request_desc_low, 0);
1327
1328 rvalue = 0;
1329 (void) cv_reltimedwait(&mpt->m_fw_cv, &mpt->m_mutex,
1330 drv_usectohz(60 * MICROSEC), TR_CLOCK_TICK);
1331 if (!(cmd->cmd_flags & CFLAG_FINISHED)) {
1332 mpt->m_softstate &= ~MPTSAS_SS_MSG_UNIT_RESET;
1333 if ((mptsas_restart_ioc(mpt)) == DDI_FAILURE) {
1334 mptsas_log(mpt, CE_WARN, "mptsas_restart_ioc failed");
1335 }
1336 rvalue = -1;
1337 }
1338 mptsas_remove_cmd(mpt, cmd);
1339 mptsas_dma_addr_destroy(&flsh_dma_handle, &flsh_accessp);
1340
1341 return (rvalue);
1342 }
1343
1344 static int
1345 mptsas_sasdevpage_0_cb(mptsas_t *mpt, caddr_t page_memp,
|