summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-06-18 10:22:30 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-06-18 10:22:30 +0000
commit54abe1cba7926386658d74d873059d72d8f08674 (patch)
treebfac8bc565a1bcc3f670610e9f7bfa8bf12e7e18 /sys/dev/ic
parent3626c537db61222d17e449f1b38c2993c8d2b29c (diff)
New rev. from Matt Thomas (June 7, 1996), which
(1) adds another parameter to PDQ_OS_VA_TO_PA() so that (via a hack) the driver works on more Alpha models, and (2) adds the definition PDQ_OS_PTR_FMT, which specifies what printf format to use when printing pointers. (%p under NetBSD.)
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/pdq.c83
-rw-r--r--sys/dev/ic/pdqvar.h17
2 files changed, 52 insertions, 48 deletions
diff --git a/sys/dev/ic/pdq.c b/sys/dev/ic/pdq.c
index 099ea3247a1..ccdb5b526a0 100644
--- a/sys/dev/ic/pdq.c
+++ b/sys/dev/ic/pdq.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pdq.c,v 1.3 1996/05/26 00:27:02 deraadt Exp $ */
-/* $NetBSD: pdq.c,v 1.5 1996/05/20 00:26:15 thorpej Exp $ */
+/* $OpenBSD: pdq.c,v 1.4 1996/06/18 10:22:28 deraadt Exp $ */
+/* $NetBSD: pdq.c,v 1.5.4.1 1996/06/08 00:17:44 cgd Exp $ */
/*-
* Copyright (c) 1995,1996 Matt Thomas <matt@3am-software.com>
@@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Id: pdq.c,v 1.26 1996/05/17 01:15:18 thomas Exp
+ * Id: pdq.c,v 1.27 1996/06/07 20:02:25 thomas Exp
*
*/
@@ -157,6 +157,9 @@ static const char * const * const pdq_pmd_types[] = {
static const char * const pdq_descriptions[] = {
"DEFPA PCI",
"DEFEA EISA",
+ "DEFTA TC",
+ "DEFAA Futurebus",
+ "DEFQA Q-bus",
};
static void
@@ -557,8 +560,6 @@ pdq_process_command_responses(
pdq_command_info_t * const ci = &pdq->pdq_command_info;
volatile const pdq_consumer_block_t * const cbp = pdq->pdq_cbp;
pdq_descriptor_block_t * const dbp = pdq->pdq_dbp;
- pdq_txdesc_t *txd;
- pdq_rxdesc_t *rxd;
const pdq_response_generic_t *rspgen;
/*
@@ -570,15 +571,13 @@ pdq_process_command_responses(
if (cbp->pdqcb_command_response == ci->ci_response_completion)
return;
- PDQ_ASSERT (cbp->pdqcb_command_request != ci->ci_request_completion);
-
- txd = &dbp->pdqdb_command_requests[ci->ci_request_completion];
- rxd = &dbp->pdqdb_command_responses[ci->ci_response_completion];
+ PDQ_ASSERT(cbp->pdqcb_command_request != ci->ci_request_completion);
rspgen = (const pdq_response_generic_t *) ci->ci_bufstart;
PDQ_ASSERT(rspgen->generic_status == PDQR_SUCCESS);
- PDQ_PRINTF(("PDQ Process Command Response: %s completed\n",
- pdq_cmd_info[rspgen->generic_op].cmd_name));
+ PDQ_PRINTF(("PDQ Process Command Response: %s completed (status=%d)\n",
+ pdq_cmd_info[rspgen->generic_op].cmd_name,
+ rspgen->generic_status));
if (rspgen->generic_op == PDQC_STATUS_CHARS_GET && (pdq->pdq_flags & PDQ_PRINTCHARS)) {
pdq->pdq_flags &= ~PDQ_PRINTCHARS;
@@ -782,7 +781,7 @@ pdq_process_received_data(
}
rxd->rxd_pa_hi = 0;
rxd->rxd_seg_len_hi = PDQ_OS_DATABUF_SIZE / 16;
- rxd->rxd_pa_lo = PDQ_OS_VA_TO_PA(PDQ_OS_DATABUF_PTR(buffers[rx->rx_producer]));
+ rxd->rxd_pa_lo = PDQ_OS_VA_TO_PA(pdq, PDQ_OS_DATABUF_PTR(buffers[rx->rx_producer]));
PDQ_ADVANCE(rx->rx_producer, 1, ring_mask);
PDQ_ADVANCE(producer, 1, ring_mask);
PDQ_ADVANCE(completion, 1, ring_mask);
@@ -812,7 +811,7 @@ pdq_process_received_data(
}
rxd->rxd_pa_hi = 0;
rxd->rxd_seg_len_hi = PDQ_OS_DATABUF_SIZE / 16;
- rxd->rxd_pa_lo = PDQ_OS_VA_TO_PA(PDQ_OS_DATABUF_PTR(pdu));
+ rxd->rxd_pa_lo = PDQ_OS_VA_TO_PA(pdq, PDQ_OS_DATABUF_PTR(pdu));
}
if (idx < PDQ_RX_SEGCNT) {
/*
@@ -863,7 +862,7 @@ pdq_queue_transmit_data(
*/
eop = &dbp->pdqdb_transmits[producer];
eop->txd_seg_len = seglen;
- eop->txd_pa_lo = PDQ_OS_VA_TO_PA(dataptr);
+ eop->txd_pa_lo = PDQ_OS_VA_TO_PA(pdq, dataptr);
eop->txd_sop = eop->txd_eop = eop->txd_pa_hi = 0;
datalen -= seglen;
@@ -1122,12 +1121,12 @@ pdq_stop(
pdq_do_port_control(csrs, PDQ_PCTL_SUB_CMD);
PDQ_CSR_WRITE(csrs, csr_port_data_b, 0);
- PDQ_CSR_WRITE(csrs, csr_port_data_a, PDQ_OS_VA_TO_PA(pdq->pdq_cbp));
+ PDQ_CSR_WRITE(csrs, csr_port_data_a, PDQ_OS_VA_TO_PA(pdq, pdq->pdq_cbp));
pdq_do_port_control(csrs, PDQ_PCTL_CONSUMER_BLOCK);
PDQ_CSR_WRITE(csrs, csr_port_data_b, 0);
PDQ_CSR_WRITE(csrs, csr_port_data_a,
- PDQ_OS_VA_TO_PA(pdq->pdq_dbp) | PDQ_DMA_INIT_LW_BSWAP_DATA);
+ PDQ_OS_VA_TO_PA(pdq, pdq->pdq_dbp) | PDQ_DMA_INIT_LW_BSWAP_DATA);
pdq_do_port_control(csrs, PDQ_PCTL_DMA_INIT);
for (cnt = 0; cnt < 1000; cnt++) {
@@ -1381,14 +1380,14 @@ pdq_initialize(
*/
p = (pdq_uint8_t *) PDQ_OS_MEMALLOC_CONTIG(contig_bytes);
if (p != NULL) {
- pdq_physaddr_t physaddr = PDQ_OS_VA_TO_PA(p);
+ pdq_physaddr_t physaddr = PDQ_OS_VA_TO_PA(pdq, p);
/*
* Assert that we really got contiguous memory. This isn't really
* needed on systems that actually have physical contiguous allocation
* routines, but on those systems that don't ...
*/
for (idx = PDQ_OS_PAGESIZE; idx < 0x2000; idx += PDQ_OS_PAGESIZE) {
- if (PDQ_OS_VA_TO_PA(p + idx) - physaddr != idx)
+ if (PDQ_OS_VA_TO_PA(pdq, p + idx) - physaddr != idx)
goto cleanup_and_return;
}
physaddr &= 0x1FFF;
@@ -1427,13 +1426,13 @@ pdq_initialize(
pdq->pdq_host_smt_info.rx_buffers = (void *) pdq->pdq_dbp->pdqdb_host_smt_buffers;
- PDQ_PRINTF(("PDQ Descriptor Block = %x\n", pdq->pdq_dbp));
- PDQ_PRINTF((" Recieve Queue = %x\n", pdq->pdq_dbp->pdqdb_receives));
- PDQ_PRINTF((" Transmit Queue = %x\n", pdq->pdq_dbp->pdqdb_transmits));
- PDQ_PRINTF((" Host SMT Queue = %x\n", pdq->pdq_dbp->pdqdb_host_smt));
- PDQ_PRINTF((" Command Response Queue = %x\n", pdq->pdq_dbp->pdqdb_command_responses));
- PDQ_PRINTF((" Command Request Queue = %x\n", pdq->pdq_dbp->pdqdb_command_requests));
- PDQ_PRINTF(("PDQ Consumer Block = %x\n", pdq->pdq_cbp));
+ PDQ_PRINTF(("\nPDQ Descriptor Block = " PDQ_OS_PTR_FMT "\n", pdq->pdq_dbp));
+ PDQ_PRINTF((" Recieve Queue = " PDQ_OS_PTR_FMT "\n", pdq->pdq_dbp->pdqdb_receives));
+ PDQ_PRINTF((" Transmit Queue = " PDQ_OS_PTR_FMT "\n", pdq->pdq_dbp->pdqdb_transmits));
+ PDQ_PRINTF((" Host SMT Queue = " PDQ_OS_PTR_FMT "\n", pdq->pdq_dbp->pdqdb_host_smt));
+ PDQ_PRINTF((" Command Response Queue = " PDQ_OS_PTR_FMT "\n", pdq->pdq_dbp->pdqdb_command_responses));
+ PDQ_PRINTF((" Command Request Queue = " PDQ_OS_PTR_FMT "\n", pdq->pdq_dbp->pdqdb_command_requests));
+ PDQ_PRINTF(("PDQ Consumer Block = " PDQ_OS_PTR_FMT "\n", pdq->pdq_cbp));
/*
* Zero out the descriptor block. Not really required but
@@ -1451,38 +1450,38 @@ pdq_initialize(
if (pdq->pdq_type == PDQ_DEFPA)
pdq_init_pci_csrs(&pdq->pdq_pci_csrs, bus, csr_base, 1);
- PDQ_PRINTF(("PDQ CSRs: BASE = %x\n", pdq->pdq_csrs.csr_base));
- PDQ_PRINTF((" Port Reset = %x [0x%08x]\n",
+ PDQ_PRINTF(("PDQ CSRs: BASE = " PDQ_OS_PTR_FMT "\n", pdq->pdq_csrs.csr_base));
+ PDQ_PRINTF((" Port Reset = " PDQ_OS_PTR_FMT " [0x%08x]\n",
pdq->pdq_csrs.csr_port_reset, PDQ_CSR_READ(&pdq->pdq_csrs, csr_port_reset)));
- PDQ_PRINTF((" Host Data = %x [0x%08x]\n",
+ PDQ_PRINTF((" Host Data = " PDQ_OS_PTR_FMT " [0x%08x]\n",
pdq->pdq_csrs.csr_host_data, PDQ_CSR_READ(&pdq->pdq_csrs, csr_host_data)));
- PDQ_PRINTF((" Port Control = %x [0x%08x]\n",
+ PDQ_PRINTF((" Port Control = " PDQ_OS_PTR_FMT " [0x%08x]\n",
pdq->pdq_csrs.csr_port_control, PDQ_CSR_READ(&pdq->pdq_csrs, csr_port_control)));
- PDQ_PRINTF((" Port Data A = %x [0x%08x]\n",
+ PDQ_PRINTF((" Port Data A = " PDQ_OS_PTR_FMT " [0x%08x]\n",
pdq->pdq_csrs.csr_port_data_a, PDQ_CSR_READ(&pdq->pdq_csrs, csr_port_data_a)));
- PDQ_PRINTF((" Port Data B = %x [0x%08x]\n",
+ PDQ_PRINTF((" Port Data B = " PDQ_OS_PTR_FMT " [0x%08x]\n",
pdq->pdq_csrs.csr_port_data_b, PDQ_CSR_READ(&pdq->pdq_csrs, csr_port_data_b)));
- PDQ_PRINTF((" Port Status = %x [0x%08x]\n",
+ PDQ_PRINTF((" Port Status = " PDQ_OS_PTR_FMT " [0x%08x]\n",
pdq->pdq_csrs.csr_port_status, PDQ_CSR_READ(&pdq->pdq_csrs, csr_port_status)));
- PDQ_PRINTF((" Host Int Type 0 = %x [0x%08x]\n",
+ PDQ_PRINTF((" Host Int Type 0 = " PDQ_OS_PTR_FMT " [0x%08x]\n",
pdq->pdq_csrs.csr_host_int_type_0, PDQ_CSR_READ(&pdq->pdq_csrs, csr_host_int_type_0)));
- PDQ_PRINTF((" Host Int Enable = %x [0x%08x]\n",
+ PDQ_PRINTF((" Host Int Enable = " PDQ_OS_PTR_FMT " [0x%08x]\n",
pdq->pdq_csrs.csr_host_int_enable, PDQ_CSR_READ(&pdq->pdq_csrs, csr_host_int_enable)));
- PDQ_PRINTF((" Type 2 Producer = %x [0x%08x]\n",
+ PDQ_PRINTF((" Type 2 Producer = " PDQ_OS_PTR_FMT " [0x%08x]\n",
pdq->pdq_csrs.csr_type_2_producer, PDQ_CSR_READ(&pdq->pdq_csrs, csr_type_2_producer)));
- PDQ_PRINTF((" Command Response Producer = %x [0x%08x]\n",
+ PDQ_PRINTF((" Command Response Producer = " PDQ_OS_PTR_FMT " [0x%08x]\n",
pdq->pdq_csrs.csr_cmd_response_producer, PDQ_CSR_READ(&pdq->pdq_csrs, csr_cmd_response_producer)));
- PDQ_PRINTF((" Command Request Producer = %x [0x%08x]\n",
+ PDQ_PRINTF((" Command Request Producer = " PDQ_OS_PTR_FMT " [0x%08x]\n",
pdq->pdq_csrs.csr_cmd_request_producer, PDQ_CSR_READ(&pdq->pdq_csrs, csr_cmd_request_producer)));
- PDQ_PRINTF((" Host SMT Producer = %x [0x%08x]\n",
+ PDQ_PRINTF((" Host SMT Producer = " PDQ_OS_PTR_FMT " [0x%08x]\n",
pdq->pdq_csrs.csr_host_smt_producer, PDQ_CSR_READ(&pdq->pdq_csrs, csr_host_smt_producer)));
- PDQ_PRINTF((" Unsolicited Producer = %x [0x%08x]\n",
+ PDQ_PRINTF((" Unsolicited Producer = " PDQ_OS_PTR_FMT " [0x%08x]\n",
pdq->pdq_csrs.csr_unsolicited_producer, PDQ_CSR_READ(&pdq->pdq_csrs, csr_unsolicited_producer)));
/*
* Initialize the command information block
*/
- pdq->pdq_command_info.ci_pa_bufstart = PDQ_OS_VA_TO_PA(pdq->pdq_command_info.ci_bufstart);
+ pdq->pdq_command_info.ci_pa_bufstart = PDQ_OS_VA_TO_PA(pdq, pdq->pdq_command_info.ci_bufstart);
for (idx = 0; idx < sizeof(pdq->pdq_dbp->pdqdb_command_requests)/sizeof(pdq->pdq_dbp->pdqdb_command_requests[0]); idx++) {
pdq_txdesc_t *txd = &pdq->pdq_dbp->pdqdb_command_requests[idx];
@@ -1503,7 +1502,7 @@ pdq_initialize(
* Initialize the unsolicited event information block
*/
pdq->pdq_unsolicited_info.ui_free = PDQ_NUM_UNSOLICITED_EVENTS;
- pdq->pdq_unsolicited_info.ui_pa_bufstart = PDQ_OS_VA_TO_PA(pdq->pdq_unsolicited_info.ui_events);
+ pdq->pdq_unsolicited_info.ui_pa_bufstart = PDQ_OS_VA_TO_PA(pdq, pdq->pdq_unsolicited_info.ui_events);
for (idx = 0; idx < sizeof(pdq->pdq_dbp->pdqdb_unsolicited_events)/sizeof(pdq->pdq_dbp->pdqdb_unsolicited_events[0]); idx++) {
pdq_rxdesc_t *rxd = &pdq->pdq_dbp->pdqdb_unsolicited_events[idx];
pdq_unsolicited_event_t *event = &pdq->pdq_unsolicited_info.ui_events[idx & (PDQ_NUM_UNSOLICITED_EVENTS-1)];
@@ -1533,7 +1532,7 @@ pdq_initialize(
pdq->pdq_tx_info.tx_free = PDQ_RING_MASK(pdq->pdq_dbp->pdqdb_transmits);
pdq->pdq_tx_info.tx_hdrdesc.txd_seg_len = sizeof(pdq->pdq_tx_hdr);
pdq->pdq_tx_info.tx_hdrdesc.txd_sop = 1;
- pdq->pdq_tx_info.tx_hdrdesc.txd_pa_lo = PDQ_OS_VA_TO_PA(pdq->pdq_tx_hdr);
+ pdq->pdq_tx_info.tx_hdrdesc.txd_pa_lo = PDQ_OS_VA_TO_PA(pdq, pdq->pdq_tx_hdr);
state = PDQ_PSTS_ADAPTER_STATE(PDQ_CSR_READ(&pdq->pdq_csrs, csr_port_status));
PDQ_PRINTF(("PDQ Adapter State = %s\n", pdq_adapter_states[state]));
diff --git a/sys/dev/ic/pdqvar.h b/sys/dev/ic/pdqvar.h
index b8eaab5d6da..aa476e8818e 100644
--- a/sys/dev/ic/pdqvar.h
+++ b/sys/dev/ic/pdqvar.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: pdqvar.h,v 1.4 1996/05/26 00:27:05 deraadt Exp $ */
-/* $NetBSD: pdqvar.h,v 1.6 1996/05/20 00:26:26 thorpej Exp $ */
+/* $OpenBSD: pdqvar.h,v 1.5 1996/06/18 10:22:29 deraadt Exp $ */
+/* $NetBSD: pdqvar.h,v 1.6.4.1 1996/06/08 00:17:49 cgd Exp $ */
/*-
* Copyright (c) 1995, 1996 Matt Thomas <matt@3am-software.com>
@@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Id: pdqvar.h,v 1.17 1996/05/17 01:15:18 thomas Exp
+ * Id: pdqvar.h,v 1.18 1996/06/07 20:02:25 thomas Exp
*
*/
@@ -84,9 +84,9 @@ enum _pdq_type_t {
#define PDQ_OS_USEC_DELAY(n) DELAY(n)
#define PDQ_OS_MEMZERO(p, n) bzero((caddr_t)(p), (n))
#if defined(__NetBSD__) && defined(__alpha__)
-#define PDQ_OS_VA_TO_PA(p) (vtophys(p) | 0x40000000)
+#define PDQ_OS_VA_TO_PA(pdq, p) (vtophys(p) | (pdq->pdq_type == PDQ_DEFTA ? 0 : 0x40000000))
#else
-#define PDQ_OS_VA_TO_PA(p) vtophys(p)
+#define PDQ_OS_VA_TO_PA(pdq, p) vtophys(p)
#endif
#define PDQ_OS_MEMALLOC(n) malloc(n, M_DEVBUF, M_NOWAIT)
#define PDQ_OS_MEMFREE(p, n) free((void *) p, M_DEVBUF)
@@ -128,6 +128,7 @@ typedef pdq_bus_memaddr_t pdq_bus_memoffset_t;
#elif defined(__NetBSD__)
#include <machine/bus.h>
#include <machine/intr.h>
+#define PDQ_OS_PTR_FMT "%p"
typedef void ifnet_ret_t;
typedef u_long ioctl_cmd_t;
typedef bus_chipset_tag_t pdq_bus_t;
@@ -165,6 +166,10 @@ typedef pdq_uint32_t pdq_bus_memoffset_t;
#define PDQ_BPFATTACH(sc, t, s) bpfattach(&(sc)->sc_bpf, &(sc)->sc_if, t, s)
#endif
+#if !defined(PDQ_OS_PTR_FMT)
+#define PDQ_OS_PTR_FMT "0x%x"
+#endif
+
#if !defined(PDQ_OS_IOMEM)
#define PDQ_OS_IORD_32(t, base, offset) inl((base) + (offset))
#define PDQ_OS_IOWR_32(t, base, offset, data) outl((base) + (offset), data)
@@ -239,7 +244,7 @@ extern void pdq_ifattach(pdq_softc_t *sc, ifnet_ret_t (*ifwatchdog)(int unit));
#define PDQ_OS_PAGESIZE PAGESIZE
#define PDQ_OS_USEC_DELAY(n) drv_usecwait(n)
#define PDQ_OS_MEMZERO(p, n) bzero((caddr_t)(p), (n))
-#define PDQ_OS_VA_TO_PA(p) vtop((caddr_t)p, NULL)
+#define PDQ_OS_VA_TO_PA(pdq, p) vtop((caddr_t)p, NULL)
#define PDQ_OS_MEMALLOC(n) kmem_zalloc(n, KM_NOSLEEP)
#define PDQ_OS_MEMFREE(p, n) kmem_free((caddr_t) p, n)
#define PDQ_OS_MEMALLOC_CONTIG(n) kmem_zalloc_physreq(n, decfddiphysreq_db, KM_NOSLEEP)