summaryrefslogtreecommitdiffstats
path: root/sys/dev/hfa
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/hfa')
-rw-r--r--sys/dev/hfa/fore_buffer.c48
-rw-r--r--sys/dev/hfa/fore_command.c11
-rw-r--r--sys/dev/hfa/fore_init.c4
-rw-r--r--sys/dev/hfa/fore_output.c4
-rw-r--r--sys/dev/hfa/fore_receive.c25
-rw-r--r--sys/dev/hfa/fore_stats.c4
-rw-r--r--sys/dev/hfa/fore_transmit.c13
-rw-r--r--sys/dev/hfa/fore_var.h26
8 files changed, 74 insertions, 61 deletions
diff --git a/sys/dev/hfa/fore_buffer.c b/sys/dev/hfa/fore_buffer.c
index d03f315..491733a 100644
--- a/sys/dev/hfa/fore_buffer.c
+++ b/sys/dev/hfa/fore_buffer.c
@@ -92,6 +92,7 @@ fore_buf_allocate(fup)
Fore_unit *fup;
{
caddr_t memp;
+ vm_paddr_t pmemp;
/*
* Allocate non-cacheable memory for buffer supply status words
@@ -105,12 +106,17 @@ fore_buf_allocate(fup)
fup->fu_buf1s_stat = (Q_status *) memp;
fup->fu_buf1l_stat = ((Q_status *) memp) + BUF1_SM_QUELEN;
- memp = (caddr_t)vtophys(fup->fu_buf1s_stat);
- if (memp == NULL) {
+ pmemp = vtophys(fup->fu_buf1s_stat);
+ if (pmemp == 0) {
return (1);
}
- fup->fu_buf1s_statd = (Q_status *) memp;
- fup->fu_buf1l_statd = ((Q_status *) memp) + BUF1_SM_QUELEN;
+ fup->fu_buf1s_statd = pmemp;
+
+ pmemp = vtophys(fup->fu_buf1l_stat);
+ if (pmemp == 0) {
+ return (1);
+ }
+ fup->fu_buf1l_statd = pmemp;
/*
* Allocate memory for buffer supply descriptors
@@ -126,13 +132,17 @@ fore_buf_allocate(fup)
fup->fu_buf1l_desc = ((Buf_descr *) memp) +
(BUF1_SM_QUELEN * BUF1_SM_ENTSIZE);
- memp = (caddr_t)vtophys(fup->fu_buf1s_desc);
- if (memp == NULL) {
+ pmemp = vtophys(fup->fu_buf1s_desc);
+ if (pmemp == 0) {
return (1);
}
- fup->fu_buf1s_descd = (Buf_descr *) memp;
- fup->fu_buf1l_descd = ((Buf_descr *) memp) +
- (BUF1_SM_QUELEN * BUF1_SM_ENTSIZE);
+ fup->fu_buf1s_descd = pmemp;
+
+ pmemp = vtophys(fup->fu_buf1l_desc);
+ if (pmemp == 0) {
+ return (1);
+ }
+ fup->fu_buf1l_descd = pmemp;
return (0);
}
@@ -160,9 +170,9 @@ fore_buf_initialize(fup)
Buf_queue *cqp;
H_buf_queue *hbp;
Buf_descr *bdp;
- Buf_descr *bdp_dma;
+ vm_paddr_t bdp_dma;
Q_status *qsp;
- Q_status *qsp_dma;
+ vm_paddr_t qsp_dma;
int i;
/*
@@ -215,9 +225,9 @@ fore_buf_initialize(fup)
*/
hbp++;
qsp++;
- qsp_dma++;
+ qsp_dma += sizeof(Q_status);
bdp += BUF1_SM_ENTSIZE;
- bdp_dma += BUF1_SM_ENTSIZE;
+ bdp_dma += BUF1_SM_ENTSIZE * sizeof(Buf_descr);
cqp++;
}
@@ -277,9 +287,9 @@ fore_buf_initialize(fup)
*/
hbp++;
qsp++;
- qsp_dma++;
+ qsp_dma += sizeof(Q_status);
bdp += BUF1_LG_ENTSIZE;
- bdp_dma += BUF1_LG_ENTSIZE;
+ bdp_dma += BUF1_LG_ENTSIZE * sizeof(Buf_descr);
cqp++;
}
@@ -755,9 +765,9 @@ fore_buf_free(fup)
if (fup->fu_buf1s_stat) {
atm_dev_free((volatile void *)fup->fu_buf1s_stat);
fup->fu_buf1s_stat = NULL;
- fup->fu_buf1s_statd = NULL;
+ fup->fu_buf1s_statd = 0;
fup->fu_buf1l_stat = NULL;
- fup->fu_buf1l_statd = NULL;
+ fup->fu_buf1l_statd = 0;
}
/*
@@ -766,9 +776,9 @@ fore_buf_free(fup)
if (fup->fu_buf1s_desc) {
atm_dev_free(fup->fu_buf1s_desc);
fup->fu_buf1s_desc = NULL;
- fup->fu_buf1s_descd = NULL;
+ fup->fu_buf1s_descd = 0;
fup->fu_buf1l_desc = NULL;
- fup->fu_buf1l_descd = NULL;
+ fup->fu_buf1l_descd = 0;
}
return;
diff --git a/sys/dev/hfa/fore_command.c b/sys/dev/hfa/fore_command.c
index f2208c6..fccb659 100644
--- a/sys/dev/hfa/fore_command.c
+++ b/sys/dev/hfa/fore_command.c
@@ -92,6 +92,7 @@ fore_cmd_allocate(fup)
Fore_unit *fup;
{
caddr_t memp;
+ vm_paddr_t pmemp;
/*
* Allocate non-cacheable memory for command status words
@@ -103,11 +104,11 @@ fore_cmd_allocate(fup)
}
fup->fu_cmd_stat = (Q_status *) memp;
- memp = (caddr_t)vtophys(fup->fu_cmd_stat);
- if (memp == NULL) {
+ pmemp = vtophys(fup->fu_cmd_stat);
+ if (pmemp == NULL) {
return (1);
}
- fup->fu_cmd_statd = (Q_status *) memp;
+ fup->fu_cmd_statd = pmemp;
/*
* Allocate memory for statistics buffer
@@ -153,7 +154,7 @@ fore_cmd_initialize(fup)
Cmd_queue *cqp;
H_cmd_queue *hcp;
Q_status *qsp;
- Q_status *qsp_dma;
+ vm_paddr_t qsp_dma;
int i;
/*
@@ -198,7 +199,7 @@ fore_cmd_initialize(fup)
*/
hcp++;
qsp++;
- qsp_dma++;
+ qsp_dma += sizeof(Q_status);
cqp++;
}
diff --git a/sys/dev/hfa/fore_init.c b/sys/dev/hfa/fore_init.c
index 1a3e695..6124bda 100644
--- a/sys/dev/hfa/fore_init.c
+++ b/sys/dev/hfa/fore_init.c
@@ -360,8 +360,8 @@ fore_get_prom(fup)
cqp = hcp->hcq_cpelem;
(*hcp->hcq_status) = QSTAT_PENDING;
- fup->fu_promd = (Fore_prom *)vtophys(fup->fu_prom);
- if (fup->fu_promd == NULL) {
+ fup->fu_promd = vtophys(fup->fu_prom);
+ if (fup->fu_promd == 0) {
fup->fu_stats->st_drv.drv_cm_nodma++;
return;
}
diff --git a/sys/dev/hfa/fore_output.c b/sys/dev/hfa/fore_output.c
index 02266fd..c8156ec 100644
--- a/sys/dev/hfa/fore_output.c
+++ b/sys/dev/hfa/fore_output.c
@@ -264,7 +264,7 @@ fore_xmit_segment(fup, m, hxp, segp, lenp)
H_dma *sdmap;
KBuffer *m0, *m1, *mprev;
caddr_t cp, bfr;
- void *dma;
+ vm_paddr_t dma;
int pdulen, nsegs, len, align;
int compressed = 0;
@@ -404,7 +404,7 @@ retry:
/*
* Get a DMA address for the data
*/
- dma = (void *)vtophys(bfr);
+ dma = vtophys(bfr);
if (dma == NULL) {
fup->fu_stats->st_drv.drv_xm_segdma++;
fore_seg_dma_free(hxp, m0, nsegs);
diff --git a/sys/dev/hfa/fore_receive.c b/sys/dev/hfa/fore_receive.c
index 881cc87..5d89522 100644
--- a/sys/dev/hfa/fore_receive.c
+++ b/sys/dev/hfa/fore_receive.c
@@ -87,6 +87,7 @@ fore_recv_allocate(fup)
Fore_unit *fup;
{
caddr_t memp;
+ vm_paddr_t pmemp;
/*
* Allocate non-cacheable memory for receive status words
@@ -98,11 +99,11 @@ fore_recv_allocate(fup)
}
fup->fu_recv_stat = (Q_status *) memp;
- memp = (caddr_t)vtophys(fup->fu_recv_stat);
- if (memp == NULL) {
+ pmemp = vtophys(fup->fu_recv_stat);
+ if (pmemp == 0) {
return (1);
}
- fup->fu_recv_statd = (Q_status *) memp;
+ fup->fu_recv_statd = pmemp;
/*
* Allocate memory for receive descriptors
@@ -114,11 +115,11 @@ fore_recv_allocate(fup)
}
fup->fu_recv_desc = (Recv_descr *) memp;
- memp = (caddr_t)vtophys(fup->fu_recv_desc);
- if (memp == NULL) {
+ pmemp = vtophys(fup->fu_recv_desc);
+ if (pmemp == 0) {
return (1);
}
- fup->fu_recv_descd = (Recv_descr *) memp;
+ fup->fu_recv_descd = pmemp;
return (0);
}
@@ -146,9 +147,9 @@ fore_recv_initialize(fup)
Recv_queue *cqp;
H_recv_queue *hrp;
Recv_descr *rdp;
- Recv_descr *rdp_dma;
+ vm_paddr_t rdp_dma;
Q_status *qsp;
- Q_status *qsp_dma;
+ vm_paddr_t qsp_dma;
int i;
/*
@@ -198,9 +199,9 @@ fore_recv_initialize(fup)
*/
hrp++;
qsp++;
- qsp_dma++;
+ qsp_dma += sizeof(Q_status);
rdp++;
- rdp_dma++;
+ rdp_dma += sizeof(Recv_descr);
cqp++;
}
@@ -577,7 +578,7 @@ fore_recv_free(fup)
if (fup->fu_recv_stat) {
atm_dev_free((volatile void *)fup->fu_recv_stat);
fup->fu_recv_stat = NULL;
- fup->fu_recv_statd = NULL;
+ fup->fu_recv_statd = 0;
}
/*
@@ -586,7 +587,7 @@ fore_recv_free(fup)
if (fup->fu_recv_desc) {
atm_dev_free(fup->fu_recv_desc);
fup->fu_recv_desc = NULL;
- fup->fu_recv_descd = NULL;
+ fup->fu_recv_descd = 0;
}
return;
diff --git a/sys/dev/hfa/fore_stats.c b/sys/dev/hfa/fore_stats.c
index 9158793..3440334 100644
--- a/sys/dev/hfa/fore_stats.c
+++ b/sys/dev/hfa/fore_stats.c
@@ -130,7 +130,7 @@ fore_get_stats(fup)
*/
hcp = fup->fu_cmd_tail;
if ((*hcp->hcq_status) & QSTAT_FREE) {
- void *dma;
+ vm_paddr_t dma;
/*
* Queue entry available, so set our view of things up
@@ -146,7 +146,7 @@ fore_get_stats(fup)
cqp = hcp->hcq_cpelem;
(*hcp->hcq_status) = QSTAT_PENDING;
- dma = (void *)vtophys(fup->fu_stats);
+ dma = vtophys(fup->fu_stats);
if (dma == NULL) {
fup->fu_stats->st_drv.drv_cm_nodma++;
(void) splx(s);
diff --git a/sys/dev/hfa/fore_transmit.c b/sys/dev/hfa/fore_transmit.c
index 4aff05f..6687c6e 100644
--- a/sys/dev/hfa/fore_transmit.c
+++ b/sys/dev/hfa/fore_transmit.c
@@ -79,6 +79,7 @@ fore_xmit_allocate(fup)
Fore_unit *fup;
{
void *memp;
+ vm_paddr_t pmemp;
H_xmit_queue *hxp;
int i;
@@ -92,11 +93,11 @@ fore_xmit_allocate(fup)
}
fup->fu_xmit_stat = (Q_status *) memp;
- memp = (void *)vtophys(fup->fu_xmit_stat);
- if (memp == NULL) {
+ pmemp = vtophys(fup->fu_xmit_stat);
+ if (pmemp == NULL) {
return (1);
}
- fup->fu_xmit_statd = (Q_status *) memp;
+ fup->fu_xmit_statd = pmemp;
/*
* Allocate memory for transmit descriptors
@@ -118,7 +119,7 @@ fore_xmit_allocate(fup)
return (1);
}
- hxp->hxq_descr_dma = (Xmit_descr *)vtophys(hxp->hxq_descr);
+ hxp->hxq_descr_dma = vtophys(hxp->hxq_descr);
if (hxp->hxq_descr_dma == NULL) {
return (1);
}
@@ -150,7 +151,7 @@ fore_xmit_initialize(fup)
Xmit_queue *cqp;
H_xmit_queue *hxp;
Q_status *qsp;
- Q_status *qsp_dma;
+ vm_paddr_t qsp_dma;
int i;
/*
@@ -195,7 +196,7 @@ fore_xmit_initialize(fup)
*/
hxp++;
qsp++;
- qsp_dma++;
+ qsp_dma += sizeof(Q_status);
cqp++;
}
diff --git a/sys/dev/hfa/fore_var.h b/sys/dev/hfa/fore_var.h
index f44d1c3..d0f05b8 100644
--- a/sys/dev/hfa/fore_var.h
+++ b/sys/dev/hfa/fore_var.h
@@ -74,7 +74,7 @@ struct h_xmit_queue {
Xmit_queue *hxq_cpelem; /* CP queue element */
Q_status *hxq_status; /* Element status word */
Xmit_descr *hxq_descr; /* Element's transmit descriptor */
- Xmit_descr *hxq_descr_dma; /* Element's transmit descriptor */
+ vm_paddr_t hxq_descr_dma; /* Element's transmit descriptor */
Fore_vcc *hxq_vcc; /* Data's VCC */
KBuffer *hxq_buf; /* Data's buffer chain head */
H_dma hxq_dma[XMIT_MAX_SEGS]; /* DMA addresses for segments */
@@ -93,7 +93,7 @@ struct h_recv_queue {
Recv_queue *hrq_cpelem; /* CP queue element */
Q_status *hrq_status; /* Element status word */
Recv_descr *hrq_descr; /* Element's receive descriptor */
- Recv_descr *hrq_descr_dma; /* Element's receive descriptor */
+ vm_paddr_t hrq_descr_dma; /* Element's receive descriptor */
};
typedef struct h_recv_queue H_recv_queue;
@@ -109,7 +109,7 @@ struct h_buf_queue {
Buf_queue *hbq_cpelem; /* CP queue element */
Q_status *hbq_status; /* Element status word */
Buf_descr *hbq_descr; /* Element's buffer descriptor array */
- Buf_descr *hbq_descr_dma; /* Element's buffer descriptor array */
+ vm_paddr_t hbq_descr_dma; /* Element's buffer descriptor array */
};
typedef struct h_buf_queue H_buf_queue;
@@ -181,24 +181,24 @@ struct fore_unit {
H_xmit_queue *fu_xmit_head; /* Queue head */
H_xmit_queue *fu_xmit_tail; /* Queue tail */
Q_status *fu_xmit_stat; /* Status array (host) */
- Q_status *fu_xmit_statd; /* Status array (DMA) */
+ vm_paddr_t fu_xmit_statd; /* Status array (DMA) */
/* Receive Queue */
H_recv_queue fu_recv_q[RECV_QUELEN]; /* Host queue */
H_recv_queue *fu_recv_head; /* Queue head */
Q_status *fu_recv_stat; /* Status array (host) */
- Q_status *fu_recv_statd; /* Status array (DMA) */
+ vm_paddr_t fu_recv_statd; /* Status array (DMA) */
Recv_descr *fu_recv_desc; /* Descriptor array (host) */
- Recv_descr *fu_recv_descd; /* Descriptor array (DMA) */
+ vm_paddr_t fu_recv_descd; /* Descriptor array (DMA) */
/* Buffer Supply Queue - Strategy 1 Small */
H_buf_queue fu_buf1s_q[BUF1_SM_QUELEN]; /* Host queue */
H_buf_queue *fu_buf1s_head; /* Queue head */
H_buf_queue *fu_buf1s_tail; /* Queue tail */
Q_status *fu_buf1s_stat; /* Status array (host) */
- Q_status *fu_buf1s_statd;/* Status array (DMA) */
+ vm_paddr_t fu_buf1s_statd;/* Status array (DMA) */
Buf_descr *fu_buf1s_desc; /* Descriptor array (host) */
- Buf_descr *fu_buf1s_descd;/* Descriptor array (DMA) */
+ vm_paddr_t fu_buf1s_descd;/* Descriptor array (DMA) */
Queue_t fu_buf1s_bq; /* Queue of supplied buffers */
u_int fu_buf1s_cnt; /* Count of supplied buffers */
@@ -207,9 +207,9 @@ struct fore_unit {
H_buf_queue *fu_buf1l_head; /* Queue head */
H_buf_queue *fu_buf1l_tail; /* Queue tail */
Q_status *fu_buf1l_stat; /* Status array (host) */
- Q_status *fu_buf1l_statd;/* Status array (DMA) */
+ vm_paddr_t fu_buf1l_statd;/* Status array (DMA) */
Buf_descr *fu_buf1l_desc; /* Descriptor array (host) */
- Buf_descr *fu_buf1l_descd;/* Descriptor array (DMA) */
+ vm_paddr_t fu_buf1l_descd;/* Descriptor array (DMA) */
Queue_t fu_buf1l_bq; /* Queue of supplied buffers */
u_int fu_buf1l_cnt; /* Count of supplied buffers */
@@ -218,14 +218,14 @@ struct fore_unit {
H_cmd_queue *fu_cmd_head; /* Queue head */
H_cmd_queue *fu_cmd_tail; /* Queue tail */
Q_status *fu_cmd_stat; /* Status array (host) */
- Q_status *fu_cmd_statd; /* Status array (DMA) */
+ vm_paddr_t fu_cmd_statd; /* Status array (DMA) */
Fore_stats *fu_stats; /* Device statistics buffer */
- Fore_stats *fu_statsd; /* Device statistics buffer (DMA) */
+ vm_paddr_t fu_statsd; /* Device statistics buffer (DMA) */
time_t fu_stats_time; /* Last stats request timestamp */
int fu_stats_ret; /* Stats request return code */
Fore_prom *fu_prom; /* Device PROM buffer */
- Fore_prom *fu_promd; /* Device PROM buffer (DMA) */
+ vm_paddr_t fu_promd; /* Device PROM buffer (DMA) */
struct callout_handle fu_thandle; /* Timer handle */
int fu_ft4; /* Running ForeThought 4 firmware */
OpenPOWER on IntegriCloud