nvme.c (e2b9900498a0c21109db8c7873978c7b5a8e9864) nvme.c (ca269f32efbb7a7f8d263e048e707dc43f13a938)
1/*-
2 * Copyright (C) 2012 Intel Corporation
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

224{
225 printf("cdw0:%08x sqhd:%04x sqid:%04x "
226 "cid:%04x p:%x sc:%02x sct:%x m:%x dnr:%x\n",
227 cpl->cdw0, cpl->sqhd, cpl->sqid,
228 cpl->cid, cpl->status.p, cpl->status.sc, cpl->status.sct,
229 cpl->status.m, cpl->status.dnr);
230}
231
1/*-
2 * Copyright (C) 2012 Intel Corporation
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

224{
225 printf("cdw0:%08x sqhd:%04x sqid:%04x "
226 "cid:%04x p:%x sc:%02x sct:%x m:%x dnr:%x\n",
227 cpl->cdw0, cpl->sqhd, cpl->sqid,
228 cpl->cid, cpl->status.p, cpl->status.sc, cpl->status.sct,
229 cpl->status.m, cpl->status.dnr);
230}
231
232void
233nvme_payload_map(void *arg, bus_dma_segment_t *seg, int nseg, int error)
234{
235 struct nvme_tracker *tr = arg;
236 uint32_t cur_nseg;
237
238 /*
239 * If the mapping operation failed, return immediately. The caller
240 * is responsible for detecting the error status and failing the
241 * tracker manually.
242 */
243 if (error != 0)
244 return;
245
246 /*
247 * Note that we specified PAGE_SIZE for alignment and max
248 * segment size when creating the bus dma tags. So here
249 * we can safely just transfer each segment to its
250 * associated PRP entry.
251 */
252 tr->req->cmd.prp1 = seg[0].ds_addr;
253
254 if (nseg == 2) {
255 tr->req->cmd.prp2 = seg[1].ds_addr;
256 } else if (nseg > 2) {
257 cur_nseg = 1;
258 tr->req->cmd.prp2 = (uint64_t)tr->prp_bus_addr;
259 while (cur_nseg < nseg) {
260 tr->prp[cur_nseg-1] =
261 (uint64_t)seg[cur_nseg].ds_addr;
262 cur_nseg++;
263 }
264 }
265
266 nvme_qpair_submit_tracker(tr->qpair, tr);
267}
268
269static int
270nvme_attach(device_t dev)
271{
272 struct nvme_controller *ctrlr = DEVICE2SOFTC(dev);
273 int status;
274
275 status = nvme_ctrlr_construct(ctrlr, dev);
276

--- 144 unchanged lines hidden ---
232static int
233nvme_attach(device_t dev)
234{
235 struct nvme_controller *ctrlr = DEVICE2SOFTC(dev);
236 int status;
237
238 status = nvme_ctrlr_construct(ctrlr, dev);
239

--- 144 unchanged lines hidden ---