Convert the Alpha port's bus_space back-end to manage address space

with vmem(9) arenas (using statically-allocated private boundary tags
for very early-in-boot) rather than extent(9).

As a side-effect, there's arguments to some initialization functions
that are no longer required, so garbage-collect those, update all the
call sites.
This commit is contained in:
thorpej 2023-12-04 00:32:10 +00:00
parent dd8677cc23
commit 7663c1deeb
55 changed files with 636 additions and 527 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: api_up1000.c,v 1.31 2020/10/14 00:59:50 thorpej Exp $ */
/* $NetBSD: api_up1000.c,v 1.32 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@ -34,7 +34,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: api_up1000.c,v 1.31 2020/10/14 00:59:50 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: api_up1000.c,v 1.32 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -114,7 +114,7 @@ api_up1000_cons_init(void)
extern struct irongate_config irongate_configuration;
icp = &irongate_configuration;
irongate_init(icp, 0);
irongate_init(icp);
ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);

View File

@ -1,4 +1,4 @@
/* $NetBSD: dec_1000a.c,v 1.33 2012/10/13 17:58:54 jdc Exp $ */
/* $NetBSD: dec_1000a.c,v 1.34 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -65,7 +65,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: dec_1000a.c,v 1.33 2012/10/13 17:58:54 jdc Exp $");
__KERNEL_RCSID(0, "$NetBSD: dec_1000a.c,v 1.34 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -172,13 +172,13 @@ dec_1000a_cons_init(void)
if(strcmp(platform.iobus, "cia") == 0) {
ccp = &cia_configuration;
cia_init(ccp, 0);
cia_init(ccp);
iot = &ccp->cc_iot;
memt = &ccp->cc_memt;
pcichipset = &ccp->cc_pc;
} else {
acp = &apecs_configuration;
apecs_init(acp, 0);
apecs_init(acp);
iot = &acp->ac_iot;
memt = &acp->ac_memt;
pcichipset = &acp->ac_pc;

View File

@ -1,4 +1,4 @@
/* $NetBSD: dec_2000_300.c,v 1.20 2020/10/14 00:59:50 thorpej Exp $ */
/* $NetBSD: dec_2000_300.c,v 1.21 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -60,7 +60,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: dec_2000_300.c,v 1.20 2020/10/14 00:59:50 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: dec_2000_300.c,v 1.21 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -127,7 +127,7 @@ dec_2000_300_cons_init(void)
extern struct jensenio_config jensenio_configuration;
jcp = &jensenio_configuration;
jensenio_init(jcp, 0);
jensenio_init(jcp);
ctb = (struct ctb_tt *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);

View File

@ -1,4 +1,4 @@
/* $NetBSD: dec_2100_a50.c,v 1.68 2020/09/04 03:41:49 thorpej Exp $ */
/* $NetBSD: dec_2100_a50.c,v 1.69 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@ -34,7 +34,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: dec_2100_a50.c,v 1.68 2020/09/04 03:41:49 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: dec_2100_a50.c,v 1.69 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -139,7 +139,7 @@ dec_2100_a50_cons_init(void)
extern struct apecs_config apecs_configuration;
acp = &apecs_configuration;
apecs_init(acp, 0);
apecs_init(acp);
ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);

View File

@ -1,4 +1,4 @@
/* $NetBSD: dec_2100_a500.c,v 1.24 2020/09/04 03:41:49 thorpej Exp $ */
/* $NetBSD: dec_2100_a500.c,v 1.25 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -60,7 +60,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: dec_2100_a500.c,v 1.24 2020/09/04 03:41:49 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: dec_2100_a500.c,v 1.25 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -160,7 +160,7 @@ dec_2100_a500_cons_init(void)
ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);
ctbslot = ctb->ctb_turboslot;
tcp = ttwoga_init(0, 0);
tcp = ttwoga_init(0);
switch (ctb->ctb_term_type) {
case CTB_PRINTERPORT:
@ -203,7 +203,7 @@ dec_2100_a500_cons_init(void)
case CTB_TURBOSLOT_TYPE_PCI:
/* The display PCI might be different */
tcp = ttwoga_init(0, CTB_TURBOSLOT_HOSE(ctbslot));
tcp = ttwoga_init(CTB_TURBOSLOT_HOSE(ctbslot));
pci_display_console(&tcp->tc_iot, &tcp->tc_memt,
&tcp->tc_pc, CTB_TURBOSLOT_BUS(ctbslot),
CTB_TURBOSLOT_SLOT(ctbslot), 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: dec_550.c,v 1.36 2012/10/13 17:58:54 jdc Exp $ */
/* $NetBSD: dec_550.c,v 1.37 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@ -34,7 +34,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: dec_550.c,v 1.36 2012/10/13 17:58:54 jdc Exp $");
__KERNEL_RCSID(0, "$NetBSD: dec_550.c,v 1.37 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -124,7 +124,7 @@ dec_550_cons_init(void)
extern struct cia_config cia_configuration;
ccp = &cia_configuration;
cia_init(ccp, 0);
cia_init(ccp);
ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);

View File

@ -1,4 +1,4 @@
/* $NetBSD: dec_6600.c,v 1.35 2020/09/04 03:41:49 thorpej Exp $ */
/* $NetBSD: dec_6600.c,v 1.36 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: dec_6600.c,v 1.35 2020/09/04 03:41:49 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: dec_6600.c,v 1.36 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -135,7 +135,7 @@ dec_6600_cons_init(void)
/* Console hose defaults to hose 0. */
tsp_console_hose = 0;
tsp = tsp_init(0, tsp_console_hose);
tsp = tsp_init(tsp_console_hose);
switch (ctb->ctb_term_type) {
case CTB_PRINTERPORT:
@ -171,7 +171,7 @@ dec_6600_cons_init(void)
else {
/* The display PCI might be different */
tsp_console_hose = CTB_TURBOSLOT_HOSE(ctbslot);
tsp = tsp_init(0, tsp_console_hose);
tsp = tsp_init(tsp_console_hose);
pci_display_console(&tsp->pc_iot, &tsp->pc_memt,
&tsp->pc_pc, CTB_TURBOSLOT_BUS(ctbslot),
CTB_TURBOSLOT_SLOT(ctbslot), 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: dec_alphabook1.c,v 1.28 2021/07/16 18:50:19 thorpej Exp $ */
/* $NetBSD: dec_alphabook1.c,v 1.29 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@ -34,7 +34,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: dec_alphabook1.c,v 1.28 2021/07/16 18:50:19 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: dec_alphabook1.c,v 1.29 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -119,7 +119,7 @@ dec_alphabook1_cons_init(void)
extern struct lca_config lca_configuration;
lcp = &lca_configuration;
lca_init(lcp, 0);
lca_init(lcp);
ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);

View File

@ -1,4 +1,4 @@
/* $NetBSD: dec_axppci_33.c,v 1.68 2021/07/16 18:50:19 thorpej Exp $ */
/* $NetBSD: dec_axppci_33.c,v 1.69 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@ -34,7 +34,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: dec_axppci_33.c,v 1.68 2021/07/16 18:50:19 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: dec_axppci_33.c,v 1.69 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -97,7 +97,7 @@ lca_preinit(void)
{
extern struct lca_config lca_configuration;
lca_init(&lca_configuration, 0);
lca_init(&lca_configuration);
return &lca_configuration;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: dec_eb164.c,v 1.62 2012/10/13 17:58:54 jdc Exp $ */
/* $NetBSD: dec_eb164.c,v 1.63 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@ -34,7 +34,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: dec_eb164.c,v 1.62 2012/10/13 17:58:54 jdc Exp $");
__KERNEL_RCSID(0, "$NetBSD: dec_eb164.c,v 1.63 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -119,7 +119,7 @@ dec_eb164_cons_init(void)
extern struct cia_config cia_configuration;
ccp = &cia_configuration;
cia_init(ccp, 0);
cia_init(ccp);
ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);

View File

@ -1,4 +1,4 @@
/* $NetBSD: dec_eb64plus.c,v 1.41 2012/10/13 17:58:54 jdc Exp $ */
/* $NetBSD: dec_eb64plus.c,v 1.42 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@ -34,7 +34,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: dec_eb64plus.c,v 1.41 2012/10/13 17:58:54 jdc Exp $");
__KERNEL_RCSID(0, "$NetBSD: dec_eb64plus.c,v 1.42 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -127,7 +127,7 @@ dec_eb64plus_cons_init(void)
extern struct apecs_config apecs_configuration;
acp = &apecs_configuration;
apecs_init(acp, 0);
apecs_init(acp);
ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);

View File

@ -1,4 +1,4 @@
/* $NetBSD: dec_eb66.c,v 1.29 2021/07/16 18:50:19 thorpej Exp $ */
/* $NetBSD: dec_eb66.c,v 1.30 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@ -34,7 +34,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: dec_eb66.c,v 1.29 2021/07/16 18:50:19 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: dec_eb66.c,v 1.30 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -119,7 +119,7 @@ dec_eb66_cons_init(void)
extern struct lca_config lca_configuration;
lcp = &lca_configuration;
lca_init(lcp, 0);
lca_init(lcp);
ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);

View File

@ -1,4 +1,4 @@
/* $NetBSD: dec_kn20aa.c,v 1.66 2020/09/04 03:41:49 thorpej Exp $ */
/* $NetBSD: dec_kn20aa.c,v 1.67 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@ -34,7 +34,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: dec_kn20aa.c,v 1.66 2020/09/04 03:41:49 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: dec_kn20aa.c,v 1.67 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -128,7 +128,7 @@ dec_kn20aa_cons_init(void)
extern struct cia_config cia_configuration;
ccp = &cia_configuration;
cia_init(ccp, 0);
cia_init(ccp);
ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);

View File

@ -1,4 +1,4 @@
/* $NetBSD: jensenio.c,v 1.22 2021/08/07 16:18:40 thorpej Exp $ */
/* $NetBSD: jensenio.c,v 1.23 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@ -43,7 +43,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: jensenio.c,v 1.22 2021/08/07 16:18:40 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: jensenio.c,v 1.23 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -103,7 +103,7 @@ static void jensenio_isa_detach_hook(isa_chipset_tag_t, device_t);
* Set up the Jensen's function pointers.
*/
void
jensenio_init(struct jensenio_config *jcp, int mallocsafe)
jensenio_init(struct jensenio_config *jcp)
{
/*
@ -126,7 +126,6 @@ jensenio_init(struct jensenio_config *jcp, int mallocsafe)
jensenio_bus_intio_init(&jcp->jc_internal_iot, jcp);
jensenio_bus_mem_init(&jcp->jc_eisa_memt, jcp);
}
jcp->jc_mallocsafe = mallocsafe;
}
static int
@ -160,7 +159,7 @@ jensenio_attach(device_t parent, device_t self, void *aux)
* Done once at console init time, but we might need to do
* additional work this time.
*/
jensenio_init(jcp, 1);
jensenio_init(jcp);
/*
* Initialize DMA.

View File

@ -1,4 +1,4 @@
/* $NetBSD: jensenio_bus_intio.c,v 1.6 2021/07/04 22:42:35 thorpej Exp $ */
/* $NetBSD: jensenio_bus_intio.c,v 1.7 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -31,12 +31,12 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: jensenio_bus_intio.c,v 1.6 2021/07/04 22:42:35 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: jensenio_bus_intio.c,v 1.7 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/extent.h>
#include <sys/vmem.h>
#include <sys/bus.h>
@ -153,12 +153,12 @@ jensenio_intio_map(void *v, bus_addr_t ioaddr, bus_size_t iosize, int flags,
printf("intio: allocating 0x%lx to 0x%lx\n", ioaddr,
ioaddr + iosize - 1);
#endif
error = extent_alloc_region(jcp->jc_io_ex, ioaddr, iosize,
EX_NOWAIT | (jcp->jc_mallocsafe ? EX_MALLOCOK : 0));
error = vmem_xalloc_addr(jcp->jc_io_arena, ioaddr, iosize,
VM_NOSLEEP);
if (error) {
#ifdef EXTENT_DEBUG
printf("intio: allocation failed (%d)\n", error);
extent_print(jcp->jc_io_ex);
/* vmem_print(jcp->jc_io_arena); XXX */
#endif
return (error);
}
@ -174,7 +174,6 @@ jensenio_intio_unmap(void *v, bus_space_handle_t ioh, bus_size_t iosize,
{
struct jensenio_config *jcp = v;
bus_addr_t ioaddr;
int error;
if (acct == 0)
return;
@ -190,15 +189,7 @@ jensenio_intio_unmap(void *v, bus_space_handle_t ioh, bus_size_t iosize,
#ifdef EXTENT_DEBUG
printf("intio: freeing 0x%lx to 0x%lx\n", ioaddr, ioaddr + iosize - 1);
#endif
error = extent_free(jcp->jc_io_ex, ioaddr, iosize,
EX_NOWAIT | (jcp->jc_mallocsafe ? EX_MALLOCOK : 0));
if (error) {
printf("WARNING: could not unmap 0x%lx-0x%lx (error %d)\n",
ioaddr, ioaddr + iosize - 1, error);
#ifdef EXTENT_DEBUG
extent_print(jcp->jc_io_ex);
#endif
}
vmem_xfree(jcp->jc_io_arena, ioaddr, iosize);
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: jensenio_bus_io.c,v 1.4 2021/07/04 22:42:35 thorpej Exp $ */
/* $NetBSD: jensenio_bus_io.c,v 1.5 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(1, "$NetBSD: jensenio_bus_io.c,v 1.4 2021/07/04 22:42:35 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: jensenio_bus_io.c,v 1.5 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -51,8 +51,7 @@ __KERNEL_RCSID(1, "$NetBSD: jensenio_bus_io.c,v 1.4 2021/07/04 22:42:35 thorpej
#define CHIP_V(v) ((struct jensenio_config *)(v))
#define CHIP_EX_MALLOC_SAFE(v) (CHIP_V(v)->jc_mallocsafe)
#define CHIP_IO_EXTENT(v) (CHIP_V(v)->jc_io_ex)
#define CHIP_IO_ARENA(v) (CHIP_V(v)->jc_io_arena)
#define CHIP_ADDR_SHIFT 7
#define CHIP_SIZE_SHIFT 5

View File

@ -1,4 +1,4 @@
/* $NetBSD: jensenio_bus_mem.c,v 1.4 2021/07/04 22:42:35 thorpej Exp $ */
/* $NetBSD: jensenio_bus_mem.c,v 1.5 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(1, "$NetBSD: jensenio_bus_mem.c,v 1.4 2021/07/04 22:42:35 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: jensenio_bus_mem.c,v 1.5 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -51,8 +51,7 @@ __KERNEL_RCSID(1, "$NetBSD: jensenio_bus_mem.c,v 1.4 2021/07/04 22:42:35 thorpej
#define CHIP_V(v) ((struct jensenio_config *)(v))
#define CHIP_EX_MALLOC_SAFE(v) (CHIP_V(v)->jc_mallocsafe)
#define CHIP_S_MEM_EXTENT(v) (CHIP_V(v)->jc_s_mem_ex)
#define CHIP_S_MEM_ARENA(v) (CHIP_V(v)->jc_s_mem_arena)
#define CHIP_ADDR_SHIFT 7
#define CHIP_SIZE_SHIFT 5

View File

@ -1,4 +1,4 @@
/* $NetBSD: jenseniovar.h,v 1.6 2020/10/14 00:59:50 thorpej Exp $ */
/* $NetBSD: jenseniovar.h,v 1.7 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -33,6 +33,7 @@
#define _ALPHA_JENSENIO_JENSENIOVAR_H_
#include <sys/evcnt.h>
#include <sys/vmem.h>
/*
* Arguments used to attach devices to the Jensen I/O bus.
@ -71,9 +72,8 @@ struct jensenio_config {
struct alpha_bus_dma_tag jc_dmat_eisa, jc_dmat_isa;
struct extent *jc_io_ex, *jc_s_mem_ex;
int jc_mallocsafe;
vmem_t *jc_io_arena;
vmem_t *jc_s_mem_arena;
};
/*
@ -89,7 +89,7 @@ struct jensenio_scb_intrhand {
};
void jensenio_page_physload(unsigned long, unsigned long);
void jensenio_init(struct jensenio_config *, int);
void jensenio_init(struct jensenio_config *);
void jensenio_bus_io_init(bus_space_tag_t, void *);
void jensenio_bus_intio_init(bus_space_tag_t, void *);
void jensenio_bus_mem_init(bus_space_tag_t, void *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: apecs.c,v 1.59 2021/08/07 16:18:41 thorpej Exp $ */
/* $NetBSD: apecs.c,v 1.60 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -58,7 +58,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: apecs.c,v 1.59 2021/08/07 16:18:41 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: apecs.c,v 1.60 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -110,7 +110,7 @@ apecsmatch(device_t parent, cfdata_t match, void *aux)
* Set up the chipset's function pointers.
*/
void
apecs_init(struct apecs_config *acp, int mallocsafe)
apecs_init(struct apecs_config *acp)
{
acp->ac_comanche_pass2 =
(REGVAL(COMANCHE_ED) & COMANCHE_ED_PASS2) != 0;
@ -134,7 +134,6 @@ apecs_init(struct apecs_config *acp, int mallocsafe)
alpha_bus_window_count[ALPHA_BUS_TYPE_PCI_MEM] = 3;
alpha_bus_get_window = apecs_bus_get_window;
}
acp->ac_mallocsafe = mallocsafe;
apecs_pci_init(&acp->ac_pc, acp);
alpha_pci_chipset = &acp->ac_pc;
@ -156,7 +155,7 @@ apecsattach(device_t parent, device_t self, void *aux)
* (maybe), but doesn't hurt to do twice.
*/
acp = &apecs_configuration;
apecs_init(acp, 1);
apecs_init(acp);
apecs_dma_init(acp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: apecs_bus_io.c,v 1.12 2021/07/04 22:42:36 thorpej Exp $ */
/* $NetBSD: apecs_bus_io.c,v 1.13 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(1, "$NetBSD: apecs_bus_io.c,v 1.12 2021/07/04 22:42:36 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: apecs_bus_io.c,v 1.13 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -43,8 +43,7 @@ __KERNEL_RCSID(1, "$NetBSD: apecs_bus_io.c,v 1.12 2021/07/04 22:42:36 thorpej Ex
#define CHIP apecs
#define CHIP_EX_MALLOC_SAFE(v) (((struct apecs_config *)(v))->ac_mallocsafe)
#define CHIP_IO_EXTENT(v) (((struct apecs_config *)(v))->ac_io_ex)
#define CHIP_IO_ARENA(v) (((struct apecs_config *)(v))->ac_io_arena)
/* IO region 1 */
#define CHIP_IO_W1_BUS_START(v) 0x00000000UL

View File

@ -1,4 +1,4 @@
/* $NetBSD: apecs_bus_mem.c,v 1.12 2021/07/04 22:42:36 thorpej Exp $ */
/* $NetBSD: apecs_bus_mem.c,v 1.13 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(1, "$NetBSD: apecs_bus_mem.c,v 1.12 2021/07/04 22:42:36 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: apecs_bus_mem.c,v 1.13 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -43,9 +43,8 @@ __KERNEL_RCSID(1, "$NetBSD: apecs_bus_mem.c,v 1.12 2021/07/04 22:42:36 thorpej E
#define CHIP apecs
#define CHIP_EX_MALLOC_SAFE(v) (((struct apecs_config *)(v))->ac_mallocsafe)
#define CHIP_D_MEM_EXTENT(v) (((struct apecs_config *)(v))->ac_d_mem_ex)
#define CHIP_S_MEM_EXTENT(v) (((struct apecs_config *)(v))->ac_s_mem_ex)
#define CHIP_D_MEM_ARENA(v) (((struct apecs_config *)(v))->ac_d_mem_arena)
#define CHIP_S_MEM_ARENA(v) (((struct apecs_config *)(v))->ac_s_mem_arena)
/* Dense region 1 */
#define CHIP_D_MEM_W1_BUS_START(v) 0x00000000UL

View File

@ -1,4 +1,4 @@
/* $NetBSD: apecsvar.h,v 1.11 2012/02/06 02:14:14 matt Exp $ */
/* $NetBSD: apecsvar.h,v 1.12 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -27,6 +27,8 @@
* rights to redistribute these changes.
*/
#include <sys/vmem.h>
#include <dev/isa/isavar.h>
#include <dev/pci/pcivar.h>
#include <alpha/pci/pci_sgmap_pte64.h>
@ -54,11 +56,12 @@ struct apecs_config {
uint32_t ac_haxr1, ac_haxr2;
struct extent *ac_io_ex, *ac_d_mem_ex, *ac_s_mem_ex;
int ac_mallocsafe;
vmem_t *ac_io_arena;
vmem_t *ac_d_mem_arena;
vmem_t *ac_s_mem_arena;
};
void apecs_init(struct apecs_config *, int);
void apecs_init(struct apecs_config *);
void apecs_pci_init(pci_chipset_tag_t, void *);
void apecs_dma_init(struct apecs_config *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: cia.c,v 1.80 2022/05/22 11:27:33 andvar Exp $ */
/* $NetBSD: cia.c,v 1.81 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -61,7 +61,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: cia.c,v 1.80 2022/05/22 11:27:33 andvar Exp $");
__KERNEL_RCSID(0, "$NetBSD: cia.c,v 1.81 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -146,7 +146,7 @@ ciamatch(device_t parent, cfdata_t match, void *aux)
* Set up the chipset's function pointers.
*/
void
cia_init(struct cia_config *ccp, int mallocsafe)
cia_init(struct cia_config *ccp)
{
int pci_use_bwx = cia_pci_use_bwx;
int bus_use_bwx = cia_bus_use_bwx;
@ -232,7 +232,6 @@ cia_init(struct cia_config *ccp, int mallocsafe)
}
alpha_bus_get_window = cia_bus_get_window;
}
ccp->cc_mallocsafe = mallocsafe;
cia_pci_init(&ccp->cc_pc, ccp);
alpha_pci_chipset = &ccp->cc_pc;
@ -259,7 +258,7 @@ ciaattach(device_t parent, device_t self, void *aux)
* that need to use memory allocation.
*/
ccp = sc->sc_ccp = &cia_configuration;
cia_init(ccp, 1);
cia_init(ccp);
if (ccp->cc_flags & CCF_ISPYXIS) {
name = "Pyxis";

View File

@ -1,4 +1,4 @@
/* $NetBSD: cia_bwx_bus_io.c,v 1.6 2021/07/04 22:42:36 thorpej Exp $ */
/* $NetBSD: cia_bwx_bus_io.c,v 1.7 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(1, "$NetBSD: cia_bwx_bus_io.c,v 1.6 2021/07/04 22:42:36 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: cia_bwx_bus_io.c,v 1.7 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -43,8 +43,7 @@ __KERNEL_RCSID(1, "$NetBSD: cia_bwx_bus_io.c,v 1.6 2021/07/04 22:42:36 thorpej E
#define CHIP cia_bwx
#define CHIP_EX_MALLOC_SAFE(v) (((struct cia_config *)(v))->cc_mallocsafe)
#define CHIP_IO_EXTENT(v) (((struct cia_config *)(v))->cc_io_ex)
#define CHIP_IO_ARENA(v) (((struct cia_config *)(v))->cc_io_arena)
#define CHIP_IO_SYS_START(v) CIA_EV56_BWIO

View File

@ -1,4 +1,4 @@
/* $NetBSD: cia_bwx_bus_mem.c,v 1.6 2021/07/04 22:42:36 thorpej Exp $ */
/* $NetBSD: cia_bwx_bus_mem.c,v 1.7 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(1, "$NetBSD: cia_bwx_bus_mem.c,v 1.6 2021/07/04 22:42:36 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: cia_bwx_bus_mem.c,v 1.7 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -43,8 +43,7 @@ __KERNEL_RCSID(1, "$NetBSD: cia_bwx_bus_mem.c,v 1.6 2021/07/04 22:42:36 thorpej
#define CHIP cia_bwx
#define CHIP_EX_MALLOC_SAFE(v) (((struct cia_config *)(v))->cc_mallocsafe)
#define CHIP_MEM_EXTENT(v) (((struct cia_config *)(v))->cc_d_mem_ex)
#define CHIP_MEM_ARENA(v) (((struct cia_config *)(v))->cc_d_mem_arena)
#define CHIP_MEM_SYS_START(v) CIA_EV56_BWMEM

View File

@ -1,4 +1,4 @@
/* $NetBSD: cia_swiz_bus_io.c,v 1.18 2021/07/04 22:42:36 thorpej Exp $ */
/* $NetBSD: cia_swiz_bus_io.c,v 1.19 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(1, "$NetBSD: cia_swiz_bus_io.c,v 1.18 2021/07/04 22:42:36 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: cia_swiz_bus_io.c,v 1.19 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -43,8 +43,7 @@ __KERNEL_RCSID(1, "$NetBSD: cia_swiz_bus_io.c,v 1.18 2021/07/04 22:42:36 thorpej
#define CHIP cia_swiz
#define CHIP_EX_MALLOC_SAFE(v) (((struct cia_config *)(v))->cc_mallocsafe)
#define CHIP_IO_EXTENT(v) (((struct cia_config *)(v))->cc_io_ex)
#define CHIP_IO_ARENA(v) (((struct cia_config *)(v))->cc_io_arena)
/* IO region 1 */
#define CHIP_IO_W1_BUS_START(v) \

View File

@ -1,4 +1,4 @@
/* $NetBSD: cia_swiz_bus_mem.c,v 1.19 2021/07/04 22:42:36 thorpej Exp $ */
/* $NetBSD: cia_swiz_bus_mem.c,v 1.20 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(1, "$NetBSD: cia_swiz_bus_mem.c,v 1.19 2021/07/04 22:42:36 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: cia_swiz_bus_mem.c,v 1.20 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -43,9 +43,8 @@ __KERNEL_RCSID(1, "$NetBSD: cia_swiz_bus_mem.c,v 1.19 2021/07/04 22:42:36 thorpe
#define CHIP cia_swiz
#define CHIP_EX_MALLOC_SAFE(v) (((struct cia_config *)(v))->cc_mallocsafe)
#define CHIP_D_MEM_EXTENT(v) (((struct cia_config *)(v))->cc_d_mem_ex)
#define CHIP_S_MEM_EXTENT(v) (((struct cia_config *)(v))->cc_s_mem_ex)
#define CHIP_D_MEM_ARENA(v) (((struct cia_config *)(v))->cc_d_mem_arena)
#define CHIP_S_MEM_ARENA(v) (((struct cia_config *)(v))->cc_s_mem_arena)
/* Dense region 1 */
#define CHIP_D_MEM_W1_BUS_START(v) 0x00000000UL

View File

@ -1,4 +1,4 @@
/* $NetBSD: ciavar.h,v 1.22 2021/07/19 01:06:14 thorpej Exp $ */
/* $NetBSD: ciavar.h,v 1.23 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -27,6 +27,8 @@
* rights to redistribute these changes.
*/
#include <sys/vmem.h>
#include <dev/isa/isavar.h>
#include <dev/pci/pcivar.h>
#include <alpha/pci/pci_sgmap_pte64.h>
@ -63,8 +65,9 @@ struct cia_config {
#define CCF_PCI_USE_BWX 0x04 /* use BWX for PCI config space */
#define CCF_BUS_USE_BWX 0x08 /* use BWX for bus space */
struct extent *cc_io_ex, *cc_d_mem_ex, *cc_s_mem_ex;
int cc_mallocsafe;
vmem_t *cc_io_arena;
vmem_t *cc_d_mem_arena;
vmem_t *cc_s_mem_arena;
struct {
uint32_t wbase[4];
@ -79,7 +82,7 @@ struct cia_softc {
struct cia_config *sc_ccp;
};
void cia_init(struct cia_config *, int);
void cia_init(struct cia_config *);
void cia_pci_init(pci_chipset_tag_t, void *);
void cia_dma_init(struct cia_config *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: dwlpx_bus_io.c,v 1.15 2021/07/04 22:42:36 thorpej Exp $ */
/* $NetBSD: dwlpx_bus_io.c,v 1.16 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1997 by Matthew Jacob
@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(1, "$NetBSD: dwlpx_bus_io.c,v 1.15 2021/07/04 22:42:36 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: dwlpx_bus_io.c,v 1.16 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -46,11 +46,12 @@ __KERNEL_RCSID(1, "$NetBSD: dwlpx_bus_io.c,v 1.15 2021/07/04 22:42:36 thorpej Ex
#define CHIP dwlpx
#define CHIP_EX_MALLOC_SAFE(v) (1)
#define CHIP_IO_EXTENT(v) (((struct dwlpx_config *)(v))->cc_io_ex)
#define CHIP_IO_EX_STORE(v) (((struct dwlpx_config *)(v))->cc_io_exstorage)
#define CHIP_IO_EX_STORE_SIZE(v) \
(sizeof (((struct dwlpx_config *)(v))->cc_io_exstorage))
#define CHIP_IO_ARENA(v) (((struct dwlpx_config *)(v))->cc_io_arena)
#define CHIP_IO_ARENA_STORE(v) \
(&(((struct dwlpx_config *)(v))->cc_io_arena_store))
#define CHIP_IO_BTAG_STORE(v) \
(((struct dwlpx_config *)(v))->cc_io_btag_store)
#define CHIP_IO_BTAG_COUNT(v) DWLPX_IO_NBTS
/* IO Region 1 */
#define CHIP_IO_W1_BUS_START(v) 0x00000000UL

View File

@ -1,4 +1,4 @@
/* $NetBSD: dwlpx_bus_mem.c,v 1.15 2021/07/04 22:42:36 thorpej Exp $ */
/* $NetBSD: dwlpx_bus_mem.c,v 1.16 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1997 by Matthew Jacob
@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(1, "$NetBSD: dwlpx_bus_mem.c,v 1.15 2021/07/04 22:42:36 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: dwlpx_bus_mem.c,v 1.16 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -46,17 +46,21 @@ __KERNEL_RCSID(1, "$NetBSD: dwlpx_bus_mem.c,v 1.15 2021/07/04 22:42:36 thorpej E
#define CHIP dwlpx
#define CHIP_EX_MALLOC_SAFE(v) (1)
#define CHIP_D_MEM_EXTENT(v) (((struct dwlpx_config *)(v))->cc_d_mem_ex)
#define CHIP_D_MEM_EX_STORE(v) \
(((struct dwlpx_config *)(v))->cc_dmem_exstorage)
#define CHIP_D_MEM_EX_STORE_SIZE(v) \
(sizeof (((struct dwlpx_config *)(v))->cc_dmem_exstorage))
#define CHIP_S_MEM_EXTENT(v) (((struct dwlpx_config *)(v))->cc_s_mem_ex)
#define CHIP_S_MEM_EX_STORE(v) \
(((struct dwlpx_config *)(v))->cc_smem_exstorage)
#define CHIP_S_MEM_EX_STORE_SIZE(v) \
(sizeof (((struct dwlpx_config *)(v))->cc_smem_exstorage))
#define CHIP_D_MEM_ARENA(v) \
(((struct dwlpx_config *)(v))->cc_d_mem_arena)
#define CHIP_D_MEM_ARENA_STORE(v) \
(&(((struct dwlpx_config *)(v))->cc_d_mem_arena_store))
#define CHIP_D_MEM_BTAG_STORE(v) \
(((struct dwlpx_config *)(v))->cc_d_mem_btag_store)
#define CHIP_D_MEM_BTAG_COUNT(v) DWLPX_D_MEM_NBTS
#define CHIP_S_MEM_ARENA(v) \
(((struct dwlpx_config *)(v))->cc_s_mem_arena)
#define CHIP_S_MEM_ARENA_STORE(v) \
(&(((struct dwlpx_config *)(v))->cc_s_mem_arena_store))
#define CHIP_S_MEM_BTAG_STORE(v) \
(((struct dwlpx_config *)(v))->cc_s_mem_btag_store)
#define CHIP_S_MEM_BTAG_COUNT(v) DWLPX_S_MEM_NBTS
/* Dense region 1 */
#define CHIP_D_MEM_W1_BUS_START(v) 0x00000000UL

View File

@ -1,4 +1,4 @@
/* $NetBSD: dwlpxvar.h,v 1.11 2012/02/06 02:14:14 matt Exp $ */
/* $NetBSD: dwlpxvar.h,v 1.12 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1997 by Matthew Jacob
@ -30,12 +30,16 @@
* SUCH DAMAGE.
*/
#include <dev/pci/pcivar.h>
#include <sys/extent.h>
#include <sys/vmem_impl.h>
#include <dev/pci/pcivar.h>
#include <alpha/pci/pci_sgmap_pte32.h>
#define _FSTORE (EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long))
#define DWLPX_IO_NBTS VMEM_EST_BTCOUNT(2, 8)
#define DWLPX_D_MEM_NBTS VMEM_EST_BTCOUNT(1, 8)
#define DWLPX_S_MEM_NBTS VMEM_EST_BTCOUNT(2, 8)
/*
* DWLPX configuration.
@ -44,14 +48,17 @@ struct dwlpx_config {
int cc_initted;
struct alpha_bus_space cc_iot;
struct alpha_bus_space cc_memt;
struct extent * cc_io_ex;
struct extent * cc_d_mem_ex;
struct extent * cc_s_mem_ex;
vmem_t * cc_io_arena;
vmem_t * cc_d_mem_arena;
vmem_t * cc_s_mem_arena;
struct alpha_pci_chipset cc_pc;
struct dwlpx_softc * cc_sc; /* back pointer */
long cc_io_exstorage[_FSTORE];
long cc_dmem_exstorage[_FSTORE];
long cc_smem_exstorage[_FSTORE];
struct vmem cc_io_arena_store;
struct vmem cc_d_mem_arena_store;
struct vmem cc_s_mem_arena_store;
struct vmem_btag cc_io_btag_store[DWLPX_IO_NBTS];
struct vmem_btag cc_d_mem_btag_store[DWLPX_D_MEM_NBTS];
struct vmem_btag cc_s_mem_btag_store[DWLPX_S_MEM_NBTS];
unsigned long cc_sysbase; /* shorthand */
struct alpha_bus_dma_tag cc_dmat_direct;
struct alpha_bus_dma_tag cc_dmat_sgmap;

View File

@ -1,4 +1,4 @@
/* $NetBSD: irongate.c,v 1.21 2021/08/07 16:18:41 thorpej Exp $ */
/* $NetBSD: irongate.c,v 1.22 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irongate.c,v 1.21 2021/08/07 16:18:41 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: irongate.c,v 1.22 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -69,13 +69,11 @@ static int irongate_bus_get_window(int, int,
* Set up the chipset's function pointers.
*/
void
irongate_init(struct irongate_config *icp, int mallocsafe)
irongate_init(struct irongate_config *icp)
{
pcitag_t tag;
pcireg_t reg;
icp->ic_mallocsafe = mallocsafe;
/*
* Set up PCI configuration space; we can only read the
* revision info through configuration space.
@ -138,7 +136,7 @@ irongate_attach(device_t parent, device_t self, void *aux)
* that need to use memory allocation.
*/
icp = sc->sc_icp = &irongate_configuration;
irongate_init(icp, 1);
irongate_init(icp);
printf(": AMD 751 Core Logic + AGP Chipset, rev. %d\n", icp->ic_rev);

View File

@ -1,4 +1,4 @@
/* $NetBSD: irongate_bus_io.c,v 1.8 2021/07/04 22:42:36 thorpej Exp $ */
/* $NetBSD: irongate_bus_io.c,v 1.9 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(1, "$NetBSD: irongate_bus_io.c,v 1.8 2021/07/04 22:42:36 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: irongate_bus_io.c,v 1.9 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -45,8 +45,7 @@ __KERNEL_RCSID(1, "$NetBSD: irongate_bus_io.c,v 1.8 2021/07/04 22:42:36 thorpej
#define CHIP irongate
#define CHIP_EX_MALLOC_SAFE(v) (((struct irongate_config *)(v))->ic_mallocsafe)
#define CHIP_IO_EXTENT(v) (((struct irongate_config *)(v))->ic_io_ex)
#define CHIP_IO_ARENA(v) (((struct irongate_config *)(v))->ic_io_arena)
#define CHIP_IO_SYS_START(v) IRONGATE_IO_BASE

View File

@ -1,4 +1,4 @@
/* $NetBSD: irongate_bus_mem.c,v 1.12 2021/07/04 22:42:36 thorpej Exp $ */
/* $NetBSD: irongate_bus_mem.c,v 1.13 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(1, "$NetBSD: irongate_bus_mem.c,v 1.12 2021/07/04 22:42:36 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: irongate_bus_mem.c,v 1.13 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -45,8 +45,7 @@ __KERNEL_RCSID(1, "$NetBSD: irongate_bus_mem.c,v 1.12 2021/07/04 22:42:36 thorpe
#define CHIP irongate
#define CHIP_EX_MALLOC_SAFE(v) (((struct irongate_config *)(v))->ic_mallocsafe)
#define CHIP_MEM_EXTENT(v) (((struct irongate_config *)(v))->ic_mem_ex)
#define CHIP_MEM_ARENA(v) (((struct irongate_config *)(v))->ic_mem_arena)
#define CHIP_MEM_SYS_START(v) IRONGATE_MEM_BASE
@ -73,7 +72,7 @@ irongate_bus_mem_init2(bus_space_tag_t t, void *v)
/*
* Since the AMD 751 doesn't have DMA windows, we need to
* allocate RAM out of the extent map.
* reserve the space used by RAM in the PCI memory arena.
*/
for (i = 0; i < mem_cluster_cnt; i++) {
start = mem_clusters[i].start;
@ -94,10 +93,8 @@ irongate_bus_mem_init2(bus_space_tag_t t, void *v)
* taste.
*/
if (start < IOM_BEGIN) {
error = extent_alloc_region(CHIP_MEM_EXTENT(v),
start, (IOM_BEGIN - start),
EX_NOWAIT |
(CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0));
error = vmem_xalloc_addr(CHIP_MEM_ARENA(v),
start, (IOM_BEGIN - start), VM_NOSLEEP);
if (error) {
printf("WARNING: unable to reserve "
"chunk from mem cluster %d "
@ -106,10 +103,8 @@ irongate_bus_mem_init2(bus_space_tag_t t, void *v)
}
}
if (end > IOM_END) {
error = extent_alloc_region(CHIP_MEM_EXTENT(v),
IOM_END, (end - IOM_END),
EX_NOWAIT |
(CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0));
error = vmem_xalloc_addr(CHIP_MEM_ARENA(v),
IOM_END, (end - IOM_END), VM_NOSLEEP);
if (error) {
printf("WARNING: unable to reserve "
"chunk from mem cluster %d "
@ -118,10 +113,8 @@ irongate_bus_mem_init2(bus_space_tag_t t, void *v)
}
}
} else {
error = extent_alloc_region(CHIP_MEM_EXTENT(v),
start, size,
EX_NOWAIT |
(CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0));
error = vmem_xalloc_addr(CHIP_MEM_ARENA(v),
start, size, VM_NOSLEEP);
if (error) {
printf("WARNING: unable reserve mem cluster %d "
"(0x%lx - 0x%lx)\n", i, start,

View File

@ -1,4 +1,4 @@
/* $NetBSD: irongatevar.h,v 1.7 2020/10/14 00:59:50 thorpej Exp $ */
/* $NetBSD: irongatevar.h,v 1.8 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -29,6 +29,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/vmem.h>
#include <dev/isa/isavar.h>
#include <dev/pci/pcivar.h>
@ -49,8 +51,8 @@ struct irongate_config {
uint32_t ic_rev;
struct extent *ic_io_ex, *ic_mem_ex;
int ic_mallocsafe;
vmem_t *ic_io_arena;
vmem_t *ic_mem_arena;
};
struct irongate_softc {
@ -60,7 +62,7 @@ struct irongate_softc {
};
void irongate_page_physload(unsigned long, unsigned long);
void irongate_init(struct irongate_config *, int);
void irongate_init(struct irongate_config *);
void irongate_pci_init(pci_chipset_tag_t, void *);
void irongate_dma_init(struct irongate_config *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: lca.c,v 1.57 2021/08/07 16:18:41 thorpej Exp $ */
/* $NetBSD: lca.c,v 1.58 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -58,7 +58,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: lca.c,v 1.57 2021/08/07 16:18:41 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: lca.c,v 1.58 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -148,7 +148,7 @@ lca_probe_bcache(void)
* Set up the chipset's function pointers.
*/
void
lca_init(struct lca_config *lcp, int mallocsafe)
lca_init(struct lca_config *lcp)
{
/*
@ -171,7 +171,6 @@ lca_init(struct lca_config *lcp, int mallocsafe)
alpha_bus_window_count[ALPHA_BUS_TYPE_PCI_MEM] = 3;
alpha_bus_get_window = lca_bus_get_window;
}
lcp->lc_mallocsafe = mallocsafe;
lca_pci_init(&lcp->lc_pc, lcp);
alpha_pci_chipset = &lcp->lc_pc;
@ -221,7 +220,7 @@ lcaattach(device_t parent, device_t self, void *aux)
* that need to use memory allocation.
*/
lcp = sc->sc_lcp = &lca_configuration;
lca_init(lcp, 1);
lca_init(lcp);
/* XXX print chipset information */
aprint_normal("\n");

View File

@ -1,4 +1,4 @@
/* $NetBSD: lca_bus_io.c,v 1.12 2021/07/04 22:42:36 thorpej Exp $ */
/* $NetBSD: lca_bus_io.c,v 1.13 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(1, "$NetBSD: lca_bus_io.c,v 1.12 2021/07/04 22:42:36 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: lca_bus_io.c,v 1.13 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -43,8 +43,7 @@ __KERNEL_RCSID(1, "$NetBSD: lca_bus_io.c,v 1.12 2021/07/04 22:42:36 thorpej Exp
#define CHIP lca
#define CHIP_EX_MALLOC_SAFE(v) (((struct lca_config *)(v))->lc_mallocsafe)
#define CHIP_IO_EXTENT(v) (((struct lca_config *)(v))->lc_io_ex)
#define CHIP_IO_ARENA(v) (((struct lca_config *)(v))->lc_io_arena)
/* IO region 1 */
#define CHIP_IO_W1_BUS_START(v) 0x00000000UL

View File

@ -1,4 +1,4 @@
/* $NetBSD: lca_bus_mem.c,v 1.12 2021/07/04 22:42:36 thorpej Exp $ */
/* $NetBSD: lca_bus_mem.c,v 1.13 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(1, "$NetBSD: lca_bus_mem.c,v 1.12 2021/07/04 22:42:36 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: lca_bus_mem.c,v 1.13 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -43,9 +43,8 @@ __KERNEL_RCSID(1, "$NetBSD: lca_bus_mem.c,v 1.12 2021/07/04 22:42:36 thorpej Exp
#define CHIP lca
#define CHIP_EX_MALLOC_SAFE(v) (((struct lca_config *)(v))->lc_mallocsafe)
#define CHIP_D_MEM_EXTENT(v) (((struct lca_config *)(v))->lc_d_mem_ex)
#define CHIP_S_MEM_EXTENT(v) (((struct lca_config *)(v))->lc_s_mem_ex)
#define CHIP_D_MEM_ARENA(v) (((struct lca_config *)(v))->lc_d_mem_arena)
#define CHIP_S_MEM_ARENA(v) (((struct lca_config *)(v))->lc_s_mem_arena)
/* Dense region 1 */
#define CHIP_D_MEM_W1_BUS_START(v) 0x00000000UL

View File

@ -1,4 +1,4 @@
/* $NetBSD: lcavar.h,v 1.12 2021/07/16 18:50:19 thorpej Exp $ */
/* $NetBSD: lcavar.h,v 1.13 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -27,6 +27,8 @@
* rights to redistribute these changes.
*/
#include <sys/vmem.h>
#include <dev/isa/isavar.h>
#include <dev/pci/pcivar.h>
#include <alpha/pci/pci_sgmap_pte64.h>
@ -50,8 +52,10 @@ struct lca_config {
bus_addr_t lc_s_mem_w2_masked_base;
struct extent *lc_io_ex, *lc_d_mem_ex, *lc_s_mem_ex;
int lc_mallocsafe;
vmem_t *lc_io_arena;
vmem_t *lc_d_mem_arena;
vmem_t *lc_s_mem_arena;
u_int lc_bcache_size;
};
@ -62,7 +66,7 @@ struct lca_softc {
};
void lca_probe_bcache(void);
void lca_init(struct lca_config *, int);
void lca_init(struct lca_config *);
void lca_pci_init(pci_chipset_tag_t, void *);
void lca_dma_init(struct lca_config *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcpcia.c,v 1.35 2021/08/07 16:18:41 thorpej Exp $ */
/* $NetBSD: mcpcia.c,v 1.36 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: mcpcia.c,v 1.35 2021/08/07 16:18:41 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: mcpcia.c,v 1.36 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -101,7 +101,7 @@ static void mcpciaattach(device_t, device_t, void *);
CFATTACH_DECL_NEW(mcpcia, sizeof(struct mcpcia_softc),
mcpciamatch, mcpciaattach, NULL, NULL);
void mcpcia_init0(struct mcpcia_config *, int);
void mcpcia_init0(struct mcpcia_config *);
/*
* We have one statically-allocated mcpcia_config structure; this is
@ -158,7 +158,7 @@ mcpciaattach(device_t parent, device_t self, void *aux)
ccp->cc_sc = mcp;
/* This initializes cc_sysbase so we can do register access. */
mcpcia_init0(ccp, 1);
mcpcia_init0(ccp);
ctl = REGVAL(MCPCIA_PCI_REV(ccp));
aprint_normal_dev(self,
@ -225,7 +225,7 @@ mcpcia_init(void)
continue;
if (EISA_PRESENT(REGVAL(MCPCIA_PCI_REV(ccp)))) {
mcpcia_init0(ccp, 0);
mcpcia_init0(ccp);
alpha_bus_window_count[ALPHA_BUS_TYPE_PCI_IO] = 2;
alpha_bus_window_count[ALPHA_BUS_TYPE_PCI_MEM] = 3;
@ -239,7 +239,7 @@ mcpcia_init(void)
}
void
mcpcia_init0(struct mcpcia_config *ccp, int mallocsafe)
mcpcia_init0(struct mcpcia_config *ccp)
{
uint32_t ctl;
@ -248,7 +248,6 @@ mcpcia_init0(struct mcpcia_config *ccp, int mallocsafe)
mcpcia_bus_io_init(&ccp->cc_iot, ccp);
mcpcia_bus_mem_init(&ccp->cc_memt, ccp);
}
ccp->cc_mallocsafe = mallocsafe;
mcpcia_pci_init(&ccp->cc_pc, ccp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcpcia_bus_io.c,v 1.6 2021/07/04 22:42:36 thorpej Exp $ */
/* $NetBSD: mcpcia_bus_io.c,v 1.7 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1998 by Matthew Jacob
@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(1, "$NetBSD: mcpcia_bus_io.c,v 1.6 2021/07/04 22:42:36 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: mcpcia_bus_io.c,v 1.7 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -46,11 +46,12 @@ __KERNEL_RCSID(1, "$NetBSD: mcpcia_bus_io.c,v 1.6 2021/07/04 22:42:36 thorpej Ex
#define CHIP mcpcia
#define CHIP_EX_MALLOC_SAFE(v) (((struct mcpcia_config *)(v))->cc_mallocsafe)
#define CHIP_IO_EXTENT(v) (((struct mcpcia_config *)(v))->cc_io_ex)
#define CHIP_IO_EX_STORE(v) (((struct mcpcia_config *)(v))->cc_io_exstorage)
#define CHIP_IO_EX_STORE_SIZE(v) \
(sizeof (((struct mcpcia_config *)(v))->cc_io_exstorage))
#define CHIP_IO_ARENA(v) (((struct mcpcia_config *)(v))->cc_io_arena)
#define CHIP_IO_ARENA_STORE(v) \
(&(((struct mcpcia_config *)(v))->cc_io_arena_store))
#define CHIP_IO_BTAG_STORE(v) \
(((struct mcpcia_config *)(v))->cc_io_btag_store)
#define CHIP_IO_BTAG_COUNT(v) MCPCIA_IO_NBTS
/* IO Region 1 */
#define CHIP_IO_W1_BUS_START(v) 0x00000000UL

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcpcia_bus_mem.c,v 1.6 2021/07/04 22:42:36 thorpej Exp $ */
/* $NetBSD: mcpcia_bus_mem.c,v 1.7 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1998 by Matthew Jacob
@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(1, "$NetBSD: mcpcia_bus_mem.c,v 1.6 2021/07/04 22:42:36 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: mcpcia_bus_mem.c,v 1.7 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -46,17 +46,21 @@ __KERNEL_RCSID(1, "$NetBSD: mcpcia_bus_mem.c,v 1.6 2021/07/04 22:42:36 thorpej E
#define CHIP mcpcia
#define CHIP_EX_MALLOC_SAFE(v) (((struct mcpcia_config *)(v))->cc_mallocsafe)
#define CHIP_D_MEM_EXTENT(v) (((struct mcpcia_config *)(v))->cc_d_mem_ex)
#define CHIP_D_MEM_EX_STORE(v) \
(((struct mcpcia_config *)(v))->cc_dmem_exstorage)
#define CHIP_D_MEM_EX_STORE_SIZE(v) \
(sizeof (((struct mcpcia_config *)(v))->cc_dmem_exstorage))
#define CHIP_S_MEM_EXTENT(v) (((struct mcpcia_config *)(v))->cc_s_mem_ex)
#define CHIP_S_MEM_EX_STORE(v) \
(((struct mcpcia_config *)(v))->cc_smem_exstorage)
#define CHIP_S_MEM_EX_STORE_SIZE(v) \
(sizeof (((struct mcpcia_config *)(v))->cc_smem_exstorage))
#define CHIP_D_MEM_ARENA(v) \
(((struct mcpcia_config *)(v))->cc_d_mem_arena)
#define CHIP_D_MEM_ARENA_STORE(v) \
(&(((struct mcpcia_config *)(v))->cc_d_mem_arena_store))
#define CHIP_D_MEM_BTAG_STORE(v) \
(((struct mcpcia_config *)(v))->cc_d_mem_btag_store)
#define CHIP_D_MEM_BTAG_COUNT(v) MCPCIA_D_MEM_NBTS
#define CHIP_S_MEM_ARENA(v) \
(((struct mcpcia_config *)(v))->cc_s_mem_arena)
#define CHIP_S_MEM_ARENA_STORE(v) \
(&(((struct mcpcia_config *)(v))->cc_s_mem_arena_store))
#define CHIP_S_MEM_BTAG_STORE(v) \
(((struct mcpcia_config *)(v))->cc_s_mem_btag_store)
#define CHIP_S_MEM_BTAG_COUNT(v) MCPCIA_S_MEM_NBTS
/* Dense region 1 */
#define CHIP_D_MEM_W1_BUS_START(v) 0x00000000UL

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcpciavar.h,v 1.6 2011/06/14 15:34:22 matt Exp $ */
/* $NetBSD: mcpciavar.h,v 1.7 2023/12/04 00:32:10 thorpej Exp $ */
/*
* Copyright (c) 1998 by Matthew Jacob
@ -30,12 +30,16 @@
* SUCH DAMAGE.
*/
#include <dev/pci/pcivar.h>
#include <sys/extent.h>
#include <sys/vmem_impl.h>
#include <dev/pci/pcivar.h>
#include <alpha/pci/pci_sgmap_pte64.h>
#define _FSTORE (EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long))
#define MCPCIA_IO_NBTS VMEM_EST_BTCOUNT(2, 8)
#define MCPCIA_D_MEM_NBTS VMEM_EST_BTCOUNT(1, 8)
#define MCPCIA_S_MEM_NBTS VMEM_EST_BTCOUNT(2, 8)
/*
* MPCIA configuration.
@ -44,17 +48,19 @@ struct mcpcia_config {
int cc_gid; /* GID of this MCbus */
int cc_mid; /* MCbus Module ID */
int cc_initted;
int cc_mallocsafe;
struct alpha_bus_space cc_iot;
struct alpha_bus_space cc_memt;
struct extent * cc_io_ex;
struct extent * cc_d_mem_ex;
struct extent * cc_s_mem_ex;
vmem_t * cc_io_arena;
vmem_t * cc_d_mem_arena;
vmem_t * cc_s_mem_arena;
struct alpha_pci_chipset cc_pc;
struct mcpcia_softc * cc_sc; /* back pointer */
long cc_io_exstorage[_FSTORE];
long cc_dmem_exstorage[_FSTORE];
long cc_smem_exstorage[_FSTORE];
struct vmem cc_io_arena_store;
struct vmem cc_d_mem_arena_store;
struct vmem cc_s_mem_arena_store;
struct vmem_btag cc_io_btag_store[MCPCIA_IO_NBTS];
struct vmem_btag cc_d_mem_btag_store[MCPCIA_D_MEM_NBTS];
struct vmem_btag cc_s_mem_btag_store[MCPCIA_S_MEM_NBTS];
unsigned long cc_sysbase; /* shorthand */
struct alpha_bus_dma_tag cc_dmat_direct;
struct alpha_bus_dma_tag cc_dmat_pci_sgmap;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_bwx_bus_io_chipdep.c,v 1.22 2021/05/05 02:15:18 thorpej Exp $ */
/* $NetBSD: pci_bwx_bus_io_chipdep.c,v 1.23 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@ -64,21 +64,26 @@
* uses:
* CHIP name of the 'chip' it's being compiled for.
* CHIP_IO_BASE I/O space base to use.
* CHIP_IO_EX_STORE
* CHIP_IO_ARENA_STORE
* If defined, device-provided static storage area
* for the I/O space extent. If this is defined,
* CHIP_IO_EX_STORE_SIZE must also be defined. If
* this is not defined, a static area will be
* declared.
* CHIP_IO_EX_STORE_SIZE
* Size of the device-provided static storage area
* for the I/O memory space extent.
* for the I/O space arena. If this is defined,
* CHIP_IO_BTAG_STORE and CHIP_IO_BTAG_COUNT must
* also be defined. If this is not defined, a
* static area will be declared.
* CHIP_IO_BTAG_STORE
* Device-provided static storage area for the
* I/O space arena's boundary tags. Ignored
* unless CHIP_IO_ARENA_STORE is defined.
* CHIP_IO_BTAG_COUNT
* The number of device-provided static I/O
* space boundary tags. Ignored unless
* CHIP_IO_ARENA_STORE is defined.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: pci_bwx_bus_io_chipdep.c,v 1.22 2021/05/05 02:15:18 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: pci_bwx_bus_io_chipdep.c,v 1.23 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/extent.h>
#include <sys/vmem_impl.h>
#include <machine/bwx.h>
@ -205,19 +210,22 @@ static void __C(CHIP,_io_copy_region_4)(void *, bus_space_handle_t,
static void __C(CHIP,_io_copy_region_8)(void *, bus_space_handle_t,
bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t);
#ifndef CHIP_IO_EX_STORE
static long
__C(CHIP,_io_ex_storage)[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)];
#define CHIP_IO_EX_STORE(v) (__C(CHIP, _io_ex_storage))
#define CHIP_IO_EX_STORE_SIZE(v) (sizeof __C(CHIP, _io_ex_storage))
#endif
#ifndef CHIP_IO_ARENA_STORE
#define CHIP_IO_BTAG_COUNT(v) VMEM_EST_BTCOUNT(1, 8)
#define CHIP_IO_BTAG_STORE(v) __C(CHIP,_io_btag_store)
#define CHIP_IO_ARENA_STORE(v) (&(__C(CHIP,_io_arena_store)))
static struct vmem __C(CHIP,_io_arena_store);
static struct vmem_btag __C(CHIP,_io_btag_store)[CHIP_IO_BTAG_COUNT(xxx)];
#endif /* CHIP_IO_ARENA_STORE */
void
__C(CHIP,_bus_io_init)(
bus_space_tag_t t,
void *v)
{
struct extent *ex;
vmem_t *vm;
int error __diagused;
/*
* Initialize the bus space tag.
@ -301,11 +309,24 @@ __C(CHIP,_bus_io_init)(
t->abs_c_4 = __C(CHIP,_io_copy_region_4);
t->abs_c_8 = __C(CHIP,_io_copy_region_8);
ex = extent_create(__S(__C(CHIP,_bus_io)), 0x0UL, 0xffffffffUL,
(void *)CHIP_IO_EX_STORE(v), CHIP_IO_EX_STORE_SIZE(v),
EX_NOWAIT|EX_NOCOALESCE);
vm = vmem_init(CHIP_IO_ARENA_STORE(v),
__S(__C(CHIP,_bus_io)), /* name */
0, /* addr */
0, /* size */
1, /* quantum */
NULL, /* importfn */
NULL, /* releasefn */
NULL, /* source */
0, /* qcache_max */
VM_NOSLEEP | VM_PRIVTAGS,
IPL_NONE);
KASSERT(vm != NULL);
CHIP_IO_EXTENT(v) = ex;
vmem_add_bts(vm, CHIP_IO_BTAG_STORE(v), CHIP_IO_BTAG_COUNT(v));
error = vmem_add(vm, 0, 0x100000000UL, VM_NOSLEEP);
KASSERT(error == 0);
CHIP_IO_ARENA(v) = vm;
}
static int
@ -378,12 +399,11 @@ __C(CHIP,_io_map)(
#ifdef EXTENT_DEBUG
printf("io: allocating 0x%lx to 0x%lx\n", ioaddr, ioaddr + iosize - 1);
#endif
error = extent_alloc_region(CHIP_IO_EXTENT(v), ioaddr, iosize,
EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0));
error = vmem_xalloc_addr(CHIP_IO_ARENA(v), ioaddr, iosize, VM_NOSLEEP);
if (error) {
#ifdef EXTENT_DEBUG
printf("io: allocation failed (%d)\n", error);
extent_print(CHIP_IO_EXTENT(v));
/* vmem_print(CHIP_IO_ARENA(v)); XXX */
#endif
return (error);
}
@ -402,7 +422,6 @@ __C(CHIP,_io_unmap)(
int acct)
{
bus_addr_t ioaddr;
int error;
if (acct == 0)
return;
@ -416,16 +435,7 @@ __C(CHIP,_io_unmap)(
#ifdef EXTENT_DEBUG
printf("io: freeing 0x%lx to 0x%lx\n", ioaddr, ioaddr + iosize - 1);
#endif
error = extent_free(CHIP_IO_EXTENT(v), ioaddr, iosize,
EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0));
if (error) {
printf("%s: WARNING: could not unmap 0x%lx-0x%lx (error %d)\n",
__S(__C(CHIP,_io_unmap)), ioaddr, ioaddr + iosize - 1,
error);
#ifdef EXTENT_DEBUG
extent_print(CHIP_IO_EXTENT(v));
#endif
}
vmem_xfree(CHIP_IO_ARENA(v), ioaddr, iosize);
}
static int
@ -455,7 +465,7 @@ __C(CHIP,_io_alloc)(
{
struct alpha_bus_space_translation abst;
int linear = flags & BUS_SPACE_MAP_LINEAR;
bus_addr_t ioaddr;
vmem_addr_t ioaddr;
int error;
/*
@ -470,14 +480,18 @@ __C(CHIP,_io_alloc)(
#ifdef EXTENT_DEBUG
printf("io: allocating from 0x%lx to 0x%lx\n", rstart, rend);
#endif
error = extent_alloc_subregion(CHIP_IO_EXTENT(v), rstart, rend,
size, align, boundary,
EX_FAST | EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0),
&ioaddr);
error = vmem_xalloc(CHIP_IO_ARENA(v), size,
align, /* align */
0, /* phase */
boundary, /* nocross */
rstart, /* minaddr */
rend, /* maxaddr */
VM_NOSLEEP,
&ioaddr);
if (error) {
#ifdef EXTENT_DEBUG
printf("io: allocation failed (%d)\n", error);
extent_print(CHIP_IO_EXTENT(v));
/* vmem_print(CHIP_IO_ARENA(v)); XXX */
#endif
return (error);
}
@ -488,8 +502,7 @@ __C(CHIP,_io_alloc)(
error = __C(CHIP,_io_translate)(v, ioaddr, size, flags, &abst);
if (error) {
(void) extent_free(CHIP_IO_EXTENT(v), ioaddr, size,
EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0));
vmem_xfree(CHIP_IO_ARENA(v), ioaddr, size);
return (error);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_bwx_bus_mem_chipdep.c,v 1.28 2021/05/05 02:15:18 thorpej Exp $ */
/* $NetBSD: pci_bwx_bus_mem_chipdep.c,v 1.29 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@ -64,21 +64,26 @@
* uses:
* CHIP name of the 'chip' it's being compiled for.
* CHIP_MEM_BASE Mem space base to use.
* CHIP_MEM_EX_STORE
* CHIP_MEM_ARENA_STORE
* If defined, device-provided static storage area
* for the memory space extent. If this is
* defined, CHIP_MEM_EX_STORE_SIZE must also be
* defined. If this is not defined, a static area
* will be declared.
* CHIP_MEM_EX_STORE_SIZE
* Size of the device-provided static storage area
* for the memory space extent.
* for the memory space arena. If this is
* defined, CHIP_MEM_BTAG_STORE and CHIP_MEM_BTAG_COUNT
* must also be defined. If this is not defined, a
* static area will be declared.
* CHIP_MEM_BTAG_STORE
* Device-provided static storage area for the
* memory space arena's boundary tags. Ignored
* unless CHIP_MEM_ARENA_STORE is defined.
* CHIP_MEM_BTAG_COUNT
* The number of device-provided static memory
* space boundary tags. Ignored unless
* CHIP_MEM_ARENA_STORE is defined.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: pci_bwx_bus_mem_chipdep.c,v 1.28 2021/05/05 02:15:18 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: pci_bwx_bus_mem_chipdep.c,v 1.29 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/extent.h>
#include <sys/vmem_impl.h>
#include <machine/bwx.h>
@ -205,19 +210,22 @@ static void __C(CHIP,_mem_copy_region_4)(void *, bus_space_handle_t,
static void __C(CHIP,_mem_copy_region_8)(void *, bus_space_handle_t,
bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t);
#ifndef CHIP_MEM_EX_STORE
static long
__C(CHIP,_mem_ex_storage)[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)];
#define CHIP_MEM_EX_STORE(v) (__C(CHIP,_mem_ex_storage))
#define CHIP_MEM_EX_STORE_SIZE(v) (sizeof __C(CHIP,_mem_ex_storage))
#endif
#ifndef CHIP_MEM_ARENA_STORE
#define CHIP_MEM_BTAG_COUNT(v) VMEM_EST_BTCOUNT(1, 8)
#define CHIP_MEM_BTAG_STORE(v) __C(CHIP,_mem_btag_store)
#define CHIP_MEM_ARENA_STORE(v) (&(__C(CHIP,_mem_arena_store)))
static struct vmem __C(CHIP,_mem_arena_store);
static struct vmem_btag __C(CHIP,_mem_btag_store)[CHIP_MEM_BTAG_COUNT(xxx)];
#endif /* CHIP_MEM_ARENA_STORE */
void
__C(CHIP,_bus_mem_init)(
bus_space_tag_t t,
void *v)
{
struct extent *ex;
vmem_t *vm;
int error __diagused;
/*
* Initialize the bus space tag.
@ -301,11 +309,24 @@ __C(CHIP,_bus_mem_init)(
t->abs_c_4 = __C(CHIP,_mem_copy_region_4);
t->abs_c_8 = __C(CHIP,_mem_copy_region_8);
ex = extent_create(__S(__C(CHIP,_bus_mem)), 0x0UL, 0xffffffffUL,
(void *)CHIP_MEM_EX_STORE(v), CHIP_MEM_EX_STORE_SIZE(v),
EX_NOWAIT|EX_NOCOALESCE);
vm = vmem_init(CHIP_MEM_ARENA_STORE(v),
__S(__C(CHIP,_bus_mem)), /* name */
0, /* addr */
0, /* size */
1, /* quantum */
NULL, /* importfn */
NULL, /* releasefn */
NULL, /* source */
0, /* qcache_max */
VM_NOSLEEP | VM_PRIVTAGS,
IPL_NONE);
KASSERT(vm != NULL);
CHIP_MEM_EXTENT(v) = ex;
vmem_add_bts(vm, CHIP_MEM_BTAG_STORE(v), CHIP_MEM_BTAG_COUNT(v));
error = vmem_add(vm, 0, 0x100000000UL, VM_NOSLEEP);
KASSERT(error == 0);
CHIP_MEM_ARENA(v) = vm;
}
static int
@ -365,12 +386,12 @@ __C(CHIP,_mem_map)(
printf("mem: allocating 0x%lx to 0x%lx\n", memaddr,
memaddr + memsize - 1);
#endif
error = extent_alloc_region(CHIP_MEM_EXTENT(v), memaddr, memsize,
EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0));
error = vmem_xalloc_addr(CHIP_MEM_ARENA(v), memaddr, memsize,
VM_NOSLEEP);
if (error) {
#ifdef EXTENT_DEBUG
printf("mem: allocation failed (%d)\n", error);
extent_print(CHIP_MEM_EXTENT(v));
/* vmem_print(CHIP_MEM_ARENA(v)); XXX */
#endif
return (error);
}
@ -389,7 +410,6 @@ __C(CHIP,_mem_unmap)(
int acct)
{
bus_addr_t memaddr;
int error;
if (acct == 0)
return;
@ -404,16 +424,7 @@ __C(CHIP,_mem_unmap)(
printf("mem: freeing 0x%lx to 0x%lx\n", memaddr, memaddr + memsize - 1);
#endif
error = extent_free(CHIP_MEM_EXTENT(v), memaddr, memsize,
EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0));
if (error) {
printf("%s: WARNING: could not unmap 0x%lx-0x%lx (error %d)\n",
__S(__C(CHIP,_mem_unmap)), memaddr, memaddr + memsize - 1,
error);
#ifdef EXTENT_DEBUG
extent_print(CHIP_MEM_EXTENT(v));
#endif
}
vmem_xfree(CHIP_MEM_ARENA(v), memaddr, memsize);
}
static int
@ -441,7 +452,7 @@ __C(CHIP,_mem_alloc)(
bus_addr_t *addrp,
bus_space_handle_t *bshp)
{
bus_addr_t memaddr;
vmem_addr_t memaddr;
int error;
/*
@ -450,14 +461,18 @@ __C(CHIP,_mem_alloc)(
#ifdef EXTENT_DEBUG
printf("mem: allocating from 0x%lx to 0x%lx\n", rstart, rend);
#endif
error = extent_alloc_subregion(CHIP_MEM_EXTENT(v), rstart, rend,
size, align, boundary,
EX_FAST | EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0),
&memaddr);
error = vmem_xalloc(CHIP_MEM_ARENA(v), size,
align, /* align */
0, /* phase */
boundary, /* nocross */
rstart, /* minaddr */
rend, /* maxaddr */
VM_NOSLEEP,
&memaddr);
if (error) {
#ifdef EXTENT_DEBUG
printf("mem: allocation failed (%d)\n", error);
extent_print(CHIP_MEM_EXTENT(v));
/* vmem_print(CHIP_MEM_ARENA(v)); XXX */
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_swiz_bus_io_chipdep.c,v 1.43 2021/05/05 02:15:18 thorpej Exp $ */
/* $NetBSD: pci_swiz_bus_io_chipdep.c,v 1.44 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -64,21 +64,26 @@
* uses:
* CHIP name of the 'chip' it's being compiled for.
* CHIP_IO_BASE Sparse I/O space base to use.
* CHIP_IO_EX_STORE
* CHIP_IO_ARENA_STORE
* If defined, device-provided static storage area
* for the I/O space extent. If this is defined,
* CHIP_IO_EX_STORE_SIZE must also be defined. If
* this is not defined, a static area will be
* declared.
* CHIP_IO_EX_STORE_SIZE
* Size of the device-provided static storage area
* for the I/O memory space extent.
* for the I/O space arena. If this is defined,
* CHIP_IO_BTAG_STORE and CHIP_IO_BTAG_COUNT must
* also be defined. If this is not defined, a
* static area will be declared.
* CHIP_IO_BTAG_STORE
* Device-provided static storage area for the
* I/O space arena's boundary tags. Ignored
* unless CHIP_IO_ARENA_STORE is defined.
* CHIP_IO_BTAG_COUNT
* The number of device-provided static I/O
* space boundary tags. Ignored unless
* CHIP_IO_ARENA_STORE is defined.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: pci_swiz_bus_io_chipdep.c,v 1.43 2021/05/05 02:15:18 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: pci_swiz_bus_io_chipdep.c,v 1.44 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/extent.h>
#include <sys/vmem_impl.h>
#define __C(A,B) __CONCAT(A,B)
#define __S(S) __STRING(S)
@ -203,12 +208,30 @@ static void __C(CHIP,_io_copy_region_4)(void *, bus_space_handle_t,
static void __C(CHIP,_io_copy_region_8)(void *, bus_space_handle_t,
bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t);
#ifndef CHIP_IO_EX_STORE
static long
__C(CHIP,_io_ex_storage)[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)];
#define CHIP_IO_EX_STORE(v) (__C(CHIP, _io_ex_storage))
#define CHIP_IO_EX_STORE_SIZE(v) (sizeof __C(CHIP, _io_ex_storage))
#endif
#ifndef CHIP_IO_ARENA_STORE
#ifdef CHIP_IO_W1_BUS_START
#define CHIP_IO_W1_BUS_SPAN 1
#else
#define CHIP_IO_W1_BUS_SPAN 0
#endif /* CHIP_IO_W1_BUS_START */
#ifdef CHIP_IO_W2_BUS_START
#define CHIP_IO_W2_BUS_SPAN 1
#else
#define CHIP_IO_W2_BUS_SPAN 0
#endif /* CHIP_IO_W2_BUS_START */
#define CHIP_IO_SPAN_COUNT (CHIP_IO_W1_BUS_SPAN + CHIP_IO_W2_BUS_SPAN)
#define CHIP_IO_BTAG_COUNT(v) VMEM_EST_BTCOUNT(CHIP_IO_SPAN_COUNT, 8)
#define CHIP_IO_BTAG_STORE(v) __C(CHIP,_io_btag_store)
#define CHIP_IO_ARENA_STORE(v) (&(__C(CHIP,_io_arena_store)))
static struct vmem __C(CHIP,_io_arena_store);
static struct vmem_btag __C(CHIP,_io_btag_store)[CHIP_IO_BTAG_COUNT(xxx)];
#endif /* CHIP_IO_ARENA_STORE */
#ifndef CHIP_ADDR_SHIFT
#define CHIP_ADDR_SHIFT 5
@ -221,7 +244,8 @@ static long
void
__C(CHIP,_bus_io_init)(bus_space_tag_t t, void *v)
{
struct extent *ex;
vmem_t *vm;
int error __diagused;
/*
* Initialize the bus space tag.
@ -305,33 +329,44 @@ __C(CHIP,_bus_io_init)(bus_space_tag_t t, void *v)
t->abs_c_4 = __C(CHIP,_io_copy_region_4);
t->abs_c_8 = __C(CHIP,_io_copy_region_8);
/* XXX WE WANT EXTENT_NOCOALESCE, BUT WE CAN'T USE IT. XXX */
ex = extent_create(__S(__C(CHIP,_bus_io)), 0x0UL, 0xffffffffUL,
(void *)CHIP_IO_EX_STORE(v), CHIP_IO_EX_STORE_SIZE(v),
EX_NOWAIT);
extent_alloc_region(ex, 0, 0xffffffffUL, EX_NOWAIT);
vm = vmem_init(CHIP_IO_ARENA_STORE(v),
__S(__C(CHIP,_bus_io)), /* name */
0, /* addr */
0, /* size */
1, /* quantum */
NULL, /* importfn */
NULL, /* releasefn */
NULL, /* source */
0, /* qcache_max */
VM_NOSLEEP | VM_PRIVTAGS,
IPL_NONE);
KASSERT(vm != NULL);
vmem_add_bts(vm, CHIP_IO_BTAG_STORE(v), CHIP_IO_BTAG_COUNT(v));
#ifdef CHIP_IO_W1_BUS_START
#ifdef EXTENT_DEBUG
printf("io: freeing from 0x%lx to 0x%lx\n", CHIP_IO_W1_BUS_START(v),
printf("io: adding span 0x%lx to 0x%lx\n", CHIP_IO_W1_BUS_START(v),
CHIP_IO_W1_BUS_END(v));
#endif
extent_free(ex, CHIP_IO_W1_BUS_START(v),
CHIP_IO_W1_BUS_END(v) - CHIP_IO_W1_BUS_START(v) + 1, EX_NOWAIT);
#endif
error = vmem_add(vm, CHIP_IO_W1_BUS_START(v),
CHIP_IO_W1_BUS_END(v) - CHIP_IO_W1_BUS_START(v) + 1, VM_NOSLEEP);
KASSERT(error == 0);
#endif /* CHIP_IO_W1_BUS_START */
#ifdef CHIP_IO_W2_BUS_START
#ifdef EXTENT_DEBUG
printf("io: freeing from 0x%lx to 0x%lx\n", CHIP_IO_W2_BUS_START(v),
printf("io: adding span 0x%lx to 0x%lx\n", CHIP_IO_W2_BUS_START(v),
CHIP_IO_W2_BUS_END(v));
#endif
extent_free(ex, CHIP_IO_W2_BUS_START(v),
CHIP_IO_W2_BUS_END(v) - CHIP_IO_W2_BUS_START(v) + 1, EX_NOWAIT);
#endif
error = vmem_add(vm, CHIP_IO_W2_BUS_START(v),
CHIP_IO_W2_BUS_END(v) - CHIP_IO_W2_BUS_START(v) + 1, VM_NOSLEEP);
#endif /* CHIP_IO_W2_BUS_START */
#ifdef EXTENT_DEBUG
extent_print(ex);
/* vmem_print(vm); XXX */
#endif
CHIP_IO_EXTENT(v) = ex;
CHIP_IO_ARENA(v) = vm;
}
static int
@ -434,12 +469,11 @@ __C(CHIP,_io_map)(void *v, bus_addr_t ioaddr, bus_size_t iosize,
#ifdef EXTENT_DEBUG
printf("io: allocating 0x%lx to 0x%lx\n", ioaddr, ioaddr + iosize - 1);
#endif
error = extent_alloc_region(CHIP_IO_EXTENT(v), ioaddr, iosize,
EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0));
error = vmem_xalloc_addr(CHIP_IO_ARENA(v), ioaddr, iosize, VM_NOSLEEP);
if (error) {
#ifdef EXTENT_DEBUG
printf("io: allocation failed (%d)\n", error);
extent_print(CHIP_IO_EXTENT(v));
/* vmem_print(CHIP_IO_ARENA(v)); XXX */
#endif
return (error);
}
@ -456,7 +490,6 @@ __C(CHIP,_io_unmap)(void *v, bus_space_handle_t ioh,
bus_size_t iosize, int acct)
{
bus_addr_t ioaddr;
int error;
if (acct == 0)
return;
@ -500,16 +533,7 @@ __C(CHIP,_io_unmap)(void *v, bus_space_handle_t ioh,
#ifdef EXTENT_DEBUG
printf("io: freeing 0x%lx to 0x%lx\n", ioaddr, ioaddr + iosize - 1);
#endif
error = extent_free(CHIP_IO_EXTENT(v), ioaddr, iosize,
EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0));
if (error) {
printf("%s: WARNING: could not unmap 0x%lx-0x%lx (error %d)\n",
__S(__C(CHIP,_io_unmap)), ioaddr, ioaddr + iosize - 1,
error);
#ifdef EXTENT_DEBUG
extent_print(CHIP_IO_EXTENT(v));
#endif
}
vmem_xfree(CHIP_IO_ARENA(v), ioaddr, iosize);
}
static int
@ -528,7 +552,7 @@ __C(CHIP,_io_alloc)(void *v, bus_addr_t rstart, bus_addr_t rend,
{
struct alpha_bus_space_translation abst;
int linear = flags & BUS_SPACE_MAP_LINEAR;
bus_addr_t ioaddr;
vmem_addr_t ioaddr;
int error;
/*
@ -543,10 +567,14 @@ __C(CHIP,_io_alloc)(void *v, bus_addr_t rstart, bus_addr_t rend,
#ifdef EXTENT_DEBUG
printf("io: allocating from 0x%lx to 0x%lx\n", rstart, rend);
#endif
error = extent_alloc_subregion(CHIP_IO_EXTENT(v), rstart, rend,
size, align, boundary,
EX_FAST | EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0),
&ioaddr);
error = vmem_xalloc(CHIP_IO_ARENA(v), size,
align, /* align */
0, /* phase */
boundary, /* nocross */
rstart, /* minaddr */
rend, /* maxaddr */
VM_NOSLEEP,
&ioaddr);
if (error) {
#ifdef EXTENT_DEBUG
printf("io: allocation failed (%d)\n", error);
@ -561,8 +589,7 @@ __C(CHIP,_io_alloc)(void *v, bus_addr_t rstart, bus_addr_t rend,
error = __C(CHIP,_io_translate)(v, ioaddr, size, flags, &abst);
if (error) {
(void) extent_free(CHIP_IO_EXTENT(v), ioaddr, size,
EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0));
vmem_xfree(CHIP_IO_ARENA(v), ioaddr, size);
return (error);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_swiz_bus_mem_chipdep.c,v 1.48 2021/05/05 02:15:18 thorpej Exp $ */
/* $NetBSD: pci_swiz_bus_mem_chipdep.c,v 1.49 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -63,31 +63,41 @@
* uses:
* CHIP name of the 'chip' it's being compiled for.
* CHIP_D_MEM_W1_SYS_START Dense Mem space base to use.
* CHIP_D_MEM_EX_STORE
* CHIP_D_MEM_ARENA_STORE
* If defined, device-provided static storage area
* for the dense memory space extent. If this is
* defined, CHIP_D_MEM_EX_STORE_SIZE must also be
* defined. If this is not defined, a static area
* will be declared.
* CHIP_D_MEM_EX_STORE_SIZE
* Size of the device-provided static storage area
* for the dense memory space extent.
* for the dense memory space arena. If this is
* defined, CHIP_D_MEM_BTAG_STORE and
* CHIP_D_MEM_BTAG_COUNT must also be defined. If
* this is not defined, a static area will be declared.
* CHIP_D_MEM_BTAG_STORE
* Device-provided static storage area for the
* dense memory space arena's boundary tags. Ignored
* unless CHIP_D_MEM_ARENA_STORE is defined.
* CHIP_D_MEM_BTAG_COUNT
* The number of device-provided static dense memory
* space boundary tags. Ignored unless
* CHIP_MEM_ARENA_STORE is defined.
* CHIP_S_MEM_BASE Sparse Mem space base to use.
* CHIP_S_MEM_EX_STORE
* CHIP_S_MEM_ARENA_STORE
* If defined, device-provided static storage area
* for the sparse memory space extent. If this is
* defined, CHIP_S_MEM_EX_STORE_SIZE must also be
* defined. If this is not defined, a static area
* will be declared.
* CHIP_S_MEM_EX_STORE_SIZE
* Size of the device-provided static storage area
* for the sparse memory space extent.
* for the sparse memory space arena. If this is
* defined, CHIP_D_MEM_BTAG_STORE and
* CHIP_D_MEM_BTAG_COUNT must also be defined. If
* this is not defined, a static area will be declared.
* CHIP_S_MEM_BTAG_STORE
* Device-provided static storage area for the
* sparse memory space arena's boundary tags. Ignored
* unless CHIP_D_MEM_ARENA_STORE is defined.
* CHIP_S_MEM_BTAG_COUNT
* The number of device-provided static sparse memory
* space boundary tags. Ignored unless
* CHIP_MEM_ARENA_STORE is defined.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: pci_swiz_bus_mem_chipdep.c,v 1.48 2021/05/05 02:15:18 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: pci_swiz_bus_mem_chipdep.c,v 1.49 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/extent.h>
#include <sys/vmem_impl.h>
#define __C(A,B) __CONCAT(A,B)
#define __S(S) __STRING(S)
@ -213,20 +223,48 @@ static void __C(CHIP,_mem_copy_region_8)(void *, bus_space_handle_t,
bus_size_t, bus_space_handle_t, bus_size_t, bus_size_t);
#ifdef CHIP_D_MEM_W1_SYS_START
#ifndef CHIP_D_MEM_EX_STORE
static long
__C(CHIP,_dmem_ex_storage)[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)];
#define CHIP_D_MEM_EX_STORE(v) (__C(CHIP,_dmem_ex_storage))
#define CHIP_D_MEM_EX_STORE_SIZE(v) (sizeof __C(CHIP,_dmem_ex_storage))
#endif
#ifndef CHIP_D_MEM_ARENA_STORE
#define CHIP_D_MEM_BTAG_COUNT(v) VMEM_EST_BTCOUNT(1, 8)
#define CHIP_D_MEM_BTAG_STORE(v) __C(CHIP,_dmem_btag_store)
#define CHIP_D_MEM_ARENA_STORE(v) (&(__C(CHIP,_dmem_arena_store)))
static struct vmem __C(CHIP,_dmem_arena_store);
static struct vmem_btag __C(CHIP,_dmem_btag_store)[CHIP_D_MEM_BTAG_COUNT(xxx)];
#endif /* CHIP_D_MEM_ARENA_STORE */
#endif /* CHIP_D_MEM_W1_SYS_START */
#ifndef CHIP_S_MEM_EX_STORE
static long
__C(CHIP,_smem_ex_storage)[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)];
#define CHIP_S_MEM_EX_STORE(v) (__C(CHIP,_smem_ex_storage))
#define CHIP_S_MEM_EX_STORE_SIZE(v) (sizeof __C(CHIP,_smem_ex_storage))
#endif
#ifndef CHIP_S_MEM_ARENA_STORE
#ifdef CHIP_S_MEM_W1_BUS_START
#define CHIP_S_MEM_W1_BUS_SPAN 1
#else
#define CHIP_S_MEM_W1_BUS_SPAN 0
#endif /* CHIP_S_MEM_W1_BUS_START */
#ifdef CHIP_S_MEM_W2_BUS_START
#define CHIP_S_MEM_W2_BUS_SPAN 1
#else
#define CHIP_S_MEM_W2_BUS_SPAN 0
#endif /* CHIP_S_MEM_W2_BUS_START */
#ifdef CHIP_S_MEM_W3_BUS_START
#define CHIP_S_MEM_W3_BUS_SPAN 1
#else
#define CHIP_S_MEM_W3_BUS_SPAN 0
#endif /* CHIP_S_MEM_W3_BUS_START */
#define CHIP_S_MEM_SPAN_COUNT \
(CHIP_S_MEM_W1_BUS_SPAN + CHIP_S_MEM_W2_BUS_SPAN + \
CHIP_S_MEM_W3_BUS_SPAN)
#define CHIP_S_MEM_BTAG_COUNT(v) VMEM_EST_BTCOUNT(CHIP_S_MEM_SPAN_COUNT, 8)
#define CHIP_S_MEM_BTAG_STORE(v) __C(CHIP,_smem_btag_store)
#define CHIP_S_MEM_ARENA_STORE(v) (&(__C(CHIP,_smem_arena_store)))
static struct vmem __C(CHIP,_smem_arena_store);
static struct vmem_btag __C(CHIP,_smem_btag_store)[CHIP_S_MEM_BTAG_COUNT(xxx)];
#endif /* CHIP_S_MEM_ARENA_STORE */
#ifndef CHIP_ADDR_SHIFT
#define CHIP_ADDR_SHIFT 5
@ -240,9 +278,10 @@ void
__C(CHIP,_bus_mem_init)(bus_space_tag_t t, void *v)
{
#ifdef CHIP_D_MEM_W1_SYS_START
struct extent *dex;
vmem_t *dvm;
#endif
struct extent *sex;
vmem_t *svm;
int error __diagused;
/*
* Initialize the bus space tag.
@ -327,54 +366,73 @@ __C(CHIP,_bus_mem_init)(bus_space_tag_t t, void *v)
t->abs_c_8 = __C(CHIP,_mem_copy_region_8);
#ifdef CHIP_D_MEM_W1_SYS_START
/* XXX WE WANT EXTENT_NOCOALESCE, BUT WE CAN'T USE IT. XXX */
dex = extent_create(__S(__C(CHIP,_bus_dmem)), 0x0UL,
0xffffffffffffffffUL,
(void *)CHIP_D_MEM_EX_STORE(v), CHIP_D_MEM_EX_STORE_SIZE(v),
EX_NOWAIT);
extent_alloc_region(dex, 0, 0xffffffffffffffffUL, EX_NOWAIT);
dvm = vmem_init(CHIP_D_MEM_ARENA_STORE(v),
__S(__C(CHIP,_bus_dmem)), /* name */
0, /* addr */
0, /* size */
1, /* quantum */
NULL, /* importfn */
NULL, /* releasefn */
NULL, /* source */
0, /* qcache_max */
VM_NOSLEEP | VM_PRIVTAGS,
IPL_NONE);
KASSERT(dvm != NULL);
vmem_add_bts(dvm, CHIP_D_MEM_BTAG_STORE(v), CHIP_D_MEM_BTAG_COUNT(v));
#ifdef CHIP_D_MEM_W1_BUS_START
#ifdef EXTENT_DEBUG
printf("dmem: freeing from 0x%lx to 0x%lx\n",
printf("dmem: adding span 0x%lx to 0x%lx\n",
CHIP_D_MEM_W1_BUS_START(v), CHIP_D_MEM_W1_BUS_END(v));
#endif
extent_free(dex, CHIP_D_MEM_W1_BUS_START(v),
error = vmem_add(dvm, CHIP_D_MEM_W1_BUS_START(v),
CHIP_D_MEM_W1_BUS_END(v) - CHIP_D_MEM_W1_BUS_START(v) + 1,
EX_NOWAIT);
#endif
VM_NOSLEEP);
KASSERT(error == 0);
#endif /* CHIP_D_MEM_W1_BUS_START */
#ifdef EXTENT_DEBUG
extent_print(dex);
/* vmem_print(dvm); XXX */
#endif
CHIP_D_MEM_EXTENT(v) = dex;
CHIP_D_MEM_ARENA(v) = dvm;
#endif /* CHIP_D_MEM_W1_SYS_START */
/* XXX WE WANT EXTENT_NOCOALESCE, BUT WE CAN'T USE IT. XXX */
sex = extent_create(__S(__C(CHIP,_bus_smem)), 0x0UL,
0xffffffffffffffffUL,
(void *)CHIP_S_MEM_EX_STORE(v), CHIP_S_MEM_EX_STORE_SIZE(v),
EX_NOWAIT);
extent_alloc_region(sex, 0, 0xffffffffffffffffUL, EX_NOWAIT);
svm = vmem_init(CHIP_S_MEM_ARENA_STORE(v),
__S(__C(CHIP,_bus_smem)), /* name */
0, /* addr */
0, /* size */
1, /* quantum */
NULL, /* importfn */
NULL, /* releasefn */
NULL, /* source */
0, /* qcache_max */
VM_NOSLEEP | VM_PRIVTAGS,
IPL_NONE);
KASSERT(svm != NULL);
vmem_add_bts(svm, CHIP_S_MEM_BTAG_STORE(v), CHIP_S_MEM_BTAG_COUNT(v));
#ifdef CHIP_S_MEM_W1_BUS_START
#ifdef EXTENT_DEBUG
printf("smem: freeing from 0x%lx to 0x%lx\n",
printf("smem: adding span 0x%lx to 0x%lx\n",
CHIP_S_MEM_W1_BUS_START(v), CHIP_S_MEM_W1_BUS_END(v));
#endif
extent_free(sex, CHIP_S_MEM_W1_BUS_START(v),
error = vmem_add(svm, CHIP_S_MEM_W1_BUS_START(v),
CHIP_S_MEM_W1_BUS_END(v) - CHIP_S_MEM_W1_BUS_START(v) + 1,
EX_NOWAIT);
VM_NOSLEEP);
KASSERT(error == 0);
#endif
#ifdef CHIP_S_MEM_W2_BUS_START
if (CHIP_S_MEM_W2_BUS_START(v) != CHIP_S_MEM_W1_BUS_START(v)) {
#ifdef EXTENT_DEBUG
printf("smem: freeing from 0x%lx to 0x%lx\n",
printf("smem: adding span 0x%lx to 0x%lx\n",
CHIP_S_MEM_W2_BUS_START(v), CHIP_S_MEM_W2_BUS_END(v));
#endif
extent_free(sex, CHIP_S_MEM_W2_BUS_START(v),
error = vmem_add(svm, CHIP_S_MEM_W2_BUS_START(v),
CHIP_S_MEM_W2_BUS_END(v) - CHIP_S_MEM_W2_BUS_START(v) + 1,
EX_NOWAIT);
VM_NOSLEEP);
KASSERT(error == 0);
} else {
#ifdef EXTENT_DEBUG
printf("smem: window 2 (0x%lx to 0x%lx) overlaps window 1\n",
@ -386,24 +444,25 @@ __C(CHIP,_bus_mem_init)(bus_space_tag_t t, void *v)
if (CHIP_S_MEM_W3_BUS_START(v) != CHIP_S_MEM_W1_BUS_START(v) &&
CHIP_S_MEM_W3_BUS_START(v) != CHIP_S_MEM_W2_BUS_START(v)) {
#ifdef EXTENT_DEBUG
printf("smem: freeing from 0x%lx to 0x%lx\n",
printf("smem: adding span 0x%lx to 0x%lx\n",
CHIP_S_MEM_W3_BUS_START(v), CHIP_S_MEM_W3_BUS_END(v));
#endif
extent_free(sex, CHIP_S_MEM_W3_BUS_START(v),
error = vmem_add(svm, CHIP_S_MEM_W3_BUS_START(v),
CHIP_S_MEM_W3_BUS_END(v) - CHIP_S_MEM_W3_BUS_START(v) + 1,
EX_NOWAIT);
VM_NOSLEEP);
KASSERT(error == 0);
} else {
#ifdef EXTENT_DEBUG
printf("smem: window 2 (0x%lx to 0x%lx) overlaps window 1\n",
CHIP_S_MEM_W2_BUS_START(v), CHIP_S_MEM_W2_BUS_END(v));
printf("smem: window 3 (0x%lx to 0x%lx) overlaps window 1/2\n",
CHIP_S_MEM_W3_BUS_START(v), CHIP_S_MEM_W3_BUS_END(v));
#endif
}
#endif
#ifdef EXTENT_DEBUG
extent_print(sex);
/* vmem_print(svm); XXX */
#endif
CHIP_S_MEM_EXTENT(v) = sex;
CHIP_S_MEM_ARENA(v) = svm;
}
#ifdef CHIP_D_MEM_W1_SYS_START
@ -671,14 +730,14 @@ __C(CHIP,_mem_map)(void *v, bus_addr_t memaddr, bus_size_t memsize,
musts ? "need" : "want");
#endif
#ifdef CHIP_D_MEM_W1_SYS_START
errord = extent_alloc_region(CHIP_D_MEM_EXTENT(v), memaddr, memsize,
EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0));
errord = vmem_xalloc_addr(CHIP_D_MEM_ARENA(v), memaddr, memsize,
VM_NOSLEEP);
#else
errord = EINVAL;
#endif
didd = (errord == 0);
errors = extent_alloc_region(CHIP_S_MEM_EXTENT(v), memaddr, memsize,
EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0));
errors = vmem_xalloc_addr(CHIP_S_MEM_ARENA(v), memaddr, memsize,
VM_NOSLEEP);
dids = (errors == 0);
#ifdef EXTENT_DEBUG
@ -727,40 +786,30 @@ __C(CHIP,_mem_map)(void *v, bus_addr_t memaddr, bus_size_t memsize,
*memhp = sh;
return (0);
bad:
bad:
#ifdef EXTENT_DEBUG
printf("mem: failed\n");
#endif
#ifdef CHIP_D_MEM_W1_SYS_START
if (didd) {
#ifdef EXTENT_DEBUG
printf("mem: freeing dense\n");
printf("mem: freeing dense\n");
#endif
if (extent_free(CHIP_D_MEM_EXTENT(v), memaddr, memsize,
EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0)) != 0) {
printf("%s: WARNING: couldn't free dense 0x%lx-0x%lx\n",
__S(__C(CHIP,_mem_map)), memaddr,
memaddr + memsize - 1);
}
vmem_xfree(CHIP_D_MEM_ARENA(v), memaddr, memsize);
}
#endif /* CHIP_D_MEM_W1_SYS_START */
if (dids) {
#ifdef EXTENT_DEBUG
printf("mem: freeing sparse\n");
printf("mem: freeing sparse\n");
#endif
if (extent_free(CHIP_S_MEM_EXTENT(v), memaddr, memsize,
EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0)) != 0) {
printf("%s: WARNING: couldn't free sparse 0x%lx-0x%lx\n",
__S(__C(CHIP,_mem_map)), memaddr,
memaddr + memsize - 1);
}
vmem_xfree(CHIP_S_MEM_ARENA(v), memaddr, memsize);
}
#ifdef EXTENT_DEBUG
#ifdef CHIP_D_MEM_W1_SYS_START
extent_print(CHIP_D_MEM_EXTENT(v));
/* vmem_print(CHIP_D_MEM_ARENA(v)); XXX */
#endif
extent_print(CHIP_S_MEM_EXTENT(v));
/* vmem_print(CHIP_S_MEM_ARENA(v)); XXX */
#endif
/*
@ -830,18 +879,12 @@ __C(CHIP,_mem_unmap)(void *v, bus_space_handle_t memh,
haved ? "" : "not ", haves ? "" : "not ");
#endif
#ifdef CHIP_D_MEM_W1_SYS_START
if (haved && extent_free(CHIP_D_MEM_EXTENT(v), memaddr, memsize,
EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0)) != 0) {
printf("%s: WARNING: couldn't free dense 0x%lx-0x%lx\n",
__S(__C(CHIP,_mem_map)), memaddr,
memaddr + memsize - 1);
if (haved) {
vmem_xfree(CHIP_D_MEM_ARENA(v), memaddr, memsize);
}
#endif
if (haves && extent_free(CHIP_S_MEM_EXTENT(v), memaddr, memsize,
EX_NOWAIT | (CHIP_EX_MALLOC_SAFE(v) ? EX_MALLOCOK : 0)) != 0) {
printf("%s: WARNING: couldn't free sparse 0x%lx-0x%lx\n",
__S(__C(CHIP,_mem_map)), memaddr,
memaddr + memsize - 1);
if (haves) {
vmem_xfree(CHIP_S_MEM_ARENA(v), memaddr, memsize);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tsc.c,v 1.29 2021/08/07 16:18:41 thorpej Exp $ */
/* $NetBSD: tsc.c,v 1.30 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 1999 by Ross Harvey. All rights reserved.
@ -33,7 +33,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.29 2021/08/07 16:18:41 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.30 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -207,7 +207,7 @@ tspattach(device_t parent, device_t self, void *aux)
struct tsp_config *pcp;
printf("\n");
pcp = tsp_init(1, t->tsp_slot);
pcp = tsp_init(t->tsp_slot);
tsp_dma_init(pcp);
@ -234,7 +234,7 @@ tspattach(device_t parent, device_t self, void *aux)
}
struct tsp_config *
tsp_init(int mallocsafe, int n)
tsp_init(int n)
/* n: Pchip number */
{
struct tsp_config *pcp;
@ -265,7 +265,6 @@ tsp_init(int mallocsafe, int n)
alpha_bus_get_window = tsp_bus_get_window;
}
pcp->pc_mallocsafe = mallocsafe;
tsp_pci_init(&pcp->pc_pc, pcp);
pcp->pc_initted = 1;
return pcp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tsp_bus_io.c,v 1.9 2021/07/04 22:42:36 thorpej Exp $ */
/* $NetBSD: tsp_bus_io.c,v 1.10 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 1999 by Ross Harvey. All rights reserved.
@ -33,7 +33,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: tsp_bus_io.c,v 1.9 2021/07/04 22:42:36 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: tsp_bus_io.c,v 1.10 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -53,10 +53,10 @@ __KERNEL_RCSID(1, "$NetBSD: tsp_bus_io.c,v 1.9 2021/07/04 22:42:36 thorpej Exp $
typedef struct tsp_config *TSPCON;
#define CHIP_EX_MALLOC_SAFE(v) (((TSPCON)(v))->pc_mallocsafe)
#define CHIP_IO_EXTENT(v) (((TSPCON)(v))->pc_io_ex)
#define CHIP_IO_EX_STORE(v) (((TSPCON)(v))->pc_io_exstorage)
#define CHIP_IO_EX_STORE_SIZE(v) (sizeof (((TSPCON)(v))->pc_io_exstorage))
#define CHIP_IO_ARENA(v) (((TSPCON)(v))->pc_io_arena)
#define CHIP_IO_ARENA_STORE(v) (&(((TSPCON)(v))->pc_io_arena_store))
#define CHIP_IO_BTAG_STORE(v) (((TSPCON)(v))->pc_io_btag_store)
#define CHIP_IO_BTAG_COUNT(v) TSP_NBTS
#define CHIP_IO_SYS_START(v) (((TSPCON)(v))->pc_iobase | P_PCI_IO)

View File

@ -1,4 +1,4 @@
/* $NetBSD: tsp_bus_mem.c,v 1.14 2021/07/04 22:42:36 thorpej Exp $ */
/* $NetBSD: tsp_bus_mem.c,v 1.15 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 1999 by Ross Harvey. All rights reserved.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tsp_bus_mem.c,v 1.14 2021/07/04 22:42:36 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: tsp_bus_mem.c,v 1.15 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -50,11 +50,13 @@ __KERNEL_RCSID(0, "$NetBSD: tsp_bus_mem.c,v 1.14 2021/07/04 22:42:36 thorpej Exp
#define CHIP tsp
#define CHIP_EX_MALLOC_SAFE(v) (((struct tsp_config *)(v))->pc_mallocsafe)
#define CHIP_MEM_EXTENT(v) (((struct tsp_config *)(v))->pc_mem_ex)
#define CHIP_MEM_EX_STORE(v) (((struct tsp_config *)(v))->pc_mem_exstorage)
#define CHIP_MEM_EX_STORE_SIZE(v) \
(sizeof (((struct tsp_config *)(v))->pc_mem_exstorage))
#define CHIP_MEM_ARENA(v) \
(((struct tsp_config *)(v))->pc_mem_arena)
#define CHIP_MEM_ARENA_STORE(v) \
(&(((struct tsp_config *)(v))->pc_mem_arena_store))
#define CHIP_MEM_BTAG_STORE(v) \
(((struct tsp_config *)(v))->pc_mem_btag_store)
#define CHIP_MEM_BTAG_COUNT(v) TSP_NBTS
#define CHIP_MEM_SYS_START(v) \
(((struct tsp_config *)(v))->pc_iobase | P_PCI_MEM)
@ -84,10 +86,10 @@ tsp_bus_mem_init2(bus_space_tag_t t, void *v)
continue;
}
error = extent_alloc_region(CHIP_MEM_EXTENT(v),
error = vmem_xalloc_addr(CHIP_MEM_ARENA(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));
VM_NOSLEEP);
if (error) {
printf("WARNING: unable to reserve DMA window "
"0x%lx - 0x%lx\n",

View File

@ -1,4 +1,4 @@
/* $NetBSD: tsvar.h,v 1.17 2021/07/19 01:06:14 thorpej Exp $ */
/* $NetBSD: tsvar.h,v 1.18 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 1999 by Ross Harvey. All rights reserved.
@ -32,12 +32,14 @@
*/
#include <sys/extent.h>
#include <sys/vmem_impl.h>
#include <dev/isa/isavar.h>
#include <dev/pci/pcivar.h>
#include <dev/i2c/i2cvar.h>
#include <alpha/pci/pci_sgmap_pte64.h>
#define _FSTORE (EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long))
#define TSP_NBTS VMEM_EST_BTCOUNT(1, 8)
#define tsvar() { Generate ctags(1) key. }
@ -62,10 +64,13 @@ struct tsp_config {
uint32_t pc_hae_mem;
uint32_t pc_hae_io;
long pc_io_exstorage[_FSTORE];
long pc_mem_exstorage[_FSTORE];
struct extent *pc_io_ex, *pc_mem_ex;
int pc_mallocsafe;
struct vmem pc_io_arena_store;
struct vmem pc_mem_arena_store;
struct vmem_btag pc_io_btag_store[TSP_NBTS];
struct vmem_btag pc_mem_btag_store[TSP_NBTS];
vmem_t *pc_io_arena;
vmem_t *pc_mem_arena;
struct {
uint64_t wsba[4];
@ -91,7 +96,7 @@ struct tsciic_attach_args {
extern int tsp_console_hose;
struct tsp_config *tsp_init(int, int);
struct tsp_config *tsp_init(int);
void tsp_pci_init(pci_chipset_tag_t, void *);
void tsp_dma_init(struct tsp_config *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ttwoga.c,v 1.20 2021/08/07 16:18:41 thorpej Exp $ */
/* $NetBSD: ttwoga.c,v 1.21 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: ttwoga.c,v 1.20 2021/08/07 16:18:41 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: ttwoga.c,v 1.21 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -163,7 +163,7 @@ ttwogaprint(void *aux, const char *pnp)
* Set up the chipset's function pointers.
*/
struct ttwoga_config *
ttwoga_init(int hose, int mallocsafe)
ttwoga_init(int hose)
{
struct ttwoga_config *tcp;
@ -194,7 +194,6 @@ ttwoga_init(int hose, int mallocsafe)
ttwoga_bus_io_init(&tcp->tc_iot, tcp);
ttwoga_bus_mem_init(&tcp->tc_memt, tcp);
}
tcp->tc_mallocsafe = mallocsafe;
ttwoga_pci_init(&tcp->tc_pc, tcp);
@ -225,7 +224,7 @@ ttwopciattach(device_t parent, device_t self, void *aux)
* set up the chipset's info; done one at console init time
* (maybe), but doesn't hurt to do it twice.
*/
tcp = ttwoga_init(pba->pba_bus, 1);
tcp = ttwoga_init(pba->pba_bus);
ttwoga_dma_init(tcp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ttwoga_bus_io.c,v 1.4 2021/07/04 22:42:36 thorpej Exp $ */
/* $NetBSD: ttwoga_bus_io.c,v 1.5 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(1, "$NetBSD: ttwoga_bus_io.c,v 1.4 2021/07/04 22:42:36 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: ttwoga_bus_io.c,v 1.5 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -47,11 +47,10 @@ __KERNEL_RCSID(1, "$NetBSD: ttwoga_bus_io.c,v 1.4 2021/07/04 22:42:36 thorpej Ex
#define CHIP_V(v) ((struct ttwoga_config *)(v))
#define CHIP_EX_MALLOC_SAFE(v) (CHIP_V(v)->tc_mallocsafe)
#define CHIP_IO_EXTENT(v) (CHIP_V(v)->tc_io_ex)
#define CHIP_IO_EX_STORE(v) (CHIP_V(v)->tc_io_exstorage)
#define CHIP_IO_EX_STORE_SIZE(v) sizeof(CHIP_IO_EX_STORE(v))
#define CHIP_IO_ARENA(v) (CHIP_V(v)->tc_io_arena)
#define CHIP_IO_ARENA_STORE(v) (&(CHIP_V(v)->tc_io_arena_store))
#define CHIP_IO_BTAG_STORE(v) (CHIP_V(v)->tc_io_btag_store)
#define CHIP_IO_BTAG_COUNT(v) TTWOGA_NBTS
/* IO region 1 */
#define CHIP_IO_W1_BUS_START(v) \

View File

@ -1,4 +1,4 @@
/* $NetBSD: ttwoga_bus_mem.c,v 1.4 2021/07/04 22:42:36 thorpej Exp $ */
/* $NetBSD: ttwoga_bus_mem.c,v 1.5 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(1, "$NetBSD: ttwoga_bus_mem.c,v 1.4 2021/07/04 22:42:36 thorpej Exp $");
__KERNEL_RCSID(1, "$NetBSD: ttwoga_bus_mem.c,v 1.5 2023/12/04 00:32:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -47,15 +47,15 @@ __KERNEL_RCSID(1, "$NetBSD: ttwoga_bus_mem.c,v 1.4 2021/07/04 22:42:36 thorpej E
#define CHIP_V(v) ((struct ttwoga_config *)(v))
#define CHIP_EX_MALLOC_SAFE(v) (CHIP_V(v)->tc_mallocsafe)
#define CHIP_D_MEM_ARENA(v) (CHIP_V(v)->tc_d_mem_arena)
#define CHIP_D_MEM_ARENA_STORE(v) (&(CHIP_V(v)->tc_d_mem_arena_store))
#define CHIP_D_MEM_BTAG_STORE(v) (CHIP_V(v)->tc_d_mem_btag_store)
#define CHIP_D_MEM_BTAG_COUNT(v) TTWOGA_NBTS
#define CHIP_D_MEM_EXTENT(v) (CHIP_V(v)->tc_d_mem_ex)
#define CHIP_D_MEM_EX_STORE(v) (CHIP_V(v)->tc_dmem_exstorage)
#define CHIP_D_MEM_EX_STORE_SIZE(v) sizeof(CHIP_D_MEM_EX_STORE(v))
#define CHIP_S_MEM_EXTENT(v) (CHIP_V(v)->tc_s_mem_ex)
#define CHIP_S_MEM_EX_STORE(v) (CHIP_V(v)->tc_smem_exstorage)
#define CHIP_S_MEM_EX_STORE_SIZE(v) sizeof(CHIP_S_MEM_EX_STORE(v))
#define CHIP_S_MEM_ARENA(v) (CHIP_V(v)->tc_s_mem_arena)
#define CHIP_S_MEM_ARENA_STORE(v) (&(CHIP_V(v)->tc_s_mem_arena_store))
#define CHIP_S_MEM_BTAG_STORE(v) (CHIP_V(v)->tc_s_mem_btag_store)
#define CHIP_S_MEM_BTAG_COUNT(v) TTWOGA_NBTS
/* Dense region 1 */
#define CHIP_D_MEM_W1_BUS_START(v) \

View File

@ -1,4 +1,4 @@
/* $NetBSD: ttwogavar.h,v 1.7 2021/05/08 00:08:43 thorpej Exp $ */
/* $NetBSD: ttwogavar.h,v 1.8 2023/12/04 00:32:10 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -30,11 +30,13 @@
*/
#include <sys/extent.h>
#include <sys/vmem_impl.h>
#include <dev/isa/isavar.h>
#include <dev/pci/pcivar.h>
#include <alpha/pci/pci_sgmap_pte64.h>
#define _FSTORE (EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long))
#define TTWOGA_NBTS VMEM_EST_BTCOUNT(1, 8)
/*
* T2 System Address Map info.
@ -81,12 +83,16 @@ struct ttwoga_config {
struct alpha_sgmap tc_sgmap;
int tc_use_tlb; /* Gamma hardware bug */
long tc_io_exstorage[_FSTORE];
long tc_smem_exstorage[_FSTORE];
long tc_dmem_exstorage[_FSTORE];
struct vmem tc_io_arena_store;
struct vmem tc_d_mem_arena_store;
struct vmem tc_s_mem_arena_store;
struct vmem_btag tc_io_btag_store[TTWOGA_NBTS];
struct vmem_btag tc_d_mem_btag_store[TTWOGA_NBTS];
struct vmem_btag tc_s_mem_btag_store[TTWOGA_NBTS];
struct extent *tc_io_ex, *tc_d_mem_ex, *tc_s_mem_ex;
int tc_mallocsafe;
vmem_t *tc_io_arena;
vmem_t *tc_d_mem_arena;
vmem_t *tc_s_mem_arena;
struct alpha_shared_intr *tc_intrtab;
@ -97,7 +103,7 @@ struct ttwoga_config {
extern cpuid_t ttwoga_conf_cpu;
struct ttwoga_config *ttwoga_init(int, int);
struct ttwoga_config *ttwoga_init(int);
void ttwoga_pci_init(pci_chipset_tag_t, void *);
void ttwoga_dma_init(struct ttwoga_config *);