diff options
author | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2012-04-27 02:31:28 +0200 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2012-04-27 19:23:16 +0200 |
commit | ae5e11d7cd7484343d277fb454fb19fdff34730d (patch) | |
tree | 231aede3dcf80242a4e68e2b4268835f4bf1c5c6 /src/pc80/vga/vga_io.c | |
parent | aee1869fcf6c5eb1616f8c5c5a446c2b2de693e8 (diff) |
Move top level pc80 directory to drivers/
There is no reason for this to be a top level directory.
Some stuff from lib/ should also be moved to drivers/
Change-Id: I3c2d2e127f7215eadead029cfc7442c22b26814a
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://review.coreboot.org/939
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/pc80/vga/vga_io.c')
-rw-r--r-- | src/pc80/vga/vga_io.c | 275 |
1 files changed, 0 insertions, 275 deletions
diff --git a/src/pc80/vga/vga_io.c b/src/pc80/vga/vga_io.c deleted file mode 100644 index c31287ab6d..0000000000 --- a/src/pc80/vga/vga_io.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (C) 2007-2009 Luc Verhaegen <libv@skynet.be> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* - * All IO necessary to poke VGA registers. - */ -#include <pc80/vga_io.h> - -#include <arch/io.h> - -#define VGA_CR_INDEX 0x3D4 -#define VGA_CR_VALUE 0x3D5 - -#define VGA_SR_INDEX 0x3C4 -#define VGA_SR_VALUE 0x3C5 - -#define VGA_GR_INDEX 0x3CE -#define VGA_GR_VALUE 0x3CF - -#define VGA_AR_INDEX 0x3C0 -#define VGA_AR_VALUE_READ 0x3C1 -#define VGA_AR_VALUE_WRITE VGA_AR_INDEX - -#define VGA_MISC_WRITE 0x3C2 -#define VGA_MISC_READ 0x3CC - -#define VGA_ENABLE 0x3C3 -#define VGA_STAT1 0x3DA - -#define VGA_DAC_MASK 0x3C6 -#define VGA_DAC_READ_ADDRESS 0x3C7 -#define VGA_DAC_WRITE_ADDRESS 0x3C8 -#define VGA_DAC_DATA 0x3C9 - -/* - * VGA enable. Poke this to have the PCI IO enabled device accept VGA IO. - */ -unsigned char -vga_enable_read(void) -{ - return inb(VGA_ENABLE); -} - -void -vga_enable_write(unsigned char value) -{ - outb(value, VGA_ENABLE); -} - -void -vga_enable_mask(unsigned char value, unsigned char mask) -{ - unsigned char tmp; - - tmp = vga_enable_read(); - tmp &= ~mask; - tmp |= (value & mask); - vga_enable_write(tmp); -} - -/* - * Miscellaneous register. - */ -unsigned char -vga_misc_read(void) -{ - return inb(VGA_MISC_READ); -} - -void -vga_misc_write(unsigned char value) -{ - outb(value, VGA_MISC_WRITE); -} - -void -vga_misc_mask(unsigned char value, unsigned char mask) -{ - unsigned char tmp; - - tmp = vga_misc_read(); - tmp &= ~mask; - tmp |= (value & mask); - vga_misc_write(tmp); -} - -/* - * Sequencer registers. - */ -unsigned char -vga_sr_read(unsigned char index) -{ - outb(index, VGA_SR_INDEX); - return (inb(VGA_SR_VALUE)); -} - -void -vga_sr_write(unsigned char index, unsigned char value) -{ - outb(index, VGA_SR_INDEX); - outb(value, VGA_SR_VALUE); -} - -void -vga_sr_mask(unsigned char index, unsigned char value, unsigned char mask) -{ - unsigned char tmp; - - tmp = vga_sr_read(index); - tmp &= ~mask; - tmp |= (value & mask); - vga_sr_write(index, tmp); -} - -/* - * CRTC registers. - */ -unsigned char -vga_cr_read(unsigned char index) -{ - outb(index, VGA_CR_INDEX); - return (inb(VGA_CR_VALUE)); -} - -void -vga_cr_write(unsigned char index, unsigned char value) -{ - outb(index, VGA_CR_INDEX); - outb(value, VGA_CR_VALUE); -} - -void -vga_cr_mask(unsigned char index, unsigned char value, unsigned char mask) -{ - unsigned char tmp; - - tmp = vga_cr_read(index); - tmp &= ~mask; - tmp |= (value & mask); - vga_cr_write(index, tmp); -} - -/* - * Attribute registers. - */ -unsigned char -vga_ar_read(unsigned char index) -{ - unsigned char ret; - - (void) inb(VGA_STAT1); - outb(index, VGA_AR_INDEX); - ret = inb(VGA_AR_VALUE_READ); - (void) inb(VGA_STAT1); - - return ret; -} - -void -vga_ar_write(unsigned char index, unsigned char value) -{ - (void) inb(VGA_STAT1); - outb(index, VGA_AR_INDEX); - outb(value, VGA_AR_VALUE_WRITE); - (void) inb(VGA_STAT1); -} - -void -vga_ar_mask(unsigned char index, unsigned char value, unsigned char mask) -{ - unsigned char tmp; - - tmp = vga_ar_read(index); - tmp &= ~mask; - tmp |= (value & mask); - vga_ar_write(index, tmp); -} - -/* - * Graphics registers. - */ -unsigned char -vga_gr_read(unsigned char index) -{ - outb(index, VGA_GR_INDEX); - return (inb(VGA_GR_VALUE)); -} - -void -vga_gr_write(unsigned char index, unsigned char value) -{ - outb(index, VGA_GR_INDEX); - outb(value, VGA_GR_VALUE); -} - -void -vga_gr_mask(unsigned char index, unsigned char value, unsigned char mask) -{ - unsigned char tmp; - - tmp = vga_gr_read(index); - tmp &= ~mask; - tmp |= (value & mask); - vga_gr_write(index, tmp); -} - -/* - * DAC functions. - */ -void -vga_palette_enable(void) -{ - (void) inb(VGA_STAT1); - outb(0x00, VGA_AR_INDEX); - (void) inb(VGA_STAT1); -} - -void -vga_palette_disable(void) -{ - (void) inb(VGA_STAT1); - outb(0x20, VGA_AR_INDEX); - (void) inb(VGA_STAT1); -} - -unsigned char -vga_dac_mask_read(void) -{ - return inb(VGA_DAC_MASK); -} - -void -vga_dac_mask_write(unsigned char mask) -{ - outb(mask, VGA_DAC_MASK); -} - -void -vga_dac_read_address(unsigned char address) -{ - outb(address, VGA_DAC_READ_ADDRESS); -} - -void -vga_dac_write_address(unsigned char address) -{ - outb(address, VGA_DAC_WRITE_ADDRESS); -} - -unsigned char -vga_dac_data_read(void) -{ - return inb(VGA_DAC_DATA); -} - -void -vga_dac_data_write(unsigned char data) -{ - outb(data, VGA_DAC_DATA); -} |