nvme_private.h (67abaee9fc91f23df6fa141fe9187a11f3ba0850) | nvme_private.h (ead7e10308947fc5b9c6b96411f09d486d92833d) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (C) 2012-2014 Intel Corporation 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 449 unchanged lines hidden (view full) --- 458int nvme_attach(device_t dev); 459int nvme_shutdown(device_t dev); 460int nvme_detach(device_t dev); 461 462/* 463 * Wait for a command to complete using the nvme_completion_poll_cb. 464 * Used in limited contexts where the caller knows it's OK to block 465 * briefly while the command runs. The ISR will run the callback which | 1/*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (C) 2012-2014 Intel Corporation 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 449 unchanged lines hidden (view full) --- 458int nvme_attach(device_t dev); 459int nvme_shutdown(device_t dev); 460int nvme_detach(device_t dev); 461 462/* 463 * Wait for a command to complete using the nvme_completion_poll_cb. 464 * Used in limited contexts where the caller knows it's OK to block 465 * briefly while the command runs. The ISR will run the callback which |
466 * will set status->done to true.usually within microseconds. A 1s 467 * pause means something is seriously AFU and we should panic to 468 * provide the proper context to diagnose. | 466 * will set status->done to true, usually within microseconds. If not, 467 * then after one second timeout handler should reset the controller 468 * and abort all outstanding requests including this polled one. If 469 * still not after ten seconds, then something is wrong with the driver, 470 * and panic is the only way to recover. |
469 */ 470static __inline 471void 472nvme_completion_poll(struct nvme_completion_poll_status *status) 473{ | 471 */ 472static __inline 473void 474nvme_completion_poll(struct nvme_completion_poll_status *status) 475{ |
474 int sanity = hz * 1; | 476 int sanity = hz * 10; |
475 476 while (!atomic_load_acq_int(&status->done) && --sanity > 0) 477 pause("nvme", 1); 478 if (sanity <= 0) | 477 478 while (!atomic_load_acq_int(&status->done) && --sanity > 0) 479 pause("nvme", 1); 480 if (sanity <= 0) |
479 panic("NVME polled command failed to complete within 1s."); | 481 panic("NVME polled command failed to complete within 10s."); |
480} 481 482static __inline void 483nvme_single_map(void *arg, bus_dma_segment_t *seg, int nseg, int error) 484{ 485 uint64_t *bus_addr = (uint64_t *)arg; 486 487 if (error != 0) --- 88 unchanged lines hidden --- | 482} 483 484static __inline void 485nvme_single_map(void *arg, bus_dma_segment_t *seg, int nseg, int error) 486{ 487 uint64_t *bus_addr = (uint64_t *)arg; 488 489 if (error != 0) --- 88 unchanged lines hidden --- |