Allocate the DMA windows out of the PCI memory extent map after

DMA is initialized.
This commit is contained in:
thorpej 2000-11-29 06:30:09 +00:00
parent 96294f7b26
commit 5f3a256833
3 changed files with 47 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: tsc.c,v 1.4 2000/06/26 18:19:27 thorpej Exp $ */
/* $NetBSD: tsc.c,v 1.5 2000/11/29 06:30:09 thorpej Exp $ */
/*-
* Copyright (c) 1999 by Ross Harvey. All rights reserved.
@ -35,7 +35,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.4 2000/06/26 18:19:27 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.5 2000/11/29 06:30:09 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -180,8 +180,18 @@ tspattach(parent, self, aux)
printf("\n");
pcp = tsp_init(1, t->tsp_slot);
tsp_dma_init(pcp);
/*
* Do PCI memory initialization that needs to be deferred until
* malloc is safe. On the Tsunami, we need to do this after
* DMA is initialized, as well.
*/
tsp_bus_mem_init2(&pcp->pc_memt, pcp);
pci_6600_pickintr(pcp);
pba.pba_busname = "pci";
pba.pba_iot = &pcp->pc_iot;
pba.pba_memt = &pcp->pc_memt;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tsp_bus_mem.c,v 1.5 2000/06/29 08:58:50 mrg Exp $ */
/* $NetBSD: tsp_bus_mem.c,v 1.6 2000/11/29 06:30:09 thorpej Exp $ */
/*-
* Copyright (c) 1999 by Ross Harvey. All rights reserved.
@ -62,3 +62,34 @@
__asm(".arch ev6");
#include <alpha/pci/pci_bwx_bus_mem_chipdep.c>
void
tsp_bus_mem_init2(bus_space_tag_t t, void *v)
{
struct tsp_config *pcp = v;
struct ts_pchip *pccsr = pcp->pc_csr;
int i, error;
/*
* Allocate the DMA windows out of the extent map.
*/
for (i = 0; i < 4; i++) {
alpha_mb();
if ((pccsr->tsp_wsba[i].tsg_r & WSBA_ENA) == 0) {
/* Window not in use. */
continue;
}
error = extent_alloc_region(CHIP_MEM_EXTENT(v),
WSBA_ADDR(pccsr->tsp_wsba[i].tsg_r),
WSM_LEN(pccsr->tsp_wsm[i].tsg_r),
EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0));
if (error) {
printf("WARNING: unable to reserve DMA window "
"0x%lx - 0x%lx\n",
WSBA_ADDR(pccsr->tsp_wsba[i].tsg_r),
WSBA_ADDR(pccsr->tsp_wsba[i].tsg_r) +
(WSM_LEN(pccsr->tsp_wsm[i].tsg_r) - 1));
}
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tsvar.h,v 1.2 2000/06/25 19:17:40 thorpej Exp $ */
/* $NetBSD: tsvar.h,v 1.3 2000/11/29 06:30:09 thorpej Exp $ */
/*-
* Copyright (c) 1999 by Ross Harvey. All rights reserved.
@ -80,3 +80,5 @@ void tsp_dma_init __P((struct tsp_config *));
void tsp_bus_io_init __P((bus_space_tag_t, void *));
void tsp_bus_mem_init __P((bus_space_tag_t, void *));
void tsp_bus_mem_init2 __P((bus_space_tag_t, void *));