diff --git a/lkm/syscons/blank/blank_saver.c b/lkm/syscons/blank/blank_saver.c index a534ab390d09..451dc9a4b241 100644 --- a/lkm/syscons/blank/blank_saver.c +++ b/lkm/syscons/blank/blank_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: blank_saver.c,v 1.9 1997/04/06 10:48:10 dufault Exp $ + * $Id: blank_saver.c,v 1.10 1997/07/15 14:49:09 yokota Exp $ */ #include @@ -46,12 +46,44 @@ blank_saver(int blank) u_char val; if (blank) { scrn_blanked = 1; - outb(TSIDX, 0x01); val = inb(TSREG); - outb(TSIDX, 0x01); outb(TSREG, val | 0x20); + switch (crtc_type) { + case KD_VGA: + outb(TSIDX, 0x01); val = inb(TSREG); + outb(TSIDX, 0x01); outb(TSREG, val | 0x20); + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x25); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x21); + break; + default: + break; + } } else { - outb(TSIDX, 0x01); val = inb(TSREG); - outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); + switch (crtc_type) { + case KD_VGA: + outb(TSIDX, 0x01); val = inb(TSREG); + outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x2d); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x29); + break; + default: + break; + } scrn_blanked = 0; } } @@ -59,8 +91,17 @@ blank_saver(int blank) static int blank_saver_load(struct lkm_table *lkmtp, int cmd) { - if (!crtc_vga) - return EINVAL; + switch (crtc_type) { + case KD_MONO: + case KD_HERCULES: + case KD_CGA: + case KD_VGA: + break; + case KD_EGA: + /* EGA is yet to be supported */ + default: + return ENODEV; + } return add_scrn_saver(blank_saver); } diff --git a/lkm/syscons/fade/fade_saver.c b/lkm/syscons/fade/fade_saver.c index d68bba93959f..341f7e8d240c 100644 --- a/lkm/syscons/fade/fade_saver.c +++ b/lkm/syscons/fade/fade_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: fade_saver.c,v 1.10 1997/04/06 10:48:18 dufault Exp $ + * $Id: fade_saver.c,v 1.11 1997/07/15 14:49:25 yokota Exp $ */ #include @@ -48,34 +48,80 @@ fade_saver(int blank) if (blank) { scrn_blanked = 1; - if (count < 64) { - outb(PIXMASK, 0xFF); /* no pixelmask */ - outb(PALWADR, 0x00); - outb(PALDATA, 0); - outb(PALDATA, 0); - outb(PALDATA, 0); - for (i = 3; i < 768; i++) { - if (palette[i] - count > 15) - outb(PALDATA, palette[i]-count); - else - outb(PALDATA, 15); + switch (crtc_type) { + case KD_VGA: + if (count < 64) { + outb(PIXMASK, 0xFF); /* no pixelmask */ + outb(PALWADR, 0x00); + outb(PALDATA, 0); + outb(PALDATA, 0); + outb(PALDATA, 0); + for (i = 3; i < 768; i++) { + if (palette[i] - count > 15) + outb(PALDATA, palette[i]-count); + else + outb(PALDATA, 15); + } + inb(crtc_addr+6); /* reset flip/flop */ + outb(ATC, 0x20); /* enable palette */ + count++; } - inb(crtc_addr+6); /* reset flip/flop */ - outb(ATC, 0x20); /* enable palette */ - count++; + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x25); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x21); + break; + default: + break; } } else { - load_palette(palette); - count = scrn_blanked = 0; + switch (crtc_type) { + case KD_VGA: + load_palette(palette); + count = 0; + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x2d); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x29); + break; + default: + break; + } + scrn_blanked = 0; } } static int fade_saver_load(struct lkm_table *lkmtp, int cmd) { - if (!crtc_vga) - return EINVAL; + switch (crtc_type) { + case KD_MONO: + case KD_HERCULES: + case KD_CGA: + /* + * `fade' saver is not fully implemented for MDA and CGA. + * It simply blanks the display instead. + */ + case KD_VGA: + break; + case KD_EGA: + /* EGA is yet to be supported */ + default: + return ENODEV; + } return add_scrn_saver(fade_saver); } diff --git a/lkm/syscons/green/green_saver.c b/lkm/syscons/green/green_saver.c index 0454753d6b0b..b8c82958ac34 100644 --- a/lkm/syscons/green/green_saver.c +++ b/lkm/syscons/green/green_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: green_saver.c,v 1.9 1997/04/06 10:49:13 dufault Exp $ + * $Id: green_saver.c,v 1.10 1997/07/15 14:49:29 yokota Exp $ */ #include @@ -46,16 +46,48 @@ green_saver(int blank) u_char val; if (blank) { scrn_blanked = 1; - outb(TSIDX, 0x01); val = inb(TSREG); - outb(TSIDX, 0x01); outb(TSREG, val | 0x20); - outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); - outb(crtc_addr + 1, val & ~0x80); + switch (crtc_type) { + case KD_VGA: + outb(TSIDX, 0x01); val = inb(TSREG); + outb(TSIDX, 0x01); outb(TSREG, val | 0x20); + outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); + outb(crtc_addr + 1, val & ~0x80); + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x25); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x21); + break; + default: + break; + } } else { - outb(TSIDX, 0x01); val = inb(TSREG); - outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); - outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); - outb(crtc_addr + 1, val | 0x80); + switch (crtc_type) { + case KD_VGA: + outb(TSIDX, 0x01); val = inb(TSREG); + outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); + outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); + outb(crtc_addr + 1, val | 0x80); + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x2d); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x29); + break; + default: + break; + } scrn_blanked = 0; } } @@ -63,8 +95,21 @@ green_saver(int blank) static int green_saver_load(struct lkm_table *lkmtp, int cmd) { - if (!crtc_vga) - return EINVAL; + switch (crtc_type) { + case KD_MONO: + case KD_HERCULES: + case KD_CGA: + /* + * `green' saver is not fully implemented for MDA and CGA. + * It simply blanks the display instead. + */ + case KD_VGA: + break; + case KD_EGA: + /* EGA is yet to be supported */ + default: + return ENODEV; + } return add_scrn_saver(green_saver); } diff --git a/lkm/syscons/saver.h b/lkm/syscons/saver.h index 7ba6c1192049..7118e4588e22 100644 --- a/lkm/syscons/saver.h +++ b/lkm/syscons/saver.h @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: saver.h,v 1.8 1997/05/21 14:18:00 yokota Exp $ + * $Id: saver.h,v 1.9 1997/07/15 14:48:11 yokota Exp $ */ #include @@ -36,7 +36,7 @@ extern scr_stat *cur_console; extern u_short *Crtat; extern u_int crtc_addr; -extern char crtc_vga; +extern char crtc_type; extern char scr_map[]; extern int scrn_blanked; extern int fonts_loaded; diff --git a/sys/dev/syscons/blank/blank_saver.c b/sys/dev/syscons/blank/blank_saver.c index a534ab390d09..451dc9a4b241 100644 --- a/sys/dev/syscons/blank/blank_saver.c +++ b/sys/dev/syscons/blank/blank_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: blank_saver.c,v 1.9 1997/04/06 10:48:10 dufault Exp $ + * $Id: blank_saver.c,v 1.10 1997/07/15 14:49:09 yokota Exp $ */ #include @@ -46,12 +46,44 @@ blank_saver(int blank) u_char val; if (blank) { scrn_blanked = 1; - outb(TSIDX, 0x01); val = inb(TSREG); - outb(TSIDX, 0x01); outb(TSREG, val | 0x20); + switch (crtc_type) { + case KD_VGA: + outb(TSIDX, 0x01); val = inb(TSREG); + outb(TSIDX, 0x01); outb(TSREG, val | 0x20); + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x25); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x21); + break; + default: + break; + } } else { - outb(TSIDX, 0x01); val = inb(TSREG); - outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); + switch (crtc_type) { + case KD_VGA: + outb(TSIDX, 0x01); val = inb(TSREG); + outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x2d); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x29); + break; + default: + break; + } scrn_blanked = 0; } } @@ -59,8 +91,17 @@ blank_saver(int blank) static int blank_saver_load(struct lkm_table *lkmtp, int cmd) { - if (!crtc_vga) - return EINVAL; + switch (crtc_type) { + case KD_MONO: + case KD_HERCULES: + case KD_CGA: + case KD_VGA: + break; + case KD_EGA: + /* EGA is yet to be supported */ + default: + return ENODEV; + } return add_scrn_saver(blank_saver); } diff --git a/sys/dev/syscons/fade/fade_saver.c b/sys/dev/syscons/fade/fade_saver.c index d68bba93959f..341f7e8d240c 100644 --- a/sys/dev/syscons/fade/fade_saver.c +++ b/sys/dev/syscons/fade/fade_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: fade_saver.c,v 1.10 1997/04/06 10:48:18 dufault Exp $ + * $Id: fade_saver.c,v 1.11 1997/07/15 14:49:25 yokota Exp $ */ #include @@ -48,34 +48,80 @@ fade_saver(int blank) if (blank) { scrn_blanked = 1; - if (count < 64) { - outb(PIXMASK, 0xFF); /* no pixelmask */ - outb(PALWADR, 0x00); - outb(PALDATA, 0); - outb(PALDATA, 0); - outb(PALDATA, 0); - for (i = 3; i < 768; i++) { - if (palette[i] - count > 15) - outb(PALDATA, palette[i]-count); - else - outb(PALDATA, 15); + switch (crtc_type) { + case KD_VGA: + if (count < 64) { + outb(PIXMASK, 0xFF); /* no pixelmask */ + outb(PALWADR, 0x00); + outb(PALDATA, 0); + outb(PALDATA, 0); + outb(PALDATA, 0); + for (i = 3; i < 768; i++) { + if (palette[i] - count > 15) + outb(PALDATA, palette[i]-count); + else + outb(PALDATA, 15); + } + inb(crtc_addr+6); /* reset flip/flop */ + outb(ATC, 0x20); /* enable palette */ + count++; } - inb(crtc_addr+6); /* reset flip/flop */ - outb(ATC, 0x20); /* enable palette */ - count++; + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x25); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x21); + break; + default: + break; } } else { - load_palette(palette); - count = scrn_blanked = 0; + switch (crtc_type) { + case KD_VGA: + load_palette(palette); + count = 0; + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x2d); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x29); + break; + default: + break; + } + scrn_blanked = 0; } } static int fade_saver_load(struct lkm_table *lkmtp, int cmd) { - if (!crtc_vga) - return EINVAL; + switch (crtc_type) { + case KD_MONO: + case KD_HERCULES: + case KD_CGA: + /* + * `fade' saver is not fully implemented for MDA and CGA. + * It simply blanks the display instead. + */ + case KD_VGA: + break; + case KD_EGA: + /* EGA is yet to be supported */ + default: + return ENODEV; + } return add_scrn_saver(fade_saver); } diff --git a/sys/dev/syscons/green/green_saver.c b/sys/dev/syscons/green/green_saver.c index 0454753d6b0b..b8c82958ac34 100644 --- a/sys/dev/syscons/green/green_saver.c +++ b/sys/dev/syscons/green/green_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: green_saver.c,v 1.9 1997/04/06 10:49:13 dufault Exp $ + * $Id: green_saver.c,v 1.10 1997/07/15 14:49:29 yokota Exp $ */ #include @@ -46,16 +46,48 @@ green_saver(int blank) u_char val; if (blank) { scrn_blanked = 1; - outb(TSIDX, 0x01); val = inb(TSREG); - outb(TSIDX, 0x01); outb(TSREG, val | 0x20); - outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); - outb(crtc_addr + 1, val & ~0x80); + switch (crtc_type) { + case KD_VGA: + outb(TSIDX, 0x01); val = inb(TSREG); + outb(TSIDX, 0x01); outb(TSREG, val | 0x20); + outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); + outb(crtc_addr + 1, val & ~0x80); + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x25); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x21); + break; + default: + break; + } } else { - outb(TSIDX, 0x01); val = inb(TSREG); - outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); - outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); - outb(crtc_addr + 1, val | 0x80); + switch (crtc_type) { + case KD_VGA: + outb(TSIDX, 0x01); val = inb(TSREG); + outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); + outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); + outb(crtc_addr + 1, val | 0x80); + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x2d); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x29); + break; + default: + break; + } scrn_blanked = 0; } } @@ -63,8 +95,21 @@ green_saver(int blank) static int green_saver_load(struct lkm_table *lkmtp, int cmd) { - if (!crtc_vga) - return EINVAL; + switch (crtc_type) { + case KD_MONO: + case KD_HERCULES: + case KD_CGA: + /* + * `green' saver is not fully implemented for MDA and CGA. + * It simply blanks the display instead. + */ + case KD_VGA: + break; + case KD_EGA: + /* EGA is yet to be supported */ + default: + return ENODEV; + } return add_scrn_saver(green_saver); } diff --git a/sys/modules/syscons/blank/blank_saver.c b/sys/modules/syscons/blank/blank_saver.c index a534ab390d09..451dc9a4b241 100644 --- a/sys/modules/syscons/blank/blank_saver.c +++ b/sys/modules/syscons/blank/blank_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: blank_saver.c,v 1.9 1997/04/06 10:48:10 dufault Exp $ + * $Id: blank_saver.c,v 1.10 1997/07/15 14:49:09 yokota Exp $ */ #include @@ -46,12 +46,44 @@ blank_saver(int blank) u_char val; if (blank) { scrn_blanked = 1; - outb(TSIDX, 0x01); val = inb(TSREG); - outb(TSIDX, 0x01); outb(TSREG, val | 0x20); + switch (crtc_type) { + case KD_VGA: + outb(TSIDX, 0x01); val = inb(TSREG); + outb(TSIDX, 0x01); outb(TSREG, val | 0x20); + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x25); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x21); + break; + default: + break; + } } else { - outb(TSIDX, 0x01); val = inb(TSREG); - outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); + switch (crtc_type) { + case KD_VGA: + outb(TSIDX, 0x01); val = inb(TSREG); + outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x2d); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x29); + break; + default: + break; + } scrn_blanked = 0; } } @@ -59,8 +91,17 @@ blank_saver(int blank) static int blank_saver_load(struct lkm_table *lkmtp, int cmd) { - if (!crtc_vga) - return EINVAL; + switch (crtc_type) { + case KD_MONO: + case KD_HERCULES: + case KD_CGA: + case KD_VGA: + break; + case KD_EGA: + /* EGA is yet to be supported */ + default: + return ENODEV; + } return add_scrn_saver(blank_saver); } diff --git a/sys/modules/syscons/fade/fade_saver.c b/sys/modules/syscons/fade/fade_saver.c index d68bba93959f..341f7e8d240c 100644 --- a/sys/modules/syscons/fade/fade_saver.c +++ b/sys/modules/syscons/fade/fade_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: fade_saver.c,v 1.10 1997/04/06 10:48:18 dufault Exp $ + * $Id: fade_saver.c,v 1.11 1997/07/15 14:49:25 yokota Exp $ */ #include @@ -48,34 +48,80 @@ fade_saver(int blank) if (blank) { scrn_blanked = 1; - if (count < 64) { - outb(PIXMASK, 0xFF); /* no pixelmask */ - outb(PALWADR, 0x00); - outb(PALDATA, 0); - outb(PALDATA, 0); - outb(PALDATA, 0); - for (i = 3; i < 768; i++) { - if (palette[i] - count > 15) - outb(PALDATA, palette[i]-count); - else - outb(PALDATA, 15); + switch (crtc_type) { + case KD_VGA: + if (count < 64) { + outb(PIXMASK, 0xFF); /* no pixelmask */ + outb(PALWADR, 0x00); + outb(PALDATA, 0); + outb(PALDATA, 0); + outb(PALDATA, 0); + for (i = 3; i < 768; i++) { + if (palette[i] - count > 15) + outb(PALDATA, palette[i]-count); + else + outb(PALDATA, 15); + } + inb(crtc_addr+6); /* reset flip/flop */ + outb(ATC, 0x20); /* enable palette */ + count++; } - inb(crtc_addr+6); /* reset flip/flop */ - outb(ATC, 0x20); /* enable palette */ - count++; + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x25); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x21); + break; + default: + break; } } else { - load_palette(palette); - count = scrn_blanked = 0; + switch (crtc_type) { + case KD_VGA: + load_palette(palette); + count = 0; + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x2d); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x29); + break; + default: + break; + } + scrn_blanked = 0; } } static int fade_saver_load(struct lkm_table *lkmtp, int cmd) { - if (!crtc_vga) - return EINVAL; + switch (crtc_type) { + case KD_MONO: + case KD_HERCULES: + case KD_CGA: + /* + * `fade' saver is not fully implemented for MDA and CGA. + * It simply blanks the display instead. + */ + case KD_VGA: + break; + case KD_EGA: + /* EGA is yet to be supported */ + default: + return ENODEV; + } return add_scrn_saver(fade_saver); } diff --git a/sys/modules/syscons/green/green_saver.c b/sys/modules/syscons/green/green_saver.c index 0454753d6b0b..b8c82958ac34 100644 --- a/sys/modules/syscons/green/green_saver.c +++ b/sys/modules/syscons/green/green_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: green_saver.c,v 1.9 1997/04/06 10:49:13 dufault Exp $ + * $Id: green_saver.c,v 1.10 1997/07/15 14:49:29 yokota Exp $ */ #include @@ -46,16 +46,48 @@ green_saver(int blank) u_char val; if (blank) { scrn_blanked = 1; - outb(TSIDX, 0x01); val = inb(TSREG); - outb(TSIDX, 0x01); outb(TSREG, val | 0x20); - outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); - outb(crtc_addr + 1, val & ~0x80); + switch (crtc_type) { + case KD_VGA: + outb(TSIDX, 0x01); val = inb(TSREG); + outb(TSIDX, 0x01); outb(TSREG, val | 0x20); + outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); + outb(crtc_addr + 1, val & ~0x80); + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x25); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x21); + break; + default: + break; + } } else { - outb(TSIDX, 0x01); val = inb(TSREG); - outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); - outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); - outb(crtc_addr + 1, val | 0x80); + switch (crtc_type) { + case KD_VGA: + outb(TSIDX, 0x01); val = inb(TSREG); + outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); + outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); + outb(crtc_addr + 1, val | 0x80); + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x2d); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x29); + break; + default: + break; + } scrn_blanked = 0; } } @@ -63,8 +95,21 @@ green_saver(int blank) static int green_saver_load(struct lkm_table *lkmtp, int cmd) { - if (!crtc_vga) - return EINVAL; + switch (crtc_type) { + case KD_MONO: + case KD_HERCULES: + case KD_CGA: + /* + * `green' saver is not fully implemented for MDA and CGA. + * It simply blanks the display instead. + */ + case KD_VGA: + break; + case KD_EGA: + /* EGA is yet to be supported */ + default: + return ENODEV; + } return add_scrn_saver(green_saver); } diff --git a/sys/modules/syscons/saver.h b/sys/modules/syscons/saver.h index 7ba6c1192049..7118e4588e22 100644 --- a/sys/modules/syscons/saver.h +++ b/sys/modules/syscons/saver.h @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: saver.h,v 1.8 1997/05/21 14:18:00 yokota Exp $ + * $Id: saver.h,v 1.9 1997/07/15 14:48:11 yokota Exp $ */ #include @@ -36,7 +36,7 @@ extern scr_stat *cur_console; extern u_short *Crtat; extern u_int crtc_addr; -extern char crtc_vga; +extern char crtc_type; extern char scr_map[]; extern int scrn_blanked; extern int fonts_loaded;