aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/int10
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xfree86/int10')
-rw-r--r--xorg-server/hw/xfree86/int10/generic.c262
-rw-r--r--xorg-server/hw/xfree86/int10/helper_exec.c547
-rw-r--r--xorg-server/hw/xfree86/int10/helper_mem.c182
-rw-r--r--xorg-server/hw/xfree86/int10/xf86int10.c1238
-rw-r--r--xorg-server/hw/xfree86/int10/xf86int10.h70
-rw-r--r--xorg-server/hw/xfree86/int10/xf86int10module.c75
6 files changed, 1207 insertions, 1167 deletions
diff --git a/xorg-server/hw/xfree86/int10/generic.c b/xorg-server/hw/xfree86/int10/generic.c
index fbc9b8507..8614e0b9b 100644
--- a/xorg-server/hw/xfree86/int10/generic.c
+++ b/xorg-server/hw/xfree86/int10/generic.c
@@ -20,12 +20,12 @@
#define ALLOC_ENTRIES(x) ((V_RAM / x) - 1)
-static CARD8 read_b(xf86Int10InfoPtr pInt,int addr);
-static CARD16 read_w(xf86Int10InfoPtr pInt,int addr);
-static CARD32 read_l(xf86Int10InfoPtr pInt,int addr);
-static void write_b(xf86Int10InfoPtr pInt,int addr, CARD8 val);
-static void write_w(xf86Int10InfoPtr pInt,int addr, CARD16 val);
-static void write_l(xf86Int10InfoPtr pInt,int addr, CARD32 val);
+static CARD8 read_b(xf86Int10InfoPtr pInt, int addr);
+static CARD16 read_w(xf86Int10InfoPtr pInt, int addr);
+static CARD32 read_l(xf86Int10InfoPtr pInt, int addr);
+static void write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val);
+static void write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val);
+static void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val);
/*
* the emulator cannot pass a pointer to the current xf86Int10InfoRec
@@ -35,11 +35,11 @@ static void write_l(xf86Int10InfoPtr pInt,int addr, CARD32 val);
typedef struct {
int shift;
int entries;
- void* base;
- void* vRam;
+ void *base;
+ void *vRam;
int highMemory;
- void* sysMem;
- char* alloc;
+ void *sysMem;
+ char *alloc;
} genericInt10Priv;
#define INTPriv(x) ((genericInt10Priv*)x->private)
@@ -55,6 +55,7 @@ int10MemRec genericMem = {
static void MapVRam(xf86Int10InfoPtr pInt);
static void UnmapVRam(xf86Int10InfoPtr pInt);
+
#ifdef _PC
#define GET_HIGH_BASE(x) (((V_BIOS + (x) + getpagesize() - 1)/getpagesize()) \
* getpagesize())
@@ -66,28 +67,28 @@ xf86Int10InfoPtr
xf86ExtendedInitInt10(int entityIndex, int Flags)
{
xf86Int10InfoPtr pInt;
- void* base = 0;
- void* vbiosMem = 0;
- void* options = NULL;
+ void *base = 0;
+ void *vbiosMem = 0;
+ void *options = NULL;
int screen;
legacyVGARec vga;
-
+
screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex;
- options = xf86HandleInt10Options(xf86Screens[screen],entityIndex);
-
+ options = xf86HandleInt10Options(xf86Screens[screen], entityIndex);
+
if (int10skip(options)) {
- free(options);
- return NULL;
+ free(options);
+ return NULL;
}
-
- pInt = (xf86Int10InfoPtr)xnfcalloc(1, sizeof(xf86Int10InfoRec));
+
+ pInt = (xf86Int10InfoPtr) xnfcalloc(1, sizeof(xf86Int10InfoRec));
pInt->entityIndex = entityIndex;
if (!xf86Int10ExecSetup(pInt))
- goto error0;
+ goto error0;
pInt->mem = &genericMem;
- pInt->private = (pointer)xnfcalloc(1, sizeof(genericInt10Priv));
- INTPriv(pInt)->alloc = (pointer)xnfcalloc(1, ALLOC_ENTRIES(getpagesize()));
+ pInt->private = (pointer) xnfcalloc(1, sizeof(genericInt10Priv));
+ INTPriv(pInt)->alloc = (pointer) xnfcalloc(1, ALLOC_ENTRIES(getpagesize()));
pInt->scrnIndex = screen;
base = INTPriv(pInt)->base = xnfalloc(SYS_BIOS);
@@ -103,69 +104,70 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
MapVRam(pInt);
#ifdef _PC
if (!sysMem)
- pci_device_map_legacy(pInt->dev, V_BIOS, BIOS_SIZE + SYS_BIOS - V_BIOS,
- PCI_DEV_MAP_FLAG_WRITABLE, &sysMem);
+ pci_device_map_legacy(pInt->dev, V_BIOS, BIOS_SIZE + SYS_BIOS - V_BIOS,
+ PCI_DEV_MAP_FLAG_WRITABLE, &sysMem);
INTPriv(pInt)->sysMem = sysMem;
if (xf86ReadBIOS(0, 0, base, LOW_PAGE_SIZE) < 0) {
- xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n");
- goto error1;
+ xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n");
+ goto error1;
}
/*
* Retrieve everything between V_BIOS and SYS_BIOS as some system BIOSes
* have executable code there.
*/
- memset((char *)base + V_BIOS, 0, SYS_BIOS - V_BIOS);
+ memset((char *) base + V_BIOS, 0, SYS_BIOS - V_BIOS);
INTPriv(pInt)->highMemory = V_BIOS;
-
+
if (xf86IsEntityPrimary(entityIndex) && !(initPrimary(options))) {
- if (!xf86int10GetBiosSegment(pInt, (unsigned char *)sysMem - V_BIOS))
- goto error1;
+ if (!xf86int10GetBiosSegment(pInt, (unsigned char *) sysMem - V_BIOS))
+ goto error1;
+
+ set_return_trap(pInt);
- set_return_trap(pInt);
+ pInt->Flags = Flags & (SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH);
+ if (!(pInt->Flags & SET_BIOS_SCRATCH))
+ pInt->Flags &= ~RESTORE_BIOS_SCRATCH;
+ xf86Int10SaveRestoreBIOSVars(pInt, TRUE);
- pInt->Flags = Flags & (SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH);
- if (! (pInt->Flags & SET_BIOS_SCRATCH))
- pInt->Flags &= ~RESTORE_BIOS_SCRATCH;
- xf86Int10SaveRestoreBIOSVars(pInt, TRUE);
-
- } else {
- const BusType location_type = xf86int10GetBiosLocationType(pInt);
- int bios_location = V_BIOS;
+ }
+ else {
+ const BusType location_type = xf86int10GetBiosLocationType(pInt);
+ int bios_location = V_BIOS;
reset_int_vect(pInt);
- set_return_trap(pInt);
-
- switch (location_type) {
- case BUS_PCI: {
- int err;
- struct pci_device *rom_device =
- xf86GetPciInfoForEntity(pInt->entityIndex);
-
- vbiosMem = (unsigned char *)base + bios_location;
- err = pci_device_read_rom(rom_device, vbiosMem);
- if (err) {
- xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (3) %s\n",
- strerror(err));
- goto error1;
- }
- INTPriv(pInt)->highMemory = GET_HIGH_BASE(rom_device->rom_size);
- break;
- }
- default:
- goto error1;
- }
- pInt->BIOSseg = V_BIOS >> 4;
- pInt->num = 0xe6;
- LockLegacyVGA(pInt, &vga);
- xf86ExecX86int10(pInt);
- UnlockLegacyVGA(pInt, &vga);
+ set_return_trap(pInt);
+
+ switch (location_type) {
+ case BUS_PCI:{
+ int err;
+ struct pci_device *rom_device =
+ xf86GetPciInfoForEntity(pInt->entityIndex);
+
+ vbiosMem = (unsigned char *) base + bios_location;
+ err = pci_device_read_rom(rom_device, vbiosMem);
+ if (err) {
+ xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (3) %s\n",
+ strerror(err));
+ goto error1;
+ }
+ INTPriv(pInt)->highMemory = GET_HIGH_BASE(rom_device->rom_size);
+ break;
+ }
+ default:
+ goto error1;
+ }
+ pInt->BIOSseg = V_BIOS >> 4;
+ pInt->num = 0xe6;
+ LockLegacyVGA(pInt, &vga);
+ xf86ExecX86int10(pInt);
+ UnlockLegacyVGA(pInt, &vga);
}
#else
if (!sysMem) {
- sysMem = xnfalloc(BIOS_SIZE);
- setup_system_bios(sysMem);
+ sysMem = xnfalloc(BIOS_SIZE);
+ setup_system_bios(sysMem);
}
INTPriv(pInt)->sysMem = sysMem;
setup_int_vect(pInt);
@@ -174,11 +176,11 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
/* Retrieve the entire legacy video BIOS segment. This can be upto
* 128KiB.
*/
- vbiosMem = (char *)base + V_BIOS;
+ vbiosMem = (char *) base + V_BIOS;
memset(vbiosMem, 0, 2 * V_BIOS_SIZE);
if (pci_device_read_rom(pInt->dev, vbiosMem) < V_BIOS_SIZE) {
- xf86DrvMsg(screen, X_WARNING,
- "Unable to retrieve all of segment 0x0C0000.\n");
+ xf86DrvMsg(screen, X_WARNING,
+ "Unable to retrieve all of segment 0x0C0000.\n");
}
/*
@@ -186,29 +188,30 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
* it).
*/
{
- int bios_location = V_BIOS;
- Bool done = FALSE;
- vbiosMem = (unsigned char *)base + bios_location;
-
- if (xf86IsEntityPrimary(entityIndex)) {
- if (int10_check_bios(screen, bios_location >> 4, vbiosMem))
- done = TRUE;
- else
- xf86DrvMsg(screen,X_INFO,
- "No legacy BIOS found -- trying PCI\n");
- }
- if (!done) {
- int err;
- struct pci_device *rom_device =
- xf86GetPciInfoForEntity(pInt->entityIndex);
-
- err = pci_device_read_rom(rom_device, vbiosMem);
- if (err) {
- xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (5) %s\n",
- strerror(err));
- goto error1;
- }
- }
+ int bios_location = V_BIOS;
+ Bool done = FALSE;
+
+ vbiosMem = (unsigned char *) base + bios_location;
+
+ if (xf86IsEntityPrimary(entityIndex)) {
+ if (int10_check_bios(screen, bios_location >> 4, vbiosMem))
+ done = TRUE;
+ else
+ xf86DrvMsg(screen, X_INFO,
+ "No legacy BIOS found -- trying PCI\n");
+ }
+ if (!done) {
+ int err;
+ struct pci_device *rom_device =
+ xf86GetPciInfoForEntity(pInt->entityIndex);
+
+ err = pci_device_read_rom(rom_device, vbiosMem);
+ if (err) {
+ xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (5) %s\n",
+ strerror(err));
+ goto error1;
+ }
+ }
}
pInt->BIOSseg = V_BIOS >> 4;
@@ -228,7 +231,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
error0:
free(pInt);
free(options);
-
+
return NULL;
}
@@ -238,7 +241,8 @@ MapVRam(xf86Int10InfoPtr pInt)
int pagesize = getpagesize();
int size = ((VRAM_SIZE + pagesize - 1) / pagesize) * pagesize;
- pci_device_map_legacy(pInt->dev, V_RAM, size, PCI_DEV_MAP_FLAG_WRITABLE, &(INTPriv(pInt)->vRam));
+ pci_device_map_legacy(pInt->dev, V_RAM, size, PCI_DEV_MAP_FLAG_WRITABLE,
+ &(INTPriv(pInt)->vRam));
pInt->io = pci_legacy_open_io(pInt->dev, 0, 64 * 1024);
}
@@ -247,7 +251,7 @@ UnmapVRam(xf86Int10InfoPtr pInt)
{
int screen = pInt->scrnIndex;
int pagesize = getpagesize();
- int size = ((VRAM_SIZE + pagesize - 1)/pagesize) * pagesize;
+ int size = ((VRAM_SIZE + pagesize - 1) / pagesize) * pagesize;
pci_device_unmap_legacy(pInt->dev, INTPriv(pInt)->vRam, size);
pci_device_close_io(pInt->dev, pInt->io);
@@ -265,12 +269,12 @@ void
xf86FreeInt10(xf86Int10InfoPtr pInt)
{
if (!pInt)
- return;
+ return;
#if defined (_PC)
xf86Int10SaveRestoreBIOSVars(pInt, FALSE);
#endif
if (Int10Current == pInt)
- Int10Current = NULL;
+ Int10Current = NULL;
free(INTPriv(pInt)->base);
UnmapVRam(pInt);
free(INTPriv(pInt)->alloc);
@@ -283,49 +287,50 @@ xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off)
{
int pagesize = getpagesize();
int num_pages = ALLOC_ENTRIES(pagesize);
- int i,j;
+ int i, j;
for (i = 0; i < (num_pages - num); i++) {
- if (INTPriv(pInt)->alloc[i] == 0) {
- for (j = i; j < (num + i); j++)
- if (INTPriv(pInt)->alloc[j] != 0)
- break;
- if (j == (num + i))
- break;
- i += num;
- }
+ if (INTPriv(pInt)->alloc[i] == 0) {
+ for (j = i; j < (num + i); j++)
+ if (INTPriv(pInt)->alloc[j] != 0)
+ break;
+ if (j == (num + i))
+ break;
+ i += num;
+ }
}
if (i == (num_pages - num))
- return NULL;
+ return NULL;
for (j = i; j < (i + num); j++)
- INTPriv(pInt)->alloc[j] = 1;
+ INTPriv(pInt)->alloc[j] = 1;
*off = (i + 1) * pagesize;
- return (char *)INTPriv(pInt)->base + *off;
+ return (char *) INTPriv(pInt)->base + *off;
}
void
xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
{
int pagesize = getpagesize();
- int first = (((char *)pbase - (char *)INTPriv(pInt)->base) / pagesize) - 1;
+ int first =
+ (((char *) pbase - (char *) INTPriv(pInt)->base) / pagesize) - 1;
int i;
for (i = first; i < (first + num); i++)
- INTPriv(pInt)->alloc[i] = 0;
+ INTPriv(pInt)->alloc[i] = 0;
}
#define OFF(addr) ((addr) & 0xffff)
#if defined _PC
-# define HIGH_OFFSET (INTPriv(pInt)->highMemory)
-# define HIGH_BASE V_BIOS
+#define HIGH_OFFSET (INTPriv(pInt)->highMemory)
+#define HIGH_BASE V_BIOS
#else
-# define HIGH_OFFSET SYS_BIOS
-# define HIGH_BASE SYS_BIOS
+#define HIGH_OFFSET SYS_BIOS
+#define HIGH_BASE SYS_BIOS
#endif
-# define SYS(addr) ((addr) >= HIGH_OFFSET)
+#define SYS(addr) ((addr) >= HIGH_OFFSET)
#define V_ADDR(addr) \
(SYS(addr) ? ((char*)INTPriv(pInt)->sysMem) + (addr - HIGH_BASE) \
: (((char*)(INTPriv(pInt)->base) + addr)))
@@ -371,7 +376,7 @@ read_w(xf86Int10InfoPtr pInt, int addr)
{
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
if (OFF(addr + 1) > 0)
- return V_ADDR_RW(addr);
+ return V_ADDR_RW(addr);
#endif
return V_ADDR_RB(addr) | (V_ADDR_RB(addr + 1) << 8);
}
@@ -381,26 +386,26 @@ read_l(xf86Int10InfoPtr pInt, int addr)
{
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
if (OFF(addr + 3) > 2)
- return V_ADDR_RL(addr);
+ return V_ADDR_RL(addr);
#endif
return V_ADDR_RB(addr) |
- (V_ADDR_RB(addr + 1) << 8) |
- (V_ADDR_RB(addr + 2) << 16) |
- (V_ADDR_RB(addr + 3) << 24);
+ (V_ADDR_RB(addr + 1) << 8) |
+ (V_ADDR_RB(addr + 2) << 16) | (V_ADDR_RB(addr + 3) << 24);
}
static void
write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val)
{
- V_ADDR_WB(addr,val);
+ V_ADDR_WB(addr, val);
}
static void
write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val)
{
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
- if (OFF(addr + 1) > 0)
- { V_ADDR_WW(addr, val); }
+ if (OFF(addr + 1) > 0) {
+ V_ADDR_WW(addr, val);
+ }
#endif
V_ADDR_WB(addr, val);
V_ADDR_WB(addr + 1, val >> 8);
@@ -410,8 +415,9 @@ static void
write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val)
{
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
- if (OFF(addr + 3) > 2)
- { V_ADDR_WL(addr, val); }
+ if (OFF(addr + 3) > 2) {
+ V_ADDR_WL(addr, val);
+ }
#endif
V_ADDR_WB(addr, val);
V_ADDR_WB(addr + 1, val >> 8);
diff --git a/xorg-server/hw/xfree86/int10/helper_exec.c b/xorg-server/hw/xfree86/int10/helper_exec.c
index 03f9f7da6..1e908778f 100644
--- a/xorg-server/hw/xfree86/int10/helper_exec.c
+++ b/xorg-server/hw/xfree86/int10/helper_exec.c
@@ -43,6 +43,7 @@ static int pciCfg1inw(CARD16 addr, CARD16 *val);
static int pciCfg1outw(CARD16 addr, CARD16 val);
static int pciCfg1inb(CARD16 addr, CARD8 *val);
static int pciCfg1outb(CARD16 addr, CARD8 val);
+
#if defined (_PC)
static void SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set);
#endif
@@ -53,9 +54,9 @@ int
setup_int(xf86Int10InfoPtr pInt)
{
if (pInt != Int10Current) {
- if (!MapCurrentInt10(pInt))
- return -1;
- Int10Current = pInt;
+ if (!MapCurrentInt10(pInt))
+ return -1;
+ Int10Current = pInt;
}
X86_EAX = (CARD32) pInt->ax;
X86_EBX = (CARD32) pInt->bx;
@@ -64,16 +65,18 @@ setup_int(xf86Int10InfoPtr pInt)
X86_ESI = (CARD32) pInt->si;
X86_EDI = (CARD32) pInt->di;
X86_EBP = (CARD32) pInt->bp;
- X86_ESP = 0x1000; X86_SS = pInt->stackseg >> 4;
- X86_EIP = 0x0600; X86_CS = 0x0; /* address of 'hlt' */
- X86_DS = 0x40; /* standard pc ds */
+ X86_ESP = 0x1000;
+ X86_SS = pInt->stackseg >> 4;
+ X86_EIP = 0x0600;
+ X86_CS = 0x0; /* address of 'hlt' */
+ X86_DS = 0x40; /* standard pc ds */
X86_ES = pInt->es;
X86_FS = 0;
X86_GS = 0;
X86_EFLAGS = X86_IF_MASK | X86_IOPL_MASK;
#if defined (_PC)
if (pInt->Flags & SET_BIOS_SCRATCH)
- SetResetBIOSVars(pInt, TRUE);
+ SetResetBIOSVars(pInt, TRUE);
#endif
OsBlockSignals();
return 0;
@@ -94,13 +97,13 @@ finish_int(xf86Int10InfoPtr pInt, int sig)
pInt->flags = (CARD32) X86_FLAGS;
#if defined (_PC)
if (pInt->Flags & RESTORE_BIOS_SCRATCH)
- SetResetBIOSVars(pInt, FALSE);
+ SetResetBIOSVars(pInt, FALSE);
#endif
}
/* general software interrupt handler */
CARD32
-getIntVect(xf86Int10InfoPtr pInt,int num)
+getIntVect(xf86Int10InfoPtr pInt, int num)
{
return MEM_RW(pInt, num << 2) + (MEM_RW(pInt, (num << 2) + 2) << 4);
}
@@ -116,26 +119,28 @@ int
run_bios_int(int num, xf86Int10InfoPtr pInt)
{
CARD32 eflags;
+
#ifndef _PC
/* check if bios vector is initialized */
- if (MEM_RW(pInt, (num << 2) + 2) == (SYS_BIOS >> 4)) { /* SYS_BIOS_SEG ?*/
-
- if (num == 21 && X86_AH == 0x4e) {
- xf86DrvMsg(pInt->scrnIndex, X_NOTICE,
- "Failing Find-Matching-File on non-PC"
- " (int 21, func 4e)\n");
- X86_AX = 2;
- SET_FLAG(F_CF);
- return 1;
- } else {
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "Ignoring int 0x%02x call\n", num);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- return 1;
- }
+ if (MEM_RW(pInt, (num << 2) + 2) == (SYS_BIOS >> 4)) { /* SYS_BIOS_SEG ? */
+
+ if (num == 21 && X86_AH == 0x4e) {
+ xf86DrvMsg(pInt->scrnIndex, X_NOTICE,
+ "Failing Find-Matching-File on non-PC"
+ " (int 21, func 4e)\n");
+ X86_AX = 2;
+ SET_FLAG(F_CF);
+ return 1;
+ }
+ else {
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "Ignoring int 0x%02x call\n", num);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ return 1;
+ }
}
#endif
#ifdef PRINT_INT
@@ -144,13 +149,13 @@ run_bios_int(int num, xf86Int10InfoPtr pInt)
eflags = X86_EFLAGS;
#if 0
eflags = eflags | IF_MASK;
- X86_EFLAGS = X86_EFLAGS & ~(VIF_MASK | TF_MASK | IF_MASK | NT_MASK);
+ X86_EFLAGS = X86_EFLAGS & ~(VIF_MASK | TF_MASK | IF_MASK | NT_MASK);
#endif
pushw(pInt, eflags);
pushw(pInt, X86_CS);
pushw(pInt, X86_IP);
X86_CS = MEM_RW(pInt, (num << 2) + 2);
- X86_IP = MEM_RW(pInt, num << 2);
+ X86_IP = MEM_RW(pInt, num << 2);
#ifdef PRINT_INT
ErrorF("0x%x:%lx\n", X86_CS, X86_EIP);
#endif
@@ -164,12 +169,13 @@ dump_code(xf86Int10InfoPtr pInt)
int i;
CARD32 lina = SEG_ADR((CARD32), X86_CS, IP);
- xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, "code at 0x%8.8" PRIx32 ":\n", lina);
- for (i=0; i<0x10; i++)
- xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i));
+ xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, "code at 0x%8.8" PRIx32 ":\n",
+ lina);
+ for (i = 0; i < 0x10; i++)
+ xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i));
xf86ErrorFVerb(3, "\n");
- for (; i<0x20; i++)
- xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i));
+ for (; i < 0x20; i++)
+ xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i));
xf86ErrorFVerb(3, "\n");
}
@@ -177,20 +183,20 @@ void
dump_registers(xf86Int10InfoPtr pInt)
{
xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
- "EAX=0x%8.8lx, EBX=0x%8.8lx, ECX=0x%8.8lx, EDX=0x%8.8lx\n",
- (unsigned long)X86_EAX, (unsigned long)X86_EBX,
- (unsigned long)X86_ECX, (unsigned long)X86_EDX);
+ "EAX=0x%8.8lx, EBX=0x%8.8lx, ECX=0x%8.8lx, EDX=0x%8.8lx\n",
+ (unsigned long) X86_EAX, (unsigned long) X86_EBX,
+ (unsigned long) X86_ECX, (unsigned long) X86_EDX);
xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
- "ESP=0x%8.8lx, EBP=0x%8.8lx, ESI=0x%8.8lx, EDI=0x%8.8lx\n",
- (unsigned long)X86_ESP, (unsigned long)X86_EBP,
- (unsigned long)X86_ESI, (unsigned long)X86_EDI);
+ "ESP=0x%8.8lx, EBP=0x%8.8lx, ESI=0x%8.8lx, EDI=0x%8.8lx\n",
+ (unsigned long) X86_ESP, (unsigned long) X86_EBP,
+ (unsigned long) X86_ESI, (unsigned long) X86_EDI);
xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
- "CS=0x%4.4x, SS=0x%4.4x,"
- " DS=0x%4.4x, ES=0x%4.4x, FS=0x%4.4x, GS=0x%4.4x\n",
- X86_CS, X86_SS, X86_DS, X86_ES, X86_FS, X86_GS);
+ "CS=0x%4.4x, SS=0x%4.4x,"
+ " DS=0x%4.4x, ES=0x%4.4x, FS=0x%4.4x, GS=0x%4.4x\n",
+ X86_CS, X86_SS, X86_DS, X86_ES, X86_FS, X86_GS);
xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
- "EIP=0x%8.8lx, EFLAGS=0x%8.8lx\n",
- (unsigned long)X86_EIP, (unsigned long)X86_EFLAGS);
+ "EIP=0x%8.8lx, EFLAGS=0x%8.8lx\n",
+ (unsigned long) X86_EIP, (unsigned long) X86_EFLAGS);
}
void
@@ -198,113 +204,120 @@ stack_trace(xf86Int10InfoPtr pInt)
{
int i = 0;
unsigned long stack = SEG_ADR((CARD32), X86_SS, SP);
- unsigned long tail = (CARD32)((X86_SS << 4) + 0x1000);
+ unsigned long tail = (CARD32) ((X86_SS << 4) + 0x1000);
- if (stack >= tail) return;
+ if (stack >= tail)
+ return;
xf86MsgVerb(X_INFO, 3, "stack at 0x%8.8lx:\n", stack);
for (; stack < tail; stack++) {
- xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, stack));
- i = (i + 1) % 0x10;
- if (!i)
- xf86ErrorFVerb(3, "\n");
+ xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, stack));
+ i = (i + 1) % 0x10;
+ if (!i)
+ xf86ErrorFVerb(3, "\n");
}
if (i)
- xf86ErrorFVerb(3, "\n");
+ xf86ErrorFVerb(3, "\n");
}
int
port_rep_inb(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
+ CARD16 port, CARD32 base, int d_f, CARD32 count)
{
register int inc = d_f ? -1 : 1;
CARD32 dst = base;
+
if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" rep_insb(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
- port, count, base, d_f ? "up" : "down");
+ ErrorF(" rep_insb(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
+ port, count, base, d_f ? "up" : "down");
while (count--) {
- MEM_WB(pInt, dst, x_inb(port));
- dst += inc;
+ MEM_WB(pInt, dst, x_inb(port));
+ dst += inc;
}
return dst - base;
}
int
port_rep_inw(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
+ CARD16 port, CARD32 base, int d_f, CARD32 count)
{
register int inc = d_f ? -2 : 2;
CARD32 dst = base;
+
if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" rep_insw(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
- port, count, base, d_f ? "up" : "down");
+ ErrorF(" rep_insw(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
+ port, count, base, d_f ? "up" : "down");
while (count--) {
- MEM_WW(pInt, dst, x_inw(port));
- dst += inc;
+ MEM_WW(pInt, dst, x_inw(port));
+ dst += inc;
}
return dst - base;
}
int
port_rep_inl(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
+ CARD16 port, CARD32 base, int d_f, CARD32 count)
{
register int inc = d_f ? -4 : 4;
CARD32 dst = base;
+
if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" rep_insl(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
- port, count, base, d_f ? "up" : "down");
+ ErrorF(" rep_insl(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
+ port, count, base, d_f ? "up" : "down");
while (count--) {
- MEM_WL(pInt, dst, x_inl(port));
- dst += inc;
+ MEM_WL(pInt, dst, x_inl(port));
+ dst += inc;
}
return dst - base;
}
int
port_rep_outb(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
+ CARD16 port, CARD32 base, int d_f, CARD32 count)
{
register int inc = d_f ? -1 : 1;
CARD32 dst = base;
+
if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" rep_outb(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
- port, count, base, d_f ? "up" : "down");
+ ErrorF(" rep_outb(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
+ port, count, base, d_f ? "up" : "down");
while (count--) {
- x_outb(port, MEM_RB(pInt, dst));
- dst += inc;
+ x_outb(port, MEM_RB(pInt, dst));
+ dst += inc;
}
return dst - base;
}
int
port_rep_outw(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
+ CARD16 port, CARD32 base, int d_f, CARD32 count)
{
register int inc = d_f ? -2 : 2;
CARD32 dst = base;
+
if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" rep_outw(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
- port, count, base, d_f ? "up" : "down");
+ ErrorF(" rep_outw(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
+ port, count, base, d_f ? "up" : "down");
while (count--) {
- x_outw(port, MEM_RW(pInt, dst));
- dst += inc;
+ x_outw(port, MEM_RW(pInt, dst));
+ dst += inc;
}
return dst - base;
}
int
port_rep_outl(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
+ CARD16 port, CARD32 base, int d_f, CARD32 count)
{
register int inc = d_f ? -4 : 4;
CARD32 dst = base;
+
if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" rep_outl(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
- port, count, base, d_f ? "up" : "down");
+ ErrorF(" rep_outl(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
+ port, count, base, d_f ? "up" : "down");
while (count--) {
- x_outl(port, MEM_RL(pInt, dst));
- dst += inc;
+ x_outl(port, MEM_RL(pInt, dst));
+ dst += inc;
}
return dst - base;
}
@@ -315,25 +328,27 @@ x_inb(CARD16 port)
CARD8 val;
if (port == 0x40) {
- Int10Current->inb40time++;
- val = (CARD8)(Int10Current->inb40time >>
- ((Int10Current->inb40time & 1) << 3));
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" inb(%#x) = %2.2x\n", port, val);
+ Int10Current->inb40time++;
+ val = (CARD8) (Int10Current->inb40time >>
+ ((Int10Current->inb40time & 1) << 3));
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" inb(%#x) = %2.2x\n", port, val);
#ifdef __NOT_YET__
- } else if (port < 0x0100) { /* Don't interfere with mainboard */
- val = 0;
- xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "inb 0x%4.4x\n", port);
- if (xf86GetVerbosity() > 3) {
- dump_registers(Int10Current);
- stack_trace(Int10Current);
- }
-#endif /* __NOT_YET__ */
- } else if (!pciCfg1inb(port, &val)) {
- val = pci_io_read8(Int10Current->io, port);
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" inb(%#x) = %2.2x\n", port, val);
+ }
+ else if (port < 0x0100) { /* Don't interfere with mainboard */
+ val = 0;
+ xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "inb 0x%4.4x\n", port);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(Int10Current);
+ stack_trace(Int10Current);
+ }
+#endif /* __NOT_YET__ */
+ }
+ else if (!pciCfg1inb(port, &val)) {
+ val = pci_io_read8(Int10Current->io, port);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" inb(%#x) = %2.2x\n", port, val);
}
return val;
}
@@ -344,18 +359,19 @@ x_inw(CARD16 port)
CARD16 val;
if (port == 0x5c) {
- struct timeval tv;
-
- /*
- * Emulate a PC's timer. Typical resolution is 3.26 usec.
- * Approximate this by dividing by 3.
- */
- X_GETTIMEOFDAY(&tv);
- val = (CARD16)(tv.tv_usec / 3);
- } else if (!pciCfg1inw(port, &val)) {
- val = pci_io_read16(Int10Current->io, port);
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" inw(%#x) = %4.4x\n", port, val);
+ struct timeval tv;
+
+ /*
+ * Emulate a PC's timer. Typical resolution is 3.26 usec.
+ * Approximate this by dividing by 3.
+ */
+ X_GETTIMEOFDAY(&tv);
+ val = (CARD16) (tv.tv_usec / 3);
+ }
+ else if (!pciCfg1inw(port, &val)) {
+ val = pci_io_read16(Int10Current->io, port);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" inw(%#x) = %4.4x\n", port, val);
}
return val;
}
@@ -364,30 +380,33 @@ void
x_outb(CARD16 port, CARD8 val)
{
if ((port == 0x43) && (val == 0)) {
- struct timeval tv;
- /*
- * Emulate a PC's timer 0. Such timers typically have a resolution of
- * some .838 usec per tick, but this can only provide 1 usec per tick.
- * (Not that this matters much, given inherent emulation delays.) Use
- * the bottom bit as a byte select. See inb(0x40) above.
- */
- X_GETTIMEOFDAY(&tv);
- Int10Current->inb40time = (CARD16)(tv.tv_usec | 1);
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" outb(%#x, %2.2x)\n", port, val);
+ struct timeval tv;
+
+ /*
+ * Emulate a PC's timer 0. Such timers typically have a resolution of
+ * some .838 usec per tick, but this can only provide 1 usec per tick.
+ * (Not that this matters much, given inherent emulation delays.) Use
+ * the bottom bit as a byte select. See inb(0x40) above.
+ */
+ X_GETTIMEOFDAY(&tv);
+ Int10Current->inb40time = (CARD16) (tv.tv_usec | 1);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" outb(%#x, %2.2x)\n", port, val);
#ifdef __NOT_YET__
- } else if (port < 0x0100) { /* Don't interfere with mainboard */
- xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "outb 0x%4.4x,0x%2.2x\n", port, val);
- if (xf86GetVerbosity() > 3) {
- dump_registers(Int10Current);
- stack_trace(Int10Current);
- }
-#endif /* __NOT_YET__ */
- } else if (!pciCfg1outb(port, val)) {
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" outb(%#x, %2.2x)\n", port, val);
- pci_io_write8(Int10Current->io, port, val);
+ }
+ else if (port < 0x0100) { /* Don't interfere with mainboard */
+ xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "outb 0x%4.4x,0x%2.2x\n", port, val);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(Int10Current);
+ stack_trace(Int10Current);
+ }
+#endif /* __NOT_YET__ */
+ }
+ else if (!pciCfg1outb(port, val)) {
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" outb(%#x, %2.2x)\n", port, val);
+ pci_io_write8(Int10Current->io, port, val);
}
}
@@ -396,9 +415,9 @@ x_outw(CARD16 port, CARD16 val)
{
if (!pciCfg1outw(port, val)) {
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" outw(%#x, %4.4x)\n", port, val);
- pci_io_write16(Int10Current->io, port, val);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" outw(%#x, %4.4x)\n", port, val);
+ pci_io_write16(Int10Current->io, port, val);
}
}
@@ -408,9 +427,9 @@ x_inl(CARD16 port)
CARD32 val;
if (!pciCfg1in(port, &val)) {
- val = pci_io_read32(Int10Current->io, port);
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" inl(%#x) = %8.8" PRIx32 "\n", port, val);
+ val = pci_io_read32(Int10Current->io, port);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" inl(%#x) = %8.8" PRIx32 "\n", port, val);
}
return val;
}
@@ -419,46 +438,46 @@ void
x_outl(CARD16 port, CARD32 val)
{
if (!pciCfg1out(port, val)) {
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" outl(%#x, %8.8" PRIx32 ")\n", port, val);
- pci_io_write32(Int10Current->io, port, val);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" outl(%#x, %8.8" PRIx32 ")\n", port, val);
+ pci_io_write32(Int10Current->io, port, val);
}
}
CARD8
Mem_rb(CARD32 addr)
{
- return (*Int10Current->mem->rb)(Int10Current, addr);
+ return (*Int10Current->mem->rb) (Int10Current, addr);
}
CARD16
Mem_rw(CARD32 addr)
{
- return (*Int10Current->mem->rw)(Int10Current, addr);
+ return (*Int10Current->mem->rw) (Int10Current, addr);
}
CARD32
Mem_rl(CARD32 addr)
{
- return (*Int10Current->mem->rl)(Int10Current, addr);
+ return (*Int10Current->mem->rl) (Int10Current, addr);
}
void
Mem_wb(CARD32 addr, CARD8 val)
{
- (*Int10Current->mem->wb)(Int10Current, addr, val);
+ (*Int10Current->mem->wb) (Int10Current, addr, val);
}
void
Mem_ww(CARD32 addr, CARD16 val)
{
- (*Int10Current->mem->ww)(Int10Current, addr, val);
+ (*Int10Current->mem->ww) (Int10Current, addr, val);
}
void
Mem_wl(CARD32 addr, CARD32 val)
{
- (*Int10Current->mem->wl)(Int10Current, addr, val);
+ (*Int10Current->mem->wl) (Int10Current, addr, val);
}
static CARD32 PciCfg1Addr = 0;
@@ -471,43 +490,45 @@ static CARD32 PciCfg1Addr = 0;
#define PCI_OFFSET(x) ((x) & 0x000000ff)
#define PCI_TAG(x) ((x) & 0x7fffff00)
-static struct pci_device*
-pci_device_for_cfg_address (CARD32 addr)
+static struct pci_device *
+pci_device_for_cfg_address(CARD32 addr)
{
- struct pci_device *dev = NULL;
- CARD32 tag = PCI_TAG(addr);
- struct pci_slot_match slot_match = {
- .domain = PCI_DOM_FROM_TAG(tag),
- .bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag)),
- .dev = PCI_DEV_FROM_TAG(tag),
- .func = PCI_FUNC_FROM_TAG(tag),
- .match_data = 0
- };
+ struct pci_device *dev = NULL;
+ CARD32 tag = PCI_TAG(addr);
+
+ struct pci_slot_match slot_match = {
+ .domain = PCI_DOM_FROM_TAG(tag),
+ .bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag)),
+ .dev = PCI_DEV_FROM_TAG(tag),
+ .func = PCI_FUNC_FROM_TAG(tag),
+ .match_data = 0
+ };
- struct pci_device_iterator *iter =
- pci_slot_match_iterator_create (&slot_match);
+ struct pci_device_iterator *iter =
+ pci_slot_match_iterator_create(&slot_match);
- if (iter)
- dev = pci_device_next(iter);
+ if (iter)
+ dev = pci_device_next(iter);
- pci_iterator_destroy(iter);
+ pci_iterator_destroy(iter);
- return dev;
+ return dev;
}
static int
pciCfg1in(CARD16 addr, CARD32 *val)
{
if (addr == 0xCF8) {
- *val = PciCfg1Addr;
- return 1;
+ *val = PciCfg1Addr;
+ return 1;
}
if (addr == 0xCFC) {
- pci_device_cfg_read_u32(pci_device_for_cfg_address(PciCfg1Addr),
- (uint32_t *)val, PCI_OFFSET(PciCfg1Addr));
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" cfg_inl(%#" PRIx32 ") = %8.8" PRIx32 "\n", PciCfg1Addr, *val);
- return 1;
+ pci_device_cfg_read_u32(pci_device_for_cfg_address(PciCfg1Addr),
+ (uint32_t *) val, PCI_OFFSET(PciCfg1Addr));
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" cfg_inl(%#" PRIx32 ") = %8.8" PRIx32 "\n", PciCfg1Addr,
+ *val);
+ return 1;
}
return 0;
}
@@ -516,15 +537,16 @@ static int
pciCfg1out(CARD16 addr, CARD32 val)
{
if (addr == 0xCF8) {
- PciCfg1Addr = val;
- return 1;
+ PciCfg1Addr = val;
+ return 1;
}
if (addr == 0xCFC) {
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" cfg_outl(%#" PRIx32 ", %8.8" PRIx32 ")\n", PciCfg1Addr, val);
- pci_device_cfg_write_u32(pci_device_for_cfg_address(PciCfg1Addr),
- val, PCI_OFFSET(PciCfg1Addr));
- return 1;
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" cfg_outl(%#" PRIx32 ", %8.8" PRIx32 ")\n", PciCfg1Addr,
+ val);
+ pci_device_cfg_write_u32(pci_device_for_cfg_address(PciCfg1Addr), val,
+ PCI_OFFSET(PciCfg1Addr));
+ return 1;
}
return 0;
}
@@ -535,18 +557,19 @@ pciCfg1inw(CARD16 addr, CARD16 *val)
int shift;
if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
- shift = (addr - 0xCF8) * 8;
- *val = (PciCfg1Addr >> shift) & 0xffff;
- return 1;
+ shift = (addr - 0xCF8) * 8;
+ *val = (PciCfg1Addr >> shift) & 0xffff;
+ return 1;
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
- const unsigned offset = addr - 0xCFC;
-
- pci_device_cfg_read_u16(pci_device_for_cfg_address(PciCfg1Addr),
- val, PCI_OFFSET(PciCfg1Addr) + offset);
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" cfg_inw(%#" PRIx32 ") = %4.4x\n", PciCfg1Addr + offset, *val);
- return 1;
+ const unsigned offset = addr - 0xCFC;
+
+ pci_device_cfg_read_u16(pci_device_for_cfg_address(PciCfg1Addr),
+ val, PCI_OFFSET(PciCfg1Addr) + offset);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" cfg_inw(%#" PRIx32 ") = %4.4x\n", PciCfg1Addr + offset,
+ *val);
+ return 1;
}
return 0;
}
@@ -557,19 +580,20 @@ pciCfg1outw(CARD16 addr, CARD16 val)
int shift;
if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
- shift = (addr - 0xCF8) * 8;
- PciCfg1Addr &= ~(0xffff << shift);
- PciCfg1Addr |= ((CARD32) val) << shift;
- return 1;
+ shift = (addr - 0xCF8) * 8;
+ PciCfg1Addr &= ~(0xffff << shift);
+ PciCfg1Addr |= ((CARD32) val) << shift;
+ return 1;
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
- const unsigned offset = addr - 0xCFC;
-
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" cfg_outw(%#" PRIx32 ", %4.4x)\n", PciCfg1Addr + offset, val);
- pci_device_cfg_write_u16(pci_device_for_cfg_address(PciCfg1Addr),
- val, PCI_OFFSET(PciCfg1Addr) + offset);
- return 1;
+ const unsigned offset = addr - 0xCFC;
+
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" cfg_outw(%#" PRIx32 ", %4.4x)\n", PciCfg1Addr + offset,
+ val);
+ pci_device_cfg_write_u16(pci_device_for_cfg_address(PciCfg1Addr), val,
+ PCI_OFFSET(PciCfg1Addr) + offset);
+ return 1;
}
return 0;
}
@@ -580,18 +604,19 @@ pciCfg1inb(CARD16 addr, CARD8 *val)
int shift;
if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
- shift = (addr - 0xCF8) * 8;
- *val = (PciCfg1Addr >> shift) & 0xff;
- return 1;
+ shift = (addr - 0xCF8) * 8;
+ *val = (PciCfg1Addr >> shift) & 0xff;
+ return 1;
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
- const unsigned offset = addr - 0xCFC;
-
- pci_device_cfg_read_u8(pci_device_for_cfg_address(PciCfg1Addr),
- val, PCI_OFFSET(PciCfg1Addr) + offset);
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" cfg_inb(%#" PRIx32 ") = %2.2x\n", PciCfg1Addr + offset, *val);
- return 1;
+ const unsigned offset = addr - 0xCFC;
+
+ pci_device_cfg_read_u8(pci_device_for_cfg_address(PciCfg1Addr),
+ val, PCI_OFFSET(PciCfg1Addr) + offset);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" cfg_inb(%#" PRIx32 ") = %2.2x\n", PciCfg1Addr + offset,
+ *val);
+ return 1;
}
return 0;
}
@@ -602,19 +627,20 @@ pciCfg1outb(CARD16 addr, CARD8 val)
int shift;
if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
- shift = (addr - 0xCF8) * 8;
- PciCfg1Addr &= ~(0xff << shift);
- PciCfg1Addr |= ((CARD32) val) << shift;
- return 1;
+ shift = (addr - 0xCF8) * 8;
+ PciCfg1Addr &= ~(0xff << shift);
+ PciCfg1Addr |= ((CARD32) val) << shift;
+ return 1;
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
- const unsigned offset = addr - 0xCFC;
-
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" cfg_outb(%#" PRIx32 ", %2.2x)\n", PciCfg1Addr + offset, val);
- pci_device_cfg_write_u8(pci_device_for_cfg_address(PciCfg1Addr),
- val, PCI_OFFSET(PciCfg1Addr) + offset);
- return 1;
+ const unsigned offset = addr - 0xCFC;
+
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" cfg_outb(%#" PRIx32 ", %2.2x)\n", PciCfg1Addr + offset,
+ val);
+ pci_device_cfg_write_u8(pci_device_for_cfg_address(PciCfg1Addr), val,
+ PCI_OFFSET(PciCfg1Addr) + offset);
+ return 1;
}
return 0;
}
@@ -625,7 +651,7 @@ bios_checksum(const CARD8 *start, int size)
CARD8 sum = 0;
while (size-- > 0)
- sum += *start++;
+ sum += *start++;
return sum;
}
@@ -650,18 +676,18 @@ bios_checksum(const CARD8 *start, int size)
void
LockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga)
{
- vga->save_msr = pci_io_read8(pInt->io, 0x03CC);
- vga->save_vse = pci_io_read8(pInt->io, 0x03C3);
+ vga->save_msr = pci_io_read8(pInt->io, 0x03CC);
+ vga->save_vse = pci_io_read8(pInt->io, 0x03C3);
#ifndef __ia64__
- vga->save_46e8 = pci_io_read8(pInt->io, 0x46E8);
+ vga->save_46e8 = pci_io_read8(pInt->io, 0x46E8);
#endif
vga->save_pos102 = pci_io_read8(pInt->io, 0x0102);
- pci_io_write8(pInt->io, 0x03C2, ~(CARD8)0x03 & vga->save_msr);
- pci_io_write8(pInt->io, 0x03C3, ~(CARD8)0x01 & vga->save_vse);
+ pci_io_write8(pInt->io, 0x03C2, ~(CARD8) 0x03 & vga->save_msr);
+ pci_io_write8(pInt->io, 0x03C3, ~(CARD8) 0x01 & vga->save_vse);
#ifndef __ia64__
- pci_io_write8(pInt->io, 0x46E8, ~(CARD8)0x08 & vga->save_46e8);
+ pci_io_write8(pInt->io, 0x46E8, ~(CARD8) 0x08 & vga->save_46e8);
#endif
- pci_io_write8(pInt->io, 0x0102, ~(CARD8)0x01 & vga->save_pos102);
+ pci_io_write8(pInt->io, 0x0102, ~(CARD8) 0x01 & vga->save_pos102);
}
void
@@ -680,20 +706,22 @@ static void
SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set)
{
int pagesize = getpagesize();
- unsigned char* base;
+ unsigned char *base;
int i;
- if (pci_device_map_legacy(pInt->dev, 0, pagesize, PCI_DEV_MAP_FLAG_WRITABLE, (void **)&base))
- return; /* eek */
+ if (pci_device_map_legacy
+ (pInt->dev, 0, pagesize, PCI_DEV_MAP_FLAG_WRITABLE, (void **) &base))
+ return; /* eek */
if (set) {
- for (i = BIOS_SCRATCH_OFF; i < BIOS_SCRATCH_END; i++)
- MEM_WW(pInt, i, *(base + i));
- } else {
- for (i = BIOS_SCRATCH_OFF; i < BIOS_SCRATCH_END; i++)
- *(base + i) = MEM_RW(pInt, i);
+ for (i = BIOS_SCRATCH_OFF; i < BIOS_SCRATCH_END; i++)
+ MEM_WW(pInt, i, *(base + i));
}
-
+ else {
+ for (i = BIOS_SCRATCH_OFF; i < BIOS_SCRATCH_END; i++)
+ *(base + i) = MEM_RW(pInt, i);
+ }
+
pci_device_unmap_legacy(pInt->dev, base, pagesize);
}
@@ -701,31 +729,32 @@ void
xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt, Bool save)
{
int pagesize = getpagesize();
- unsigned char* base;
+ unsigned char *base;
int i;
if (!xf86IsEntityPrimary(pInt->entityIndex)
- || (!save && !pInt->BIOSScratch))
- return;
-
- if (pci_device_map_legacy(pInt->dev, 0, pagesize, PCI_DEV_MAP_FLAG_WRITABLE, (void **)&base))
- return; /* eek */
+ || (!save && !pInt->BIOSScratch))
+ return;
+
+ if (pci_device_map_legacy
+ (pInt->dev, 0, pagesize, PCI_DEV_MAP_FLAG_WRITABLE, (void **) &base))
+ return; /* eek */
base += BIOS_SCRATCH_OFF;
if (save) {
- if ((pInt->BIOSScratch
- = xnfalloc(BIOS_SCRATCH_LEN)))
- for (i = 0; i < BIOS_SCRATCH_LEN; i++)
- *(((char*)pInt->BIOSScratch + i)) = *(base + i);
- } else {
- if (pInt->BIOSScratch) {
- for (i = 0; i < BIOS_SCRATCH_LEN; i++)
- *(base + i) = *(pInt->BIOSScratch + i);
- free(pInt->BIOSScratch);
- pInt->BIOSScratch = NULL;
- }
- }
-
+ if ((pInt->BIOSScratch = xnfalloc(BIOS_SCRATCH_LEN)))
+ for (i = 0; i < BIOS_SCRATCH_LEN; i++)
+ *(((char *) pInt->BIOSScratch + i)) = *(base + i);
+ }
+ else {
+ if (pInt->BIOSScratch) {
+ for (i = 0; i < BIOS_SCRATCH_LEN; i++)
+ *(base + i) = *(pInt->BIOSScratch + i);
+ free(pInt->BIOSScratch);
+ pInt->BIOSScratch = NULL;
+ }
+ }
+
pci_device_unmap_legacy(pInt->dev, base - BIOS_SCRATCH_OFF, pagesize);
}
#endif
diff --git a/xorg-server/hw/xfree86/int10/helper_mem.c b/xorg-server/hw/xfree86/int10/helper_mem.c
index 9088298a9..96c598a53 100644
--- a/xorg-server/hw/xfree86/int10/helper_mem.c
+++ b/xorg-server/hw/xfree86/int10/helper_mem.c
@@ -28,29 +28,30 @@ typedef enum {
} INT10Opts;
static const OptionInfoRec INT10Options[] = {
- {OPT_NOINT10, "NoINT10", OPTV_BOOLEAN, {0}, FALSE },
- {OPT_INIT_PRIMARY, "InitPrimary", OPTV_BOOLEAN, {0}, FALSE },
- { -1, NULL, OPTV_NONE, {0}, FALSE },
+ {OPT_NOINT10, "NoINT10", OPTV_BOOLEAN, {0}, FALSE},
+ {OPT_INIT_PRIMARY, "InitPrimary", OPTV_BOOLEAN, {0}, FALSE},
+ {-1, NULL, OPTV_NONE, {0}, FALSE},
};
#ifdef DEBUG
void
dprint(unsigned long start, unsigned long size)
{
- int i,j;
- char *c = (char *)start;
+ int i, j;
+ char *c = (char *) start;
for (j = 0; j < (size >> 4); j++) {
- char *d = c;
- ErrorF("\n0x%lx: ",(unsigned long)c);
- for (i = 0; i<16; i++)
- ErrorF("%2.2x ",(unsigned char) (*(c++)));
- c = d;
- for (i = 0; i<16; i++) {
- ErrorF("%c",((((CARD8)(*c)) > 32) && (((CARD8)(*c)) < 128)) ?
- (unsigned char) (*(c)): '.');
- c++;
- }
+ char *d = c;
+
+ ErrorF("\n0x%lx: ", (unsigned long) c);
+ for (i = 0; i < 16; i++)
+ ErrorF("%2.2x ", (unsigned char) (*(c++)));
+ c = d;
+ for (i = 0; i < 16; i++) {
+ ErrorF("%c", ((((CARD8) (*c)) > 32) && (((CARD8) (*c)) < 128)) ?
+ (unsigned char) (*(c)) : '.');
+ c++;
+ }
}
ErrorF("\n");
}
@@ -69,13 +70,13 @@ setup_int_vect(xf86Int10InfoPtr pInt)
/* let the int vects point to the SYS_BIOS seg */
for (i = 0; i < 0x80; i++) {
- MEM_WW(pInt, i << 2, 0);
- MEM_WW(pInt, (i << 2) + 2, SYS_BIOS >> 4);
+ MEM_WW(pInt, i << 2, 0);
+ MEM_WW(pInt, (i << 2) + 2, SYS_BIOS >> 4);
}
reset_int_vect(pInt);
/* font tables default location (int 1F) */
- MEM_WW(pInt,0x1f<<2,0xfa6e);
+ MEM_WW(pInt, 0x1f << 2, 0xfa6e);
/* int 11 default location (Get Equipment Configuration) */
MEM_WW(pInt, 0x11 << 2, 0xf84d);
@@ -122,7 +123,7 @@ setup_system_bios(void *base_addr)
/* set up eisa ident string */
strcpy(base + 0x0FFD9, "PCI_ISA");
/* write system model id for IBM-AT */
- *((unsigned char *)(base + 0x0FFFE)) = 0xfc;
+ *((unsigned char *) (base + 0x0FFFE)) = 0xfc;
return 1;
}
@@ -137,42 +138,42 @@ reset_int_vect(xf86Int10InfoPtr pInt)
* only be used during EGA/VGA BIOS initialisation.
*/
static const CARD8 VideoParms[] = {
- /* Timing for modes 0x00 & 0x01 */
- 0x38, 0x28, 0x2d, 0x0a, 0x1f, 0x06, 0x19, 0x1c,
- 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
- /* Timing for modes 0x02 & 0x03 */
- 0x71, 0x50, 0x5a, 0x0a, 0x1f, 0x06, 0x19, 0x1c,
- 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
- /* Timing for modes 0x04, 0x05 & 0x06 */
- 0x38, 0x28, 0x2d, 0x0a, 0x7f, 0x06, 0x64, 0x70,
- 0x02, 0x01, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
- /* Timing for mode 0x07 */
- 0x61, 0x50, 0x52, 0x0f, 0x19, 0x06, 0x19, 0x19,
- 0x02, 0x0d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00,
- /* Display page lengths in little endian order */
- 0x00, 0x08, /* Modes 0x00 and 0x01 */
- 0x00, 0x10, /* Modes 0x02 and 0x03 */
- 0x00, 0x40, /* Modes 0x04 and 0x05 */
- 0x00, 0x40, /* Modes 0x06 and 0x07 */
- /* Number of columns for each mode */
- 40, 40, 80, 80, 40, 40, 80, 80,
- /* CGA Mode register value for each mode */
- 0x2c, 0x28, 0x2d, 0x29, 0x2a, 0x2e, 0x1e, 0x29,
- /* Padding */
- 0x00, 0x00, 0x00, 0x00
- };
+ /* Timing for modes 0x00 & 0x01 */
+ 0x38, 0x28, 0x2d, 0x0a, 0x1f, 0x06, 0x19, 0x1c,
+ 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
+ /* Timing for modes 0x02 & 0x03 */
+ 0x71, 0x50, 0x5a, 0x0a, 0x1f, 0x06, 0x19, 0x1c,
+ 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
+ /* Timing for modes 0x04, 0x05 & 0x06 */
+ 0x38, 0x28, 0x2d, 0x0a, 0x7f, 0x06, 0x64, 0x70,
+ 0x02, 0x01, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
+ /* Timing for mode 0x07 */
+ 0x61, 0x50, 0x52, 0x0f, 0x19, 0x06, 0x19, 0x19,
+ 0x02, 0x0d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00,
+ /* Display page lengths in little endian order */
+ 0x00, 0x08, /* Modes 0x00 and 0x01 */
+ 0x00, 0x10, /* Modes 0x02 and 0x03 */
+ 0x00, 0x40, /* Modes 0x04 and 0x05 */
+ 0x00, 0x40, /* Modes 0x06 and 0x07 */
+ /* Number of columns for each mode */
+ 40, 40, 80, 80, 40, 40, 80, 80,
+ /* CGA Mode register value for each mode */
+ 0x2c, 0x28, 0x2d, 0x29, 0x2a, 0x2e, 0x1e, 0x29,
+ /* Padding */
+ 0x00, 0x00, 0x00, 0x00
+ };
int i;
for (i = 0; i < sizeof(VideoParms); i++)
- MEM_WB(pInt, i + (0x1000 - sizeof(VideoParms)), VideoParms[i]);
- MEM_WW(pInt, 0x1d << 2, 0x1000 - sizeof(VideoParms));
+ MEM_WB(pInt, i + (0x1000 - sizeof(VideoParms)), VideoParms[i]);
+ MEM_WW(pInt, 0x1d << 2, 0x1000 - sizeof(VideoParms));
MEM_WW(pInt, (0x1d << 2) + 2, 0);
- MEM_WW(pInt, 0x10 << 2, 0xf065);
+ MEM_WW(pInt, 0x10 << 2, 0xf065);
MEM_WW(pInt, (0x10 << 2) + 2, SYS_BIOS >> 4);
- MEM_WW(pInt, 0x42 << 2, 0xf065);
+ MEM_WW(pInt, 0x42 << 2, 0xf065);
MEM_WW(pInt, (0x42 << 2) + 2, SYS_BIOS >> 4);
- MEM_WW(pInt, 0x6D << 2, 0xf065);
+ MEM_WW(pInt, 0x6D << 2, 0xf065);
MEM_WW(pInt, (0x6D << 2) + 2, SYS_BIOS >> 4);
}
@@ -196,24 +197,22 @@ xf86HandleInt10Options(ScrnInfoPtr pScrn, int entityIndex)
{
EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
OptionInfoPtr options = NULL;
-
+
if (pEnt->device) {
- pointer configOptions = NULL;
-
- /* Check if xf86CollectOptions() has already been called */
- if (((pEnt->index < 0) ||
- !pScrn ||
- !(configOptions = pScrn->options)) &&
- pEnt->device)
- configOptions = pEnt->device->options;
-
- if (configOptions) {
- if (!(options = (OptionInfoPtr) malloc(sizeof(INT10Options))))
- return NULL;
-
- (void)memcpy(options, INT10Options, sizeof(INT10Options));
- xf86ProcessOptions(pScrn->scrnIndex, configOptions, options);
- }
+ pointer configOptions = NULL;
+
+ /* Check if xf86CollectOptions() has already been called */
+ if (((pEnt->index < 0) ||
+ !pScrn || !(configOptions = pScrn->options)) && pEnt->device)
+ configOptions = pEnt->device->options;
+
+ if (configOptions) {
+ if (!(options = (OptionInfoPtr) malloc(sizeof(INT10Options))))
+ return NULL;
+
+ (void) memcpy(options, INT10Options, sizeof(INT10Options));
+ xf86ProcessOptions(pScrn->scrnIndex, configOptions, options);
+ }
}
free(pEnt);
@@ -221,47 +220,48 @@ xf86HandleInt10Options(ScrnInfoPtr pScrn, int entityIndex)
}
Bool
-int10skip(const void* options)
+int10skip(const void *options)
{
Bool noint10 = FALSE;
- if (!options) return FALSE;
-
+ if (!options)
+ return FALSE;
+
xf86GetOptValBool(options, OPT_NOINT10, &noint10);
return noint10;
}
Bool
-int10_check_bios(int scrnIndex, int codeSeg, const unsigned char* vbiosMem)
+int10_check_bios(int scrnIndex, int codeSeg, const unsigned char *vbiosMem)
{
int size;
- if ((codeSeg & 0x1f) || /* Not 512-byte aligned otherwise */
- ((codeSeg << 4) < V_BIOS) ||
- ((codeSeg << 4) >= SYS_SIZE))
- return FALSE;
+ if ((codeSeg & 0x1f) || /* Not 512-byte aligned otherwise */
+ ((codeSeg << 4) < V_BIOS) || ((codeSeg << 4) >= SYS_SIZE))
+ return FALSE;
- if ((*vbiosMem != 0x55) || (*(vbiosMem+1) != 0xAA) || !*(vbiosMem+2))
- return FALSE;
+ if ((*vbiosMem != 0x55) || (*(vbiosMem + 1) != 0xAA) || !*(vbiosMem + 2))
+ return FALSE;
size = *(vbiosMem + 2) * 512;
if ((size + (codeSeg << 4)) > SYS_SIZE)
- return FALSE;
+ return FALSE;
if (bios_checksum(vbiosMem, size))
- xf86DrvMsg(scrnIndex, X_INFO, "Bad V_BIOS checksum\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Bad V_BIOS checksum\n");
return TRUE;
}
Bool
-initPrimary(const void* options)
+initPrimary(const void *options)
{
Bool initPrimary = FALSE;
- if (!options) return FALSE;
-
+ if (!options)
+ return FALSE;
+
xf86GetOptValBool(options, OPT_INIT_PRIMARY, &initPrimary);
return initPrimary;
}
@@ -272,13 +272,13 @@ xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt)
BusType location_type;
EntityInfoPtr pEnt = xf86GetEntityInfo(pInt->entityIndex);
+
location_type = pEnt->location.type;
free(pEnt);
return location_type;
}
-
#define CHECK_V_SEGMENT_RANGE(x) \
if (((x) << 4) < V_BIOS) { \
xf86DrvMsg(pInt->scrnIndex, X_ERROR, \
@@ -300,24 +300,24 @@ xf86int10GetBiosSegment(xf86Int10InfoPtr pInt, void *base)
segments[3] = ~0;
for (i = 0; segments[i] != ~0; i++) {
- unsigned char * vbiosMem;
+ unsigned char *vbiosMem;
- cs = segments[i];
+ cs = segments[i];
- CHECK_V_SEGMENT_RANGE(cs);
- vbiosMem = (unsigned char *)base + (cs << 4);
- if (int10_check_bios(pInt->scrnIndex, cs, vbiosMem)) {
- break;
- }
+ CHECK_V_SEGMENT_RANGE(cs);
+ vbiosMem = (unsigned char *) base + (cs << 4);
+ if (int10_check_bios(pInt->scrnIndex, cs, vbiosMem)) {
+ break;
+ }
}
if (segments[i] == ~0) {
- xf86DrvMsg(pInt->scrnIndex, X_ERROR, "No V_BIOS found\n");
- return FALSE;
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "No V_BIOS found\n");
+ return FALSE;
}
xf86DrvMsg(pInt->scrnIndex, X_INFO, "Primary V_BIOS segment is: 0x%lx\n",
- (unsigned long)cs);
+ (unsigned long) cs);
pInt->BIOSseg = cs;
return TRUE;
diff --git a/xorg-server/hw/xfree86/int10/xf86int10.c b/xorg-server/hw/xfree86/int10/xf86int10.c
index dd00e5465..df347d4dd 100644
--- a/xorg-server/hw/xfree86/int10/xf86int10.c
+++ b/xorg-server/hw/xfree86/int10/xf86int10.c
@@ -20,12 +20,13 @@
xf86Int10InfoPtr Int10Current = NULL;
static int int1A_handler(xf86Int10InfoPtr pInt);
+
#ifndef _PC
static int int42_handler(xf86Int10InfoPtr pInt);
#endif
static int intE6_handler(xf86Int10InfoPtr pInt);
static struct pci_device *findPci(xf86Int10InfoPtr pInt, unsigned short bx);
-static CARD32 pciSlotBX( const struct pci_device * pvp );
+static CARD32 pciSlotBX(const struct pci_device *pvp);
int
int_handler(xf86Int10InfoPtr pInt)
@@ -38,28 +39,27 @@ int_handler(xf86Int10InfoPtr pInt)
case 0x10:
case 0x42:
case 0x6D:
- if (getIntVect(pInt, num) == I_S_DEFAULT_INT_VECT)
- ret = int42_handler(pInt);
- break;
+ if (getIntVect(pInt, num) == I_S_DEFAULT_INT_VECT)
+ ret = int42_handler(pInt);
+ break;
#endif
case 0x1A:
- ret = int1A_handler(pInt);
- break;
+ ret = int1A_handler(pInt);
+ break;
case 0xe6:
- ret = intE6_handler(pInt);
- break;
+ ret = intE6_handler(pInt);
+ break;
default:
- break;
+ break;
}
if (!ret)
- ret = run_bios_int(num, pInt);
+ ret = run_bios_int(num, pInt);
if (!ret) {
- xf86DrvMsg(pInt->scrnIndex, X_ERROR,
- "Halting on int 0x%2.2x!\n", num);
- dump_registers(pInt);
- stack_trace(pInt);
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Halting on int 0x%2.2x!\n", num);
+ dump_registers(pInt);
+ stack_trace(pInt);
}
return ret;
@@ -79,507 +79,511 @@ int42_handler(xf86Int10InfoPtr pInt)
{
switch (X86_AH) {
case 0x00:
- /* Set Video Mode */
- /* Enter: AL = video mode number */
- /* Leave: Nothing */
- /* Implemented (except for clearing the screen) */
- { /* Localise */
- unsigned int ioport;
- int i;
- CARD16 int1d, regvals, tmp;
- CARD8 mode, cgamode, cgacolour;
-
- /*
- * Ignore all mode numbers but 0x00-0x13. Some systems also ignore
- * 0x0B and 0x0C, but don't do that here.
- */
- if (X86_AL > 0x13)
- break;
-
- /*
- * You didn't think that was really the mode set, did you? There
- * are only so many slots in the video parameter table...
- */
- mode = X86_AL;
- ioport = 0x03D4;
- switch (MEM_RB(pInt, 0x0410) & 0x30) {
- case 0x30: /* MDA */
- mode = 0x07; /* Force mode to 0x07 */
- ioport = 0x03B4;
- break;
- case 0x10: /* CGA 40x25 */
- if (mode >= 0x07)
- mode = 0x01;
- break;
- case 0x20: /* CGA 80x25 (MCGA?) */
- if (mode >= 0x07)
- mode = 0x03;
- break;
- case 0x00: /* EGA/VGA */
- if (mode >= 0x07) /* Don't try MDA timings */
- mode = 0x01; /* !?!?! */
- break;
- }
-
- /* Locate data in video parameter table */
- int1d = MEM_RW(pInt, 0x1d << 2);
- regvals = ((mode >> 1) << 4) + int1d;
- cgacolour = 0x30;
- if (mode == 0x06) {
- regvals -= 0x10;
- cgacolour = 0x3F;
- }
-
- /** Update BIOS Data Area **/
-
- /* Video mode */
- MEM_WB(pInt, 0x0449, mode);
-
- /* Columns */
- tmp = MEM_RB(pInt, mode + int1d + 0x48);
- MEM_WW(pInt, 0x044A, tmp);
-
- /* Page length */
- tmp = MEM_RW(pInt, (mode & 0x06) + int1d + 0x40);
- MEM_WW(pInt, 0x044C, tmp);
-
- /* Start Address */
- MEM_WW(pInt, 0x044E, 0);
-
- /* Cursor positions, one for each display page */
- for (i = 0x0450; i < 0x0460; i += 2)
- MEM_WW(pInt, i, 0);
-
- /* Cursor start & end scanlines */
- tmp = MEM_RB(pInt, regvals + 0x0B);
- MEM_WB(pInt, 0x0460, tmp);
- tmp = MEM_RB(pInt, regvals + 0x0A);
- MEM_WB(pInt, 0x0461, tmp);
-
- /* Current display page number */
- MEM_WB(pInt, 0x0462, 0);
-
- /* CRTC I/O address */
- MEM_WW(pInt, 0x0463, ioport);
-
- /* CGA Mode register value */
- cgamode = MEM_RB(pInt, mode + int1d + 0x50);
- MEM_WB(pInt, 0x0465, cgamode);
-
- /* CGA Colour register value */
- MEM_WB(pInt, 0x0466, cgacolour);
-
- /* Rows */
- MEM_WB(pInt, 0x0484, (25 - 1));
-
- /* Program the mode */
- pci_io_write8(pInt->io, ioport + 4, cgamode & 0x37); /* Turn off screen */
- for (i = 0; i < 0x10; i++) {
- tmp = MEM_RB(pInt, regvals + i);
- pci_io_write8(pInt->io, ioport, i);
- pci_io_write8(pInt->io, ioport + 1, tmp);
- }
- pci_io_write8(pInt->io, ioport + 5, cgacolour); /* Select colour mode */
- pci_io_write8(pInt->io, ioport + 4, cgamode); /* Turn on screen */
- }
- break;
+ /* Set Video Mode */
+ /* Enter: AL = video mode number */
+ /* Leave: Nothing */
+ /* Implemented (except for clearing the screen) */
+ { /* Localise */
+ unsigned int ioport;
+ int i;
+ CARD16 int1d, regvals, tmp;
+ CARD8 mode, cgamode, cgacolour;
+
+ /*
+ * Ignore all mode numbers but 0x00-0x13. Some systems also ignore
+ * 0x0B and 0x0C, but don't do that here.
+ */
+ if (X86_AL > 0x13)
+ break;
+
+ /*
+ * You didn't think that was really the mode set, did you? There
+ * are only so many slots in the video parameter table...
+ */
+ mode = X86_AL;
+ ioport = 0x03D4;
+ switch (MEM_RB(pInt, 0x0410) & 0x30) {
+ case 0x30: /* MDA */
+ mode = 0x07; /* Force mode to 0x07 */
+ ioport = 0x03B4;
+ break;
+ case 0x10: /* CGA 40x25 */
+ if (mode >= 0x07)
+ mode = 0x01;
+ break;
+ case 0x20: /* CGA 80x25 (MCGA?) */
+ if (mode >= 0x07)
+ mode = 0x03;
+ break;
+ case 0x00: /* EGA/VGA */
+ if (mode >= 0x07) /* Don't try MDA timings */
+ mode = 0x01; /* !?!?! */
+ break;
+ }
+
+ /* Locate data in video parameter table */
+ int1d = MEM_RW(pInt, 0x1d << 2);
+ regvals = ((mode >> 1) << 4) + int1d;
+ cgacolour = 0x30;
+ if (mode == 0x06) {
+ regvals -= 0x10;
+ cgacolour = 0x3F;
+ }
+
+ /** Update BIOS Data Area **/
+
+ /* Video mode */
+ MEM_WB(pInt, 0x0449, mode);
+
+ /* Columns */
+ tmp = MEM_RB(pInt, mode + int1d + 0x48);
+ MEM_WW(pInt, 0x044A, tmp);
+
+ /* Page length */
+ tmp = MEM_RW(pInt, (mode & 0x06) + int1d + 0x40);
+ MEM_WW(pInt, 0x044C, tmp);
+
+ /* Start Address */
+ MEM_WW(pInt, 0x044E, 0);
+
+ /* Cursor positions, one for each display page */
+ for (i = 0x0450; i < 0x0460; i += 2)
+ MEM_WW(pInt, i, 0);
+
+ /* Cursor start & end scanlines */
+ tmp = MEM_RB(pInt, regvals + 0x0B);
+ MEM_WB(pInt, 0x0460, tmp);
+ tmp = MEM_RB(pInt, regvals + 0x0A);
+ MEM_WB(pInt, 0x0461, tmp);
+
+ /* Current display page number */
+ MEM_WB(pInt, 0x0462, 0);
+
+ /* CRTC I/O address */
+ MEM_WW(pInt, 0x0463, ioport);
+
+ /* CGA Mode register value */
+ cgamode = MEM_RB(pInt, mode + int1d + 0x50);
+ MEM_WB(pInt, 0x0465, cgamode);
+
+ /* CGA Colour register value */
+ MEM_WB(pInt, 0x0466, cgacolour);
+
+ /* Rows */
+ MEM_WB(pInt, 0x0484, (25 - 1));
+
+ /* Program the mode */
+ pci_io_write8(pInt->io, ioport + 4, cgamode & 0x37); /* Turn off screen */
+ for (i = 0; i < 0x10; i++) {
+ tmp = MEM_RB(pInt, regvals + i);
+ pci_io_write8(pInt->io, ioport, i);
+ pci_io_write8(pInt->io, ioport + 1, tmp);
+ }
+ pci_io_write8(pInt->io, ioport + 5, cgacolour); /* Select colour mode */
+ pci_io_write8(pInt->io, ioport + 4, cgamode); /* Turn on screen */
+ }
+ break;
case 0x01:
- /* Set Cursor Type */
- /* Enter: CH = starting line for cursor */
- /* CL = ending line for cursor */
- /* Leave: Nothing */
- /* Implemented */
- { /* Localise */
- unsigned int ioport = MEM_RW(pInt, 0x0463);
-
- MEM_WB(pInt, 0x0460, X86_CL);
- MEM_WB(pInt, 0x0461, X86_CH);
-
- pci_io_write8(pInt->io, ioport, 0x0A);
- pci_io_write8(pInt->io, ioport + 1, X86_CH);
- pci_io_write8(pInt->io, ioport, 0x0B);
- pci_io_write8(pInt->io, ioport + 1, X86_CL);
- }
- break;
+ /* Set Cursor Type */
+ /* Enter: CH = starting line for cursor */
+ /* CL = ending line for cursor */
+ /* Leave: Nothing */
+ /* Implemented */
+ { /* Localise */
+ unsigned int ioport = MEM_RW(pInt, 0x0463);
+
+ MEM_WB(pInt, 0x0460, X86_CL);
+ MEM_WB(pInt, 0x0461, X86_CH);
+
+ pci_io_write8(pInt->io, ioport, 0x0A);
+ pci_io_write8(pInt->io, ioport + 1, X86_CH);
+ pci_io_write8(pInt->io, ioport, 0x0B);
+ pci_io_write8(pInt->io, ioport + 1, X86_CL);
+ }
+ break;
case 0x02:
- /* Set Cursor Position */
- /* Enter: BH = display page number */
- /* DH = row */
- /* DL = column */
- /* Leave: Nothing */
- /* Implemented */
- { /* Localise */
- unsigned int ioport;
- CARD16 offset;
-
- MEM_WB(pInt, (X86_BH << 1) + 0x0450, X86_DL);
- MEM_WB(pInt, (X86_BH << 1) + 0x0451, X86_DH);
-
- if (X86_BH != MEM_RB(pInt, 0x0462))
- break;
-
- offset = (X86_DH * MEM_RW(pInt, 0x044A)) + X86_DL;
- offset += MEM_RW(pInt, 0x044E) << 1;
-
- ioport = MEM_RW(pInt, 0x0463);
- pci_io_write8(pInt->io, ioport, 0x0E);
- pci_io_write8(pInt->io, ioport + 1, offset >> 8);
- pci_io_write8(pInt->io, ioport, 0x0F);
- pci_io_write8(pInt->io, ioport + 1, offset & 0xFF);
- }
- break;
+ /* Set Cursor Position */
+ /* Enter: BH = display page number */
+ /* DH = row */
+ /* DL = column */
+ /* Leave: Nothing */
+ /* Implemented */
+ { /* Localise */
+ unsigned int ioport;
+ CARD16 offset;
+
+ MEM_WB(pInt, (X86_BH << 1) + 0x0450, X86_DL);
+ MEM_WB(pInt, (X86_BH << 1) + 0x0451, X86_DH);
+
+ if (X86_BH != MEM_RB(pInt, 0x0462))
+ break;
+
+ offset = (X86_DH * MEM_RW(pInt, 0x044A)) + X86_DL;
+ offset += MEM_RW(pInt, 0x044E) << 1;
+
+ ioport = MEM_RW(pInt, 0x0463);
+ pci_io_write8(pInt->io, ioport, 0x0E);
+ pci_io_write8(pInt->io, ioport + 1, offset >> 8);
+ pci_io_write8(pInt->io, ioport, 0x0F);
+ pci_io_write8(pInt->io, ioport + 1, offset & 0xFF);
+ }
+ break;
case 0x03:
- /* Get Cursor Position */
- /* Enter: BH = display page number */
- /* Leave: CH = starting line for cursor */
- /* CL = ending line for cursor */
- /* DH = row */
- /* DL = column */
- /* Implemented */
- { /* Localise */
- X86_CL = MEM_RB(pInt, 0x0460);
- X86_CH = MEM_RB(pInt, 0x0461);
- X86_DL = MEM_RB(pInt, (X86_BH << 1) + 0x0450);
- X86_DH = MEM_RB(pInt, (X86_BH << 1) + 0x0451);
- }
- break;
+ /* Get Cursor Position */
+ /* Enter: BH = display page number */
+ /* Leave: CH = starting line for cursor */
+ /* CL = ending line for cursor */
+ /* DH = row */
+ /* DL = column */
+ /* Implemented */
+ { /* Localise */
+ X86_CL = MEM_RB(pInt, 0x0460);
+ X86_CH = MEM_RB(pInt, 0x0461);
+ X86_DL = MEM_RB(pInt, (X86_BH << 1) + 0x0450);
+ X86_DH = MEM_RB(pInt, (X86_BH << 1) + 0x0451);
+ }
+ break;
case 0x04:
- /* Get Light Pen Position */
- /* Enter: Nothing */
- /* Leave: AH = 0x01 (down/triggered) or 0x00 (not) */
- /* BX = pixel column */
- /* CX = pixel row */
- /* DH = character row */
- /* DL = character column */
- /* Not Implemented */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x04) -- Get Light Pen Position\n", pInt->num);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- X86_AH = X86_BX = X86_CX = X86_DX = 0;
- }
- break;
+ /* Get Light Pen Position */
+ /* Enter: Nothing */
+ /* Leave: AH = 0x01 (down/triggered) or 0x00 (not) */
+ /* BX = pixel column */
+ /* CX = pixel row */
+ /* DH = character row */
+ /* DL = character column */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x04) -- Get Light Pen Position\n",
+ pInt->num);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ X86_AH = X86_BX = X86_CX = X86_DX = 0;
+ }
+ break;
case 0x05:
- /* Set Display Page */
- /* Enter: AL = display page number */
- /* Leave: Nothing */
- /* Implemented */
- { /* Localise */
- unsigned int ioport = MEM_RW(pInt, 0x0463);
- CARD16 start;
- CARD8 x, y;
-
- /* Calculate new start address */
- MEM_WB(pInt, 0x0462, X86_AL);
- start = X86_AL * MEM_RW(pInt, 0x044C);
- MEM_WW(pInt, 0x044E, start);
- start <<= 1;
-
- /* Update start address */
- pci_io_write8(pInt->io, ioport, 0x0C);
- pci_io_write8(pInt->io, ioport + 1, start >> 8);
- pci_io_write8(pInt->io, ioport, 0x0D);
- pci_io_write8(pInt->io, ioport + 1, start & 0xFF);
-
- /* Switch cursor position */
- y = MEM_RB(pInt, (X86_AL << 1) + 0x0450);
- x = MEM_RB(pInt, (X86_AL << 1) + 0x0451);
- start += (y * MEM_RW(pInt, 0x044A)) + x;
-
- /* Update cursor position */
- pci_io_write8(pInt->io, ioport, 0x0E);
- pci_io_write8(pInt->io, ioport + 1, start >> 8);
- pci_io_write8(pInt->io, ioport, 0x0F);
- pci_io_write8(pInt->io, ioport + 1, start & 0xFF);
- }
- break;
+ /* Set Display Page */
+ /* Enter: AL = display page number */
+ /* Leave: Nothing */
+ /* Implemented */
+ { /* Localise */
+ unsigned int ioport = MEM_RW(pInt, 0x0463);
+ CARD16 start;
+ CARD8 x, y;
+
+ /* Calculate new start address */
+ MEM_WB(pInt, 0x0462, X86_AL);
+ start = X86_AL * MEM_RW(pInt, 0x044C);
+ MEM_WW(pInt, 0x044E, start);
+ start <<= 1;
+
+ /* Update start address */
+ pci_io_write8(pInt->io, ioport, 0x0C);
+ pci_io_write8(pInt->io, ioport + 1, start >> 8);
+ pci_io_write8(pInt->io, ioport, 0x0D);
+ pci_io_write8(pInt->io, ioport + 1, start & 0xFF);
+
+ /* Switch cursor position */
+ y = MEM_RB(pInt, (X86_AL << 1) + 0x0450);
+ x = MEM_RB(pInt, (X86_AL << 1) + 0x0451);
+ start += (y * MEM_RW(pInt, 0x044A)) + x;
+
+ /* Update cursor position */
+ pci_io_write8(pInt->io, ioport, 0x0E);
+ pci_io_write8(pInt->io, ioport + 1, start >> 8);
+ pci_io_write8(pInt->io, ioport, 0x0F);
+ pci_io_write8(pInt->io, ioport + 1, start & 0xFF);
+ }
+ break;
case 0x06:
- /* Initialise or Scroll Window Up */
- /* Enter: AL = lines to scroll up */
- /* BH = attribute for blank */
- /* CH = upper y of window */
- /* CL = left x of window */
- /* DH = lower y of window */
- /* DL = right x of window */
- /* Leave: Nothing */
- /* Not Implemented */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x06) -- Initialise or Scroll Window Up\n",
- pInt->num);
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
- " AL=0x%2.2x, BH=0x%2.2x,"
- " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n",
- X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- }
- break;
+ /* Initialise or Scroll Window Up */
+ /* Enter: AL = lines to scroll up */
+ /* BH = attribute for blank */
+ /* CH = upper y of window */
+ /* CL = left x of window */
+ /* DH = lower y of window */
+ /* DL = right x of window */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x06) -- Initialise or Scroll Window Up\n",
+ pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ " AL=0x%2.2x, BH=0x%2.2x,"
+ " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n",
+ X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
case 0x07:
- /* Initialise or Scroll Window Down */
- /* Enter: AL = lines to scroll down */
- /* BH = attribute for blank */
- /* CH = upper y of window */
- /* CL = left x of window */
- /* DH = lower y of window */
- /* DL = right x of window */
- /* Leave: Nothing */
- /* Not Implemented */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x07) -- Initialise or Scroll Window Down\n",
- pInt->num);
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
- " AL=0x%2.2x, BH=0x%2.2x,"
- " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n",
- X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- }
- break;
+ /* Initialise or Scroll Window Down */
+ /* Enter: AL = lines to scroll down */
+ /* BH = attribute for blank */
+ /* CH = upper y of window */
+ /* CL = left x of window */
+ /* DH = lower y of window */
+ /* DL = right x of window */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x07) -- Initialise or Scroll Window Down\n",
+ pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ " AL=0x%2.2x, BH=0x%2.2x,"
+ " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n",
+ X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
case 0x08:
- /* Read Character and Attribute at Cursor */
- /* Enter: BH = display page number */
- /* Leave: AH = attribute */
- /* AL = character */
- /* Not Implemented */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x08) -- Read Character and Attribute at"
- " Cursor\n", pInt->num);
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
- "BH=0x%2.2x\n", X86_BH);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- X86_AX = 0;
- }
- break;
+ /* Read Character and Attribute at Cursor */
+ /* Enter: BH = display page number */
+ /* Leave: AH = attribute */
+ /* AL = character */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x08) -- Read Character and Attribute at"
+ " Cursor\n", pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "BH=0x%2.2x\n", X86_BH);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ X86_AX = 0;
+ }
+ break;
case 0x09:
- /* Write Character and Attribute at Cursor */
- /* Enter: AL = character */
- /* BH = display page number */
- /* BL = attribute (text) or colour (graphics) */
- /* CX = replication count */
- /* Leave: Nothing */
- /* Not Implemented */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x09) -- Write Character and Attribute at"
- " Cursor\n", pInt->num);
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
- "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n",
- X86_AL, X86_BH, X86_BL, X86_CX);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- }
- break;
+ /* Write Character and Attribute at Cursor */
+ /* Enter: AL = character */
+ /* BH = display page number */
+ /* BL = attribute (text) or colour (graphics) */
+ /* CX = replication count */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x09) -- Write Character and Attribute at"
+ " Cursor\n", pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n",
+ X86_AL, X86_BH, X86_BL, X86_CX);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
case 0x0a:
- /* Write Character at Cursor */
- /* Enter: AL = character */
- /* BH = display page number */
- /* BL = colour */
- /* CX = replication count */
- /* Leave: Nothing */
- /* Not Implemented */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x0A) -- Write Character at Cursor\n",
- pInt->num);
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
- "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n",
- X86_AL, X86_BH, X86_BL, X86_CX);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- }
- break;
+ /* Write Character at Cursor */
+ /* Enter: AL = character */
+ /* BH = display page number */
+ /* BL = colour */
+ /* CX = replication count */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x0A) -- Write Character at Cursor\n",
+ pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n",
+ X86_AL, X86_BH, X86_BL, X86_CX);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
case 0x0b:
- /* Set Palette, Background or Border */
- /* Enter: BH = 0x00 or 0x01 */
- /* BL = colour or palette (respectively) */
- /* Leave: Nothing */
- /* Implemented */
- { /* Localise */
- unsigned int ioport = MEM_RW(pInt, 0x0463) + 5;
- CARD8 cgacolour = MEM_RB(pInt, 0x0466);
-
- if (X86_BH) {
- cgacolour &= 0xDF;
- cgacolour |= (X86_BL & 0x01) << 5;
- } else {
- cgacolour &= 0xE0;
- cgacolour |= X86_BL & 0x1F;
- }
-
- MEM_WB(pInt, 0x0466, cgacolour);
- pci_io_write8(pInt->io, ioport, cgacolour);
- }
- break;
+ /* Set Palette, Background or Border */
+ /* Enter: BH = 0x00 or 0x01 */
+ /* BL = colour or palette (respectively) */
+ /* Leave: Nothing */
+ /* Implemented */
+ { /* Localise */
+ unsigned int ioport = MEM_RW(pInt, 0x0463) + 5;
+ CARD8 cgacolour = MEM_RB(pInt, 0x0466);
+
+ if (X86_BH) {
+ cgacolour &= 0xDF;
+ cgacolour |= (X86_BL & 0x01) << 5;
+ }
+ else {
+ cgacolour &= 0xE0;
+ cgacolour |= X86_BL & 0x1F;
+ }
+
+ MEM_WB(pInt, 0x0466, cgacolour);
+ pci_io_write8(pInt->io, ioport, cgacolour);
+ }
+ break;
case 0x0c:
- /* Write Graphics Pixel */
- /* Enter: AL = pixel value */
- /* BH = display page number */
- /* CX = column */
- /* DX = row */
- /* Leave: Nothing */
- /* Not Implemented */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x0C) -- Write Graphics Pixel\n", pInt->num);
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
- "AL=0x%2.2x, BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n",
- X86_AL, X86_BH, X86_CX, X86_DX);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- }
- break;
+ /* Write Graphics Pixel */
+ /* Enter: AL = pixel value */
+ /* BH = display page number */
+ /* CX = column */
+ /* DX = row */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x0C) -- Write Graphics Pixel\n",
+ pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "AL=0x%2.2x, BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n",
+ X86_AL, X86_BH, X86_CX, X86_DX);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
case 0x0d:
- /* Read Graphics Pixel */
- /* Enter: BH = display page number */
- /* CX = column */
- /* DX = row */
- /* Leave: AL = pixel value */
- /* Not Implemented */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x0D) -- Read Graphics Pixel\n", pInt->num);
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
- "BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n",
- X86_BH, X86_CX, X86_DX);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- X86_AL = 0;
- }
- break;
+ /* Read Graphics Pixel */
+ /* Enter: BH = display page number */
+ /* CX = column */
+ /* DX = row */
+ /* Leave: AL = pixel value */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x0D) -- Read Graphics Pixel\n",
+ pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n", X86_BH, X86_CX,
+ X86_DX);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ X86_AL = 0;
+ }
+ break;
case 0x0e:
- /* Write Character in Teletype Mode */
- /* Enter: AL = character */
- /* BH = display page number */
- /* BL = foreground colour */
- /* Leave: Nothing */
- /* Not Implemented */
- /* WARNING: Emulation of BEL characters will require */
- /* emulation of RTC and PC speaker I/O. */
- /* Also, this recurses through int 0x10 */
- /* which might or might not have been */
- /* installed yet. */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x0E) -- Write Character in Teletype Mode\n",
- pInt->num);
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
- "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x\n",
- X86_AL, X86_BH, X86_BL);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- }
- break;
+ /* Write Character in Teletype Mode */
+ /* Enter: AL = character */
+ /* BH = display page number */
+ /* BL = foreground colour */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ /* WARNING: Emulation of BEL characters will require */
+ /* emulation of RTC and PC speaker I/O. */
+ /* Also, this recurses through int 0x10 */
+ /* which might or might not have been */
+ /* installed yet. */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x0E) -- Write Character in Teletype Mode\n",
+ pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x\n",
+ X86_AL, X86_BH, X86_BL);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
case 0x0f:
- /* Get Video Mode */
- /* Enter: Nothing */
- /* Leave: AH = number of columns */
- /* AL = video mode number */
- /* BH = display page number */
- /* Implemented */
- { /* Localise */
- X86_AH = MEM_RW(pInt, 0x044A);
- X86_AL = MEM_RB(pInt, 0x0449);
- X86_BH = MEM_RB(pInt, 0x0462);
- }
- break;
+ /* Get Video Mode */
+ /* Enter: Nothing */
+ /* Leave: AH = number of columns */
+ /* AL = video mode number */
+ /* BH = display page number */
+ /* Implemented */
+ { /* Localise */
+ X86_AH = MEM_RW(pInt, 0x044A);
+ X86_AL = MEM_RB(pInt, 0x0449);
+ X86_BH = MEM_RB(pInt, 0x0462);
+ }
+ break;
case 0x10:
- /* Colour Control (subfunction in AL) */
- /* Enter: Various */
- /* Leave: Various */
- /* Ignored */
- break;
+ /* Colour Control (subfunction in AL) */
+ /* Enter: Various */
+ /* Leave: Various */
+ /* Ignored */
+ break;
case 0x11:
- /* Font Control (subfunction in AL) */
- /* Enter: Various */
- /* Leave: Various */
- /* Ignored */
- break;
+ /* Font Control (subfunction in AL) */
+ /* Enter: Various */
+ /* Leave: Various */
+ /* Ignored */
+ break;
case 0x12:
- /* Miscellaneous (subfunction in BL) */
- /* Enter: Various */
- /* Leave: Various */
- /* Ignored. Previous code here optionally allowed */
- /* the enabling and disabling of VGA, but no system */
- /* BIOS I've come across actually implements it. */
- break;
+ /* Miscellaneous (subfunction in BL) */
+ /* Enter: Various */
+ /* Leave: Various */
+ /* Ignored. Previous code here optionally allowed */
+ /* the enabling and disabling of VGA, but no system */
+ /* BIOS I've come across actually implements it. */
+ break;
case 0x13:
- /* Write String in Teletype Mode */
- /* Enter: AL = write mode */
- /* BL = attribute (if (AL & 0x02) == 0) */
- /* CX = string length */
- /* DH = row */
- /* DL = column */
- /* ES:BP = string segment:offset */
- /* Leave: Nothing */
- /* Not Implemented */
- /* WARNING: Emulation of BEL characters will require */
- /* emulation of RTC and PC speaker I/O. */
- /* Also, this recurses through int 0x10 */
- /* which might or might not have been */
- /* installed yet. */
- { /* Localise */
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x%2.2x(AH=0x13) -- Write String in Teletype Mode\n",
- pInt->num);
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
- "AL=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x,"
- " DH=0x%2.2x, DL=0x%2.2x, ES:BP=0x%4.4x:0x%4.4x\n",
- X86_AL, X86_BL, X86_CX, X86_DH, X86_DL, X86_ES, X86_BP);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- }
- break;
+ /* Write String in Teletype Mode */
+ /* Enter: AL = write mode */
+ /* BL = attribute (if (AL & 0x02) == 0) */
+ /* CX = string length */
+ /* DH = row */
+ /* DL = column */
+ /* ES:BP = string segment:offset */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ /* WARNING: Emulation of BEL characters will require */
+ /* emulation of RTC and PC speaker I/O. */
+ /* Also, this recurses through int 0x10 */
+ /* which might or might not have been */
+ /* installed yet. */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x13) -- Write String in Teletype Mode\n",
+ pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "AL=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x,"
+ " DH=0x%2.2x, DL=0x%2.2x, ES:BP=0x%4.4x:0x%4.4x\n",
+ X86_AL, X86_BL, X86_CX, X86_DH, X86_DL, X86_ES, X86_BP);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
default:
- /* Various extensions */
- /* Enter: Various */
- /* Leave: Various */
- /* Ignored */
- break;
+ /* Various extensions */
+ /* Enter: Various */
+ /* Leave: Various */
+ /* Ignored */
+ break;
}
return 1;
@@ -598,7 +602,7 @@ int42_handler(xf86Int10InfoPtr pInt)
* required.
*/
static struct pci_device *
-do_find(const struct pci_id_match *m, char n, const struct pci_device * exclude)
+do_find(const struct pci_id_match *m, char n, const struct pci_device *exclude)
{
struct pci_device *dev;
struct pci_device_iterator *iter;
@@ -607,9 +611,9 @@ do_find(const struct pci_id_match *m, char n, const struct pci_device * exclude)
iter = pci_id_match_iterator_create(m);
while ((dev = pci_device_next(iter)) != NULL) {
- if ((dev != exclude) && !(--n)) {
- break;
- }
+ if ((dev != exclude) && !(--n)) {
+ break;
+ }
}
pci_iterator_destroy(iter);
@@ -617,10 +621,9 @@ do_find(const struct pci_id_match *m, char n, const struct pci_device * exclude)
return dev;
}
-
static struct pci_device *
find_pci_device_vendor(CARD16 vendorID, CARD16 deviceID,
- char n, const struct pci_device * exclude)
+ char n, const struct pci_device *exclude)
{
struct pci_id_match m;
@@ -631,12 +634,12 @@ find_pci_device_vendor(CARD16 vendorID, CARD16 deviceID,
m.device_class = 0;
m.device_class_mask = 0;
- return do_find(& m, n, exclude);
+ return do_find(&m, n, exclude);
}
static struct pci_device *
find_pci_class(CARD8 intf, CARD8 subClass, CARD16 _class,
- char n, const struct pci_device * exclude)
+ char n, const struct pci_device *exclude)
{
struct pci_id_match m;
@@ -644,11 +647,11 @@ find_pci_class(CARD8 intf, CARD8 subClass, CARD16 _class,
m.device_id = PCI_MATCH_ANY;
m.subvendor_id = PCI_MATCH_ANY;
m.subdevice_id = PCI_MATCH_ANY;
- m.device_class = (((uint32_t)_class) << 16)
- | (((uint32_t)subClass) << 8) | intf;
+ m.device_class = (((uint32_t) _class) << 16)
+ | (((uint32_t) subClass) << 8) | intf;
m.device_class_mask = 0x00ffffff;
- return do_find(& m, n, exclude);
+ return do_find(&m, n, exclude);
}
#endif
@@ -660,18 +663,20 @@ static int
int1A_last_bus_number(struct pci_device *dev)
{
struct pci_device *d;
+
struct pci_slot_match m = { dev->domain,
- PCI_MATCH_ANY,
- PCI_MATCH_ANY,
- PCI_MATCH_ANY };
+ PCI_MATCH_ANY,
+ PCI_MATCH_ANY,
+ PCI_MATCH_ANY
+ };
struct pci_device_iterator *iter;
int i = 0;
iter = pci_slot_match_iterator_create(&m);
while ((d = pci_device_next(iter)))
- if (d->bus > i)
- i = d->bus;
+ if (d->bus > i)
+ i = d->bus;
pci_iterator_destroy(iter);
@@ -681,176 +686,181 @@ int1A_last_bus_number(struct pci_device *dev)
static int
int1A_handler(xf86Int10InfoPtr pInt)
{
- struct pci_device * const pvp = xf86GetPciInfoForEntity(pInt->entityIndex);
- struct pci_device * dev;
+ struct pci_device *const pvp = xf86GetPciInfoForEntity(pInt->entityIndex);
+ struct pci_device *dev;
if (pvp == NULL)
- return 0; /* oops */
+ return 0; /* oops */
#ifdef PRINT_INT
ErrorF("int 0x1a: ax=0x%x bx=0x%x cx=0x%x dx=0x%x di=0x%x es=0x%x\n",
- X86_EAX, X86_EBX, X86_ECX, X86_EDX, X86_EDI, X86_ESI);
+ X86_EAX, X86_EBX, X86_ECX, X86_EDX, X86_EDI, X86_ESI);
#endif
switch (X86_AX) {
case 0xb101:
- X86_EAX &= 0xFF00; /* no config space/special cycle support */
- X86_EDX = 0x20494350; /* " ICP" */
- X86_EBX = 0x0210; /* Version 2.10 */
- X86_ECX &= 0xFF00;
- X86_ECX |= int1A_last_bus_number(pvp);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
+ X86_EAX &= 0xFF00; /* no config space/special cycle support */
+ X86_EDX = 0x20494350; /* " ICP" */
+ X86_EBX = 0x0210; /* Version 2.10 */
+ X86_ECX &= 0xFF00;
+ X86_ECX |= int1A_last_bus_number(pvp);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
#ifdef PRINT_INT
- ErrorF("ax=0x%x dx=0x%x bx=0x%x cx=0x%x flags=0x%x\n",
- X86_EAX, X86_EDX, X86_EBX, X86_ECX, X86_EFLAGS);
+ ErrorF("ax=0x%x dx=0x%x bx=0x%x cx=0x%x flags=0x%x\n",
+ X86_EAX, X86_EDX, X86_EBX, X86_ECX, X86_EFLAGS);
#endif
- return 1;
+ return 1;
case 0xb102:
- if ( (X86_DX == pvp->vendor_id)
- && (X86_CX == pvp->device_id)
- && (X86_ESI == 0) ) {
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- X86_EBX = pciSlotBX(pvp);
- }
+ if ((X86_DX == pvp->vendor_id)
+ && (X86_CX == pvp->device_id)
+ && (X86_ESI == 0)) {
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ X86_EBX = pciSlotBX(pvp);
+ }
#ifdef SHOW_ALL_DEVICES
- else
- if ((dev = find_pci_device_vendor(X86_EDX, X86_ECX, X86_ESI, pvp))) {
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- X86_EBX = pciSlotBX(dev);
- }
+ else if ((dev = find_pci_device_vendor(X86_EDX, X86_ECX, X86_ESI, pvp))) {
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ X86_EBX = pciSlotBX(dev);
+ }
#endif
- else {
- X86_EAX = X86_AL | (DEVICE_NOT_FOUND << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
+ else {
+ X86_EAX = X86_AL | (DEVICE_NOT_FOUND << 8);
+ X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */
+ }
#ifdef PRINT_INT
- ErrorF("ax=0x%x bx=0x%x flags=0x%x\n", X86_EAX, X86_EBX, X86_EFLAGS);
+ ErrorF("ax=0x%x bx=0x%x flags=0x%x\n", X86_EAX, X86_EBX, X86_EFLAGS);
#endif
- return 1;
+ return 1;
case 0xb103:
- if ( (X86_ECX & 0x00FFFFFF) == pvp->device_class ) {
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EBX = pciSlotBX(pvp);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- }
+ if ((X86_ECX & 0x00FFFFFF) == pvp->device_class) {
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EBX = pciSlotBX(pvp);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ }
#ifdef SHOW_ALL_DEVICES
- else if ((dev = find_pci_class(X86_CL, X86_CH,
- (X86_ECX & 0xffff0000) >> 16,
- X86_ESI, pvp))) {
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- X86_EBX = pciSlotBX(dev);
- }
+ else if ((dev = find_pci_class(X86_CL, X86_CH,
+ (X86_ECX & 0xffff0000) >> 16,
+ X86_ESI, pvp))) {
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ X86_EBX = pciSlotBX(dev);
+ }
#endif
- else {
- X86_EAX = X86_AL | (DEVICE_NOT_FOUND << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
+ else {
+ X86_EAX = X86_AL | (DEVICE_NOT_FOUND << 8);
+ X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */
+ }
#ifdef PRINT_INT
- ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
+ ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
#endif
- return 1;
+ return 1;
case 0xb108:
- if ((dev = findPci(pInt, X86_EBX)) != NULL) {
- pci_device_cfg_read_u8(dev, & X86_CL, X86_DI);
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
+ if ((dev = findPci(pInt, X86_EBX)) != NULL) {
+ pci_device_cfg_read_u8(dev, &X86_CL, X86_DI);
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ }
+ else {
+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
+ X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */
+ }
#ifdef PRINT_INT
- ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS);
+ ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS);
#endif
- return 1;
+ return 1;
case 0xb109:
- if ((dev = findPci(pInt, X86_EBX)) != NULL) {
- pci_device_cfg_read_u16(dev, & X86_CX, X86_DI);
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
+ if ((dev = findPci(pInt, X86_EBX)) != NULL) {
+ pci_device_cfg_read_u16(dev, &X86_CX, X86_DI);
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ }
+ else {
+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
+ X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */
+ }
#ifdef PRINT_INT
- ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS);
+ ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS);
#endif
- return 1;
+ return 1;
case 0xb10a:
- if ((dev = findPci(pInt, X86_EBX)) != NULL) {
- pci_device_cfg_read_u32(dev, & X86_ECX, X86_DI);
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
+ if ((dev = findPci(pInt, X86_EBX)) != NULL) {
+ pci_device_cfg_read_u32(dev, &X86_ECX, X86_DI);
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ }
+ else {
+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
+ X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */
+ }
#ifdef PRINT_INT
- ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS);
+ ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS);
#endif
- return 1;
+ return 1;
case 0xb10b:
- if ((dev = findPci(pInt, X86_EBX)) != NULL) {
- pci_device_cfg_write_u8(dev, X86_CL, X86_DI);
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
+ if ((dev = findPci(pInt, X86_EBX)) != NULL) {
+ pci_device_cfg_write_u8(dev, X86_CL, X86_DI);
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ }
+ else {
+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
+ X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */
+ }
#ifdef PRINT_INT
- ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
+ ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
#endif
- return 1;
+ return 1;
case 0xb10c:
- if ((dev = findPci(pInt, X86_EBX)) != NULL) {
- pci_device_cfg_write_u16(dev, X86_CX, X86_DI);
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
+ if ((dev = findPci(pInt, X86_EBX)) != NULL) {
+ pci_device_cfg_write_u16(dev, X86_CX, X86_DI);
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ }
+ else {
+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
+ X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */
+ }
#ifdef PRINT_INT
- ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
+ ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
#endif
- return 1;
+ return 1;
case 0xb10d:
- if ((dev = findPci(pInt, X86_EBX)) != NULL) {
- pci_device_cfg_write_u32(dev, X86_ECX, X86_DI);
- X86_EAX = X86_AL | (SUCCESSFUL << 8);
- X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
- } else {
- X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
- X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
- }
+ if ((dev = findPci(pInt, X86_EBX)) != NULL) {
+ pci_device_cfg_write_u32(dev, X86_ECX, X86_DI);
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long) 0x01); /* clear carry flag */
+ }
+ else {
+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
+ X86_EFLAGS |= ((unsigned long) 0x01); /* set carry flag */
+ }
#ifdef PRINT_INT
- ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
+ ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
#endif
- return 1;
+ return 1;
default:
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "int 0x1a subfunction\n");
- dump_registers(pInt);
- if (xf86GetVerbosity() > 3)
- stack_trace(pInt);
- return 0;
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x1a subfunction\n");
+ dump_registers(pInt);
+ if (xf86GetVerbosity() > 3)
+ stack_trace(pInt);
+ return 0;
}
}
static struct pci_device *
findPci(xf86Int10InfoPtr pInt, unsigned short bx)
{
- const unsigned bus = (bx >> 8) & 0x00FF;
- const unsigned dev = (bx >> 3) & 0x001F;
- const unsigned func = (bx ) & 0x0007;
+ const unsigned bus = (bx >> 8) & 0x00FF;
+ const unsigned dev = (bx >> 3) & 0x001F;
+ const unsigned func = (bx) & 0x0007;
return pci_device_find_by_slot(pInt->dev->domain, bus, dev, func);
}
static CARD32
-pciSlotBX(const struct pci_device * pvp)
+pciSlotBX(const struct pci_device *pvp)
{
return ((pvp->bus << 8) & 0x00FF00) | (pvp->dev << 3) | (pvp->func);
}
@@ -861,14 +871,14 @@ pciSlotBX(const struct pci_device * pvp)
static int
intE6_handler(xf86Int10InfoPtr pInt)
{
- struct pci_device * pvp;
+ struct pci_device *pvp;
if ((pvp = xf86GetPciInfoForEntity(pInt->entityIndex)))
- X86_AX = (pvp->bus << 8) | (pvp->dev << 3) | (pvp->func & 0x7);
+ X86_AX = (pvp->bus << 8) | (pvp->dev << 3) | (pvp->func & 0x7);
pushw(pInt, X86_CS);
pushw(pInt, X86_IP);
X86_CS = pInt->BIOSseg;
X86_EIP = 0x0003;
- X86_ES = 0; /* standard pc es */
+ X86_ES = 0; /* standard pc es */
return 1;
}
diff --git a/xorg-server/hw/xfree86/int10/xf86int10.h b/xorg-server/hw/xfree86/int10/xf86int10.h
index 5bf326e78..36b659fd7 100644
--- a/xorg-server/hw/xfree86/int10/xf86int10.h
+++ b/xorg-server/hw/xfree86/int10/xf86int10.h
@@ -23,12 +23,12 @@ typedef struct {
int entityIndex;
int scrnIndex;
pointer cpuRegs;
- CARD16 BIOSseg;
- CARD16 inb40time;
- char * BIOSScratch;
+ CARD16 BIOSseg;
+ CARD16 inb40time;
+ char *BIOSScratch;
int Flags;
pointer private;
- struct _int10Mem* mem;
+ struct _int10Mem *mem;
int num;
int ax;
int bx;
@@ -45,12 +45,12 @@ typedef struct {
} xf86Int10InfoRec, *xf86Int10InfoPtr;
typedef struct _int10Mem {
- CARD8(*rb)(xf86Int10InfoPtr, int);
- CARD16(*rw)(xf86Int10InfoPtr, int);
- CARD32(*rl)(xf86Int10InfoPtr, int);
- void(*wb)(xf86Int10InfoPtr, int, CARD8);
- void(*ww)(xf86Int10InfoPtr, int, CARD16);
- void(*wl)(xf86Int10InfoPtr, int, CARD32);
+ CARD8 (*rb) (xf86Int10InfoPtr, int);
+ CARD16 (*rw) (xf86Int10InfoPtr, int);
+ CARD32 (*rl) (xf86Int10InfoPtr, int);
+ void (*wb) (xf86Int10InfoPtr, int, CARD8);
+ void (*ww) (xf86Int10InfoPtr, int, CARD16);
+ void (*wl) (xf86Int10InfoPtr, int, CARD32);
} int10MemRec, *int10MemPtr;
typedef struct {
@@ -59,16 +59,16 @@ typedef struct {
CARD8 save_vse;
CARD8 save_46e8;
} legacyVGARec, *legacyVGAPtr;
-
+
/* OS dependent functions */
extern _X_EXPORT xf86Int10InfoPtr xf86InitInt10(int entityIndex);
extern _X_EXPORT xf86Int10InfoPtr xf86ExtendedInitInt10(int entityIndex,
- int Flags);
+ int Flags);
extern _X_EXPORT void xf86FreeInt10(xf86Int10InfoPtr pInt);
extern _X_EXPORT void *xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num,
- int *off);
+ int *off);
extern _X_EXPORT void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase,
- int num);
+ int num);
extern _X_EXPORT pointer xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr);
/* x86 executor related functions */
@@ -81,7 +81,7 @@ extern _X_EXPORT void xf86ExecX86int10(xf86Int10InfoPtr pInt);
#define SYS_BIOS 0xF0000
#if 1
#define BIOS_SIZE 0x10000
-#else /* a bug in DGUX requires this - let's try it */
+#else /* a bug in DGUX requires this - let's try it */
#define BIOS_SIZE (0x10000 - 1)
#endif
#define LOW_PAGE_SIZE 0x600
@@ -103,8 +103,8 @@ extern _X_EXPORT void xf86ExecX86int10(xf86Int10InfoPtr pInt);
#define X86_NT_MASK 0x00004000
#define X86_VM_MASK 0x00020000
#define X86_AC_MASK 0x00040000
-#define X86_VIF_MASK 0x00080000 /* virtual interrupt flag */
-#define X86_VIP_MASK 0x00100000 /* virtual interrupt pending */
+#define X86_VIF_MASK 0x00080000 /* virtual interrupt flag */
+#define X86_VIP_MASK 0x00100000 /* virtual interrupt pending */
#define X86_ID_MASK 0x00200000
#define MEM_RB(name, addr) (*name->mem->rb)(name, addr)
@@ -116,6 +116,7 @@ extern _X_EXPORT void xf86ExecX86int10(xf86Int10InfoPtr pInt);
/* OS dependent functions */
extern _X_EXPORT Bool MapCurrentInt10(xf86Int10InfoPtr pInt);
+
/* x86 executor related functions */
extern _X_EXPORT Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt);
@@ -135,21 +136,23 @@ void stack_trace(xf86Int10InfoPtr pInt);
CARD8 bios_checksum(const CARD8 *start, int size);
void LockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga);
void UnlockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga);
+
#if defined (_PC)
-extern _X_EXPORT void xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt, Bool save);
+extern _X_EXPORT void xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt,
+ Bool save);
#endif
int port_rep_inb(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count);
+ CARD16 port, CARD32 base, int d_f, CARD32 count);
int port_rep_inw(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count);
+ CARD16 port, CARD32 base, int d_f, CARD32 count);
int port_rep_inl(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count);
+ CARD16 port, CARD32 base, int d_f, CARD32 count);
int port_rep_outb(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count);
+ CARD16 port, CARD32 base, int d_f, CARD32 count);
int port_rep_outw(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count);
+ CARD16 port, CARD32 base, int d_f, CARD32 count);
int port_rep_outl(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count);
+ CARD16 port, CARD32 base, int d_f, CARD32 count);
CARD8 x_inb(CARD16 port);
CARD16 x_inw(CARD16 port);
@@ -170,16 +173,19 @@ void setup_int_vect(xf86Int10InfoPtr pInt);
int setup_system_bios(void *base_addr);
void reset_int_vect(xf86Int10InfoPtr pInt);
void set_return_trap(xf86Int10InfoPtr pInt);
-extern _X_EXPORT void * xf86HandleInt10Options(ScrnInfoPtr pScrn, int entityIndex);
-Bool int10skip(const void* options);
+extern _X_EXPORT void *xf86HandleInt10Options(ScrnInfoPtr pScrn,
+ int entityIndex);
+Bool int10skip(const void *options);
Bool int10_check_bios(int scrnIndex, int codeSeg,
- const unsigned char* vbiosMem);
-Bool initPrimary(const void* options);
-extern _X_EXPORT BusType xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt);
-extern _X_EXPORT Bool xf86int10GetBiosSegment(xf86Int10InfoPtr pInt, void *base);
+ const unsigned char *vbiosMem);
+Bool initPrimary(const void *options);
+extern _X_EXPORT BusType xf86int10GetBiosLocationType(const xf86Int10InfoPtr
+ pInt);
+extern _X_EXPORT Bool xf86int10GetBiosSegment(xf86Int10InfoPtr pInt,
+ void *base);
#ifdef DEBUG
void dprint(unsigned long start, unsigned long size);
#endif
-#endif /* _INT10_PRIVATE */
-#endif /* _XF86INT10_H */
+#endif /* _INT10_PRIVATE */
+#endif /* _XF86INT10_H */
diff --git a/xorg-server/hw/xfree86/int10/xf86int10module.c b/xorg-server/hw/xfree86/int10/xf86int10module.c
index 52bf0eeb1..1eb5a0783 100644
--- a/xorg-server/hw/xfree86/int10/xf86int10module.c
+++ b/xorg-server/hw/xfree86/int10/xf86int10module.c
@@ -1,43 +1,32 @@
-/*
- * XFree86 int10 module
- * execute BIOS int 10h calls in x86 real mode environment
- * Copyright 1999 Egbert Eich
- */
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86str.h"
-#include "xf86Pci.h"
-#include "xf86int10.h"
-
-#ifndef MOD_NAME
-# define MOD_NAME int10
-#endif
-
-#define stringify(x) #x
-#define STRING(x) stringify(x)
-#define concat(x,y) x ## y
-#define combine(a,b) concat(a,b)
-#define NAME(x) combine(MOD_NAME,x)
-
-static XF86ModuleVersionInfo NAME(VersRec) =
-{
- STRING(NAME( )),
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_VIDEODRV, /* needs the video driver ABI */
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
-};
-
-_X_EXPORT XF86ModuleData NAME(ModuleData) = {
- &NAME(VersRec),
- NULL,
- NULL
-};
+/*
+ * XFree86 int10 module
+ * execute BIOS int 10h calls in x86 real mode environment
+ * Copyright 1999 Egbert Eich
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86str.h"
+#include "xf86Pci.h"
+#include "xf86int10.h"
+
+#ifndef MOD_NAME
+#define MOD_NAME int10
+#endif
+
+#define stringify(x) #x
+#define STRING(x) stringify(x)
+#define concat(x,y) x ## y
+#define combine(a,b) concat(a,b)
+#define NAME(x) combine(MOD_NAME,x)
+
+static XF86ModuleVersionInfo NAME(VersRec) = {
+ STRING(NAME()), MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, XORG_VERSION_CURRENT, 1, 0, 0, ABI_CLASS_VIDEODRV, /* needs the video driver ABI */
+ ABI_VIDEODRV_VERSION, MOD_CLASS_NONE, {
+ 0, 0, 0, 0}
+};
+
+_X_EXPORT XF86ModuleData NAME(ModuleData) = {
+&NAME(VersRec), NULL, NULL};