summaryrefslogtreecommitdiffstats
path: root/src/drivers/infiniband/golan.c
diff options
context:
space:
mode:
authorMichael Brown2020-11-05 20:08:48 +0100
committerMichael Brown2020-11-05 20:13:52 +0100
commitbe1c87b72237f633c4f4b05bcb133acf2967d788 (patch)
treeadc9bc36da62d55f0f1f5708af7c66d1cc3af949 /src/drivers/infiniband/golan.c
parent[efi] Retain a long-lived reference to the EFI_PCI_IO_PROTOCOL instance (diff)
downloadipxe-be1c87b72237f633c4f4b05bcb133acf2967d788.tar.gz
ipxe-be1c87b72237f633c4f4b05bcb133acf2967d788.tar.xz
ipxe-be1c87b72237f633c4f4b05bcb133acf2967d788.zip
[malloc] Rename malloc_dma() to malloc_phys()
The malloc_dma() function allocates memory with specified physical alignment, and is typically (though not exclusively) used to allocate memory for DMA. Rename to malloc_phys() to more closely match the functionality, and to create name space for functions that specifically allocate and map DMA-capable buffers. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/infiniband/golan.c')
-rwxr-xr-xsrc/drivers/infiniband/golan.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/drivers/infiniband/golan.c b/src/drivers/infiniband/golan.c
index 7ab4a4ee..9bd810e2 100755
--- a/src/drivers/infiniband/golan.c
+++ b/src/drivers/infiniband/golan.c
@@ -585,9 +585,9 @@ static inline int golan_set_access_reg ( struct golan *golan __attribute__ (( un
static inline void golan_cmd_uninit ( struct golan *golan )
{
- free_dma(golan->mboxes.outbox, GOLAN_PAGE_SIZE);
- free_dma(golan->mboxes.inbox, GOLAN_PAGE_SIZE);
- free_dma(golan->cmd.addr, GOLAN_PAGE_SIZE);
+ free_phys(golan->mboxes.outbox, GOLAN_PAGE_SIZE);
+ free_phys(golan->mboxes.inbox, GOLAN_PAGE_SIZE);
+ free_phys(golan->cmd.addr, GOLAN_PAGE_SIZE);
}
/**
@@ -602,17 +602,17 @@ static inline int golan_cmd_init ( struct golan *golan )
int rc = 0;
uint32_t addr_l_sz;
- if (!(golan->cmd.addr = malloc_dma(GOLAN_PAGE_SIZE , GOLAN_PAGE_SIZE))) {
+ if (!(golan->cmd.addr = malloc_phys(GOLAN_PAGE_SIZE , GOLAN_PAGE_SIZE))) {
rc = -ENOMEM;
- goto malloc_dma_failed;
+ goto malloc_phys_failed;
}
- if (!(golan->mboxes.inbox = malloc_dma(GOLAN_PAGE_SIZE , GOLAN_PAGE_SIZE))) {
+ if (!(golan->mboxes.inbox = malloc_phys(GOLAN_PAGE_SIZE , GOLAN_PAGE_SIZE))) {
rc = -ENOMEM;
- goto malloc_dma_inbox_failed;
+ goto malloc_phys_inbox_failed;
}
- if (!(golan->mboxes.outbox = malloc_dma(GOLAN_PAGE_SIZE , GOLAN_PAGE_SIZE))) {
+ if (!(golan->mboxes.outbox = malloc_phys(GOLAN_PAGE_SIZE , GOLAN_PAGE_SIZE))) {
rc = -ENOMEM;
- goto malloc_dma_outbox_failed;
+ goto malloc_phys_outbox_failed;
}
addr_l_sz = be32_to_cpu(readl(&golan->iseg->cmdq_addr_l_sz));
@@ -629,11 +629,11 @@ static inline int golan_cmd_init ( struct golan *golan )
DBGC( golan , "%s Command interface was initialized\n", __FUNCTION__);
return 0;
-malloc_dma_outbox_failed:
- free_dma(golan->mboxes.inbox, GOLAN_PAGE_SIZE);
-malloc_dma_inbox_failed:
- free_dma(golan->cmd.addr, GOLAN_PAGE_SIZE);
-malloc_dma_failed:
+malloc_phys_outbox_failed:
+ free_phys(golan->mboxes.inbox, GOLAN_PAGE_SIZE);
+malloc_phys_inbox_failed:
+ free_phys(golan->cmd.addr, GOLAN_PAGE_SIZE);
+malloc_phys_failed:
DBGC (golan ,"%s Failed to initialize command interface (rc = 0x%x)\n",
__FUNCTION__, rc);
return rc;
@@ -743,7 +743,7 @@ static int golan_create_eq(struct golan *golan)
eq->cons_index = 0;
eq->size = GOLAN_NUM_EQES * sizeof(eq->eqes[0]);
- eq->eqes = malloc_dma ( GOLAN_PAGE_SIZE, GOLAN_PAGE_SIZE );
+ eq->eqes = malloc_phys ( GOLAN_PAGE_SIZE, GOLAN_PAGE_SIZE );
if (!eq->eqes) {
rc = -ENOMEM;
goto err_create_eq_eqe_alloc;
@@ -781,7 +781,7 @@ static int golan_create_eq(struct golan *golan)
return 0;
err_create_eq_cmd:
- free_dma ( eq->eqes , GOLAN_PAGE_SIZE );
+ free_phys ( eq->eqes , GOLAN_PAGE_SIZE );
err_create_eq_eqe_alloc:
DBGC (golan ,"%s [%d] out\n", __FUNCTION__, rc);
return rc;
@@ -806,7 +806,7 @@ static void golan_destory_eq(struct golan *golan)
rc = send_command_and_wait(golan, DEF_CMD_IDX, NO_MBOX, NO_MBOX, __FUNCTION__);
GOLAN_PRINT_RC_AND_CMD_STATUS;
- free_dma ( golan->eq.eqes , GOLAN_PAGE_SIZE );
+ free_phys ( golan->eq.eqes , GOLAN_PAGE_SIZE );
golan->eq.eqn = 0;
DBGC( golan, "%s Event queue (0x%x) was destroyed\n", __FUNCTION__, eqn);
@@ -962,14 +962,14 @@ static int golan_create_cq(struct ib_device *ibdev,
goto err_create_cq;
}
golan_cq->size = sizeof(golan_cq->cqes[0]) * cq->num_cqes;
- golan_cq->doorbell_record = malloc_dma(GOLAN_CQ_DB_RECORD_SIZE,
+ golan_cq->doorbell_record = malloc_phys(GOLAN_CQ_DB_RECORD_SIZE,
GOLAN_CQ_DB_RECORD_SIZE);
if (!golan_cq->doorbell_record) {
rc = -ENOMEM;
goto err_create_cq_db_alloc;
}
- golan_cq->cqes = malloc_dma ( GOLAN_PAGE_SIZE, GOLAN_PAGE_SIZE );
+ golan_cq->cqes = malloc_phys ( GOLAN_PAGE_SIZE, GOLAN_PAGE_SIZE );
if (!golan_cq->cqes) {
rc = -ENOMEM;
goto err_create_cq_cqe_alloc;
@@ -1008,9 +1008,9 @@ static int golan_create_cq(struct ib_device *ibdev,
return 0;
err_create_cq_cmd:
- free_dma( golan_cq->cqes , GOLAN_PAGE_SIZE );
+ free_phys( golan_cq->cqes , GOLAN_PAGE_SIZE );
err_create_cq_cqe_alloc:
- free_dma(golan_cq->doorbell_record, GOLAN_CQ_DB_RECORD_SIZE);
+ free_phys(golan_cq->doorbell_record, GOLAN_CQ_DB_RECORD_SIZE);
err_create_cq_db_alloc:
free ( golan_cq );
err_create_cq:
@@ -1045,8 +1045,8 @@ static void golan_destroy_cq(struct ib_device *ibdev,
cq->cqn = 0;
ib_cq_set_drvdata(cq, NULL);
- free_dma ( golan_cq->cqes , GOLAN_PAGE_SIZE );
- free_dma(golan_cq->doorbell_record, GOLAN_CQ_DB_RECORD_SIZE);
+ free_phys ( golan_cq->cqes , GOLAN_PAGE_SIZE );
+ free_phys(golan_cq->doorbell_record, GOLAN_CQ_DB_RECORD_SIZE);
free(golan_cq);
DBGC (golan, "%s CQ number 0x%x was destroyed\n", __FUNCTION__, cqn);
@@ -1138,7 +1138,7 @@ static int golan_create_qp_aux(struct ib_device *ibdev,
golan_qp->size = golan_qp->sq.size + golan_qp->rq.size;
/* allocate dma memory for WQEs (1 page is enough) - should change it */
- golan_qp->wqes = malloc_dma ( GOLAN_PAGE_SIZE, GOLAN_PAGE_SIZE );
+ golan_qp->wqes = malloc_phys ( GOLAN_PAGE_SIZE, GOLAN_PAGE_SIZE );
if (!golan_qp->wqes) {
rc = -ENOMEM;
goto err_create_qp_wqe_alloc;
@@ -1160,7 +1160,7 @@ static int golan_create_qp_aux(struct ib_device *ibdev,
data++;
}
- golan_qp->doorbell_record = malloc_dma(sizeof(struct golan_qp_db),
+ golan_qp->doorbell_record = malloc_phys(sizeof(struct golan_qp_db),
sizeof(struct golan_qp_db));
if (!golan_qp->doorbell_record) {
rc = -ENOMEM;
@@ -1213,9 +1213,9 @@ static int golan_create_qp_aux(struct ib_device *ibdev,
return 0;
err_create_qp_cmd:
- free_dma(golan_qp->doorbell_record, sizeof(struct golan_qp_db));
+ free_phys(golan_qp->doorbell_record, sizeof(struct golan_qp_db));
err_create_qp_db_alloc:
- free_dma ( golan_qp->wqes, GOLAN_PAGE_SIZE );
+ free_phys ( golan_qp->wqes, GOLAN_PAGE_SIZE );
err_create_qp_wqe_alloc:
err_create_qp_sq_size:
err_create_qp_sq_wqe_size:
@@ -1422,8 +1422,8 @@ static void golan_destroy_qp(struct ib_device *ibdev,
qp->qpn = 0;
ib_qp_set_drvdata(qp, NULL);
- free_dma(golan_qp->doorbell_record, sizeof(struct golan_qp_db));
- free_dma ( golan_qp->wqes, GOLAN_PAGE_SIZE );
+ free_phys(golan_qp->doorbell_record, sizeof(struct golan_qp_db));
+ free_phys ( golan_qp->wqes, GOLAN_PAGE_SIZE );
free(golan_qp);
DBGC( golan ,"%s QP 0x%lx was destroyed\n", __FUNCTION__, qpn);