[PATCH] int10: Delete unused "_PC" variant methods.

Jeremy Huddleston jeremyhu at apple.com
Tue Sep 13 16:17:56 PDT 2011


Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

On Sep 13, 2011, at 5:36 PM, Jamey Sharp wrote:

> I can't find any evidence that _PC has ever been defined.
> 
> Patch created by fixing the documentation that referenced _PC, and
> running:
> 
> 	for f in `git grep -Fwl _PC -- '*.[ch]'`; do
> 		unifdef -U_PC -B $f | sponge $f;
> 	done
> 
> Signed-off-by: Jamey Sharp <jamey at minilop.net>
> Cc: Tomas Carnecky <tom at dbservice.com>
> ---
> Tomas, you're the last person who touched anything _PC-related, and it
> looks like you were building with _PC defined, so perhaps you could
> comment on where this symbol comes from?
> 
> hw/xfree86/int10/INT10.HOWTO              |    6 +--
> hw/xfree86/int10/generic.c                |   85 -----------------------------
> hw/xfree86/int10/helper_exec.c            |   64 ----------------------
> hw/xfree86/int10/helper_mem.c             |    2 -
> hw/xfree86/int10/xf86int10.c              |    6 --
> hw/xfree86/int10/xf86int10.h              |    3 -
> hw/xfree86/os-support/linux/int10/linux.c |    9 ---
> 7 files changed, 1 insertions(+), 174 deletions(-)
> 
> diff --git a/hw/xfree86/int10/INT10.HOWTO b/hw/xfree86/int10/INT10.HOWTO
> index e2154c1..7f734fc 100644
> --- a/hw/xfree86/int10/INT10.HOWTO
> +++ b/hw/xfree86/int10/INT10.HOWTO
> @@ -121,10 +121,6 @@ IPC to  map the  appropriate real  mode memory image  to address  0 in
> virtual  address  space  just  prior  to execution  may  be  found  in
> xfree86/os-support/linux/int10/linux.c.
> 
> -On  non-PC like  platforms emulation  of certain  PC features  such as
> -initialization of  BIOS int vectors, sys_BIOS constants  or PCI config
> -method 1 can be turned on by defining _PC.
> -
> I. Setup Code
> -------------
> 
> @@ -316,7 +312,7 @@ is provided. The use should be self explanatory.
> 
> Register  and memory  access functions  are provided  in helper_mem.c.
> The PIO register access functions  can trap access to PCI config space
> -access register (config method 1) if _PC is not defined.
> +access register (config method 1).
> 
> A header  file 'defines.h' is required to  define OS/emulator specific
> ways  to access  memory and  xf86 CPU  registers: Defines  need  to be
> diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c
> index fe8bb69..77eb917 100644
> --- a/hw/xfree86/int10/generic.c
> +++ b/hw/xfree86/int10/generic.c
> @@ -55,10 +55,6 @@ 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())
> -#endif
> 
> static void *sysMem = NULL;
> 
> @@ -75,7 +71,6 @@ static void *sysMem = NULL;
>  * etc.).  How do we know that \c pci_device_read_rom will return the
>  * legacy VGA BIOS image?
>  */
> -#ifndef _PC
> static int
> read_legacy_video_BIOS(struct pci_device *dev, unsigned char *Buf)
> {
> @@ -115,7 +110,6 @@ read_legacy_video_BIOS(struct pci_device *dev, unsigned char *Buf)
> 
>     return Len;
> }
> -#endif /* _PC */
> 
> 
> xf86Int10InfoPtr
> @@ -161,76 +155,6 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
>      * registers into this range.
>      */
>     MapVRam(pInt);
> -#ifdef _PC
> -    if (!sysMem)
> -	sysMem = xf86MapVidMem(screen, VIDMEM_MMIO, V_BIOS,
> -			       BIOS_SIZE + SYS_BIOS - V_BIOS);
> -    INTPriv(pInt)->sysMem = sysMem;
> -
> -    if (xf86ReadBIOS(0, 0, base, LOW_PAGE_SIZE) < 0) {
> -	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.  Note that xf86ReadBIOS() can only read in
> -     * 64kB at a time.
> -     */
> -    memset((char *)base + V_BIOS, 0, SYS_BIOS - V_BIOS);
> -#if 0
> -    for (cs = V_BIOS;  cs < SYS_BIOS;  cs += V_BIOS_SIZE)
> -	if (xf86ReadBIOS(cs, 0, (unsigned char *)base + cs, V_BIOS_SIZE) <
> -		V_BIOS_SIZE)
> -	    xf86DrvMsg(screen, X_WARNING,
> -		       "Unable to retrieve all of segment 0x%06X.\n", cs);
> -#endif
> -    INTPriv(pInt)->highMemory = V_BIOS;
> -    
> -    if (xf86IsEntityPrimary(entityIndex) && !(initPrimary(options))) {
> -	if (!xf86int10GetBiosSegment(pInt, (unsigned char *)sysMem - V_BIOS))
> -	    goto error1;
> -
> -	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);
> -	
> -    } 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);
> -    }
> -#else
>     if (!sysMem) {
> 	sysMem = xnfalloc(BIOS_SIZE);
> 	setup_system_bios(sysMem);
> @@ -284,7 +208,6 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
>     LockLegacyVGA(pInt, &vga);
>     xf86ExecX86int10(pInt);
>     UnlockLegacyVGA(pInt, &vga);
> -#endif
>     free(options);
>     return pInt;
> 
> @@ -334,9 +257,6 @@ xf86FreeInt10(xf86Int10InfoPtr pInt)
> {
>     if (!pInt)
>       return;
> -#if defined (_PC)
> -    xf86Int10SaveRestoreBIOSVars(pInt, FALSE);
> -#endif
>     if (Int10Current == pInt)
> 	Int10Current = NULL;
>     free(INTPriv(pInt)->base);
> @@ -386,13 +306,8 @@ xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
> }
> 
> #define OFF(addr) ((addr) & 0xffff)
> -#if defined _PC
> -# define HIGH_OFFSET (INTPriv(pInt)->highMemory)
> -# define HIGH_BASE   V_BIOS
> -#else
> # define HIGH_OFFSET SYS_BIOS
> # define HIGH_BASE   SYS_BIOS
> -#endif
> # define SYS(addr) ((addr) >= HIGH_OFFSET)
> #define V_ADDR(addr) \
> 	  (SYS(addr) ? ((char*)INTPriv(pInt)->sysMem) + (addr - HIGH_BASE) \
> diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c
> index ec84200..c4e6d0b 100644
> --- a/hw/xfree86/int10/helper_exec.c
> +++ b/hw/xfree86/int10/helper_exec.c
> @@ -43,9 +43,6 @@ 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
> 
> #define REG pInt
> 
> @@ -71,10 +68,6 @@ setup_int(xf86Int10InfoPtr pInt)
>     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);
> -#endif
>     OsBlockSignals();
>     return 0;
> }
> @@ -92,10 +85,6 @@ finish_int(xf86Int10InfoPtr pInt, int sig)
>     pInt->es = (CARD16) X86_ES;
>     pInt->bp = (CARD32) X86_EBP;
>     pInt->flags = (CARD32) X86_FLAGS;
> -#if defined (_PC)
> -    if (pInt->Flags & RESTORE_BIOS_SCRATCH)
> -	SetResetBIOSVars(pInt, FALSE);
> -#endif
> }
> 
> /* general software interrupt handler */
> @@ -116,7 +105,6 @@ 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 ?*/
> 
> @@ -137,7 +125,6 @@ run_bios_int(int num, xf86Int10InfoPtr pInt)
> 	    return 1;
> 	}
>     }
> -#endif
> #ifdef PRINT_INT
>     ErrorF("calling card BIOS at: ");
> #endif
> @@ -675,57 +662,6 @@ UnlockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga)
>     outb(pInt->ioBase + 0x03C2, vga->save_msr);
> }
> 
> -#if defined (_PC)
> -static void
> -SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set)
> -{
> -    int pagesize = getpagesize();
> -    unsigned char* base = xf86MapVidMem(pInt->scrnIndex,
> -					VIDMEM_MMIO, 0, pagesize);
> -    int i;
> -
> -    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);
> -    }
> -    
> -    xf86UnMapVidMem(pInt->scrnIndex,base,pagesize);
> -}
> -
> -void
> -xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt, Bool save)
> -{
> -    int pagesize = getpagesize();
> -    unsigned char* base;
> -    int i;
> -
> -    if (!xf86IsEntityPrimary(pInt->entityIndex)
> -	|| (!save && !pInt->BIOSScratch))
> -	return;
> -    
> -    base = xf86MapVidMem(pInt->scrnIndex, VIDMEM_MMIO, 0, pagesize);
> -    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;
> -	}
> -    }
> -    
> -    xf86UnMapVidMem(pInt->scrnIndex,base - BIOS_SCRATCH_OFF ,pagesize);
> -}
> -#endif
> -
> xf86Int10InfoPtr
> xf86InitInt10(int entityIndex)
> {
> diff --git a/hw/xfree86/int10/helper_mem.c b/hw/xfree86/int10/helper_mem.c
> index 496c9a5..eb06307 100644
> --- a/hw/xfree86/int10/helper_mem.c
> +++ b/hw/xfree86/int10/helper_mem.c
> @@ -56,7 +56,6 @@ dprint(unsigned long start, unsigned long size)
> }
> #endif
> 
> -#ifndef _PC
> /*
>  * here we are really paranoid about faking a "real"
>  * BIOS. Most of this information was pulled from
> @@ -103,7 +102,6 @@ setup_int_vect(xf86Int10InfoPtr pInt)
>     MEM_WB(pInt, 0x0410, i);
>     /* XXX Perhaps setup more of the BDA here.  See also int42(0x00). */
> }
> -#endif
> 
> int
> setup_system_bios(void *base_addr)
> diff --git a/hw/xfree86/int10/xf86int10.c b/hw/xfree86/int10/xf86int10.c
> index 51eb91f..cfcaecb 100644
> --- a/hw/xfree86/int10/xf86int10.c
> +++ b/hw/xfree86/int10/xf86int10.c
> @@ -20,9 +20,7 @@
> 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 );
> @@ -34,14 +32,12 @@ int_handler(xf86Int10InfoPtr pInt)
>     int ret = 0;
> 
>     switch (num) {
> -#ifndef _PC
>     case 0x10:
>     case 0x42:
>     case 0x6D:
> 	if (getIntVect(pInt, num) == I_S_DEFAULT_INT_VECT)
> 	    ret = int42_handler(pInt);
> 	break;
> -#endif
>     case 0x1A:
> 	ret = int1A_handler(pInt);
> 	break;
> @@ -65,7 +61,6 @@ int_handler(xf86Int10InfoPtr pInt)
>     return ret;
> }
> 
> -#ifndef _PC
> /*
>  * This is derived from a number of PC system BIOS'es.  The intent here is to
>  * provide very primitive video support, before an EGA/VGA BIOS installs its
> @@ -587,7 +582,6 @@ int42_handler(xf86Int10InfoPtr pInt)
> 
>     return 1;
> }
> -#endif
> 
> #define SUCCESSFUL              0x00
> #define DEVICE_NOT_FOUND        0x86
> diff --git a/hw/xfree86/int10/xf86int10.h b/hw/xfree86/int10/xf86int10.h
> index ba9ee52..2848f0f 100644
> --- a/hw/xfree86/int10/xf86int10.h
> +++ b/hw/xfree86/int10/xf86int10.h
> @@ -135,9 +135,6 @@ 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);
> -#endif
> int port_rep_inb(xf86Int10InfoPtr pInt,
> 		 CARD16 port, CARD32 base, int d_f, CARD32 count);
> int port_rep_inw(xf86Int10InfoPtr pInt,
> diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c
> index 2965b37..a983cb5 100644
> --- a/hw/xfree86/os-support/linux/int10/linux.c
> +++ b/hw/xfree86/os-support/linux/int10/linux.c
> @@ -246,12 +246,6 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
> 	    goto error3;
> 
> 	set_return_trap(pInt);
> -#ifdef _PC	
> -	pInt->Flags = Flags & (SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH);
> -	if (! (pInt->Flags & SET_BIOS_SCRATCH))
> -	    pInt->Flags &= ~RESTORE_BIOS_SCRATCH;
> -  	xf86Int10SaveRestoreBIOSVars(pInt, TRUE);
> -#endif
>     } else {
> 	const BusType location_type = xf86int10GetBiosLocationType(pInt);
> 
> @@ -381,9 +375,6 @@ xf86FreeInt10(xf86Int10InfoPtr pInt)
>     if (!pInt)
> 	return;
> 
> -#ifdef _PC
> -    xf86Int10SaveRestoreBIOSVars(pInt, FALSE); 
> -#endif
>     if (Int10Current == pInt) {
> 	shmdt(0);
> 	if (((linuxInt10Priv*)pInt->private)->highMem >= 0)
> -- 
> 1.7.5.4
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 

---
Jeremy Huddleston

Rebuild Sudan
 - Board of Directors
 - http://www.rebuildsudan.org

Berkeley Foundation for Opportunities in Information Technology
 - Advisory Board
 - http://www.bfoit.org



More information about the xorg-devel mailing list