Lines Matching full:req
88 static u8 peci_request_data_cc(struct peci_request *req) in peci_request_data_cc() argument
90 return req->rx.buf[0]; in peci_request_data_cc()
95 * @req: the PECI request that contains response data with completion code
102 int peci_request_status(struct peci_request *req) in peci_request_status() argument
104 u8 cc = peci_request_data_cc(req); in peci_request_status()
107 dev_dbg(&req->device->dev, "ret: %#02x\n", cc); in peci_request_status()
133 static int peci_request_xfer(struct peci_request *req) in peci_request_xfer() argument
135 struct peci_device *device = req->device; in peci_request_xfer()
140 ret = controller->ops->xfer(controller, device->addr, req); in peci_request_xfer()
146 static int peci_request_xfer_retry(struct peci_request *req) in peci_request_xfer_retry() argument
149 struct peci_device *device = req->device; in peci_request_xfer_retry()
155 if (WARN_ON(req->tx.len == 0)) in peci_request_xfer_retry()
159 ret = peci_request_xfer(req); in peci_request_xfer_retry()
165 if (peci_request_status(req) != -EAGAIN) in peci_request_xfer_retry()
169 req->tx.buf[1] |= PECI_RETRY_BIT; in peci_request_xfer_retry()
192 struct peci_request *req; in peci_request_alloc() local
206 req = kzalloc(sizeof(*req), GFP_KERNEL); in peci_request_alloc()
207 if (!req) in peci_request_alloc()
210 req->device = device; in peci_request_alloc()
211 req->tx.len = tx_len; in peci_request_alloc()
212 req->rx.len = rx_len; in peci_request_alloc()
214 return req; in peci_request_alloc()
220 * @req: the PECI request to be freed
222 void peci_request_free(struct peci_request *req) in peci_request_free() argument
224 kfree(req); in peci_request_free()
230 struct peci_request *req; in peci_xfer_get_dib() local
233 req = peci_request_alloc(device, PECI_GET_DIB_WR_LEN, PECI_GET_DIB_RD_LEN); in peci_xfer_get_dib()
234 if (!req) in peci_xfer_get_dib()
237 req->tx.buf[0] = PECI_GET_DIB_CMD; in peci_xfer_get_dib()
239 ret = peci_request_xfer(req); in peci_xfer_get_dib()
241 peci_request_free(req); in peci_xfer_get_dib()
245 return req; in peci_xfer_get_dib()
251 struct peci_request *req; in peci_xfer_get_temp() local
254 req = peci_request_alloc(device, PECI_GET_TEMP_WR_LEN, PECI_GET_TEMP_RD_LEN); in peci_xfer_get_temp()
255 if (!req) in peci_xfer_get_temp()
258 req->tx.buf[0] = PECI_GET_TEMP_CMD; in peci_xfer_get_temp()
260 ret = peci_request_xfer(req); in peci_xfer_get_temp()
262 peci_request_free(req); in peci_xfer_get_temp()
266 return req; in peci_xfer_get_temp()
273 struct peci_request *req; in __pkg_cfg_read() local
276 req = peci_request_alloc(device, PECI_RDPKGCFG_WR_LEN, PECI_RDPKGCFG_RD_LEN_BASE + len); in __pkg_cfg_read()
277 if (!req) in __pkg_cfg_read()
280 req->tx.buf[0] = PECI_RDPKGCFG_CMD; in __pkg_cfg_read()
281 req->tx.buf[1] = 0; in __pkg_cfg_read()
282 req->tx.buf[2] = index; in __pkg_cfg_read()
283 put_unaligned_le16(param, &req->tx.buf[3]); in __pkg_cfg_read()
285 ret = peci_request_xfer_retry(req); in __pkg_cfg_read()
287 peci_request_free(req); in __pkg_cfg_read()
291 return req; in __pkg_cfg_read()
302 struct peci_request *req; in __pci_cfg_local_read() local
306 req = peci_request_alloc(device, PECI_RDPCICFGLOCAL_WR_LEN, in __pci_cfg_local_read()
308 if (!req) in __pci_cfg_local_read()
313 req->tx.buf[0] = PECI_RDPCICFGLOCAL_CMD; in __pci_cfg_local_read()
314 req->tx.buf[1] = 0; in __pci_cfg_local_read()
315 put_unaligned_le24(pci_addr, &req->tx.buf[2]); in __pci_cfg_local_read()
317 ret = peci_request_xfer_retry(req); in __pci_cfg_local_read()
319 peci_request_free(req); in __pci_cfg_local_read()
323 return req; in __pci_cfg_local_read()
330 struct peci_request *req; in __ep_pci_cfg_read() local
334 req = peci_request_alloc(device, PECI_RDENDPTCFG_PCI_WR_LEN, in __ep_pci_cfg_read()
336 if (!req) in __ep_pci_cfg_read()
341 req->tx.buf[0] = PECI_RDENDPTCFG_CMD; in __ep_pci_cfg_read()
342 req->tx.buf[1] = 0; in __ep_pci_cfg_read()
343 req->tx.buf[2] = msg_type; in __ep_pci_cfg_read()
344 req->tx.buf[3] = 0; in __ep_pci_cfg_read()
345 req->tx.buf[4] = 0; in __ep_pci_cfg_read()
346 req->tx.buf[5] = 0; in __ep_pci_cfg_read()
347 req->tx.buf[6] = PECI_ENDPTCFG_ADDR_TYPE_PCI; in __ep_pci_cfg_read()
348 req->tx.buf[7] = seg; /* PCI Segment */ in __ep_pci_cfg_read()
349 put_unaligned_le32(pci_addr, &req->tx.buf[8]); in __ep_pci_cfg_read()
351 ret = peci_request_xfer_retry(req); in __ep_pci_cfg_read()
353 peci_request_free(req); in __ep_pci_cfg_read()
357 return req; in __ep_pci_cfg_read()
364 struct peci_request *req; in __ep_mmio_read() local
367 req = peci_request_alloc(device, tx_len, PECI_RDENDPTCFG_RD_LEN_BASE + len); in __ep_mmio_read()
368 if (!req) in __ep_mmio_read()
371 req->tx.buf[0] = PECI_RDENDPTCFG_CMD; in __ep_mmio_read()
372 req->tx.buf[1] = 0; in __ep_mmio_read()
373 req->tx.buf[2] = PECI_ENDPTCFG_TYPE_MMIO; in __ep_mmio_read()
374 req->tx.buf[3] = 0; /* Endpoint ID */ in __ep_mmio_read()
375 req->tx.buf[4] = 0; /* Reserved */ in __ep_mmio_read()
376 req->tx.buf[5] = bar; in __ep_mmio_read()
377 req->tx.buf[6] = addr_type; in __ep_mmio_read()
378 req->tx.buf[7] = seg; /* PCI Segment */ in __ep_mmio_read()
379 req->tx.buf[8] = PCI_DEVFN(dev, func); in __ep_mmio_read()
380 req->tx.buf[9] = bus; /* PCI Bus */ in __ep_mmio_read()
383 put_unaligned_le32(offset, &req->tx.buf[10]); in __ep_mmio_read()
385 put_unaligned_le64(offset, &req->tx.buf[10]); in __ep_mmio_read()
387 ret = peci_request_xfer_retry(req); in __ep_mmio_read()
389 peci_request_free(req); in __ep_mmio_read()
393 return req; in __ep_mmio_read()
396 u8 peci_request_data_readb(struct peci_request *req) in peci_request_data_readb() argument
398 return req->rx.buf[1]; in peci_request_data_readb()
402 u16 peci_request_data_readw(struct peci_request *req) in peci_request_data_readw() argument
404 return get_unaligned_le16(&req->rx.buf[1]); in peci_request_data_readw()
408 u32 peci_request_data_readl(struct peci_request *req) in peci_request_data_readl() argument
410 return get_unaligned_le32(&req->rx.buf[1]); in peci_request_data_readl()
414 u64 peci_request_data_readq(struct peci_request *req) in peci_request_data_readq() argument
416 return get_unaligned_le64(&req->rx.buf[1]); in peci_request_data_readq()
420 u64 peci_request_dib_read(struct peci_request *req) in peci_request_dib_read() argument
422 return get_unaligned_le64(&req->rx.buf[0]); in peci_request_dib_read()
426 s16 peci_request_temp_read(struct peci_request *req) in peci_request_temp_read() argument
428 return get_unaligned_le16(&req->rx.buf[0]); in peci_request_temp_read()