Dave Frodin (dave.frodin@se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10144
-gerrit
commit b097745c6ec0db5d2a7b1713b5a96c2bde799b5d Author: Dave Frodin dave.frodin@se-eng.com Date: Fri May 8 07:20:48 2015 -0600
Add a function to do indexed I/O reads/writes
There are multiple superio functions defined to do indexed I/O reads and writes. These generic functions will replace them in a follow on patch.
Change-Id: I491a40e51d304496c5ec45a8171370b281669048 Signed-off-by: Dave Frodin dave.frodin@se-eng.com --- src/arch/x86/lib/Makefile.inc | 2 ++ src/arch/x86/lib/io_index.c | 33 +++++++++++++++++++++++++++++++++ src/include/io_index.h | 23 +++++++++++++++++++++++ 3 files changed, 58 insertions(+)
diff --git a/src/arch/x86/lib/Makefile.inc b/src/arch/x86/lib/Makefile.inc index c7e8b62..ea1430d 100644 --- a/src/arch/x86/lib/Makefile.inc +++ b/src/arch/x86/lib/Makefile.inc @@ -2,6 +2,7 @@ ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
romstage-y += cbfs_and_run.c +romstage-y += io_index.c romstage-y += memset.c romstage-y += memcpy.c romstage-y += memmove.c @@ -13,6 +14,7 @@ ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
ramstage-y += c_start.S ramstage-y += cpu.c +ramstage-y += io_index.c ramstage-y += pci_ops_conf1.c ramstage-$(CONFIG_MMCONF_SUPPORT) += pci_ops_mmconf.c ramstage-y += exception.c diff --git a/src/arch/x86/lib/io_index.c b/src/arch/x86/lib/io_index.c new file mode 100644 index 0000000..a8e4b2d --- /dev/null +++ b/src/arch/x86/lib/io_index.c @@ -0,0 +1,33 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2015 Sage Electronic Engineering, LLC. + * + * 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; version 2 of the License. + * + * 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 + */ + +#include <arch/io.h> +#include <io_index.h> + +u8 io_read_index(u16 port, u8 reg) +{ + outb(reg, port); + return inb(port + 1); +} + +void io_write_index(u16 port, u8 reg, u8 value) +{ + outb(reg, port); + outb(value, port + 1); +} diff --git a/src/include/io_index.h b/src/include/io_index.h new file mode 100644 index 0000000..04be707 --- /dev/null +++ b/src/include/io_index.h @@ -0,0 +1,23 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2015 Sage Electronic Engineering, LLC. + * + * 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; version 2 of the License. + * + * 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 + */ + +#include <stdint.h> + +u8 io_read_index(u16 port, u8 reg); +void io_write_index(u16 port, u8 reg, u8 value);