- Add a bus space method for getting the translation for a window.

- Add sysarch methods for "get bus window count", "get bus window",
  and "pci conf read/write".

These are a hack, but they're what's necessary in order to make
XFree86 work in its current state.
This commit is contained in:
thorpej 2000-02-26 18:53:10 +00:00
parent f4665e12b2
commit df88882d80
11 changed files with 666 additions and 59 deletions

View File

@ -1,4 +1,40 @@
/* $NetBSD: sys_machdep.c,v 1.10 1999/04/30 00:58:31 ross Exp $ */
/* $NetBSD: sys_machdep.c,v 1.11 2000/02/26 18:53:10 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -29,15 +65,26 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.10 1999/04/30 00:58:31 ross Exp $");
__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.11 2000/02/26 18:53:10 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <machine/sysarch.h>
#include <dev/pci/pcivar.h>
u_int alpha_bus_window_count[ALPHA_BUS_TYPE_MAX + 1];
int (*alpha_bus_get_window) __P((int, int,
struct alpha_bus_space_translation *));
struct alpha_pci_chipset *alpha_pci_chipset;
int
sys_sysarch(p, v, retval)
struct proc *p;
@ -51,15 +98,97 @@ sys_sysarch(p, v, retval)
int error = 0;
switch(SCARG(uap, op)) {
case ALPHA_FPGETMASK:
case ALPHA_FPSETMASK:
case ALPHA_FPSETSTICKY:
case ALPHA_FPGETMASK:
case ALPHA_FPSETMASK:
case ALPHA_FPSETSTICKY:
/* XXX kernel Magick required here */
break;
default:
case ALPHA_BUS_GET_WINDOW_COUNT:
{
struct alpha_bus_get_window_count_args args;
error = copyin(SCARG(uap, parms), &args, sizeof(args));
if (error)
return (error);
if (args.type > ALPHA_BUS_TYPE_MAX)
return (EINVAL);
if (alpha_bus_window_count[args.type] == 0)
return (EOPNOTSUPP);
args.count = alpha_bus_window_count[args.type];
error = copyout(&args, SCARG(uap, parms), sizeof(args));
break;
}
case ALPHA_BUS_GET_WINDOW:
{
struct alpha_bus_space_translation abst;
struct alpha_bus_get_window_args args;
error = copyin(SCARG(uap, parms), &args, sizeof(args));
if (error)
return (error);
if (args.type > ALPHA_BUS_TYPE_MAX)
return (EINVAL);
if (alpha_bus_window_count[args.type] == 0)
return (EOPNOTSUPP);
if (args.window >= alpha_bus_window_count[args.type])
return (EINVAL);
error = (*alpha_bus_get_window)(args.type, args.window,
&abst);
if (error)
return (error);
error = copyout(&abst, args.translation, sizeof(abst));
break;
}
case ALPHA_PCI_CONF_READWRITE:
{
struct alpha_pci_conf_readwrite_args args;
pcitag_t tag;
error = copyin(SCARG(uap, parms), &args, sizeof(args));
if (error)
return (error);
if (alpha_pci_chipset == NULL)
return (EOPNOTSUPP);
if (args.bus > 0xff) /* XXX MAGIC NUMBER */
return (EINVAL);
if (args.device > pci_bus_maxdevs(alpha_pci_chipset, args.bus))
return (EINVAL);
if (args.function > 7) /* XXX MAGIC NUMBER */
return (EINVAL);
if (args.reg > 0xff) /* XXX MAGIC NUMBER */
return (EINVAL);
tag = pci_make_tag(alpha_pci_chipset, args.bus, args.device,
args.function);
if (args.write)
pci_conf_write(alpha_pci_chipset, tag, args.reg,
args.val);
else {
args.val = pci_conf_read(alpha_pci_chipset, tag,
args.reg);
error = copyout(&args, SCARG(uap, parms), sizeof(args));
}
break;
}
default:
error = EINVAL;
break;
}
return error;
return (error);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus.h,v 1.34 2000/02/25 01:16:41 thorpej Exp $ */
/* $NetBSD: bus.h,v 1.35 2000/02/26 18:53:12 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@ -131,6 +131,8 @@ struct alpha_bus_space {
/* ALPHA SPECIFIC MAPPING METHOD */
int (*abs_translate) __P((void *, bus_addr_t, bus_size_t,
int, struct alpha_bus_space_translation *));
int (*abs_get_window) __P((void *, int,
struct alpha_bus_space_translation *));
/* allocation/deallocation */
int (*abs_alloc) __P((void *, bus_addr_t, bus_addr_t,
@ -302,9 +304,10 @@ do { \
#define bus_space_subregion(t, h, o, s, hp) \
(*(t)->abs_subregion)((t)->abs_cookie, (h), (o), (s), (hp))
#define alpha_bus_space_translate(t, a, s, d, bs, be, ss, se, sh) \
(*(t)->abs_translate)((t)->abs_cookie, (a), (s), (d), (bs), (be), \
(ss), (se), (sh))
#define alpha_bus_space_translate(t, a, s, f, abst) \
(*(t)->abs_translate)((t)->abs_cookie, (a), (s), (f), (abst))
#define alpha_bus_space_get_window(t, w, abst) \
(*(t)->abs_get_window)((t)->abs_cookie, (w), (abst))
#endif /* _KERNEL */
#define BUS_SPACE_MAP_CACHEABLE 0x01

View File

@ -1,23 +1,109 @@
/* $NetBSD: sysarch.h,v 1.3 1999/04/30 00:58:32 ross Exp $ */
/* $NetBSD: sysarch.h,v 1.4 2000/02/26 18:53:12 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ALPHA_SYSARCH_H_
#define _ALPHA_SYSARCH_H_
#include <machine/bus.h>
#include <machine/ieeefp.h>
/*
* Architecture specific syscalls (ALPHA)
*/
#define ALPHA_FPGETMASK 0
#define ALPHA_FPSETMASK 1
#define ALPHA_FPSETSTICKY 2
#define ALPHA_FPGETMASK 0
#define ALPHA_FPSETMASK 1
#define ALPHA_FPSETSTICKY 2
struct alpha_fp_except_args {
fp_except mask;
};
#ifndef _KERNEL
int sysarch __P((int, void *));
#endif
#define ALPHA_BUS_GET_WINDOW_COUNT 3
struct alpha_bus_get_window_count_args {
u_int type;
u_int count; /* output */
};
#define ALPHA_BUS_GET_WINDOW 4
struct alpha_bus_get_window_args {
u_int type;
u_int window;
struct alpha_bus_space_translation *translation; /* output */
};
#define ALPHA_BUS_TYPE_PCI_IO 0
#define ALPHA_BUS_TYPE_PCI_MEM 1
#define ALPHA_BUS_TYPE_MAX 1
#define ALPHA_PCI_CONF_READWRITE 5
struct alpha_pci_conf_readwrite_args {
int write;
u_int bus;
u_int device;
u_int function;
u_int reg;
u_int32_t val;
};
#ifdef _KERNEL
extern u_int alpha_bus_window_count[];
extern int (*alpha_bus_get_window) __P((int, int,
struct alpha_bus_space_translation *));
extern struct alpha_pci_chipset *alpha_pci_chipset;
#else
struct alpha_bus_window {
caddr_t abw_addr;
size_t abw_size;
struct alpha_bus_space_translation abw_abst;
};
int alpha_bus_getwindows __P((int, struct alpha_bus_window **));
int alpha_bus_mapwindow __P((struct alpha_bus_window *));
void alpha_bus_unmapwindow __P((struct alpha_bus_window *));
void *alpha_pci_mem_map __P((bus_addr_t, bus_size_t, int,
struct alpha_bus_space_translation *));
void alpha_pci_mem_unmap __P((void *addr, bus_size_t));
u_int32_t alpha_pci_conf_read __P((u_int, u_int, u_int, u_int));
void alpha_pci_conf_write __P((u_int, u_int, u_int, u_int, u_int32_t));
int sysarch __P((int, void *));
#endif /* _KERNEL */
#endif /* !_ALPHA_SYSARCH_H_ */

View File

@ -1,4 +1,40 @@
/* $NetBSD: apecs.c,v 1.36 1999/11/04 19:15:22 thorpej Exp $ */
/* $NetBSD: apecs.c,v 1.37 2000/02/26 18:53:12 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -34,7 +70,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: apecs.c,v 1.36 1999/11/04 19:15:22 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: apecs.c,v 1.37 2000/02/26 18:53:12 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -45,6 +81,7 @@ __KERNEL_RCSID(0, "$NetBSD: apecs.c,v 1.36 1999/11/04 19:15:22 thorpej Exp $");
#include <machine/autoconf.h>
#include <machine/rpb.h>
#include <machine/sysarch.h>
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
@ -77,6 +114,9 @@ extern struct cfdriver apecs_cd;
static int apecsprint __P((void *, const char *pnp));
int apecs_bus_get_window __P((int, int,
struct alpha_bus_space_translation *));
/* There can be only one. */
int apecsfound;
struct apecs_config apecs_configuration;
@ -121,10 +161,18 @@ apecs_init(acp, mallocsafe)
/* don't do these twice since they set up extents */
apecs_bus_io_init(&acp->ac_iot, acp);
apecs_bus_mem_init(&acp->ac_memt, acp);
/*
* We have two I/O windows and 3 MEM windows.
*/
alpha_bus_window_count[ALPHA_BUS_TYPE_PCI_IO] = 2;
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;
acp->ac_initted = 1;
}
@ -217,3 +265,27 @@ apecsprint(aux, pnp)
printf(" bus %d", pba->pba_bus);
return (UNCONF);
}
int
apecs_bus_get_window(type, window, abst)
int type, window;
struct alpha_bus_space_translation *abst;
{
struct apecs_config *acp = &apecs_configuration;
bus_space_tag_t st;
switch (type) {
case ALPHA_BUS_TYPE_PCI_IO:
st = &acp->ac_iot;
break;
case ALPHA_BUS_TYPE_PCI_MEM:
st = &acp->ac_memt;
break;
default:
panic("apecs_bus_get_window");
}
return (alpha_bus_space_get_window(st, window, abst));
}

View File

@ -1,7 +1,7 @@
/* $NetBSD: cia.c,v 1.52 2000/02/09 01:39:20 thorpej Exp $ */
/* $NetBSD: cia.c,v 1.53 2000/02/26 18:53:12 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -72,7 +72,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: cia.c,v 1.52 2000/02/09 01:39:20 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: cia.c,v 1.53 2000/02/26 18:53:12 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -83,6 +83,7 @@ __KERNEL_RCSID(0, "$NetBSD: cia.c,v 1.52 2000/02/09 01:39:20 thorpej Exp $");
#include <machine/autoconf.h>
#include <machine/rpb.h>
#include <machine/sysarch.h>
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
@ -119,6 +120,9 @@ extern struct cfdriver cia_cd;
static int ciaprint __P((void *, const char *pnp));
int cia_bus_get_window __P((int, int,
struct alpha_bus_space_translation *));
/* There can be only one. */
int ciafound;
struct cia_config cia_configuration;
@ -246,14 +250,30 @@ cia_init(ccp, mallocsafe)
if (ccp->cc_flags & CCF_BUS_USE_BWX) {
cia_bwx_bus_io_init(&ccp->cc_iot, ccp);
cia_bwx_bus_mem_init(&ccp->cc_memt, ccp);
/*
* We have one window for both PCI I/O and MEM
* in BWX mode.
*/
alpha_bus_window_count[ALPHA_BUS_TYPE_PCI_IO] = 1;
alpha_bus_window_count[ALPHA_BUS_TYPE_PCI_MEM] = 1;
} else {
cia_swiz_bus_io_init(&ccp->cc_iot, ccp);
cia_swiz_bus_mem_init(&ccp->cc_memt, ccp);
/*
* We have two I/O windows and 4 MEM windows in
* SWIZ mode.
*/
alpha_bus_window_count[ALPHA_BUS_TYPE_PCI_IO] = 2;
alpha_bus_window_count[ALPHA_BUS_TYPE_PCI_MEM] = 4;
}
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;
ccp->cc_initted = 1;
}
@ -418,3 +438,27 @@ ciaprint(aux, pnp)
printf(" bus %d", pba->pba_bus);
return (UNCONF);
}
int
cia_bus_get_window(type, window, abst)
int type, window;
struct alpha_bus_space_translation *abst;
{
struct cia_config *ccp = &cia_configuration;
bus_space_tag_t st;
switch (type) {
case ALPHA_BUS_TYPE_PCI_IO:
st = &ccp->cc_iot;
break;
case ALPHA_BUS_TYPE_PCI_MEM:
st = &ccp->cc_memt;
break;
default:
panic("cia_bus_get_window");
}
return (alpha_bus_space_get_window(st, window, abst));
}

View File

@ -1,4 +1,40 @@
/* $NetBSD: lca.c,v 1.34 1999/11/04 19:15:22 thorpej Exp $ */
/* $NetBSD: lca.c,v 1.35 2000/02/26 18:53:12 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -33,7 +69,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: lca.c,v 1.34 1999/11/04 19:15:22 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: lca.c,v 1.35 2000/02/26 18:53:12 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -44,6 +80,7 @@ __KERNEL_RCSID(0, "$NetBSD: lca.c,v 1.34 1999/11/04 19:15:22 thorpej Exp $");
#include <machine/autoconf.h>
#include <machine/rpb.h>
#include <machine/sysarch.h>
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
@ -73,6 +110,9 @@ extern struct cfdriver lca_cd;
static int lcaprint __P((void *, const char *pnp));
int lca_bus_get_window __P((int, int,
struct alpha_bus_space_translation *));
/* There can be only one. */
int lcafound;
struct lca_config lca_configuration;
@ -116,10 +156,18 @@ lca_init(lcp, mallocsafe)
/* don't do these twice since they set up extents */
lca_bus_io_init(&lcp->lc_iot, lcp);
lca_bus_mem_init(&lcp->lc_memt, lcp);
/*
* We have 1 I/O window and 3 MEM windows.
*/
alpha_bus_window_count[ALPHA_BUS_TYPE_PCI_IO] = 1;
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;
/*
* Refer to ``DECchip 21066 and DECchip 21068 Alpha AXP Microprocessors
@ -221,3 +269,27 @@ lcaprint(aux, pnp)
printf(" bus %d", pba->pba_bus);
return (UNCONF);
}
int
lca_bus_get_window(type, window, abst)
int type, window;
struct alpha_bus_space_translation *abst;
{
struct lca_config *lcp = &lca_configuration;
bus_space_tag_t st;
switch (type) {
case ALPHA_BUS_TYPE_PCI_IO:
st = &lcp->lc_iot;
break;
case ALPHA_BUS_TYPE_PCI_MEM:
st = &lcp->lc_memt;
break;
default:
panic("lca_bus_get_window");
}
return (alpha_bus_space_get_window(st, window, abst));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_bwx_bus_io_chipdep.c,v 1.7 2000/02/25 00:45:05 thorpej Exp $ */
/* $NetBSD: pci_bwx_bus_io_chipdep.c,v 1.8 2000/02/26 18:53:13 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@ -99,6 +99,8 @@ int __C(CHIP,_io_subregion) __P((void *, bus_space_handle_t,
int __C(CHIP,_io_translate) __P((void *, bus_addr_t, bus_size_t,
int, struct alpha_bus_space_translation *));
int __C(CHIP,_io_get_window) __P((void *, int,
struct alpha_bus_space_translation *));
/* allocation/deallocation */
int __C(CHIP,_io_alloc) __P((void *, bus_addr_t, bus_addr_t,
@ -228,6 +230,7 @@ __C(CHIP,_bus_io_init)(t, v)
t->abs_subregion = __C(CHIP,_io_subregion);
t->abs_translate = __C(CHIP,_io_translate);
t->abs_get_window = __C(CHIP,_io_get_window);
/* allocation/deallocation */
t->abs_alloc = __C(CHIP,_io_alloc);
@ -313,13 +316,32 @@ __C(CHIP,_io_translate)(v, ioaddr, iolen, flags, abst)
if (linear)
return (EOPNOTSUPP);
abst->abst_bus_start = 0;
abst->abst_bus_end = 0xffffffffUL;
abst->abst_sys_start = CHIP_IO_SYS_START(v);
abst->abst_sys_end = CHIP_IO_SYS_START(v) + abst->abst_bus_end;
abst->abst_addr_shift = 0;
abst->abst_size_shift = 0;
abst->abst_flags = ABST_DENSE|ABST_BWX;
return (__C(CHIP,_io_get_window)(v, 0, abst));
}
int
__C(CHIP,_io_get_window)(v, window, abst)
void *v;
int window;
struct alpha_bus_space_translation *abst;
{
switch (window) {
case 0:
abst->abst_bus_start = 0;
abst->abst_bus_end = 0xffffffffUL;
abst->abst_sys_start = CHIP_IO_SYS_START(v);
abst->abst_sys_end = CHIP_IO_SYS_START(v) + abst->abst_bus_end;
abst->abst_addr_shift = 0;
abst->abst_size_shift = 0;
abst->abst_flags = ABST_DENSE|ABST_BWX;
break;
default:
panic(__S(__C(CHIP,_io_get_window)) ": invalid window %d",
window);
}
return (0);
}

View File

@ -1,7 +1,7 @@
/* $NetBSD: pci_bwx_bus_mem_chipdep.c,v 1.8 2000/02/25 00:45:05 thorpej Exp $ */
/* $NetBSD: pci_bwx_bus_mem_chipdep.c,v 1.9 2000/02/26 18:53:13 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
* Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -99,6 +99,8 @@ int __C(CHIP,_mem_subregion) __P((void *, bus_space_handle_t,
int __C(CHIP,_mem_translate) __P((void *, bus_addr_t, bus_size_t,
int, struct alpha_bus_space_translation *));
int __C(CHIP,_mem_get_window) __P((void *, int,
struct alpha_bus_space_translation *));
/* allocation/deallocation */
int __C(CHIP,_mem_alloc) __P((void *, bus_addr_t, bus_addr_t,
@ -228,6 +230,7 @@ __C(CHIP,_bus_mem_init)(t, v)
t->abs_subregion = __C(CHIP,_mem_subregion);
t->abs_translate = __C(CHIP,_mem_translate);
t->abs_get_window = __C(CHIP,_mem_get_window);
/* allocation/deallocation */
t->abs_alloc = __C(CHIP,_mem_alloc);
@ -310,6 +313,32 @@ __C(CHIP,_mem_translate)(v, memaddr, memlen, flags, abst)
return (EOPNOTSUPP);
}
int
__C(CHIP,_mem_get_window)(v, window, abst)
void *v;
int window;
struct alpha_bus_space_translation *abst;
{
switch (window) {
case 0:
abst->abst_bus_start = 0;
abst->abst_bus_end = 0xffffffffUL;
abst->abst_sys_start = CHIP_MEM_SYS_START(v);
abst->abst_sys_end = CHIP_MEM_SYS_START(v) + abst->abst_bus_end;
abst->abst_addr_shift = 0;
abst->abst_size_shift = 0;
abst->abst_flags = ABST_DENSE|ABST_BWX;
break;
default:
panic(__S(__C(CHIP,_mem_get_window)) ": invalid window %d",
window);
}
return (0);
}
int
__C(CHIP,_mem_map)(v, memaddr, memsize, flags, memhp, acct)
void *v;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_swiz_bus_io_chipdep.c,v 1.29 2000/02/25 00:45:05 thorpej Exp $ */
/* $NetBSD: pci_swiz_bus_io_chipdep.c,v 1.30 2000/02/26 18:53:13 thorpej Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -97,6 +97,8 @@ int __C(CHIP,_io_subregion) __P((void *, bus_space_handle_t,
int __C(CHIP,_io_translate) __P((void *, bus_addr_t, bus_size_t,
int, struct alpha_bus_space_translation *));
int __C(CHIP,_io_get_window) __P((void *, int,
struct alpha_bus_space_translation *));
/* allocation/deallocation */
int __C(CHIP,_io_alloc) __P((void *, bus_addr_t, bus_addr_t,
@ -234,6 +236,7 @@ __C(CHIP,_bus_io_init)(t, v)
t->abs_subregion = __C(CHIP,_io_subregion);
t->abs_translate = __C(CHIP,_io_translate);
t->abs_get_window = __C(CHIP,_io_get_window);
/* allocation/deallocation */
t->abs_alloc = __C(CHIP,_io_alloc);
@ -344,30 +347,16 @@ __C(CHIP,_io_translate)(v, ioaddr, iolen, flags, abst)
#ifdef CHIP_IO_W1_BUS_START
if (ioaddr >= CHIP_IO_W1_BUS_START(v) &&
ioend <= CHIP_IO_W1_BUS_END(v)) {
abst->abst_bus_start = CHIP_IO_W1_BUS_START(v);
abst->abst_bus_end = CHIP_IO_W1_BUS_END(v);
abst->abst_sys_start = CHIP_IO_W1_SYS_START(v);
abst->abst_sys_end = CHIP_IO_W1_SYS_END(v);
abst->abst_addr_shift = CHIP_ADDR_SHIFT;
abst->abst_size_shift = CHIP_SIZE_SHIFT;
abst->abst_flags = 0;
return (0);
}
ioend <= CHIP_IO_W1_BUS_END(v))
return (__C(CHIP,_io_get_window)(v, 0, abst));
#endif
#ifdef CHIP_IO_W2_BUS_START
if (ioaddr >= CHIP_IO_W2_BUS_START(v) &&
ioend <= CHIP_IO_W2_BUS_END(v)) {
abst->abst_bus_start = CHIP_IO_W2_BUS_START(v);
abst->abst_bus_end = CHIP_IO_W2_BUS_END(v);
abst->abst_sys_start = CHIP_IO_W2_SYS_START(v);
abst->abst_sys_end = CHIP_IO_W2_SYS_END(v);
abst->abst_addr_shift = CHIP_ADDR_SHIFT;
abst->abst_size_shift = CHIP_SIZE_SHIFT;
abst->abst_flags = 0;
return (0);
}
ioend <= CHIP_IO_W2_BUS_END(v))
return (__C(CHIP,_io_get_window)(v, 1, abst));
#endif
#ifdef EXTENT_DEBUG
printf("\n");
#ifdef CHIP_IO_W1_BUS_START
@ -385,6 +374,46 @@ __C(CHIP,_io_translate)(v, ioaddr, iolen, flags, abst)
return (EINVAL);
}
int
__C(CHIP,_io_get_window)(v, window, abst)
void *v;
int window;
struct alpha_bus_space_translation *abst;
{
switch (window) {
#ifdef CHIP_IO_W1_BUS_START
case 0:
abst->abst_bus_start = CHIP_IO_W1_BUS_START(v);
abst->abst_bus_end = CHIP_IO_W1_BUS_END(v);
abst->abst_sys_start = CHIP_IO_W1_SYS_START(v);
abst->abst_sys_end = CHIP_IO_W1_SYS_END(v);
abst->abst_addr_shift = CHIP_ADDR_SHIFT;
abst->abst_size_shift = CHIP_SIZE_SHIFT;
abst->abst_flags = 0;
break;
#endif
#ifdef CHIP_IO_W2_BUS_START
case 1:
abst->abst_bus_start = CHIP_IO_W2_BUS_START(v);
abst->abst_bus_end = CHIP_IO_W2_BUS_END(v);
abst->abst_sys_start = CHIP_IO_W2_SYS_START(v);
abst->abst_sys_end = CHIP_IO_W2_SYS_END(v);
abst->abst_addr_shift = CHIP_ADDR_SHIFT;
abst->abst_size_shift = CHIP_SIZE_SHIFT;
abst->abst_flags = 0;
break;
#endif
default:
panic(__S(__C(CHIP,_io_get_window)) ": invalid window %d",
window);
}
return (0);
}
int
__C(CHIP,_io_map)(v, ioaddr, iosize, flags, iohp, acct)
void *v;

View File

@ -1,4 +1,40 @@
/* $NetBSD: pci_swiz_bus_mem_chipdep.c,v 1.33 2000/02/25 00:45:06 thorpej Exp $ */
/* $NetBSD: pci_swiz_bus_mem_chipdep.c,v 1.34 2000/02/26 18:53:13 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -70,6 +106,8 @@ int __C(CHIP,_mem_subregion) __P((void *, bus_space_handle_t,
int __C(CHIP,_mem_translate) __P((void *, bus_addr_t, bus_size_t,
int, struct alpha_bus_space_translation *));
int __C(CHIP,_mem_get_window) __P((void *, int,
struct alpha_bus_space_translation *));
/* allocation/deallocation */
int __C(CHIP,_mem_alloc) __P((void *, bus_addr_t, bus_addr_t,
@ -219,6 +257,7 @@ __C(CHIP,_bus_mem_init)(t, v)
t->abs_subregion = __C(CHIP,_mem_subregion);
t->abs_translate = __C(CHIP,_mem_translate);
t->abs_get_window = __C(CHIP,_mem_get_window);
/* allocation/deallocation */
t->abs_alloc = __C(CHIP,_mem_alloc);
@ -505,6 +544,74 @@ __C(CHIP,_mem_translate)(v, memaddr, memlen, flags, abst)
return (EOPNOTSUPP);
}
int
__C(CHIP,_mem_get_window)(v, window, abst)
void *v;
int window;
struct alpha_bus_space_translation *abst;
{
#ifdef CHIP_D_MEM_W1_BUS_START
#define FIRST_SPARSE 1
#else
#define FIRST_SPARSE 0
#endif
switch (window) {
#ifdef CHIP_D_MEM_W1_BUS_START
case 0:
abst->abst_bus_start = CHIP_D_MEM_W1_BUS_START(v);
abst->abst_bus_end = CHIP_D_MEM_W1_BUS_END(v);
abst->abst_sys_start = CHIP_D_MEM_W1_SYS_START(v);
abst->abst_sys_end = CHIP_D_MEM_W1_SYS_END(v);
abst->abst_addr_shift = CHIP_ADDR_SHIFT;
abst->abst_size_shift = CHIP_SIZE_SHIFT;
abst->abst_flags = ABST_DENSE;
break;
#endif
#ifdef CHIP_S_MEM_W1_BUS_START
case (FIRST_SPARSE):
abst->abst_bus_start = CHIP_S_MEM_W1_BUS_START(v);
abst->abst_bus_end = CHIP_S_MEM_W1_BUS_END(v);
abst->abst_sys_start = CHIP_S_MEM_W1_SYS_START(v);
abst->abst_sys_end = CHIP_S_MEM_W1_SYS_END(v);
abst->abst_addr_shift = CHIP_ADDR_SHIFT;
abst->abst_size_shift = CHIP_SIZE_SHIFT;
abst->abst_flags = 0;
break;
#endif
#ifdef CHIP_S_MEM_W2_BUS_START
case (FIRST_SPARSE + 1):
abst->abst_bus_start = CHIP_S_MEM_W2_BUS_START(v);
abst->abst_bus_end = CHIP_S_MEM_W2_BUS_END(v);
abst->abst_sys_start = CHIP_S_MEM_W2_SYS_START(v);
abst->abst_sys_end = CHIP_S_MEM_W2_SYS_END(v);
abst->abst_addr_shift = CHIP_ADDR_SHIFT;
abst->abst_size_shift = CHIP_SIZE_SHIFT;
abst->abst_flags = 0;
break;
#endif
#ifdef CHIP_S_MEM_W3_BUS_START
case (FIRST_SPARSE + 2):
abst->abst_bus_start = CHIP_S_MEM_W3_BUS_START(v);
abst->abst_bus_end = CHIP_S_MEM_W3_BUS_END(v);
abst->abst_sys_start = CHIP_S_MEM_W3_SYS_START(v);
abst->abst_sys_end = CHIP_S_MEM_W3_SYS_END(v);
abst->abst_addr_shift = CHIP_ADDR_SHIFT;
abst->abst_size_shift = CHIP_SIZE_SHIFT;
abst->abst_flags = 0;
break;
#endif
}
#undef FIRST_SPARSE
return (0);
}
int
__C(CHIP,_mem_map)(v, memaddr, memsize, flags, memhp, acct)
void *v;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tc_bus_mem.c,v 1.20 2000/02/25 00:45:06 thorpej Exp $ */
/* $NetBSD: tc_bus_mem.c,v 1.21 2000/02/26 18:53:13 thorpej Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@ -33,7 +33,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: tc_bus_mem.c,v 1.20 2000/02/25 00:45:06 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: tc_bus_mem.c,v 1.21 2000/02/26 18:53:13 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -56,6 +56,8 @@ int tc_mem_subregion __P((void *, bus_space_handle_t, bus_size_t,
int tc_mem_translate __P((void *, bus_addr_t, bus_size_t,
int, struct alpha_bus_space_translation *));
int tc_mem_get_window __P((void *, int,
struct alpha_bus_space_translation *));
/* allocation/deallocation */
int tc_mem_alloc __P((void *, bus_addr_t, bus_addr_t, bus_size_t,
@ -163,6 +165,7 @@ static struct alpha_bus_space tc_mem_space = {
tc_mem_subregion,
tc_mem_translate,
tc_mem_get_window,
/* allocation/deallocation */
tc_mem_alloc,
@ -249,6 +252,17 @@ tc_mem_translate(v, memaddr, memlen, flags, abst)
return (EOPNOTSUPP);
}
/* ARGSUSED */
int
tc_mem_get_window(v, window, abst)
void *v;
int window;
struct alpha_bus_space_translation *abst;
{
return (EOPNOTSUPP);
}
/* ARGSUSED */
int
tc_mem_map(v, memaddr, memsize, flags, memhp, acct)