X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fioport.h;h=3282fb49546af3acdc1daace77ad37785af8c904;hb=9f857fc97c0cdfa6f18a43d1548cd91014766c26;hp=ba9117b845812c261b7d5d20ff5121fc9022e8c4;hpb=843a62c3e54154077f0197f009491e2a712c3175;p=seabios.git diff --git a/src/ioport.h b/src/ioport.h index ba9117b..3282fb4 100644 --- a/src/ioport.h +++ b/src/ioport.h @@ -2,19 +2,17 @@ // // Copyright (C) 2008 Kevin O'Connor // -// This file may be distributed under the terms of the GNU GPLv3 license. +// This file may be distributed under the terms of the GNU LGPLv3 license. #ifndef __IOPORT_H #define __IOPORT_H -#include "types.h" // u8 - #define PORT_DMA_ADDR_2 0x0004 #define PORT_DMA_CNT_2 0x0005 #define PORT_DMA1_MASK_REG 0x000a #define PORT_DMA1_MODE_REG 0x000b #define PORT_DMA1_CLEAR_FF_REG 0x000c #define PORT_DMA1_MASTER_CLEAR 0x000d -#define PORT_PIC1 0x0020 +#define PORT_PIC1_CMD 0x0020 #define PORT_PIC1_DATA 0x0021 #define PORT_PIT_COUNTER0 0x0040 #define PORT_PIT_COUNTER1 0x0041 @@ -28,25 +26,59 @@ #define PORT_DIAG 0x0080 #define PORT_DMA_PAGE_2 0x0081 #define PORT_A20 0x0092 -#define PORT_PIC2 0x00a0 +#define PORT_PIC2_CMD 0x00a0 #define PORT_PIC2_DATA 0x00a1 +#define PORT_SMI_CMD 0x00b2 +#define PORT_SMI_STATUS 0x00b3 #define PORT_DMA2_MASK_REG 0x00d4 #define PORT_DMA2_MODE_REG 0x00d6 #define PORT_DMA2_MASTER_CLEAR 0x00da #define PORT_MATH_CLEAR 0x00f0 +#define PORT_ATA2_CMD_BASE 0x0170 +#define PORT_ATA1_CMD_BASE 0x01f0 +#define PORT_LPT2 0x0278 +#define PORT_SERIAL4 0x02e8 +#define PORT_SERIAL2 0x02f8 +#define PORT_ATA2_CTRL_BASE 0x0374 +#define PORT_LPT1 0x0378 +#define PORT_SERIAL3 0x03e8 +#define PORT_ATA1_CTRL_BASE 0x03f4 +#define PORT_FD_BASE 0x03f0 #define PORT_FD_DOR 0x03f2 #define PORT_FD_STATUS 0x03f4 #define PORT_FD_DATA 0x03f5 +#define PORT_HD_DATA 0x03f6 +#define PORT_FD_DIR 0x03f7 +#define PORT_SERIAL1 0x03f8 +#define PORT_PCI_CMD 0x0cf8 +#define PORT_PCI_REBOOT 0x0cf9 +#define PORT_PCI_DATA 0x0cfc +#define PORT_BIOS_DEBUG 0x0402 +#define PORT_QEMU_CFG_CTL 0x0510 +#define PORT_QEMU_CFG_DATA 0x0511 +#define PORT_ACPI_PM_BASE 0xb000 +#define PORT_SMB_BASE 0xb100 +#define PORT_BIOS_APM 0x8900 + +// Serial port offsets +#define SEROFF_DATA 0 +#define SEROFF_DLL 0 +#define SEROFF_IER 1 +#define SEROFF_DLH 1 +#define SEROFF_IIR 2 +#define SEROFF_LCR 3 +#define SEROFF_LSR 5 +#define SEROFF_MSR 6 -// PORT_PIC1 bitdefs -#define PIC1_IRQ5 (1<<5) -// PORT_PIC2 bitdefs -#define PIC2_IRQ8 (1<<0) -#define PIC2_IRQ13 (1<<5) +// PORT_A20 bitdefs +#define A20_ENABLE_BIT 0x02 -// PORT_KBD_CTRLB bitdefs -#define KBD_REFRESH (1<<4) +// PORT_CMOS_INDEX nmi disable bit +#define NMI_DISABLE_BIT 0x80 +#ifndef __ASSEMBLY__ + +#include "types.h" // u8 static inline void outb(u8 value, u16 port) { __asm__ __volatile__("outb %b0, %w1" : : "a"(value), "Nd"(port)); @@ -74,29 +106,31 @@ static inline u32 inl(u16 port) { } static inline void insb(u16 port, u8 *data, u32 count) { - asm volatile("rep insb (%%dx), %%es:(%%di)" + asm volatile("rep insb (%%dx), %%es:(%%edi)" : "+c"(count), "+D"(data) : "d"(port) : "memory"); } static inline void insw(u16 port, u16 *data, u32 count) { - asm volatile("rep insw (%%dx), %%es:(%%di)" + asm volatile("rep insw (%%dx), %%es:(%%edi)" : "+c"(count), "+D"(data) : "d"(port) : "memory"); } static inline void insl(u16 port, u32 *data, u32 count) { - asm volatile("rep insl (%%dx), %%es:(%%di)" + asm volatile("rep insl (%%dx), %%es:(%%edi)" : "+c"(count), "+D"(data) : "d"(port) : "memory"); } // XXX - outs not limited to es segment static inline void outsb(u16 port, u8 *data, u32 count) { - asm volatile("rep outsb %%es:(%%si), (%%dx)" + asm volatile("rep outsb %%es:(%%esi), (%%dx)" : "+c"(count), "+S"(data) : "d"(port) : "memory"); } static inline void outsw(u16 port, u16 *data, u32 count) { - asm volatile("rep outsw %%es:(%%si), (%%dx)" + asm volatile("rep outsw %%es:(%%esi), (%%dx)" : "+c"(count), "+S"(data) : "d"(port) : "memory"); } static inline void outsl(u16 port, u32 *data, u32 count) { - asm volatile("rep outsl %%es:(%%si), (%%dx)" + asm volatile("rep outsl %%es:(%%esi), (%%dx)" : "+c"(count), "+S"(data) : "d"(port) : "memory"); } +#endif // !__ASSEMBLY__ + #endif // ioport.h