Add podulebus_shift_tag, which generates a bus_space_tag_t with a specified

address shift (stride).  This is necessary because many podules have standard
chips with odd address-bus wiring to allow for using LDM for
bus_space_*_multi_*().
This commit is contained in:
bjh21 2001-03-24 00:10:42 +00:00
parent 70f969e600
commit 2714607c72
3 changed files with 30 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: podulebus_machdep.h,v 1.2 2001/03/20 23:29:07 bjh21 Exp $ */ /* $NetBSD: podulebus_machdep.h,v 1.3 2001/03/24 00:10:42 bjh21 Exp $ */
/* /*
* Copyright (c) 1995 Mark Brinicombe. * Copyright (c) 1995 Mark Brinicombe.
@ -94,6 +94,10 @@ struct podulebus_attach_args {
#define IS_PODULE(pa, man, prod) \ #define IS_PODULE(pa, man, prod) \
((pa)->pa_manufacturer == (man) && (pa)->pa_product == (prod)) ((pa)->pa_manufacturer == (man) && (pa)->pa_product == (prod))
/* Set the address-bus shift for a bus_space tag. */
#define podulebus_shift_tag(tag, shift, tagp) (*(tagp) = (shift))
#ifdef _KERNEL #ifdef _KERNEL
struct evcnt; struct evcnt;

View File

@ -1,4 +1,4 @@
/* $NetBSD: podulebus_machdep.h,v 1.2 2001/03/20 23:27:04 bjh21 Exp $ */ /* $NetBSD: podulebus_machdep.h,v 1.3 2001/03/24 00:10:42 bjh21 Exp $ */
/* /*
* Copyright (c) 1995 Mark Brinicombe. * Copyright (c) 1995 Mark Brinicombe.
@ -158,6 +158,8 @@ void netslot_ea __P((u_int8_t *buffer));
extern void *podulebus_irq_establish __P((podulebus_intr_handle_t, int, extern void *podulebus_irq_establish __P((podulebus_intr_handle_t, int,
int (*)(void *), void *, struct evcnt *)); int (*)(void *), void *, struct evcnt *));
extern void podulebus_shift_tag __P((bus_space_tag_t, u_int,
bus_space_tag_t *));
#endif #endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: podulebus.c,v 1.39 2001/03/18 15:56:05 bjh21 Exp $ */ /* $NetBSD: podulebus.c,v 1.40 2001/03/24 00:10:43 bjh21 Exp $ */
/* /*
* Copyright (c) 1994-1996 Mark Brinicombe. * Copyright (c) 1994-1996 Mark Brinicombe.
@ -715,4 +715,25 @@ podulebus_irq_establish(ih, ipl, func, arg, ev)
arg); arg);
} }
/*
* Generate a bus_space_tag_t with the specified address-bus shift.
*/
void
podulebus_shift_tag(tag, shift, tagp)
bus_space_tag_t tag, *tagp;
u_int shift;
{
/*
* For the podulebus, the bus tag cookie is the shift to apply
* to registers, so duplicate the bus space tag and change the
* cookie.
*/
/* XXX never freed, but podules are never detached anyway. */
*tagp = malloc(sizeof(struct bus_space), M_DEVBUF, M_WAITOK);
**tagp = *tag;
(*tagp)->bs_cookie = (void *)shift;
}
/* End of podulebus.c */ /* End of podulebus.c */