Subject: Re: Splitting sa1111 support codes.
To: IWAMOTO Toshihiro <toshii@netbsd.org>
From: Hiroyuki Bessho <bsh@grotto.jp>
List: port-arm
Date: 04/28/2003 02:10:02
IWAMOTO Toshihiro <toshii@netbsd.org> writes:

> I don't like this portion of your patch.
> The other parts seems okay, though I haven't looked at carefully.
>
> hpcarm's softintr is capable of handling all IPL levels,
> so I think this code should be in softintr_establish in
> sys/arm/arm/softintr.c.
>
>

  OK, I understood that remapping IPL levels here is redundant for
hpcarm (and some other platforms) and should be avoided.  I don't
think moving it to arm's softintr_establish is the best way, because
SA1111 can be connected to any other CPUs than arm-based in theory.

  How abount using __GENERIC_SOFT_INTERRUPTS_ALL_LEVELS suggested by
Martin Husemann?

#if defined(__HAVE_GENERIC_SOFT_INTERRUPTS) && \
    !defined(__GENERIC_SOFT_INTERRUPTS_ALL_LEVELS)
	/* map interrupt level to appropriate softinterrupt level */
	if (level >= IPL_SOFTSERIAL)
		level = IPL_SOFTSERIAL;
	else if(level >= IPL_SOFTNET)
		level = IPL_SOFTNET;
#endif
	ih->ih_soft = softintr_establish(level, (void (*)(void *)) ih_fun,
        		ih_arg);

  Or let all ports define IPL mapping macro and use it like following?

	ih->ih_soft = softintr_establish(ipl_to_soft_ipl(level),
        		(void (*)(void *)) ih_fun, ih_arg);


# BTW, I'm not sure what should we do for
#  !defined(__HAVE_GENERIC_SOFT_INTERRUPTS) case.