From 721b6fcf1bebd07ae00d9dd0a63b7da8a42a8dbb Mon Sep 17 00:00:00 2001 From: sezero Date: Thu, 9 Aug 2018 11:56:56 +0300 Subject: [PATCH] cvg, fxremap: removed all unnecessary stuff, made it to use INIT_OUTPUT --- glide2x/cvg/init/fxremap.c | 227 ++---------------------------------- glide2x/cvg/init/fxremap.h | 2 - glide3x/cvg/init/fxremap.c | 229 ++----------------------------------- glide3x/cvg/init/fxremap.h | 2 - 4 files changed, 20 insertions(+), 440 deletions(-) diff --git a/glide2x/cvg/init/fxremap.c b/glide2x/cvg/init/fxremap.c index 9c8b08e..97e3e04 100644 --- a/glide2x/cvg/init/fxremap.c +++ b/glide2x/cvg/init/fxremap.c @@ -1,22 +1,13 @@ #include #include #include -#ifndef __linux__ -#include -#endif #include <3dfx.h> #include +/* for INIT_PRINTF: */ +#include #define FX_DLL_DEFINITION #include -/*#define FXREMAP_EXE*/ /* cmdline tool */ -#ifdef FXREMAP_EXE -static int silent = 1; -#define FXREMAP_PRINTF(a) if(!silent) printf a -#else -#define FXREMAP_PRINTF(a) -#endif - #define SIZE_SST1_NEEDED 0x100000 #define END_ADDRESS 0x10000000 #define S3_SHIFT 0x400000 @@ -60,29 +51,8 @@ static void HandleMemoryOverlap(void); static FxBool overlap_map(RangeStruct *begin,FxU32 end); #endif -#ifdef FXREMAP_EXE -static void ProcessCommandLine(char **argv,int argc); -static FxBool ReadHex(const char *string,FxU32 *num); -//static FxBool switch_force=FXFALSE; -static FxBool switch_C0_bias=FXTRUE; -static FxBool switch_S3_flag_ignore=FXFALSE; -static int switch_voodoo_loc = 0; -#endif - static FxU32 num_voodoos=0; -//#define TESTING 1 - -#ifdef TESTING -static RangeStruct test_data[6]= - {{0xF0000000,0x100000,1,0,0,0,0}, - {0xF3000000,0x200000,4,1,0,0,0}, - {0xF3000000,0x200000,8,0,0,0,0}, - {0xF5000000,0x200000,2,0,0,0,0}, - {0xE6000000,0x200000,5,0,0,0,0}, - {0xD3001000,0x200000,3,0,0,0,0}}; -#endif - static RangeStruct map[80]; #if 0 /* not used */ static RangeStruct hole[80]; @@ -97,16 +67,11 @@ static void fxremap_dowork(int argc,char **argv,int doit_silently) { RangeStruct *conflict; -#ifdef FXREMAP_EXE - silent = doit_silently; - ProcessCommandLine(argv,argc); -#endif - InitRemap(); if (!FindNecessaryCards()) { - FXREMAP_PRINTF(("No Voodoo chipset was detected\n")); + INIT_PRINTF(("No Voodoo chipset was detected\n")); ForceCleanUp(); } @@ -128,14 +93,14 @@ static void fxremap_dowork(int argc,char **argv,int doit_silently) } else { - FXREMAP_PRINTF(("Unable to find region to map conflicting board\n")); + INIT_PRINTF(("Unable to find region to map conflicting board\n")); ForceCleanUp(); return; } } if (!conflicts_found) { - FXREMAP_PRINTF(("No conflict with the Voodoo cards was found\n")); + INIT_PRINTF(("No conflict with the Voodoo cards was found\n")); } CloseRemap(); } @@ -144,12 +109,6 @@ void fxremap(void) { fxremap_dowork(0,NULL,1); } -#ifdef FXREMAP_EXE -void fxremap_main(int argc,char **argv) { - fxremap_dowork(argc,argv,0); -} -#endif - static void InitRemap(void) { #if !DIRECTX @@ -162,7 +121,7 @@ static void CloseRemap(void) // pciClose(); } -FxU32 pciGetConfigData_R(PciRegister reg, FxU32 devNum) { +static FxU32 pciGetConfigData_R(PciRegister reg, FxU32 devNum) { FxU32 data; if (pciGetConfigData(reg,devNum,&data) == FXTRUE) { @@ -184,14 +143,6 @@ static void GetMemoryMap(void) int maxFnNumber; int multi_fn = 0; -#ifdef TESTING - for (i=0;i<6;i++) - { - temp=test_data[i].address; - temp2=~(test_data[i].range - 0x1); - AddMapEntry(temp,temp2,test_data[i].id,test_data[i].is_voodoo,test_data[i].is_S3); - } -#else for (devNum=0;devNum %X (%X)\n",cur->id, cur->address, cur->next->id, cur->next->address)); } @@ -404,7 +354,7 @@ static void RemoveEntry(RangeStruct *del) { if (!(del->prev)) { - FXREMAP_PRINTF(("FxRemap: No entries mapped\n")); + INIT_PRINTF(("FxRemap: No entries mapped\n")); ForceCleanUp(); return; } @@ -572,11 +522,9 @@ static void RemapVoodoo(RangeStruct *conflict) /* put conflict back into memory map */ InsertEntry(conflict); -#ifndef TESTING address=(conflict->address)<<4; pciSetConfigData(PCI_BASE_ADDRESS_0,conflict->id,&address); -#endif - FXREMAP_PRINTF(("Remapped Voodoo Board to avoid a conflict\n")); + INIT_PRINTF(("Remapped Voodoo Board to avoid a conflict\n")); } static void pciGetRange(PciRegister reg,FxU32 device_number,FxU32 *data) @@ -589,12 +537,6 @@ static void pciGetRange(PciRegister reg,FxU32 device_number,FxU32 *data) pciGetConfigData(reg,device_number,&size); pciSetConfigData(reg,device_number,&save); -#ifdef TESTING - printf("PciGetRange: save %08x \n",save); - printf("PciGetRange: temp %08x \n",temp); - printf("PciGetRange: size %08x \n",size); - printf("PciGetRange: save %08x \n",save); -#endif *data=size; } @@ -635,155 +577,6 @@ static FxBool FindNecessaryCards(void) return FXTRUE; } -#ifdef FXREMAP_EXE -static void ProcessCommandLine(char **argv,int argc) -{ - long i; - FxU32 temp,temp2; - FxU32 address,range; - char *hex_ptr; - - for (i=1;i=0x30)&&(string[i]<0x3A))||((string[i]>=0x41)&&(string[i]<0x47))||((string[i]>=0x61)&&(string[i]<0x67))) - { - if ((string[i]>=0x30)&&(string[i]<0x3A)) - temp2=string[i] - 0x30; - else if ((string[i]>=0x41)&&(string[i]<0x47)) - temp2=string[i] - 0x37; - else if ((string[i]>=0x61)&&(string[i]<0x67)) - temp2=string[i] - 0x57; - if (num_count!=0) - temp=(temp<<4)+temp2; - else if (num_count<8) - temp=temp2; - else - return FXFALSE; - num_count++;i++; - } - *num=temp; - return FXTRUE; -} -#endif /* FXREMAP_EXE */ - static FxU32 pciGetType(long i) { FxU32 header_type; @@ -812,7 +605,7 @@ static FxBool IsCardVoodoo(long i) return FXTRUE; /* if voodoo2 */ if ((vendor==0x121a)&&(dev_id==0x0002)) { - if (true_val == 2) { FXREMAP_PRINTF(("found voodoo2 hidden sli\n")); } + if (true_val == 2) { INIT_PRINTF(("found voodoo2 hidden sli\n")); } return true_val; } /* if banshee */ diff --git a/glide2x/cvg/init/fxremap.h b/glide2x/cvg/init/fxremap.h index bbd5d03..892b14b 100644 --- a/glide2x/cvg/init/fxremap.h +++ b/glide2x/cvg/init/fxremap.h @@ -4,11 +4,9 @@ * pci remapper, used to remap the single board SLI slave to a valid * PCI address */ - #ifndef _FXREMAP_H_ #define _FXREMAP_H_ void fxremap(void); -int fxremap_main(int argc, char **argv); #endif diff --git a/glide3x/cvg/init/fxremap.c b/glide3x/cvg/init/fxremap.c index 27d7712..b0de751 100644 --- a/glide3x/cvg/init/fxremap.c +++ b/glide3x/cvg/init/fxremap.c @@ -1,22 +1,13 @@ #include #include #include -#ifndef __linux__ -#include -#endif #include <3dfx.h> #include +/* for INIT_PRINTF: */ +#include #define FX_DLL_DEFINITION #include -/*#define FXREMAP_EXE*/ /* cmdline tool */ -#ifdef FXREMAP_EXE -static int silent = 1; -#define FXREMAP_PRINTF(a) if(!silent) printf a -#else -#define FXREMAP_PRINTF(a) -#endif - #define SIZE_SST1_NEEDED 0x100000 #define END_ADDRESS 0x10000000 #define S3_SHIFT 0x400000 @@ -60,29 +51,8 @@ static void HandleMemoryOverlap(void); static FxBool overlap_map(RangeStruct *begin,FxU32 end); #endif -#ifdef FXREMAP_EXE -static void ProcessCommandLine(char **argv,int argc); -static FxBool ReadHex(const char *string,FxU32 *num); -//static FxBool switch_force=FXFALSE; -static FxBool switch_C0_bias=FXTRUE; -static FxBool switch_S3_flag_ignore=FXFALSE; -static int switch_voodoo_loc = 0; -#endif - static FxU32 num_voodoos=0; -//#define TESTING 1 - -#ifdef TESTING -static RangeStruct test_data[6]= - {{0xF0000000,0x100000,1,0,0,0,0}, - {0xF3000000,0x200000,4,1,0,0,0}, - {0xF3000000,0x200000,8,0,0,0,0}, - {0xF5000000,0x200000,2,0,0,0,0}, - {0xE6000000,0x200000,5,0,0,0,0}, - {0xD3001000,0x200000,3,0,0,0,0}}; -#endif - static RangeStruct map[80]; #if 0 /* not used */ static RangeStruct hole[80]; @@ -97,16 +67,11 @@ static void fxremap_dowork(int argc,char **argv,int doit_silently) { RangeStruct *conflict; -#ifdef FXREMAP_EXE - silent = doit_silently; - ProcessCommandLine(argv,argc); -#endif - InitRemap(); if (!FindNecessaryCards()) { - FXREMAP_PRINTF(("No Voodoo chipset was detected\n")); + INIT_PRINTF(("No Voodoo chipset was detected\n")); ForceCleanUp(); } @@ -128,14 +93,14 @@ static void fxremap_dowork(int argc,char **argv,int doit_silently) } else { - FXREMAP_PRINTF(("Unable to find region to map conflicting board\n")); + INIT_PRINTF(("Unable to find region to map conflicting board\n")); ForceCleanUp(); return; } } if (!conflicts_found) { - FXREMAP_PRINTF(("No conflict with the Voodoo cards was found\n")); + INIT_PRINTF(("No conflict with the Voodoo cards was found\n")); } CloseRemap(); } @@ -144,12 +109,6 @@ void fxremap(void) { fxremap_dowork(0,NULL,1); } -#ifdef FXREMAP_EXE -void fxremap_main(int argc,char **argv) { - fxremap_dowork(argc,argv,0); -} -#endif - static void InitRemap(void) { #if !DIRECTX @@ -162,7 +121,7 @@ static void CloseRemap(void) // pciClose(); } -FxU32 pciGetConfigData_R(PciRegister reg, FxU32 devNum) { +static FxU32 pciGetConfigData_R(PciRegister reg, FxU32 devNum) { FxU32 data; if (pciGetConfigData(reg,devNum,&data) == FXTRUE) { @@ -184,14 +143,6 @@ static void GetMemoryMap(void) int maxFnNumber; int multi_fn = 0; -#ifdef TESTING - for (i=0;i<6;i++) - { - temp=test_data[i].address; - temp2=~(test_data[i].range - 0x1); - AddMapEntry(temp,temp2,test_data[i].id,test_data[i].is_voodoo,test_data[i].is_S3); - } -#else for (devNum=0;devNum %X (%X)\n",cur->id, cur->address, cur->next->id, cur->next->address)); } @@ -404,7 +354,7 @@ static void RemoveEntry(RangeStruct *del) { if (!(del->prev)) { - FXREMAP_PRINTF(("FxRemap: No entries mapped\n")); + INIT_PRINTF(("FxRemap: No entries mapped\n")); ForceCleanUp(); return; } @@ -574,11 +524,9 @@ static void RemapVoodoo(RangeStruct *conflict) /* put conflict back into memory map */ InsertEntry(conflict); -#ifndef TESTING address=(conflict->address)<<4; pciSetConfigData(PCI_BASE_ADDRESS_0,conflict->id,&address); -#endif - FXREMAP_PRINTF(("Remapped Voodoo Board to avoid a conflict\n")); + INIT_PRINTF(("Remapped Voodoo Board to avoid a conflict\n")); } static void pciGetRange(PciRegister reg,FxU32 device_number,FxU32 *data) @@ -591,12 +539,6 @@ static void pciGetRange(PciRegister reg,FxU32 device_number,FxU32 *data) pciGetConfigData(reg,device_number,&size); pciSetConfigData(reg,device_number,&save); -#ifdef TESTING - printf("PciGetRange: save %08x \n",save); - printf("PciGetRange: temp %08x \n",temp); - printf("PciGetRange: size %08x \n",size); - printf("PciGetRange: save %08x \n",save); -#endif *data=size; } @@ -637,157 +579,6 @@ static FxBool FindNecessaryCards(void) return FXTRUE; } -#ifdef FXREMAP_EXE -static void ProcessCommandLine(char **argv,int argc) -{ - int i; - FxU32 temp,temp2; - FxU32 address,range; - char *hex_ptr; - - for (i=1;i=0x30)&&(string[i]<0x3A))||((string[i]>=0x41)&&(string[i]<0x47))||((string[i]>=0x61)&&(string[i]<0x67))) - { - if ((string[i]>='0')&&(string[i]<='9')) - temp2=string[i] - '0'; - else if ((string[i]>='A')&&(string[i]<='F')) - temp2=10 + string[i] - 'A'; - else if ((string[i]>='a')&&(string[i]<='f')) - temp2=10 + string[i] - 'a'; - else - return FXFALSE; - if (num_count!=0) - temp=(temp<<4)+temp2; - else if (num_count<8) - temp=temp2; - else - return FXFALSE; - num_count++;i++; - } - *num=temp; - return FXTRUE; -} -#endif /* FXREMAP_EXE */ - static FxU32 pciGetType(int i) { FxU32 header_type; @@ -816,7 +607,7 @@ static FxBool IsCardVoodoo(int i) return FXTRUE; /* if voodoo2 */ if ((vendor==0x121a)&&(dev_id==0x0002)) { - if (true_val == 2) { FXREMAP_PRINTF(("found voodoo2 hidden sli\n")); } + if (true_val == 2) { INIT_PRINTF(("found voodoo2 hidden sli\n")); } return true_val; } /* if banshee */ diff --git a/glide3x/cvg/init/fxremap.h b/glide3x/cvg/init/fxremap.h index bbd5d03..892b14b 100644 --- a/glide3x/cvg/init/fxremap.h +++ b/glide3x/cvg/init/fxremap.h @@ -4,11 +4,9 @@ * pci remapper, used to remap the single board SLI slave to a valid * PCI address */ - #ifndef _FXREMAP_H_ #define _FXREMAP_H_ void fxremap(void); -int fxremap_main(int argc, char **argv); #endif