mirror of
https://github.com/ipxe/ipxe
synced 2026-02-28 03:11:18 +03:00
[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>
This commit is contained in:
@@ -164,7 +164,7 @@ static int ena_create_admin ( struct ena_nic *ena ) {
|
||||
int rc;
|
||||
|
||||
/* Allocate admin completion queue */
|
||||
ena->acq.rsp = malloc_dma ( acq_len, acq_len );
|
||||
ena->acq.rsp = malloc_phys ( acq_len, acq_len );
|
||||
if ( ! ena->acq.rsp ) {
|
||||
rc = -ENOMEM;
|
||||
goto err_alloc_acq;
|
||||
@@ -172,7 +172,7 @@ static int ena_create_admin ( struct ena_nic *ena ) {
|
||||
memset ( ena->acq.rsp, 0, acq_len );
|
||||
|
||||
/* Allocate admin queue */
|
||||
ena->aq.req = malloc_dma ( aq_len, aq_len );
|
||||
ena->aq.req = malloc_phys ( aq_len, aq_len );
|
||||
if ( ! ena->aq.req ) {
|
||||
rc = -ENOMEM;
|
||||
goto err_alloc_aq;
|
||||
@@ -196,9 +196,9 @@ static int ena_create_admin ( struct ena_nic *ena ) {
|
||||
|
||||
ena_clear_caps ( ena, ENA_AQ_CAPS );
|
||||
ena_clear_caps ( ena, ENA_ACQ_CAPS );
|
||||
free_dma ( ena->aq.req, aq_len );
|
||||
free_phys ( ena->aq.req, aq_len );
|
||||
err_alloc_aq:
|
||||
free_dma ( ena->acq.rsp, acq_len );
|
||||
free_phys ( ena->acq.rsp, acq_len );
|
||||
err_alloc_acq:
|
||||
return rc;
|
||||
}
|
||||
@@ -218,8 +218,8 @@ static void ena_destroy_admin ( struct ena_nic *ena ) {
|
||||
wmb();
|
||||
|
||||
/* Free queues */
|
||||
free_dma ( ena->aq.req, aq_len );
|
||||
free_dma ( ena->acq.rsp, acq_len );
|
||||
free_phys ( ena->aq.req, aq_len );
|
||||
free_phys ( ena->acq.rsp, acq_len );
|
||||
DBGC ( ena, "ENA %p AQ and ACQ destroyed\n", ena );
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ static int ena_create_sq ( struct ena_nic *ena, struct ena_sq *sq,
|
||||
int rc;
|
||||
|
||||
/* Allocate submission queue entries */
|
||||
sq->sqe.raw = malloc_dma ( sq->len, ENA_ALIGN );
|
||||
sq->sqe.raw = malloc_phys ( sq->len, ENA_ALIGN );
|
||||
if ( ! sq->sqe.raw ) {
|
||||
rc = -ENOMEM;
|
||||
goto err_alloc;
|
||||
@@ -375,7 +375,7 @@ static int ena_create_sq ( struct ena_nic *ena, struct ena_sq *sq,
|
||||
return 0;
|
||||
|
||||
err_admin:
|
||||
free_dma ( sq->sqe.raw, sq->len );
|
||||
free_phys ( sq->sqe.raw, sq->len );
|
||||
err_alloc:
|
||||
return rc;
|
||||
}
|
||||
@@ -403,7 +403,7 @@ static int ena_destroy_sq ( struct ena_nic *ena, struct ena_sq *sq ) {
|
||||
return rc;
|
||||
|
||||
/* Free submission queue entries */
|
||||
free_dma ( sq->sqe.raw, sq->len );
|
||||
free_phys ( sq->sqe.raw, sq->len );
|
||||
|
||||
DBGC ( ena, "ENA %p %s SQ%d destroyed\n",
|
||||
ena, ena_direction ( sq->direction ), sq->id );
|
||||
@@ -423,7 +423,7 @@ static int ena_create_cq ( struct ena_nic *ena, struct ena_cq *cq ) {
|
||||
int rc;
|
||||
|
||||
/* Allocate completion queue entries */
|
||||
cq->cqe.raw = malloc_dma ( cq->len, ENA_ALIGN );
|
||||
cq->cqe.raw = malloc_phys ( cq->len, ENA_ALIGN );
|
||||
if ( ! cq->cqe.raw ) {
|
||||
rc = -ENOMEM;
|
||||
goto err_alloc;
|
||||
@@ -461,7 +461,7 @@ static int ena_create_cq ( struct ena_nic *ena, struct ena_cq *cq ) {
|
||||
return 0;
|
||||
|
||||
err_admin:
|
||||
free_dma ( cq->cqe.raw, cq->len );
|
||||
free_phys ( cq->cqe.raw, cq->len );
|
||||
err_alloc:
|
||||
return rc;
|
||||
}
|
||||
@@ -488,7 +488,7 @@ static int ena_destroy_cq ( struct ena_nic *ena, struct ena_cq *cq ) {
|
||||
return rc;
|
||||
|
||||
/* Free completion queue entries */
|
||||
free_dma ( cq->cqe.raw, cq->len );
|
||||
free_phys ( cq->cqe.raw, cq->len );
|
||||
|
||||
DBGC ( ena, "ENA %p CQ%d destroyed\n", ena, cq->id );
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user