summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-08-20 16:41:18 -0700
committerEric Anholt <eric@anholt.net>2007-09-04 18:04:57 -0700
commit65e357db17a8a45b90a4af92d5765aefda80c00c (patch)
treebb36efeba3d830efc5d102717c85f8fbaa4983c1
parentb4703cb8a5eab9aa88f40484b15c122cb869569b (diff)
Bug #9588: Fix build after XFree86Server unifdef by removing HAL junk.
This is untested beyond building, but no maintainer could be found.
-rw-r--r--src/durango.c265
-rw-r--r--src/panel.c19
-rw-r--r--src/panel/panel.c19
-rw-r--r--src/panel/platform.c366
4 files changed, 0 insertions, 669 deletions
diff --git a/src/durango.c b/src/durango.c
index 690824f..12f3b46 100644
--- a/src/durango.c
+++ b/src/durango.c
@@ -311,221 +311,6 @@ unsigned char *gfx_phys_vipptr = (unsigned char *)0x40015000;
* routines will work properly.
*/
-#if defined(OS_WIN32) /* For Windows */
-
-/* VSA II CALL */
-
-void
-gfx_msr_asm_read(unsigned short msrReg, unsigned long msrAddr,
- unsigned long *ptrHigh, unsigned long *ptrLow)
-{
- unsigned long temp1, temp2;
-
- _asm {
- mov dx, 0x0AC1C
- mov eax, 0x0FC530007
- out dx, eax
- add dl, 2
- mov ecx, msrAddr
- mov cx, msrReg
- in ax, dx;
- ;EDX:EAX will contain MSR contents.
- mov temp1, edx
- mov temp2, eax
- }
-
- *ptrHigh = temp1;
- *ptrLow = temp2;
-}
-
-void
-gfx_msr_asm_write(unsigned short msrReg, unsigned long msrAddr,
- unsigned long *ptrHigh, unsigned long *ptrLow)
-{
- unsigned long temp1 = *ptrHigh;
- unsigned long temp2 = *ptrLow;
-
- _asm {
- mov dx, 0x0AC1C
- mov eax, 0x0FC530007
- out dx, eax i
- add dl, 2
- ;ECX contains msrAddr | msrReg
- mov ecx, msrAddr
- mov cx, msrReg
- ;<OR_mask_hi >
- mov ebx, temp1
-
- ;<OR_mask_hi >
- mov eax, temp2
- ;<AND_mask_hi >
- mov esi, 0
- ;<AND_mask_lo >
- mov edi, 0
- ;MSR is written at this point
- out dx, ax
- }
-}
-
-unsigned char
-gfx_inb(unsigned short port)
-{
- unsigned char data;
-
- _asm {
- pushf
- mov dx, port
- in al, dx
- mov data, al
- popf
- }
- return (data);
-}
-
-unsigned short
-gfx_inw(unsigned short port)
-{
- unsigned short data;
-
- _asm {
- pushf
- mov dx, port
- in ax, dx
- mov data, ax
- popf
- }
- return (data);
-}
-
-unsigned long
-gfx_ind(unsigned short port)
-{
- unsigned long data;
-
- _asm {
- pushf
- mov dx, port
- in eax, dx
- mov data, eax
- popf
- }
- return (data);
-}
-
-void
-gfx_outb(unsigned short port, unsigned char data)
-{
- _asm {
- pushf
- mov al, data
- mov dx, port
- out dx, al
- popf
- }
-}
-
-void
-gfx_outw(unsigned short port, unsigned short data)
-{
- _asm {
- pushf
- mov ax, data
- mov dx, port
- out dx, ax
- popf
- }
-}
-
-void
-gfx_outd(unsigned short port, unsigned long data)
-{
- _asm {
- pushf
- mov eax, data
- mov dx, port
- out dx, eax
- popf
- }
-}
-
-#elif defined(OS_VXWORKS) || defined (OS_LINUX) /* VxWorks and Linux */
-
-extern unsigned long nsc_asm_msr_vsa_rd(unsigned long, unsigned long *,
- unsigned long *);
-extern unsigned long nsc_asm_msr_vsa_wr(unsigned long, unsigned long,
- unsigned long);
-
-void
-gfx_msr_asm_read(unsigned short msrReg, unsigned long msrAddr,
- unsigned long *ptrHigh, unsigned long *ptrLow)
-{
- unsigned long addr, val1, val2;
-
- addr = msrAddr | (unsigned long)msrReg;
- nsc_asm_msr_vsa_rd(addr, &val2, &val1);
- *ptrHigh = val2;
- *ptrLow = val1;
-}
-
-void
-gfx_msr_asm_write(unsigned short msrReg, unsigned long msrAddr,
- unsigned long *ptrHigh, unsigned long *ptrLow)
-{
- unsigned long addr, val1, val2;
-
- val2 = *ptrHigh;
- val1 = *ptrLow;
- addr = (msrAddr & 0xFFFF0000) | (unsigned long)msrReg;
- nsc_asm_msr_vsa_wr(addr, val2, val1);
-}
-
-unsigned char
-gfx_inb(unsigned short port)
-{
- unsigned char value;
- __asm__ volatile ("inb %1,%0":"=a" (value):"d"(port));
-
- return value;
-}
-
-unsigned short
-gfx_inw(unsigned short port)
-{
- unsigned short value;
- __asm__ volatile ("in %1,%0":"=a" (value):"d"(port));
-
- return value;
-}
-
-unsigned long
-gfx_ind(unsigned short port)
-{
- unsigned long value;
- __asm__ volatile ("inl %1,%0":"=a" (value):"d"(port));
-
- return value;
-}
-
-void
-gfx_outb(unsigned short port, unsigned char data)
-{
- __asm__ volatile ("outb %0,%1"::"a" (data), "d"(port));
-}
-
-void
-gfx_outw(unsigned short port, unsigned short data)
-{
- __asm__ volatile ("out %0,%1"::"a" (data), "d"(port));
-}
-
-void
-gfx_outd(unsigned short port, unsigned long data)
-{
- __asm__ volatile ("outl %0,%1"::"a" (data), "d"(port));
-}
-
-#elif defined(XFree86Server)
-
#include <compiler.h>
#define INB(port) inb(port)
#define INW(port) inw(port)
@@ -611,56 +396,6 @@ gfx_msr_asm_write(unsigned short msrReg, unsigned long msrAddr,
nsc_asm_msr_vsa_wr(addr, val2, val1);
#endif
}
-#else /* else nothing */
-
-unsigned char
-gfx_inb(unsigned short port)
-{
- /* ADD OS SPECIFIC IMPLEMENTATION */
- return (0);
-}
-
-unsigned short
-gfx_inw(unsigned short port)
-{
- /* ADD OS SPECIFIC IMPLEMENTATION */
- return (0);
-}
-
-unsigned long
-gfx_ind(unsigned short port)
-{
- /* ADD OS SPECIFIC IMPLEMENTATION */
- return (0);
-}
-
-void
-gfx_outb(unsigned short port, unsigned char data)
-{
- /* ADD OS SPECIFIC IMPLEMENTATION */
-}
-
-void
-gfx_outw(unsigned short port, unsigned short data)
-{
- /* ADD OS SPECIFIC IMPLEMENTATION */
-}
-
-void
-gfx_outd(unsigned short port, unsigned long data)
-{
- /* ADD OS SPECIFIC IMPLEMENTATION */
-}
-#endif
-
-#ifndef XFree86Server
-#define INB(port) gfx_inb(port)
-#define INW(port) gfx_inw(port)
-#define IND(port) gfx_ind(port)
-#define OUTB(port, data) gfx_outb(port, data)
-#define OUTW(port, data) gfx_outw(port, data)
-#define OUTD(port, data) gfx_outd(port, data)
-#endif
/* INITIALIZATION ROUTINES
* These routines are used during the initialization of the driver to
diff --git a/src/panel.c b/src/panel.c
index 89a49d7..4bc11e1 100644
--- a/src/panel.c
+++ b/src/panel.c
@@ -144,25 +144,6 @@
#include "config.h"
#endif
-#if defined(linux) /* Linux */
-
-#ifdef __KERNEL__
-
-#include <linux/string.h>
-#include <asm/io.h>
-
-#elif !defined(XFree86Server)
-
-#include <linux/fs.h>
-#include <asm/mman.h>
-
-#endif /* __KERNEL__ */
-#elif defined(_WIN32) /* windows */
-
-#include <windows.h>
-
-#endif
-
#include "panel.h"
#include "gfx_defs.h"
#include "nsc.h"
diff --git a/src/panel/panel.c b/src/panel/panel.c
index 5880974..1349d31 100644
--- a/src/panel/panel.c
+++ b/src/panel/panel.c
@@ -139,25 +139,6 @@
*
* END_NSC_LIC_GPL */
-#if defined(linux) /* Linux */
-
-#ifdef __KERNEL__
-
-#include <linux/string.h>
-#include <asm/io.h>
-
-#elif !defined(XFree86Server)
-
-#include <linux/fs.h>
-#include <asm/mman.h>
-
-#endif /* __KERNEL__ */
-#elif defined(_WIN32) /* windows */
-
-#include <windows.h>
-
-#endif
-
#include "panel.h"
#include "gfx_defs.h"
diff --git a/src/panel/platform.c b/src/panel/platform.c
index 94707c1..68c64d2 100644
--- a/src/panel/platform.c
+++ b/src/panel/platform.c
@@ -191,26 +191,10 @@ SYS_BOARD_INFO *Sys_board_array_base = Sys_board_info_array;
int FindStringInSeg(unsigned int, char *);
static unsigned char get_sys_board_type(SYS_BOARD_INFO *, SYS_BOARD_INFO *);
-#if defined(linux) && !defined(__KERNEL__)
-#if !defined(XFree86Server)
-static void platform_protected_mode_access(unsigned int, unsigned int,
- unsigned long, unsigned char *);
-static void setup_pma();
-static void close_pma();
-static int fd;
-#endif /* IN_MODULE */
-#endif /* __KERNEL__ */
-
/* Detect the Platform */
int
Detect_Platform(void)
{
-#if defined(linux) && !defined(__KERNEL__)
-#if !defined(XFree86Server)
- setup_pma();
-#endif /* IN_MODULE */
-#endif /* __KERNEL__ */
-
/* See if we can find the board name using Xpressrom */
if (get_sys_board_type(&Sys_info, Sys_board_array_base) == TRUE) {
#if 0
@@ -223,11 +207,6 @@ Detect_Platform(void)
}
#endif
}
-#if defined(linux) && !defined(__KERNEL__)
-#if !defined(XFree86Server)
- close_pma();
-#endif /* IN_MODULE */
-#endif /* __KERNEL__ */
return (Sys_info.sys_board);
}
@@ -302,25 +281,7 @@ FindStringInSeg(unsigned int segment_address, char *string_ptr)
(void)mem_ptr;
(void)segment_buffer;
-#if defined(linux) && !defined(XFree86Server)
-#ifdef __KERNEL__
- XpressROMPtr = (unsigned char *)ioremap(mem_ptr, SEGMENT_LENGTH + 1);
psegment_buf = (char *)XpressROMPtr;
-#else
- /* Fill the segment_buffer with 16 page accesses */
-
- for (cursor = 0; (cursor * PAGE_LENGTH) < SEGMENT_LENGTH; cursor++) {
- platform_protected_mode_access(PLT_READ_BYTES, PAGE_LENGTH, mem_ptr +
- (cursor * PAGE_LENGTH),
- &(segment_buffer[(cursor * PAGE_LENGTH)]));
- }
- psegment_buf = segment_buffer;
-#endif /* __KERNEL__ */
-#elif defined (XFree86Server)
- psegment_buf = (char *)XpressROMPtr;
-#elif defined(_WIN32) /* Windows */
- psegment_buf = XpressROMPtr;
-#endif
/* Now search for the first character of the string_ptr */
for (i = 0; i < SEGMENT_LENGTH + 1; i++) {
@@ -397,330 +358,3 @@ get_sys_board_type(SYS_BOARD_INFO * sys_info,
Strcpy(sys_info->sys_board_name, "Unknown");
return (FALSE);
} /* end get_sys_board_type() */
-
-#if defined(linux) && !defined(__KERNEL__)
-#if !defined(XFree86Server)
-
-/******************************************************************
- *
- * platform_protected_mode_access( unsigned int mode, unsigned int width,
- * unsigned long addr, unsigned char* pdata )
- * This function provides access to physical memory
- * at the requested address.
- * mode is: PLT_READ or PLT_WRITE (accesses a single byte, word
- * or double word depending on the value of "width".
- * Only 1, 2 or 4 supported).
- * PLT_READ_BYTES, PLT_WRITE_BYTES accesses "width" number
- * of bytes (8 bits)
- * PLT_READ_WORDS, PLT_WRITE_WORDS accesses "width" number
- * of words (16 bits) PLT_READ_DWORDS, PLT_WRITE_DWORDS accesses
- * "width" number of dwords (32 bits)
- * width is: The size of the access.
- * For PLT_READ or PLT_WRITE, only 1, 2 and 4 are
- * supported. For other modes, width is not limited but
- * will cause paging if the block traverses page boundaries.
- * addr is: The physical address being accessed
- * pdata is: A pointer to the data to be read or written into.
- * NOTE! WORD or DWORD accesses can only be made on
- * WORD or DWORD boundaries!
- *
- ******************************************************************
- */
-
-static void
-platform_protected_mode_access(unsigned int mode, unsigned int width,
- unsigned long addr, unsigned char *pdata)
-{
-
-#define PMTRASH 0x12345678L
-
- unsigned long base; /* The physical page address */
- int length = 0x1000; /* the page size is 4k */
- unsigned int offset = 0; /* The physical addr offset into page */
- unsigned int index = 0; /* Used to read/write from/to a block */
- unsigned int chunk = 0; /* The amount to read/wr from THIS block */
- unsigned int size = 0; /* Data size shift value (to avoid math) */
- static void *ptr; /* pointer to real memory location. */
-
- static unsigned long lastbase = PMTRASH;
-
- /* temp storage of previous base used. */
- /* type specific buffer pointers */
- unsigned char *byte_data = (unsigned char *)pdata;
- unsigned int *word_data = (unsigned int *)pdata;
- unsigned long *dword_data = (unsigned long *)pdata;
-
- switch (mode) {
-
- case PLT_READ_WORDS:
- case PLT_WRITE_WORDS:
-
- size = 1;
- break;
-
- case PLT_READ_DWORDS:
- case PLT_WRITE_DWORDS:
-
- size = 2;
- }
-
- /* Check if we're in the user accessable range */
- if (addr < 0xFF000000L) {
-
- /* We get physical memory in "pages", defined by the
- * following "base" address and the "offset" into it.
- * "base" will be used with mmap to get "ptr", which
- * points to the memory mapped actual physical memory at
- * the address pointed-to by "base".
- * "width" and "chunk" are in units of whatever data
- * type we're reading.
- * "length" and "offset" are in units of bytes.
- * "width" and "chunk" must be adjusted with "<<size"
- * to use with "length" or "offset". Similarly, the
- * result must be adjusted with ">>size" to make into the
- * proper type units when done.
- */
- base = addr & 0xFFFFF000L;
- offset = addr & 0x00000FFFL;
- do {
- if ((offset + (width << size)) > length) {
-
- /* Block being read extends beyond the
- * page boundary. Adjust things.
- */
- chunk = (length - offset) >> size;
-
- /* Figure the chunk size */
- width -= chunk;
-
- /* Reduce width by the current chunk */
- } else {
-
- /* Block being read is within the
- * page boundary.
- */
- chunk = width;
- width = 0;
-
- /* set to zero so we'll exit at the end */
-
- }
- /* We keep the page around in case we need to
- * access it again.
- * This saves us some time if we have consecutive
- * accesses.
- */
-
- if (base != lastbase) {
-
- /* we haven't mmap'd this address
- * Have to get a new page. Free the
- * previous page, if it's valid (ie, not
- * PMTRASH). If not, unmap it and get the
- * new page.
- */
- if (lastbase != PMTRASH)
- munmap(ptr, length);
- ptr = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd,
- base);
- if ((int)ptr == -1) {
- lastbase = PMTRASH;
- return; /* error */
- }
- }
-
- /* Now we're ready to get the data.
- * It's pure memory access now, no funny
- * function calls, however we do cast things to get
- * the right size data.
- */
-
- /* Scale the offset for the data type size */
- index = offset >> size;
-
- /* Note that the above line and below lines,
- * which shift "offset", discard address information
- * if you happen to be trying to write, for example,
- * dwords on non-dword boundaries.
- */
- /* Note that cases PLT_READ and PLT_WRITE don't
- * use "index". They shift "offset" on their own.
- * This is because in PLT_READ and PLT_WRITE modes,
- * the information on the size of the data
- * transaction is in the "width" variable not "size".
- * We also need separate cases to cast the values
- * right.
- */
- switch (mode) {
-
- case PLT_READ:{
-
- switch (chunk) {
-
- case FOUR_BYTES:
-
- *(dword_data) = (unsigned long)
- (*(((unsigned long *)ptr) + (offset >> 2)));
- break;
-
- case TWO_BYTES:
-
- *(word_data) = (unsigned int)
- (*(((unsigned int *)ptr) + (offset >> 1)));
- break;
-
- default:
-
- *(byte_data) = (unsigned char)
- (*(((unsigned char *)ptr) + (offset)));
- break;
-
- } /* end switch() */
- break;
-
- } /* end case PLT_READ */
-
- case PLT_WRITE:{
-
- switch (chunk) {
-
- case FOUR_BYTES:
-
- *(((unsigned long *)ptr) + (offset >> 2)) = *dword_data;
- break;
-
- case TWO_BYTES:
-
- *(((unsigned int *)ptr) + (offset >> 1)) = *word_data;
- break;
-
- default:
-
- *(((unsigned char *)ptr) + (offset)) = *byte_data;
- break;
- } /* end switch() */
- break;
-
- } /* end case PLT_WRITE */
-
- case PLT_READ_BYTES:{
-
- for (; chunk > 0; chunk--) {
-
- *(byte_data++) = (unsigned char)(*(((unsigned char *)ptr) +
- (index++)));
- }
- break;
- } /* end case PLT_READ_BYTES */
-
- case PLT_WRITE_BYTES:{
-
- for (; chunk > 0; chunk--) {
- *(((unsigned char *)ptr) + (index++)) = *(byte_data++);
- }
- break;
-
- } /* end case PLT_WRITE_BYTES */
-
- case PLT_READ_WORDS:{
-
- for (; chunk > 0; chunk--) {
-
- *(word_data++) = (unsigned int)
- (*(((unsigned int *)ptr) + (index++)));
- }
- break;
-
- } /* end case PLT_READ_WORDS */
-
- case PLT_WRITE_WORDS:{
-
- for (; chunk > 0; chunk--) {
-
- *(((unsigned int *)ptr) + (index++)) = *(word_data++);
- }
- break;
-
- } /* end case PLT_WRITE_WORDS */
-
- case PLT_READ_DWORDS:{
-
- for (; chunk > 0; chunk--) {
-
- *(dword_data++) = (*(((unsigned long *)ptr) + (index++)));
- }
- break;
-
- } /* end case PLT_READ_DWORDS */
-
- case PLT_WRITE_DWORDS:{
-
- for (; chunk > 0; chunk--) {
-
- *(((unsigned long *)ptr) + (index++))
- = *(dword_data++);
- }
- break;
-
- } /* end case PLT_WRITE_DWORDS */
-
- } /* end switch(mode) */
-
- lastbase = base;
-
- /* Save the page we've just processed. */
-
- if (width) {
-
- /* If there's still width left to get. */
-
- base += length;
- /* Increment to the next page. */
-
- offset = 0;
- /* Set the offset to zero. */
- }
-
- } while (width); /* While there's still data to get. */
- return;
-
- } /* end for if addr */
- else {
-
- printf("PMA error: Unable to read ROM address space\n");
- exit(1);
- }
- return;
-}
-
-/************************************************************************
- * setup_pma() loads the ROM memory access module and initializes
- * memory access file descriptor (access is handled through a file-like
- * interface).
- ************************************************************************
- */
-static void
-setup_pma()
-{
- fd = open("/dev/mem", 2); /* O_RDWR */
- if (fd == -1) {
-
- printf("Error: Unable to open /dev/mem !\a\n");
- exit(1);
- }
- return;
-}
-
-/**********************************************************************
- * close_pma() cleans up the open memory access devices and file
- * descriptors.
- **********************************************************************
- */
-static void
-close_pma()
-{
- close(fd);
- return;
-}
-#endif /* IN_MODULE */
-#endif /* linux && !__KERNEL__ */