[comp.os.minix] PC Minix 1.5 Kernel

mcm@maple.ucsb.edu (Marcelo Mourier) (09/16/90)

Hi everybody!

The kernel in PC Minix 1.5 uses a global variable 'snow' to identify video
cards that produce snowy displays; i.e, that require their video memory to
be written during the vertical retrace period.  This variable is declared
in line 44 of kernel/glo.h as EXTERN int snow.  Space is assigned to it in
table.c, along with the default value of zero (FALSE).  However, I couldn't
find any piece of code where its value could be changed to TRUE.  Moreover,
the only reference to 'snow' is in klib.x, line 885: cmpb _snow,#0 , where
it is treated as a byte (char), instead of as a word (int)...???!!!!

The second question is regarding the keyboard hardware in the PC-AT.  In 
these machines it doesn't seem to be necessary to acknowledge the char to
the keyboard controller (i8042); at least not in the way it's done now by
scan_keyboard() in kernel/keyboard.c.  In that function the char read from
the keyboard is acknowledged by toggling bit 7 in the I/O port 0x061 (PORT_B).
In the PC and XT this I/O port corresponds to parallel port B of the 8255 PPI.
But in the AT (at least in the schematics I have) this I/O port addrerss is
assigned to a 4-bit latch connected to the lowest four bits of the data bus;
e.g., DB0 - DB3.  So, trying to toggle bit 7 is just a waist of CPU clocks...
I've modified the code in scan_keyboard() to look like this:

		.
		.
		.
	out_byte(0x66, val & ~0x10);
} else {
	code = in_byte(KEYBD);
	/* If machine is PC or XT, ack the char */
	if (!pc_at) {
		val = in_byte(PORT_B);
		out_byte(PORT_B, val | KBIT);
		out_byte(PORT_B, val);
	}
}
		.
		.
		.

I've tested the modified kernel successfully on two different AT's, but I'd
like to hear that the patch is 100% reliable.  Could you, AT Minixers, try it
please..?

Thanks,



--
Marcelo Mourier (mcm@cs.ucsb.edu)

evans@syd.dit.CSIRO.AU (Bruce.Evans) (09/18/90)

In article <6288@hub.ucsb.edu> mcm@maple.ucsb.edu (Marcelo Mourier) writes:
>The kernel in PC Minix 1.5 uses a global variable 'snow' to identify video
>cards that produce snowy displays; ... However, I couldn't
>find any piece of code where its value could be changed to TRUE.

It was intended to be set using an ioctl or escape sequence, or from the
boot menu. No one got around to doing it for 1.5.10. The virtual consoles
driver sets it with an escape sequence.

>the only reference to 'snow' is in klib.x, line 885: cmpb _snow,#0 , where
>it is treated as a byte (char), instead of as a word (int)...???!!!!

It should be set to 1 so it is a waste of time (on an 8088) to test the high
bits. I declared it as int because that is what is done for other boolean
variables in the Minix kernel (though I don't like that - they should be
bool_t :-).

>The second question is regarding the keyboard hardware in the PC-AT.  In 
>these machines it doesn't seem to be necessary to acknowledge the char to
>the keyboard controller (i8042); at least not in the way it's done now by
>scan_keyboard() in kernel/keyboard.c.  In that function the char read from

I don't think anyone realised it is different for an AT. Provided the
unnecessary code is not harmful, it saves a little source code not to test
for an AT, while the extra runtime is not important.

Actually, it may be harmful. The same port/bit is used on PS/2 models 50
and higher to acknowledge the clock interrupt (CLOCK_* in sconst.h). I used
to think the bits were doubled up somehow to prevent interference.
-- 
Bruce Evans		evans@syd.dit.csiro.au