Re: axe CPU_UPGRADE_HW_CACHE from i386 specific code

2005-03-26 Thread M. Warner Losh
In message: [EMAIL PROTECTED]
Mark Santcroos [EMAIL PROTECTED] writes:
: It looks like CPU_UPGRADE_HW_CACHE is only used in PC98, so it can be
: removed from all I386 specific code.
: 
: Any objections to the following patch?

This does appear to be a pc98 only item.  A grep of the tree shows
this to be the clase.

However, there's more opportunity here for cleanup.  One can easily
move nearly all the PC98 code out of initcpu.

First, there's some redudant code:

In initcput.c we see:

static void
init_bluelightning(void)
{
u_long  eflags;

#if defined(PC98)  !defined(CPU_UPGRADE_HW_CACHE)
need_post_dma_flush = 1;
#endif
...

but we also see:
#if defined(PC98)  !defined(CPU_UPGRADE_HW_CACHE)
...
} else if (strcmp(cpu_vendor, IBM) == 0) {
need_post_dma_flush = 1;
...
#endif

So, we set it once in init_bluelightning, and again at the tail end of
initialize cpu.  So that code should be just eliminated, unless I've
missed something subtle in my analysis of the code.

In addition, one can easily add the CPU_I486_ON_386 tests to the same
code at the end of initializecpu().  In fact, it may already be there,
or there may be a bug:

#ifdef CPU_I486_ON_386
case CPU_486:
init_i486_on_386();
break;
#endif

vs

case CPU_CY486DX:
need_pre_dma_flush = 1;
#ifdef CPU_I486_ON_386
need_post_dma_flush = 1;
#endif
break;

Note that the comments say that this flushing is necessary for
non-intel hardware only, yet CPU_486 is a true intel part.  At the
very least, the ifdef code in init_i486_on_386 can be eliminated,
since it appears redudant with code later on:

} else {
#ifdef CPU_I486_ON_386
need_pre_dma_flush = 1;
#endif

This makes the code fairly well contained, and it could be convered to
a function an placed somehere appropriate in pc98/pc98, maybe
pc98_machine.c?  This would localize the use of the
need_{pre,post}_dma_flush variables to pc98/pc98 (well, and one
instance in dev/ct, which doesn't call the standard DMA complete
routines, but I've not investigated further).  This would shrink the
size of the ifdefs down to a single one-liner...

Warner
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


axe CPU_UPGRADE_HW_CACHE from i386 specific code

2005-03-25 Thread Mark Santcroos
It looks like CPU_UPGRADE_HW_CACHE is only used in PC98, so it can be
removed from all I386 specific code.

Any objections to the following patch?

Mark


Index: conf/options.i386
===
RCS file: /usr/cvs/src/sys/conf/options.i386,v
retrieving revision 1.218
diff -d -u -r1.218 options.i386
--- conf/options.i386   17 Mar 2005 01:20:49 -  1.218
+++ conf/options.i386   26 Mar 2005 00:57:20 -
@@ -63,7 +63,6 @@
 CPU_RSTK_ENopt_cpu.h
 CPU_SOEKRISopt_cpu.h
 CPU_SUSP_HLT   opt_cpu.h
-CPU_UPGRADE_HW_CACHE   opt_cpu.h
 CPU_WT_ALLOC   opt_cpu.h
 CYRIX_CACHE_REALLY_WORKS   opt_cpu.h
 CYRIX_CACHE_WORKS  opt_cpu.h
Index: i386/conf/NOTES
===
RCS file: /usr/cvs/src/sys/i386/conf/NOTES,v
retrieving revision 1.1190
diff -d -u -r1.1190 NOTES
--- i386/conf/NOTES 18 Mar 2005 09:34:52 -  1.1190
+++ i386/conf/NOTES 26 Mar 2005 00:57:42 -
@@ -151,8 +151,6 @@
 # CPU_SUSP_HLT enables suspend on HALT.  If this option is set, CPU
 # enters suspend mode following execution of HALT instruction.
 #
-# CPU_UPGRADE_HW_CACHE eliminates unneeded cache flush instruction(s).
-#
 # CPU_WT_ALLOC enables write allocation on Cyrix 6x86/6x86MX and AMD
 # K5/K6/K6-2 CPUs.
 #
@@ -206,7 +204,6 @@
 optionsCPU_RSTK_EN
 optionsCPU_SOEKRIS
 optionsCPU_SUSP_HLT
-optionsCPU_UPGRADE_HW_CACHE
 optionsCPU_WT_ALLOC
 optionsCYRIX_CACHE_WORKS
 optionsCYRIX_CACHE_REALLY_WORKS

-- 
RIPE NCC - Delft University of Technology - The FreeBSD Project
[EMAIL PROTECTED] - [EMAIL PROTECTED] - [EMAIL PROTECTED]
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]