From a34ebbc44ce38b49eddd9fc745e5cfa5ed99bd7f Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 5 Nov 2021 20:45:34 -0300 Subject: [PATCH 01/62] Reintroduce TGUI DDC --- src/video/vid_tgui9440.c | 42 +++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/src/video/vid_tgui9440.c b/src/video/vid_tgui9440.c index b961fbf78..6c4faf170 100644 --- a/src/video/vid_tgui9440.c +++ b/src/video/vid_tgui9440.c @@ -479,6 +479,10 @@ tgui_out(uint16_t addr, uint8_t val, void *p) tgui_recalcmapping(tgui); break; + case 0x37: + i2c_gpio_set(tgui->i2c, (val & 0x02) || !(val & 0x04), (val & 0x01) || !(val & 0x08)); + break; + case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47: if (tgui->type >= TGUI_9440) { @@ -577,7 +581,7 @@ tgui_in(uint16_t addr, void *p) return svga->seqregs[0x0e]; } break; - + case 0x3C6: if (tgui->type == TGUI_9400CXI) return tkd8001_ramdac_in(addr, svga->ramdac, svga); @@ -585,13 +589,13 @@ tgui_in(uint16_t addr, void *p) return tgui->ramdac_ctrl; tgui->ramdac_state++; break; - + case 0x3C7: case 0x3C8: case 0x3C9: if (tgui->type == TGUI_9400CXI) return tkd8001_ramdac_in(addr, svga->ramdac, svga); tgui->ramdac_state = 0; break; - + case 0x3CF: if (tgui->type == TGUI_9400CXI && svga->gdcaddr >= 16 && svga->gdcaddr < 32) return tgui->ext_gdc_regs[svga->gdcaddr & 15]; @@ -601,7 +605,17 @@ tgui_in(uint16_t addr, void *p) case 0x3D4: return svga->crtcreg; case 0x3D5: - temp = svga->crtc[svga->crtcreg]; + temp = svga->crtc[svga->crtcreg]; + if (!(svga->crtc[0x37] & 0x04)) { + temp &= 0xfd; + if (i2c_gpio_get_scl(tgui->i2c)) + temp |= 0x02; + } + if (!(svga->crtc[0x37] & 0x08)) { + temp &= 0xfe; + if (i2c_gpio_get_sda(tgui->i2c)) + temp |= 0x01; + } return temp; case 0x3d8: return tgui->tgui_3d8; @@ -2991,16 +3005,19 @@ static void *tgui_init(const device_t *info) tgui_set_io(tgui); if (tgui->pci && (tgui->type >= TGUI_9440)) - tgui->card = pci_add_card(PCI_ADD_VIDEO, tgui_pci_read, tgui_pci_write, tgui); + tgui->card = pci_add_card(PCI_ADD_VIDEO, tgui_pci_read, tgui_pci_write, tgui); - tgui->pci_regs[PCI_REG_COMMAND] = 7; + tgui->pci_regs[PCI_REG_COMMAND] = 7; - tgui->pci_regs[0x30] = 0x00; - tgui->pci_regs[0x32] = 0x0c; - tgui->pci_regs[0x33] = 0x00; + tgui->pci_regs[0x30] = 0x00; + tgui->pci_regs[0x32] = 0x0c; + tgui->pci_regs[0x33] = 0x00; - if (tgui->type >= TGUI_9440) - svga->packed_chain4 = 1; + tgui->i2c = i2c_gpio_init("ddc_tgui9440"); + tgui->ddc = ddc_init(i2c_gpio_get_bus(tgui->i2c)); + + if (tgui->type >= TGUI_9440) + svga->packed_chain4 = 1; return tgui; } @@ -3026,6 +3043,9 @@ void tgui_close(void *p) svga_close(&tgui->svga); + ddc_close(tgui->ddc); + i2c_gpio_close(tgui->i2c); + free(tgui); } From f48c3a299e3978f92b6a177f6191124c3ee8849b Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 5 Nov 2021 20:48:56 -0300 Subject: [PATCH 02/62] Add CMake artifacts to gitignore --- .gitignore | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ac3c080a8..6de49d74e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ src/*.o src/*.exe src/*.res -src/*.d src/*.cfg src/*.log src/*.dll @@ -10,6 +9,14 @@ src/NUL src/nvr/ src/roms/ /.vs -/CMakeUserPresets.json /build /.vscode +/CMakeUserPresets.json +/CMakeCache.txt +CMakeFiles +*.cmake +*.obj +*.d +*.a +src/include/86box/version.h +Makefile From 06ab671d326dc4e99b5bc72180e5edc743909d12 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 5 Nov 2021 21:49:00 -0300 Subject: [PATCH 03/62] Allow inserting of build number and git hash through CMake, while also porting the mouse capture title fix from the CLI branch --- CMakeLists.txt | 2 +- src/86box.c | 12 ++++++++---- src/win/win.c | 2 +- src/win/win_about.c | 14 ++++++++++---- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 10f14a967..9565d55b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") project(86Box VERSION 3.0 DESCRIPTION "Emulator of x86-based systems" - HOMEPAGE_URL "https://86box.github.io/" + HOMEPAGE_URL "https://86box.net" LANGUAGES C CXX) # Detect the target architecture by trying to compile `src/arch_detect.c` diff --git a/src/86box.c b/src/86box.c index eca8544a5..e93f8bbe3 100644 --- a/src/86box.c +++ b/src/86box.c @@ -196,7 +196,7 @@ int unscaled_size_y = SCREEN_RES_Y; /* current unscaled size Y */ int efscrnsz_y = SCREEN_RES_Y; -static wchar_t mouse_msg[2][200]; +static wchar_t mouse_msg[3][200]; #ifndef RELEASE_BUILD @@ -1010,11 +1010,13 @@ pc_reset_hard_init(void) *(wcp - 1) = L'\0'; mbstowcs(wcpu, cpu_s->name, strlen(cpu_s->name)+1); swprintf(mouse_msg[0], sizeof_w(mouse_msg[0]), L"%ls v%ls - %%i%%%% - %ls - %ls/%ls - %ls", - EMU_NAME_W, EMU_VERSION_W, wmachine, wcpufamily, wcpu, + EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu, plat_get_string(IDS_2077)); swprintf(mouse_msg[1], sizeof_w(mouse_msg[1]), L"%ls v%ls - %%i%%%% - %ls - %ls/%ls - %ls", - EMU_NAME_W, EMU_VERSION_W, wmachine, wcpufamily, wcpu, + EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu, (mouse_get_buttons() > 2) ? plat_get_string(IDS_2078) : plat_get_string(IDS_2079)); + swprintf(mouse_msg[2], sizeof_w(mouse_msg[2]), L"%ls v%ls - %%i%%%% - %ls - %ls/%ls", + EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu); } @@ -1101,6 +1103,7 @@ static void _ui_window_title(void *s) void pc_run(void) { + int mouse_msg_idx; wchar_t temp[200]; /* Trigger a hard reset if one is pending. */ @@ -1125,7 +1128,8 @@ pc_run(void) } if (title_update) { - swprintf(temp, sizeof_w(temp), mouse_msg[!!mouse_capture], fps); + mouse_msg_idx = (mouse_type == MOUSE_TYPE_NONE) ? 2 : !!mouse_capture; + swprintf(temp, sizeof_w(temp), mouse_msg[mouse_msg_idx], fps); #ifdef __APPLE__ /* Needed due to modifying the UI on the non-main thread is a big no-no. */ dispatch_async_f(dispatch_get_main_queue(), wcsdup((const wchar_t *) temp), _ui_window_title); diff --git a/src/win/win.c b/src/win/win.c index 6e397b98f..133a7c1db 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -434,7 +434,7 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow) hinstance = hInst; /* Set the application version ID string. */ - sprintf(emu_version, "%s v%s", EMU_NAME, EMU_VERSION); + sprintf(emu_version, "%s v%s", EMU_NAME, EMU_VERSION_FULL); /* First, set our (default) language. */ set_language(0x0409); diff --git a/src/win/win_about.c b/src/win/win_about.c index 7ca81cd2c..b84711a62 100644 --- a/src/win/win_about.c +++ b/src/win/win_about.c @@ -39,17 +39,23 @@ AboutDialogCreate(HWND hwnd) int i; TASKDIALOGCONFIG tdconfig = {0}; TASKDIALOG_BUTTON tdbuttons[] = { - {IDOK, EMU_SITE}, - {IDCANCEL, MAKEINTRESOURCE(IDS_2127)} + {IDOK, EMU_SITE}, + {IDCANCEL, MAKEINTRESOURCE(IDS_2127)} }; + wchar_t emu_version[256]; + i = swprintf(emu_version, sizeof(emu_version), L"%ls v%ls", EMU_NAME_W, EMU_VERSION_FULL_W); +#ifdef EMU_GIT_HASH + swprintf(&emu_version[i], sizeof(emu_version) - i, L" [%ls]", EMU_GIT_HASH_W); +#endif + tdconfig.cbSize = sizeof(tdconfig); tdconfig.hwndParent = hwnd; tdconfig.hInstance = hinstance; tdconfig.dwCommonButtons = 0; tdconfig.pszWindowTitle = MAKEINTRESOURCE(IDS_2124); tdconfig.pszMainIcon = (PCWSTR) 10; - tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2125); + tdconfig.pszMainInstruction = emu_version; tdconfig.pszContent = MAKEINTRESOURCE(IDS_2126); tdconfig.cButtons = ARRAYSIZE(tdbuttons); tdconfig.pButtons = tdbuttons; @@ -57,5 +63,5 @@ AboutDialogCreate(HWND hwnd) TaskDialogIndirect(&tdconfig, &i, NULL, NULL); if (i == IDOK) - ShellExecute(hwnd, L"open", L"https://" EMU_SITE, NULL, NULL, SW_SHOW); + ShellExecute(hwnd, L"open", L"https://" EMU_SITE, NULL, NULL, SW_SHOW); } From 9699d63e7034b6b7d95bb4ca0a8633ca24d1367e Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 5 Nov 2021 22:02:34 -0300 Subject: [PATCH 04/62] Add icon type switch to CMake and de-duplicate wide version strings --- CMakeLists.txt | 9 +++++++++ src/86box.c | 2 +- src/include/86box/version.h.in | 28 +++++++++++++++++++++++----- src/win/win_sdl.c | 2 +- 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9565d55b5..89e661fcb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,6 +88,15 @@ CMAKE_DEPENDENT_OPTION(VNC "VNC renderer" ON "DEV_BRANCH" OFF) CMAKE_DEPENDENT_OPTION(XL24 "ATI VGA Wonder XL24 (ATI-28800-6)" ON "DEV_BRANCH" OFF) CMAKE_DEPENDENT_OPTION(VECT486VL "HP Vectra 486VL" ON "DEV_BRANCH" OFF) +string(TOLOWER "${BUILD_TYPE}" BUILD_TYPE_LOWER) +if(BUILD_TYPE_LOWER STREQUAL "release") + add_compile_definitions(RELEASE_BUILD) +elseif(BUILD_TYPE_LOWER STREQUAL "beta") + add_compile_definitions(BETA_BUILD) +elseif(BUILD_TYPE_LOWER STREQUAL "alpha") + add_compile_definitions(ALPHA_BUILD) +endif() + # HACK: Avoid a MSVC2019 compiler bug on ARM64 Debug builds if(MSVC_TOOLSET_VERSION GREATER_EQUAL 142 AND ARCH STREQUAL "arm64") # Define a cache option in case somebody wants to disable this workaround diff --git a/src/86box.c b/src/86box.c index e93f8bbe3..a9f78dc53 100644 --- a/src/86box.c +++ b/src/86box.c @@ -665,7 +665,7 @@ usage: info = localtime(&now); strftime(temp, sizeof(temp), "%Y/%m/%d %H:%M:%S", info); pclog("#\n# %ls v%ls logfile, created %s\n#\n", - EMU_NAME_W, EMU_VERSION_W, temp); + EMU_NAME_W, EMU_VERSION_FULL_W, temp); pclog("# VM: %s\n#\n", vm_name); pclog("# Emulator path: %s\n", exe_path); pclog("# Userfiles path: %s\n", usr_path); diff --git a/src/include/86box/version.h.in b/src/include/86box/version.h.in index 67832258d..ec7a4fdb7 100644 --- a/src/include/86box/version.h.in +++ b/src/include/86box/version.h.in @@ -13,19 +13,37 @@ * Copyright 2020 Miran Grca. */ +#define _LSTR(s) L ## s +#define LSTR(s) _LSTR(s) + /* Version info. */ #define EMU_NAME "@CMAKE_PROJECT_NAME@" -#define EMU_NAME_W L"@CMAKE_PROJECT_NAME@" +#define EMU_NAME_W LSTR(EMU_NAME) #define EMU_VERSION "@CMAKE_PROJECT_VERSION@" -#define EMU_VERSION_W L"@CMAKE_PROJECT_VERSION@" -#define EMU_VERSION_EX "@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@0" +#define EMU_VERSION_W LSTR(EMU_VERSION) +#define EMU_VERSION_EX "@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@@CMAKE_PROJECT_VERSION_PATCH@" #define EMU_VERSION_MAJ @CMAKE_PROJECT_VERSION_MAJOR@ #define EMU_VERSION_MIN @CMAKE_PROJECT_VERSION_MINOR@ -#define COPYRIGHT_YEAR "2020" +#cmakedefine EMU_BUILD "@EMU_BUILD@" +#cmakedefine EMU_GIT_HASH "@EMU_GIT_HASH@" + +#ifdef EMU_BUILD +# define EMU_BUILD_W LSTR(EMU_BUILD) +# define EMU_VERSION_FULL EMU_VERSION " [" EMU_BUILD "]" +# define EMU_VERSION_FULL_W EMU_VERSION_W L" [" EMU_BUILD_W L"]" +#else +# define EMU_VERSION_FULL EMU_VERSION +# define EMU_VERSION_FULL_W EMU_VERSION_W +#endif +#ifdef EMU_GIT_HASH +# define EMU_GIT_HASH_W LSTR(EMU_GIT_HASH) +#endif + +#define COPYRIGHT_YEAR "2021" /* Web URL info. */ -#define EMU_SITE L"@CMAKE_PROJECT_HOMEPAGE_URL@" +#define EMU_SITE L"86box.net" #define EMU_ROMS_URL L"https://github.com/86Box/roms/releases/latest" #define EMU_DOCS_URL L"https://86box.readthedocs.io" diff --git a/src/win/win_sdl.c b/src/win/win_sdl.c index e8bdd6e0d..af876540d 100644 --- a/src/win/win_sdl.c +++ b/src/win/win_sdl.c @@ -459,7 +459,7 @@ sdl_init_common(int flags) sdl_h = GetSystemMetrics(SM_CYSCREEN); /* Create the desktop-covering window. */ - _swprintf(temp, L"%s v%s", EMU_NAME_W, EMU_VERSION_W); + _swprintf(temp, L"%s v%s", EMU_NAME_W, EMU_VERSION_FULL_W); sdl_parent_hwnd = CreateWindow(SDL_CLASS_NAME, temp, WS_POPUP, 0, 0, sdl_w, sdl_h, HWND_DESKTOP, NULL, hinstance, NULL); ShowWindow(sdl_parent_hwnd, FALSE); From 8f2b111c2bf248b4358d2c131de0bb0d3716fd04 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 8 Nov 2021 14:34:05 -0300 Subject: [PATCH 05/62] Fix typo in CMakePresets --- CMakePresets.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 843727936..2cfd8ea4a 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -16,8 +16,8 @@ "CMAKE_CXX_FLAGS_RELEASE": "-g0 -O3", "CMAKE_C_FLAGS_DEBUG": "-ggdb -Og", "CMAKE_CXX_FLAGS_DEBUG": "-ggdb -Og", - "CMAKE_C_FLAGS_OPTIMIZED": "-march=native -mtune=native -O3 -ffp-contract=last -flto", - "CMAKE_CXX_FLAGS_OPTIMIZED": "-march=native -mtune=native -O3 -ffp-contract=last -flto" + "CMAKE_C_FLAGS_OPTIMIZED": "-march=native -mtune=native -O3 -ffp-contract=fast -flto", + "CMAKE_CXX_FLAGS_OPTIMIZED": "-march=native -mtune=native -O3 -ffp-contract=fast -flto" }, "hidden": true, "binaryDir": "build" From e2fbac9e0001588fabbafc45de3471ee390c01fb Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 8 Nov 2021 18:21:28 -0300 Subject: [PATCH 06/62] Revamp gitignore --- .gitignore | 50 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 6de49d74e..e91950bf5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,22 +1,36 @@ -src/*.o -src/*.exe -src/*.res -src/*.cfg -src/*.log -src/*.dll -src/*.dmp -src/NUL -src/nvr/ -src/roms/ -/.vs -/build -/.vscode +# CMake /CMakeUserPresets.json /CMakeCache.txt +/build CMakeFiles -*.cmake -*.obj -*.d -*.a -src/include/86box/version.h Makefile +*.a +*.cmake +/src/*.exe +/src/86Box +/src/include/86box/version.h + +# Legacy Makefile +/src/*.o +/src/*.d +/src/*.res +/src/*.dll +/src/NUL + +# State +/src/*.cfg +/src/*.log +/src/*.dmp +/src/nvr/ +/src/printer/ +/src/roms/ +/src/screenshots/ + +# Build scripts +/archive_tmp +/static2dll.* +/*.zip + +# Visual Studio Code +/.vs +/.vscode From 43da85325e447ae824d79a604d30116674a0566f Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 8 Nov 2021 18:22:04 -0300 Subject: [PATCH 07/62] Fixes for static and CMake version includes --- src/include/86box/version.h.in | 2 +- src/include_make/86box/version.h | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/include/86box/version.h.in b/src/include/86box/version.h.in index ec7a4fdb7..f0a92a008 100644 --- a/src/include/86box/version.h.in +++ b/src/include/86box/version.h.in @@ -22,7 +22,7 @@ #define EMU_VERSION "@CMAKE_PROJECT_VERSION@" #define EMU_VERSION_W LSTR(EMU_VERSION) -#define EMU_VERSION_EX "@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@@CMAKE_PROJECT_VERSION_PATCH@" +#define EMU_VERSION_EX "@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@0" #define EMU_VERSION_MAJ @CMAKE_PROJECT_VERSION_MAJOR@ #define EMU_VERSION_MIN @CMAKE_PROJECT_VERSION_MINOR@ diff --git a/src/include_make/86box/version.h b/src/include_make/86box/version.h index b3da62c6e..6574d0049 100644 --- a/src/include_make/86box/version.h +++ b/src/include_make/86box/version.h @@ -13,19 +13,25 @@ * Copyright 2020 Miran Grca. */ +#define _LSTR(s) L ## s +#define LSTR(s) _LSTR(s) + /* Version info. */ #define EMU_NAME "86Box" -#define EMU_NAME_W L"86Box" +#define EMU_NAME_W LSTR(EMU_NAME) #define EMU_VERSION "3.0" -#define EMU_VERSION_W L"3.0" +#define EMU_VERSION_W LSTR(EMU_VERSION) #define EMU_VERSION_EX "3.00" #define EMU_VERSION_MAJ 3 #define EMU_VERSION_MIN 0 -#define COPYRIGHT_YEAR "2020" +#define EMU_VERSION_FULL EMU_VERSION +#define EMU_VERSION_FULL_W EMU_VERSION_W + +#define COPYRIGHT_YEAR "2021" /* Web URL info. */ #define EMU_SITE L"86box.net" #define EMU_ROMS_URL L"https://github.com/86Box/roms/releases/latest" -#define EMU_DOCS_URL L"https://86box.readthedocs.io" \ No newline at end of file +#define EMU_DOCS_URL L"https://86box.readthedocs.io" From e904cf782f0db9f61e2edc452d84ee345667bd30 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 8 Nov 2021 18:56:00 -0300 Subject: [PATCH 08/62] Add tar.xz to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e91950bf5..4103ce839 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ Makefile /archive_tmp /static2dll.* /*.zip +/*.tar.xz # Visual Studio Code /.vs From dfa2583cfbb6d487f9f98fc44bd0534b70327549 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 8 Nov 2021 22:40:12 -0300 Subject: [PATCH 09/62] Remove unused code from x86 Voodoo dynarec, fixes x86 Linux builds --- src/include/86box/vid_voodoo_codegen_x86.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/include/86box/vid_voodoo_codegen_x86.h b/src/include/86box/vid_voodoo_codegen_x86.h index d54a7e683..b6d60e5ff 100644 --- a/src/include/86box/vid_voodoo_codegen_x86.h +++ b/src/include/86box/vid_voodoo_codegen_x86.h @@ -3361,12 +3361,6 @@ voodoo_recomp++; void voodoo_codegen_init(voodoo_t *voodoo) { int c; -#if defined(__linux__) || defined(__APPLE__) - void *start; - size_t len; - long pagesize = sysconf(_SC_PAGESIZE); - long pagemask = ~(pagesize - 1); -#endif voodoo->codegen_data = plat_mmap(sizeof(voodoo_x86_data_t) * BLOCK_NUM*4, 1); From 409671115467d5c79f3fe611785b883b044df497 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 8 Nov 2021 22:46:53 -0300 Subject: [PATCH 10/62] Initial commit of the new Jenkins build flow --- .jenkins/Jenkinsfile | 44 ++++ .jenkins/build.sh | 447 +++++++++++++++++++++++++++++++++++++++++ .jenkins/static2dll.sh | 148 ++++++++++++++ 3 files changed, 639 insertions(+) create mode 100644 .jenkins/Jenkinsfile create mode 100644 .jenkins/build.sh create mode 100644 .jenkins/static2dll.sh diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile new file mode 100644 index 000000000..f0457e976 --- /dev/null +++ b/.jenkins/Jenkinsfile @@ -0,0 +1,44 @@ +def gitClone() { + cleanWs() + def scmVars = git url: 'https://github.com/richardg867/86Box.git', + branch: 'cleanup30' + env.GIT_COMMIT = scmVars.GIT_COMMIT +} + +def windowsBuild() { + bat 'C:\\msys64\\msys2_shell.cmd -msys2 -defterm -here -no-start -c .jenkins/build.sh' +} + +def unixBuild() { + sh 'chmod u+x .jenkins/build.sh && .jenkins/build.sh' +} + +def saveArtifacts() { + archiveArtifacts artifacts: "${env.JOB_BASE_NAME}-*" +} + +pipeline { + agent any + + stages { + stage('Build Windows') { + steps { + node('windows') { + gitClone() + windowsBuild() + saveArtifacts() + } + } + } + + stage('Build Linux') { + steps { + node('debian') { + gitClone() + unixBuild() + saveArtifacts() + } + } + } + } +} diff --git a/.jenkins/build.sh b/.jenkins/build.sh new file mode 100644 index 000000000..f32793584 --- /dev/null +++ b/.jenkins/build.sh @@ -0,0 +1,447 @@ +#!/bin/sh +# +# 86Box A hypervisor and IBM PC system emulator that specializes in +# running old operating systems and software designed for IBM +# PC systems and compatibles from 1981 through fairly recent +# system designs based on the PCI bus. +# +# This file is part of the 86Box distribution. +# +# Jenkins build script. +# +# +# Authors: RichardG, +# +# Copyright 2021 RichardG. +# + +# +# While this script was made for our Jenkins infrastructure, you can run it +# to produce Jenkins-like builds on your local machine by following these notes: +# +# - Run build.sh without parameters to see its usage +# - For Windows (MSYS MinGW) builds: +# - Packaging requires 7-Zip on Program Files +# - Packaging the Ghostscript DLL requires 32-bit and/or 64-bit Ghostscript on Program Files +# - Packaging the FluidSynth DLL requires it to be at /home/86Box/dll32/libfluidsynth.dll +# and/or /home/86Box/dll64/libfluidsynth64.dll (for 32-bit and 64-bit builds respectively) +# - Packaging the Discord DLL requires wget (MSYS should come with it) +# - For Linux builds: +# - Only Debian and derivatives are supported +# - dpkg and apt-get are called through sudo to manage dependencies +# - For macOS builds: +# - TBD +# + +alias is_windows='[ ! -z "$MSYSTEM" ]' +alias is_mac='uname -s | grep -q Darwin' + +try_make() { + # Try makefiles on two locations. I don't know what causes + # CMake to pick ./ instead of build/, but :worksonmymachine: + if [ -e "build/Makefile" ] + then + build_dir="$(pwd)/build" + cd build + make -j$(nproc) $* + local status=$? + cd .. + return $status + elif [ -e "Makefile" ] + then + build_dir="$(pwd)" + make -j$(nproc) $* + return $? + else + echo [!] No makefile found + return 1 + fi +} + +build() { + # Create a line gap between builds. + [ $first_build -eq 0 ] && echo + first_build=0 + + # Set argument and environment variables. + local job_name=$JOB_BASE_NAME + local build_number=$BUILD_NUMBER + local git_hash=$(echo $GIT_COMMIT | cut -c1-7) + local arch=$1 + shift + local cmake_flags=$* + local cmake_flags_extra= + + # Check if at least the job name was received. + if [ -z "$job_name" ] + then + echo [!] Missing environment variables: received JOB_BASE_NAME=[$job_name] BUILD_NUMBER=[$build_number] GIT_COMMIT=[$git_hash] + return 1 + fi + + # Generate the build qualifier and filename. + if echo $build_number | grep -q " " + then + # Full build qualifier. + build_qualifier="$build_number" + build_fn="-"$(echo "$build_number" | rev | cut -f1 -d" " | rev | tr '\\/:*?"<>|' '_') + elif [ ! -z "$build_number" ] + then + # Build number. + build_number=$(echo "$build_number" | sed "s/[^0-9]//g") # remove non-numeric characters + build_qualifier="build $build_number" + build_fn="-b$build_number" + else + # No build information. + build_qualifier= + build_fn= + fi + + echo [-] Building [$job_name] [$build_number] [$git_hash] for [$arch] with flags [$cmake_flags] + + # Switch to the correct directory. + cd "$cwd" + [ -e "build.sh" ] && cd .. + + # Perform platform-specific setup. + if is_windows + then + # Switch into the correct MSYSTEM if required. + msys=MINGW$arch + [ ! -d "/$msys" ] && msys=CLANG$arch + if [ -d "/$msys" ] + then + if [ "$MSYSTEM" != "$msys" ] + then + # Call build with the correct MSYSTEM. + echo [-] Switching to MSYSTEM [$msys] + cd "$cwd" + CHERE_INVOKING=yes MSYSTEM=$msys JOB_BASE_NAME=$JOB_BASE_NAME BUILD_NUMBER=$BUILD_NUMBER GIT_COMMIT=$GIT_COMMIT \ + bash -lc '"'$0'" -b "'$arch'" '$cmake_flags + return $? + fi + else + echo [!] No MSYSTEM for architecture [$arch] + return 2 + fi + echo [-] Using MSYSTEM [$MSYSTEM] + elif is_mac + then + # macOS lacks nproc, but sysctl can do the same job. + alias nproc='sysctl -n hw.logicalcpu' + else + # Determine Debian architecture. + case $arch in + x86) arch_deb="i386";; + x86_64) arch_deb="amd64";; + arm32) arch_deb="armhf";; + *) arch_deb="$arch";; + esac + + # Establish general and architecture-specific dependencies. + local pkgs="cmake git tar xz-utils dpkg-dev rpm" + if [ "$(dpkg --print-architecture)" = "$arch_deb" ] + then + local pkgs="$pkgs build-essential" + else + sudo dpkg --add-architecture $arch_deb + local pkgs="$pkgs crossbuild-essential-$arch_deb" + fi + local libpkgs="" + local longest_libpkg=0 + for pkg in libc6-dev linux-libc-dev libopenal-dev libfreetype6-dev libsdl2-dev libpng-dev + do + local libpkgs="$libpkgs $pkg:$arch_deb" + length=$(echo -n $pkg | sed 's/-dev$//g' | wc -c) + [ $length -gt $longest_libpkg ] && longest_libpkg=$length + done + + # Determine GNU toolchain architecture. + case $arch in + x86) arch_gnu="i686-linux-gnu";; + arm32) arch_gnu="arm-linux-gnueabihf";; + arm64) arch_gnu="aarch64-linux-gnu";; + *) arch_gnu="$arch-linux-gnu";; + esac + + # Create CMake toolchain file. + cat << EOF > toolchain.cmake +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR $arch) + +set(CMAKE_AR $arch_gnu-ar) +set(CMAKE_ASM_COMPILER $arch_gnu-gcc) +set(CMAKE_C_COMPILER $arch_gnu-gcc) +set(CMAKE_CXX_COMPILER $arch_gnu-g++) +set(CMAKE_LINKER $arch_gnu-ld) +set(CMAKE_OBJCOPY $arch_gnu-objcopy) +set(CMAKE_RANLIB $arch_gnu-ranlib) +set(CMAKE_SIZE $arch_gnu-size) +set(CMAKE_STRIP $arch_gnu-strip) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +EOF + local cmake_flags_extra="$cmake_flags_extra -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake" + + # Install or update dependencies. + echo [-] Installing dependencies through apt + sudo apt-get update + DEBIAN_FRONTEND=noninteractive sudo apt-get -y install $pkgs $libpkgs + sudo apt-get clean + fi + + # Clean workspace. + echo [-] Cleaning workspace + try_make clean > /dev/null + find . \( -name Makefile -o -name CMakeCache.txt -o -name CMakeFiles \) -exec rm -rf "{}" \; 2> /dev/null + rm -rf build + + # Determine available dynarec types for this architecture, and + # also specify ARCH right away to skip the arch_detect process. + case $arch in + # old dynarec available + 32 | x86) local cmake_flags_extra="$cmake_flags_extra -D ARCH=i386";; + 64 | x86_64) local cmake_flags_extra="$cmake_flags_extra -D ARCH=x86_64";; + # new dynarec only + arm32) local cmake_flags_extra="$cmake_flags_extra -D NEW_DYNAREC=ON -D ARCH=arm";; + arm64) local cmake_flags_extra="$cmake_flags_extra -D NEW_DYNAREC=ON -D ARCH=arm64";; + # no dynarec + *) local cmake_flags_extra="$cmake_flags_extra -D DYNAREC=OFF";; # no dynarec + esac + + # Run CMake. + echo [-] Running CMake + cmake -G "Unix Makefiles" $cmake_flags $cmake_flags_extra -D BUILD_TYPE="alpha" -D EMU_BUILD="$build_qualifier" -D EMU_GIT_HASH="$git_hash" . + local status=$? + if [ $? -gt 0 ] + then + echo [!] CMake failed with status [$status] + return 3 + fi + + # Run actual build. + echo [-] Running build + try_make + local status=$? + if [ $status -gt 0 ] + then + echo [!] Make failed with status [$status] + return 4 + fi + + # Create temporary directory for archival. + echo [-] Gathering archive files + rm -rf archive_tmp + mkdir archive_tmp + if [ ! -d "archive_tmp" ] + then + echo [!] Archive directory creation failed + return 5 + fi + + # Archive the executable and its dependencies. + # The executable should always be archived last for the check after this block. + local status=$? + if is_windows + then + # Determine Program Files directory for Ghostscript and 7-Zip. + # Manual checks because MSYS is bad at passing the ProgramFiles variables. + pf="/c/Program Files" + sevenzip="$pf/7-Zip/7z.exe" + [ "$arch" = "32" -a -d "/c/Program Files (x86)" ] && pf="/c/Program Files (x86)" + + # Archive freetype from local MSYS installation. + ./.jenkins/static2dll.sh -p freetype2 /$MSYSTEM/lib/libfreetype.a archive_tmp/libfreetype-6.dll + + # Archive Ghostscript DLL from local official distribution installation. + for gs in "$pf"/gs/gs*.*.* + do + cp -p "$gs"/bin/gsdll*.dll archive_tmp/ + done + + # Archive Discord Game SDK DLL from their CDN. + discordarch= + [ "$arch" = "32" ] && discordarch=x86 + [ "$arch" = "64" ] && discordarch=x86_64 + if [ ! -z "$discordarch" ] + then + [ ! -e "discord_game_sdk.zip" ] && wget -qOdiscord_game_sdk.zip https://dl-game-sdk.discordapp.net/2.5.6/discord_game_sdk.zip + "$sevenzip" e -y -oarchive_tmp discord_game_sdk.zip lib/$discordarch/discord_game_sdk.dll + fi + + # Archive other DLLs from local directory. + cp -p /home/$project/dll$arch/* archive_tmp/ + + # Archive executable. + mv "$build_dir"/src/$project.exe archive_tmp/ + status=$? + elif is_mac + then + # TBD + : + else + # Archive readme with library package versions. + echo Libraries used to compile this $arch build of $project: > archive_tmp/README + dpkg-query -f '${Package} ${Version}\n' -W $libpkgs | sed "s/-dev / /g" | while IFS=" " read pkg version + do + for i in $(seq $(expr $longest_libpkg - $(echo -n $pkg | wc -c))) + do + echo -n " " >> archive_tmp/README + done + echo $pkg $version >> archive_tmp/README + done + + # Archive executable. + mv "$build_dir"/src/$project archive_tmp/ + status=$? + fi + + # Check if the executable move succeeded. + if [ $status -gt 0 ] + then + echo [!] Executable move failed with status [$status] + return 6 + fi + + # Produce artifact archive. + echo [-] Creating artifact archive + cd archive_tmp + if is_windows + then + # Create zip. + "$sevenzip" a -y -mx9 "..\\$job_name-Windows-$arch$build_fn.zip" * + local status=$? + elif is_mac + then + # TBD + : + else + # Create tarball. + tar Jcvf ../$job_name-Linux-$arch$build_fn.tar.xz --owner=0 --group=0 * # strip UID/GID metadata + local status=$? + fi + cd .. + + # Check if the archival succeeded. + if [ $status -gt 0 ] + then + echo [!] Artifact archive creation failed with status [$status] + return 7 + fi + + # All good. + echo [-] Build of [$job_name] [$build_number] [$git_hash] for [$arch] with flags [$cmake_flags] successful + job_exit=0 +} + +# Set common variables. +project=86Box +cwd=$(pwd) +first_build=1 +job_exit=1 + +# Parse arguments. +single_build=0 +args=0 +while [ $# -gt 0 ] +do + case $1 in + -b) + # Execute single build. + shift + [ -z "$JOB_BASE_NAME" ] && JOB_BASE_NAME=$project-Custom + single_build=1 + break + ;; + + *) + # Allow for manually specifying Jenkins variables. + if [ $args -eq 0 ] + then + JOB_BASE_NAME=$1 + args=1 + elif [ $args -eq 1 ] + then + BUILD_NUMBER=$1 + args=2 + elif [ $args -eq 2 ] + then + GIT_COMMIT=$1 + args=3 + fi + shift + ;; + esac +done + +# Check if at least the job name was specified. +if [ -z "$JOB_BASE_NAME" ] +then + echo [!] Manual usage: build.sh [{job_name} [{build_number|build_qualifier} [git_hash]]] [-b {architecture} [cmake_flags...]] + exit 100 +fi + +# Run single build if requested. +if [ $single_build -ne 0 ] +then + build $* + exit $? +fi + +# Run builds according to the Jenkins job name. +case $JOB_BASE_NAME in + $project | $project-TestBuildPleaseIgnore) + if is_windows + then + build 32 --preset=regular + elif is_mac + then + build Universal --preset=regular + else + build x86 --preset=regular + build x86_64 --preset=regular + build arm32 --preset=regular + build arm64 --preset=regular + fi + ;; + + $project-Debug) + if is_windows + then + build 32 --preset=debug + build 64 --preset=debug + elif is_mac + then + build Universal --preset=debug + else + build x86 --preset=debug + build x86_64 --preset=debug + build arm32 --preset=debug + build arm64 --preset=debug + fi + ;; + + $project-Dev) + if is_windows + then + build 32 --preset=experimental + build 64 --preset=experimental + elif is_mac + then + build Universal --preset=experimental + else + build x86 --preset=experimental + build x86_64 --preset=experimental + build arm32 --preset=experimental + build arm64 --preset=experimental + fi + ;; + + *) + echo Error: unknown job name $JOB_BASE_NAME + exit 1 + ;; +esac +exit $job_exit diff --git a/.jenkins/static2dll.sh b/.jenkins/static2dll.sh new file mode 100644 index 000000000..2148537d1 --- /dev/null +++ b/.jenkins/static2dll.sh @@ -0,0 +1,148 @@ +#!/bin/sh +# +# 86Box A hypervisor and IBM PC system emulator that specializes in +# running old operating systems and software designed for IBM +# PC systems and compatibles from 1981 through fairly recent +# system designs based on the PCI bus. +# +# This file is part of the 86Box distribution. +# +# Script for converting MinGW static libraries into a DLL. +# +# +# Authors: RichardG, +# +# Copyright 2021 RichardG. +# + +def_file="static2dll.def" +seen_file="static2dll.seen" +libs_file="static2dll.libs" + +find_lib() { + # Try to find a static library's file. + local msystem_lib="/$(echo $MSYSTEM | tr '[:upper:]' '[:lower:]')/lib/lib" + if [ -e "$msystem_lib$1.a" ] + then + echo "$msystem_lib$1.a" + elif [ -e "$msystem_lib$1.dll.a" ] + then + echo "$msystem_lib$1.dll.a" + else + # Return dynamic reference to the library. + echo "-l$1" + return 1 + fi +} + +add_lib() { + # Always make sure this lib is listed after the last lib that depends on it. + if grep -q -- '^'"$*"'$' "$libs_file" + then + cp "$libs_file" "$libs_file.tmp" + grep -v -- '^'"$*"'$' "$libs_file.tmp" > "$libs_file" + fi + echo "$*" >> "$libs_file" + + # Add libstdc++ in the end if required. + if echo "$*" | grep -q "/" + then + grep -Eq -- "__cxa_|__gxx_" "$1" 2> /dev/null && add_lib -static -lstdc++ + fi + + # Add libiconv for libintl. + if echo "$*" | grep -q "libintl" + then + add_lib $(find_lib iconv) + fi + + # Add libuuid for glib. + if echo "$*" | grep -q "libglib" + then + add_lib $(find_lib uuid) + fi +} + +parse_pkgconfig() { + # Parse arguments. + local layers=$1 + shift + local input_lib_name=$1 + shift + + # Don't process the same file again. + grep -q '^'$input_lib_name'$' "$seen_file" && return + echo $input_lib_name >> "$seen_file" + + echo "$layers" parse_pkgconfig $input_lib_name + + # Parse pkg-config arguments. + for arg in $* + do + local arg_base="$(echo $arg | cut -c1-2)" + if [ "x$arg_base" = "x-l" ] + then + # Don't process the same lib again. + local lib_name="$(echo $arg | cut -c3-)" + [ "x$lib_name" == "x$input_lib_name" ] && continue + + # Add lib path. + add_lib "$(find_lib $lib_name)" + + # Get this lib's dependencies through pkg-config. + local pkgconfig="$(pkg-config --static --libs "$lib_name" 2>/dev/null)" + [ $? -eq 0 ] && parse_pkgconfig "$layers"'>' "$lib_name" $pkgconfig || echo $lib_name >> "$seen_file" + elif [ "x$(echo $arg_base | cut -c1)" = "x-" ] + then + # Ignore other arguments. + continue + else + # Add lib path. + add_lib "$arg" + fi + done +} + +# Parse arguments. +case $1 in + -p) # -p pkg_config_name static_lib_path out_dll + shift + base_pkgconfig=$(pkg-config --static --libs "$1") + base_path="$2" + base_name="$1" + ;; + + *) # pc_path static_lib_path out_dll + base_pkgconfig="$(grep ^Libs.private: $1 | cut -d: -f2-)" + base_path="$2" + base_name="$2" + ;; +esac + +# Check arguments. +if [ -z "$base_pkgconfig" -o -z "$base_path" -o -z "$base_name" ] +then + echo Usage: + echo static2dll.sh -p {pkgconfig_package_name} {static_lib_path} {out_dll_name} + echo static2dll.sh {pc_file_path} {static_lib_path} {out_dll_name} + exit 1 +fi + +# Produce .def file. +echo LIBRARY $(basename "$3") > "$def_file" +echo EXPORTS >> "$def_file" +nm "$base_path" | grep " [TC] " | sed "/ _/s// /" | awk '{ print $3 }' >> "$def_file" + +# Parse dependencies recursively. +rm -f "$seen_file" "$libs_file" "$libs_file.tmp" +touch "$seen_file" "$libs_file" +parse_pkgconfig '>' $base_name $base_pkgconfig + +# Produce final DLL. +dllwrap --def "$def_file" -o "$3" -Wl,--allow-multiple-definition "$base_path" $(cat "$libs_file") +status=$? + +# Update final DLL timestamp. +touch -r "$base_path" "$3" + +exit $status From 70e2503fc7ec9521fe3cdae5c6045a6754100f43 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 8 Nov 2021 22:56:48 -0300 Subject: [PATCH 11/62] Add build type to Jenkins flow --- .jenkins/Jenkinsfile | 24 ++++++++++++++++++++++++ .jenkins/build.sh | 14 +++++++++----- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index f0457e976..846c75a76 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -1,3 +1,20 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Jenkins build pipeline definition. + * + * + * + * Authors: RichardG, + * + * Copyright 2021 RichardG. + */ + def gitClone() { cleanWs() def scmVars = git url: 'https://github.com/richardg867/86Box.git', @@ -20,6 +37,13 @@ def saveArtifacts() { pipeline { agent any + parameters { + choice(name: 'BUILD_TYPE', + choices: ['none', 'alpha', 'beta', 'release'], + defaultValue: 'beta', + description: 'Build type to pass on to CMake. This may affect the UI icon and feature set.') + } + stages { stage('Build Windows') { steps { diff --git a/.jenkins/build.sh b/.jenkins/build.sh index f32793584..321e17fa4 100644 --- a/.jenkins/build.sh +++ b/.jenkins/build.sh @@ -116,7 +116,7 @@ build() { # Call build with the correct MSYSTEM. echo [-] Switching to MSYSTEM [$msys] cd "$cwd" - CHERE_INVOKING=yes MSYSTEM=$msys JOB_BASE_NAME=$JOB_BASE_NAME BUILD_NUMBER=$BUILD_NUMBER GIT_COMMIT=$GIT_COMMIT \ + CHERE_INVOKING=yes MSYSTEM=$msys JOB_BASE_NAME=$JOB_BASE_NAME BUILD_TYPE=$BUILD_TYPE BUILD_NUMBER=$BUILD_NUMBER GIT_COMMIT=$GIT_COMMIT \ bash -lc '"'$0'" -b "'$arch'" '$cmake_flags return $? fi @@ -213,7 +213,7 @@ EOF # Run CMake. echo [-] Running CMake - cmake -G "Unix Makefiles" $cmake_flags $cmake_flags_extra -D BUILD_TYPE="alpha" -D EMU_BUILD="$build_qualifier" -D EMU_GIT_HASH="$git_hash" . + cmake -G "Unix Makefiles" $cmake_flags $cmake_flags_extra -D BUILD_TYPE="$BUILD_TYPE" -D EMU_BUILD="$build_qualifier" -D EMU_GIT_HASH="$git_hash" . local status=$? if [ $? -gt 0 ] then @@ -364,12 +364,16 @@ do args=1 elif [ $args -eq 1 ] then - BUILD_NUMBER=$1 + BUILD_TYPE=$1 args=2 elif [ $args -eq 2 ] then - GIT_COMMIT=$1 + BUILD_NUMBER=$1 args=3 + elif [ $args -eq 3 ] + then + GIT_COMMIT=$1 + args=4 fi shift ;; @@ -379,7 +383,7 @@ done # Check if at least the job name was specified. if [ -z "$JOB_BASE_NAME" ] then - echo [!] Manual usage: build.sh [{job_name} [{build_number|build_qualifier} [git_hash]]] [-b {architecture} [cmake_flags...]] + echo [!] Manual usage: build.sh [{job_name} [{build_type} [{build_number|build_qualifier} [git_hash]]]] [-b {architecture} [cmake_flags...]] exit 100 fi From a0c27de4d97f0955779d64e6ba76c5a993a4fec7 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 8 Nov 2021 22:59:18 -0300 Subject: [PATCH 12/62] Fix Jenkins build type choice --- .jenkins/Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index 846c75a76..aa084ef49 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -39,8 +39,7 @@ pipeline { parameters { choice(name: 'BUILD_TYPE', - choices: ['none', 'alpha', 'beta', 'release'], - defaultValue: 'beta', + choices: ['beta', 'none', 'alpha', 'beta', 'release'], // duplicated on purpose, first is default description: 'Build type to pass on to CMake. This may affect the UI icon and feature set.') } From 703aa87cbf4fde8f12ef47655562c92cccafe24b Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 8 Nov 2021 23:15:39 -0300 Subject: [PATCH 13/62] Fix VIA AC97 warning --- src/sound/snd_ac97_via.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/sound/snd_ac97_via.c b/src/sound/snd_ac97_via.c index 1707c0c9a..2ca80e538 100644 --- a/src/sound/snd_ac97_via.c +++ b/src/sound/snd_ac97_via.c @@ -176,7 +176,8 @@ ac97_via_update_irqs(ac97_via_t *dev) static void -ac97_via_update_codec(ac97_via_t *dev) { +ac97_via_update_codec(ac97_via_t *dev) +{ /* Get primary audio codec. */ ac97_codec_t *codec = dev->codec[0][0]; @@ -378,16 +379,16 @@ ac97_via_sgd_write(uint16_t addr, uint8_t val, void *priv) if (val & 1) { /* return 0x00 on unaligned reads */ dev->sgd_regs[0x80] = dev->sgd_regs[0x81] = 0x00; } else { - dev->sgd_regs[0x80] = dev->codec_shadow[modem].regs_codec[i][val] = ac97_codec_read(codec, val); - dev->sgd_regs[0x81] = dev->codec_shadow[modem].regs_codec[i][val | 1] = ac97_codec_read(codec, val | 1); + dev->sgd_regs[0x80] = dev->codec_shadow[modem].regs_codec[i][(val & 0x7f)] = ac97_codec_read(codec, val); + dev->sgd_regs[0x81] = dev->codec_shadow[modem].regs_codec[i][(val & 0x7f) | 1] = ac97_codec_read(codec, val | 1); } /* Flag data/status/index for this codec as valid. */ if (val & 0x80) dev->sgd_regs[0x83] |= 0x02 << (i << 1); } else if (!(val & 1)) { /* do nothing on unaligned writes */ - ac97_codec_write(codec, val, dev->codec_shadow[modem].regs_codec[i][val] = dev->sgd_regs[0x80]); - ac97_codec_write(codec, val | 1, dev->codec_shadow[modem].regs_codec[i][val | 1] = dev->sgd_regs[0x81]); + ac97_codec_write(codec, val, dev->codec_shadow[modem].regs_codec[i][(val & 0x7f)] = dev->sgd_regs[0x80]); + ac97_codec_write(codec, val | 1, dev->codec_shadow[modem].regs_codec[i][(val & 0x7f) | 1] = dev->sgd_regs[0x81]); /* Update primary audio codec state if that codec was written to. */ if (!modem && !i) From 1b4745847baffc5f449241afbc8145f07330eafd Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 8 Nov 2021 23:17:17 -0300 Subject: [PATCH 14/62] Attempt to fix Jenkins build script exit code issue --- .jenkins/Jenkinsfile | 2 +- .jenkins/build.sh | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index aa084ef49..a1b24438d 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -23,7 +23,7 @@ def gitClone() { } def windowsBuild() { - bat 'C:\\msys64\\msys2_shell.cmd -msys2 -defterm -here -no-start -c .jenkins/build.sh' + bat 'C:\\msys64\\msys2_shell.cmd -msys2 -defterm -here -no-start -c "exec .jenkins/build.sh"' } def unixBuild() { diff --git a/.jenkins/build.sh b/.jenkins/build.sh index 321e17fa4..c78f56ee8 100644 --- a/.jenkins/build.sh +++ b/.jenkins/build.sh @@ -208,12 +208,13 @@ EOF arm32) local cmake_flags_extra="$cmake_flags_extra -D NEW_DYNAREC=ON -D ARCH=arm";; arm64) local cmake_flags_extra="$cmake_flags_extra -D NEW_DYNAREC=ON -D ARCH=arm64";; # no dynarec - *) local cmake_flags_extra="$cmake_flags_extra -D DYNAREC=OFF";; # no dynarec + *) local cmake_flags_extra="$cmake_flags_extra -D DYNAREC=OFF";; esac # Run CMake. - echo [-] Running CMake - cmake -G "Unix Makefiles" $cmake_flags $cmake_flags_extra -D BUILD_TYPE="$BUILD_TYPE" -D EMU_BUILD="$build_qualifier" -D EMU_GIT_HASH="$git_hash" . + cmake_flags_extra="$cmake_flags_extra -D BUILD_TYPE=\"$BUILD_TYPE\" -D EMU_BUILD=\"$build_qualifier\" -D EMU_GIT_HASH=\"$git_hash\"" + echo [-] Running CMake with flags [$cmake_flags $cmake_flags_extra] + cmake -G "Unix Makefiles" $cmake_flags $cmake_flags_extra . local status=$? if [ $? -gt 0 ] then @@ -333,7 +334,7 @@ EOF # All good. echo [-] Build of [$job_name] [$build_number] [$git_hash] for [$arch] with flags [$cmake_flags] successful - job_exit=0 + export job_exit=0 } # Set common variables. @@ -444,8 +445,11 @@ case $JOB_BASE_NAME in ;; *) - echo Error: unknown job name $JOB_BASE_NAME + echo [!] Unknown job name $JOB_BASE_NAME exit 1 ;; esac + +echo +echo [-] Exiting with code [$job_exit] exit $job_exit From 0cbf23fda33feb51ceb74aae2943dd78c4e17475 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 8 Nov 2021 23:22:19 -0300 Subject: [PATCH 15/62] Fix CMake quoting issue in Jenkins build flow --- .jenkins/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.jenkins/build.sh b/.jenkins/build.sh index c78f56ee8..816bb3a2d 100644 --- a/.jenkins/build.sh +++ b/.jenkins/build.sh @@ -214,7 +214,7 @@ EOF # Run CMake. cmake_flags_extra="$cmake_flags_extra -D BUILD_TYPE=\"$BUILD_TYPE\" -D EMU_BUILD=\"$build_qualifier\" -D EMU_GIT_HASH=\"$git_hash\"" echo [-] Running CMake with flags [$cmake_flags $cmake_flags_extra] - cmake -G "Unix Makefiles" $cmake_flags $cmake_flags_extra . + eval cmake -G "Unix Makefiles" $cmake_flags $cmake_flags_extra . local status=$? if [ $? -gt 0 ] then From 74ec220a370c4100416af08094ce43a108ea6973 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 8 Nov 2021 23:23:13 -0300 Subject: [PATCH 16/62] *Actually* fix CMake quoting issue --- .jenkins/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.jenkins/build.sh b/.jenkins/build.sh index 816bb3a2d..e0f783db7 100644 --- a/.jenkins/build.sh +++ b/.jenkins/build.sh @@ -214,7 +214,7 @@ EOF # Run CMake. cmake_flags_extra="$cmake_flags_extra -D BUILD_TYPE=\"$BUILD_TYPE\" -D EMU_BUILD=\"$build_qualifier\" -D EMU_GIT_HASH=\"$git_hash\"" echo [-] Running CMake with flags [$cmake_flags $cmake_flags_extra] - eval cmake -G "Unix Makefiles" $cmake_flags $cmake_flags_extra . + eval cmake -G \"Unix Makefiles\" $cmake_flags $cmake_flags_extra . local status=$? if [ $? -gt 0 ] then From 3b450932219d28fec71921872e420b18f0a2aa68 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 8 Nov 2021 23:25:34 -0300 Subject: [PATCH 17/62] Add potential future Windows build targets to Jenkins dynarec check --- .jenkins/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.jenkins/build.sh b/.jenkins/build.sh index e0f783db7..66a0aed0b 100644 --- a/.jenkins/build.sh +++ b/.jenkins/build.sh @@ -205,8 +205,8 @@ EOF 32 | x86) local cmake_flags_extra="$cmake_flags_extra -D ARCH=i386";; 64 | x86_64) local cmake_flags_extra="$cmake_flags_extra -D ARCH=x86_64";; # new dynarec only - arm32) local cmake_flags_extra="$cmake_flags_extra -D NEW_DYNAREC=ON -D ARCH=arm";; - arm64) local cmake_flags_extra="$cmake_flags_extra -D NEW_DYNAREC=ON -D ARCH=arm64";; + ARM32 | arm32) local cmake_flags_extra="$cmake_flags_extra -D NEW_DYNAREC=ON -D ARCH=arm";; + ARM64 | arm64) local cmake_flags_extra="$cmake_flags_extra -D NEW_DYNAREC=ON -D ARCH=arm64";; # no dynarec *) local cmake_flags_extra="$cmake_flags_extra -D DYNAREC=OFF";; esac From e75376b4844ac30f0e1aa69b7c4ba911a58c1d44 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 8 Nov 2021 23:34:15 -0300 Subject: [PATCH 18/62] Improvements to Jenkins CMake flow, and fix MSYS-switching exit code bug --- .jenkins/build.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.jenkins/build.sh b/.jenkins/build.sh index 66a0aed0b..abe117466 100644 --- a/.jenkins/build.sh +++ b/.jenkins/build.sh @@ -65,6 +65,7 @@ build() { # Set argument and environment variables. local job_name=$JOB_BASE_NAME + local build_type=$BUILD_TYPE local build_number=$BUILD_NUMBER local git_hash=$(echo $GIT_COMMIT | cut -c1-7) local arch=$1 @@ -117,8 +118,7 @@ build() { echo [-] Switching to MSYSTEM [$msys] cd "$cwd" CHERE_INVOKING=yes MSYSTEM=$msys JOB_BASE_NAME=$JOB_BASE_NAME BUILD_TYPE=$BUILD_TYPE BUILD_NUMBER=$BUILD_NUMBER GIT_COMMIT=$GIT_COMMIT \ - bash -lc '"'$0'" -b "'$arch'" '$cmake_flags - return $? + bash -lc '"'$0'" -b "'$arch'" '$cmake_flags && job_exit=0 fi else echo [!] No MSYSTEM for architecture [$arch] @@ -211,8 +211,12 @@ EOF *) local cmake_flags_extra="$cmake_flags_extra -D DYNAREC=OFF";; esac + # Determine additional CMake flags. + [ ! -z "$build_type" ] && local cmake_flags_extra="$cmake_flags_extra -D BUILD_TYPE=\"$build_type\"" + [ ! -z "$build_qualifier" ] && local cmake_flags_extra="$cmake_flags_extra -D EMU_BUILD=\"$build_qualifier\"" + [ ! -z "$git_hash" ] && local cmake_flags_extra="$cmake_flags_extra -D EMU_GIT_HASH=\"$git_hash\"" + # Run CMake. - cmake_flags_extra="$cmake_flags_extra -D BUILD_TYPE=\"$BUILD_TYPE\" -D EMU_BUILD=\"$build_qualifier\" -D EMU_GIT_HASH=\"$git_hash\"" echo [-] Running CMake with flags [$cmake_flags $cmake_flags_extra] eval cmake -G \"Unix Makefiles\" $cmake_flags $cmake_flags_extra . local status=$? @@ -334,7 +338,7 @@ EOF # All good. echo [-] Build of [$job_name] [$build_number] [$git_hash] for [$arch] with flags [$cmake_flags] successful - export job_exit=0 + job_exit=0 } # Set common variables. From 786b294bb09b00dbbfb80d227c680a686e901c58 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 8 Nov 2021 23:35:42 -0300 Subject: [PATCH 19/62] Re-add missing return statement --- .jenkins/build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.jenkins/build.sh b/.jenkins/build.sh index abe117466..f56152dd0 100644 --- a/.jenkins/build.sh +++ b/.jenkins/build.sh @@ -119,6 +119,7 @@ build() { cd "$cwd" CHERE_INVOKING=yes MSYSTEM=$msys JOB_BASE_NAME=$JOB_BASE_NAME BUILD_TYPE=$BUILD_TYPE BUILD_NUMBER=$BUILD_NUMBER GIT_COMMIT=$GIT_COMMIT \ bash -lc '"'$0'" -b "'$arch'" '$cmake_flags && job_exit=0 + return $? fi else echo [!] No MSYSTEM for architecture [$arch] From e0c2d2f30bba6215475c7f22fb30da1d9fc30ed8 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 8 Nov 2021 23:36:49 -0300 Subject: [PATCH 20/62] Use exec when jumping between MSYSTEMs to preserve exit code --- .jenkins/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.jenkins/build.sh b/.jenkins/build.sh index f56152dd0..db71e3e98 100644 --- a/.jenkins/build.sh +++ b/.jenkins/build.sh @@ -118,7 +118,7 @@ build() { echo [-] Switching to MSYSTEM [$msys] cd "$cwd" CHERE_INVOKING=yes MSYSTEM=$msys JOB_BASE_NAME=$JOB_BASE_NAME BUILD_TYPE=$BUILD_TYPE BUILD_NUMBER=$BUILD_NUMBER GIT_COMMIT=$GIT_COMMIT \ - bash -lc '"'$0'" -b "'$arch'" '$cmake_flags && job_exit=0 + bash -lc 'exec "'$0'" -b "'$arch'" '$cmake_flags && job_exit=0 # make sure the main script exits cleanly on any success return $? fi else From 02df33d1aae945e10c9ba2d09bff8502aa5f9b4c Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Mon, 8 Nov 2021 23:54:41 -0300 Subject: [PATCH 21/62] Change some dynamically loaded library names to reflect the new build infrastructure --- src/printer/prt_escp.c | 2 +- src/printer/prt_ps.c | 12 ++++++++---- src/sound/midi_fluidsynth.c | 6 +++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/printer/prt_escp.c b/src/printer/prt_escp.c index 8e490e9e1..1cd3b8ebe 100644 --- a/src/printer/prt_escp.c +++ b/src/printer/prt_escp.c @@ -87,7 +87,7 @@ #ifdef _WIN32 -# define PATH_FREETYPE_DLL "freetype.dll" +# define PATH_FREETYPE_DLL "libfreetype-6.dll" #else # define PATH_FREETYPE_DLL "libfreetype.so.6" #endif diff --git a/src/printer/prt_ps.c b/src/printer/prt_ps.c index 5f16784cb..73bd56b63 100644 --- a/src/printer/prt_ps.c +++ b/src/printer/prt_ps.c @@ -44,11 +44,15 @@ #define gs_error_Quit -101 #ifdef _WIN32 -#define PATH_GHOSTSCRIPT_DLL "gsdll32.dll" +#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)) +# define PATH_GHOSTSCRIPT_DLL "gsdll32.dll" +#else +# define PATH_GHOSTSCRIPT_DLL "gsdll64.dll" +#endif #elif defined __APPLE__ #define PATH_GHOSTSCRIPT_DLL "libgs.dylib" #else -#define PATH_GHOSTSCRIPT_DLL "libgs.so" +#define PATH_GHOSTSCRIPT_DLL "libgs.so.9" #endif #define POSTSCRIPT_BUFFER_LENGTH 65536 @@ -344,8 +348,6 @@ ps_init(void *lpt) dev->ctrl = 0x04; dev->lpt = lpt; - reset_ps(dev); - /* Try loading the DLL. */ ghostscript_handle = dynld_module(PATH_GHOSTSCRIPT_DLL, ghostscript_imports); if (ghostscript_handle == NULL) @@ -369,6 +371,8 @@ ps_init(void *lpt) timer_add(&dev->pulse_timer, pulse_timer, dev, 0); timer_add(&dev->timeout_timer, timeout_timer, dev, 0); + reset_ps(dev); + return(dev); } diff --git a/src/sound/midi_fluidsynth.c b/src/sound/midi_fluidsynth.c index 874d328f3..283188fef 100644 --- a/src/sound/midi_fluidsynth.c +++ b/src/sound/midi_fluidsynth.c @@ -224,11 +224,15 @@ void* fluidsynth_init(const device_t *info) /* Try loading the DLL. */ #ifdef _WIN32 +# if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)) fluidsynth_handle = dynld_module("libfluidsynth.dll", fluidsynth_imports); +# else + fluidsynth_handle = dynld_module("libfluidsynth64.dll", fluidsynth_imports); +# endif #elif defined __APPLE__ fluidsynth_handle = dynld_module("libfluidsynth.dylib", fluidsynth_imports); #else - fluidsynth_handle = dynld_module("libfluidsynth.so", fluidsynth_imports); + fluidsynth_handle = dynld_module("libfluidsynth.so.3", fluidsynth_imports); #endif if (fluidsynth_handle == NULL) { From 485403ac65c70a9baf8324feae0472117fd112a9 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 10 Nov 2021 15:37:12 -0300 Subject: [PATCH 22/62] Fix TGUI DDC read bug --- src/video/vid_tgui9440.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/video/vid_tgui9440.c b/src/video/vid_tgui9440.c index 6c4faf170..04ff8b1d5 100644 --- a/src/video/vid_tgui9440.c +++ b/src/video/vid_tgui9440.c @@ -606,15 +606,17 @@ tgui_in(uint16_t addr, void *p) return svga->crtcreg; case 0x3D5: temp = svga->crtc[svga->crtcreg]; - if (!(svga->crtc[0x37] & 0x04)) { - temp &= 0xfd; - if (i2c_gpio_get_scl(tgui->i2c)) - temp |= 0x02; - } - if (!(svga->crtc[0x37] & 0x08)) { - temp &= 0xfe; - if (i2c_gpio_get_sda(tgui->i2c)) - temp |= 0x01; + if (svga->crtcreg == 0x37) { + if (!(temp & 0x04)) { + temp &= ~0x02; + if (i2c_gpio_get_scl(tgui->i2c)) + temp |= 0x02; + } + if (!(temp & 0x08)) { + temp &= ~0x01; + if (i2c_gpio_get_sda(tgui->i2c)) + temp |= 0x01; + } } return temp; case 0x3d8: From ab0a8fa4f864a3a3064361d10b984262a904ca1b Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 10 Nov 2021 15:40:19 -0300 Subject: [PATCH 23/62] Rename .jenkins to a more generic .ci --- {.jenkins => .ci}/Jenkinsfile | 4 ++-- {.jenkins => .ci}/build.sh | 12 ++++++------ {.jenkins => .ci}/static2dll.sh | 0 3 files changed, 8 insertions(+), 8 deletions(-) rename {.jenkins => .ci}/Jenkinsfile (93%) rename {.jenkins => .ci}/build.sh (98%) rename {.jenkins => .ci}/static2dll.sh (100%) diff --git a/.jenkins/Jenkinsfile b/.ci/Jenkinsfile similarity index 93% rename from .jenkins/Jenkinsfile rename to .ci/Jenkinsfile index a1b24438d..106fdfffd 100644 --- a/.jenkins/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -23,11 +23,11 @@ def gitClone() { } def windowsBuild() { - bat 'C:\\msys64\\msys2_shell.cmd -msys2 -defterm -here -no-start -c "exec .jenkins/build.sh"' + bat 'C:\\msys64\\msys2_shell.cmd -msys2 -defterm -here -no-start -c "exec .ci/build.sh"' } def unixBuild() { - sh 'chmod u+x .jenkins/build.sh && .jenkins/build.sh' + sh 'chmod u+x .ci/build.sh && .ci/build.sh' } def saveArtifacts() { diff --git a/.jenkins/build.sh b/.ci/build.sh similarity index 98% rename from .jenkins/build.sh rename to .ci/build.sh index db71e3e98..ddd90d6b8 100644 --- a/.jenkins/build.sh +++ b/.ci/build.sh @@ -259,7 +259,7 @@ EOF [ "$arch" = "32" -a -d "/c/Program Files (x86)" ] && pf="/c/Program Files (x86)" # Archive freetype from local MSYS installation. - ./.jenkins/static2dll.sh -p freetype2 /$MSYSTEM/lib/libfreetype.a archive_tmp/libfreetype-6.dll + .ci/static2dll.sh -p freetype2 /$MSYSTEM/lib/libfreetype.a archive_tmp/libfreetype-6.dll # Archive Ghostscript DLL from local official distribution installation. for gs in "$pf"/gs/gs*.*.* @@ -268,9 +268,9 @@ EOF done # Archive Discord Game SDK DLL from their CDN. - discordarch= - [ "$arch" = "32" ] && discordarch=x86 - [ "$arch" = "64" ] && discordarch=x86_64 + local discordarch= + [ "$arch" = "32" ] && local discordarch=x86 + [ "$arch" = "64" ] && local discordarch=x86_64 if [ ! -z "$discordarch" ] then [ ! -e "discord_game_sdk.zip" ] && wget -qOdiscord_game_sdk.zip https://dl-game-sdk.discordapp.net/2.5.6/discord_game_sdk.zip @@ -282,7 +282,7 @@ EOF # Archive executable. mv "$build_dir"/src/$project.exe archive_tmp/ - status=$? + local status=$? elif is_mac then # TBD @@ -301,7 +301,7 @@ EOF # Archive executable. mv "$build_dir"/src/$project archive_tmp/ - status=$? + local status=$? fi # Check if the executable move succeeded. diff --git a/.jenkins/static2dll.sh b/.ci/static2dll.sh similarity index 100% rename from .jenkins/static2dll.sh rename to .ci/static2dll.sh From d65cfe1f502483e97ab0c2981ea9c8bf90365c23 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 10 Nov 2021 19:03:13 -0300 Subject: [PATCH 24/62] Machine fixes, renames and such --- src/config.c | 8 ++++ src/include/86box/machine.h | 22 ++++----- src/machine/m_at_slot1.c | 6 +-- src/machine/m_at_socket370.c | 6 +-- src/machine/m_at_socket4_5.c | 65 ------------------------- src/machine/m_at_socket7.c | 92 +++++++++++++++++++++++++++++------- src/machine/m_at_socket8.c | 2 +- src/machine/machine_table.c | 26 +++++----- 8 files changed, 115 insertions(+), 112 deletions(-) diff --git a/src/config.c b/src/config.c index 7323b6a81..ce6b1a33c 100644 --- a/src/config.c +++ b/src/config.c @@ -638,6 +638,14 @@ load_machine(void) machine = machine_get_machine_from_internal_name("m30015"); else if (! strcmp(p, "cbm_sl386sx25")) machine = machine_get_machine_from_internal_name("cmdsl386sx25"); + else if (! strcmp(p, "mr586")) + machine = machine_get_machine_from_internal_name("p54tp4xe_mr"); + else if (! strcmp(p, "pcv240")) + machine = machine_get_machine_from_internal_name("pcv90"); + else if (! strcmp(p, "tsunamiatx")) + machine = machine_get_machine_from_internal_name("s1846"); + else if (! strcmp(p, "trinity371")) + machine = machine_get_machine_from_internal_name("s1857"); else if (! strcmp(p, "award386dx")) /* ...merged machines... */ machine = machine_get_machine_from_internal_name("award486"); else if (! strcmp(p, "ami386dx")) diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 50cedccca..f87dc277b 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -404,12 +404,10 @@ extern int machine_at_plato_init(const machine_t *); extern int machine_at_ambradp90_init(const machine_t *); extern int machine_at_430nx_init(const machine_t *); -extern int machine_at_p54tp4xe_init(const machine_t *); extern int machine_at_endeavor_init(const machine_t *); extern int machine_at_zappa_init(const machine_t *); extern int machine_at_mb500n_init(const machine_t *); extern int machine_at_apollo_init(const machine_t *); -extern int machine_at_vectra54_init(const machine_t *); extern int machine_at_powermatev_init(const machine_t *); extern int machine_at_acerv30_init(const machine_t *); @@ -421,7 +419,6 @@ extern int machine_at_hot539_init(const machine_t *); #ifdef EMU_DEVICE_H extern const device_t *at_endeavor_get_device(void); -#define at_vectra54_get_device at_endeavor_get_device extern const device_t *at_pb520r_get_device(void); extern const device_t *at_thor_get_device(void); #endif @@ -430,7 +427,8 @@ extern const device_t *at_thor_get_device(void); extern int machine_at_ap5s_init(const machine_t *); extern int machine_at_chariot_init(const machine_t *); -extern int machine_at_mr586_init(const machine_t *); +extern int machine_at_p54tp4xe_init(const machine_t *); +extern int machine_at_p54tp4xe_mr_init(const machine_t *); extern int machine_at_thor_init(const machine_t *); extern int machine_at_gw2katx_init(const machine_t *); extern int machine_at_mrthor_init(const machine_t *); @@ -445,7 +443,7 @@ extern int machine_at_8500tuc_init(const machine_t *); extern int machine_at_m7shi_init(const machine_t *); extern int machine_at_tc430hx_init(const machine_t *); extern int machine_at_equium5200_init(const machine_t *); -extern int machine_at_pcv240_init(const machine_t *); +extern int machine_at_pcv90_init(const machine_t *); extern int machine_at_p65up5_cp55t2d_init(const machine_t *); extern int machine_at_mb520n_init(const machine_t *); @@ -478,12 +476,14 @@ extern int machine_at_ms5164_init(const machine_t *); #endif extern int machine_at_ficva502_init(const machine_t *); - extern int machine_at_ficpa2012_init(const machine_t *); +extern int machine_at_vectra54_init(const machine_t *); + #ifdef EMU_DEVICE_H extern const device_t *at_thor_get_device(void); extern const device_t *at_pb640_get_device(void); +#define at_vectra54_get_device at_endeavor_get_device #endif /* m_at_super7_ss7.c */ @@ -501,7 +501,7 @@ extern int machine_at_v60n_init(const machine_t *); extern int machine_at_vs440fx_init(const machine_t *); extern int machine_at_ap440fx_init(const machine_t *); extern int machine_at_mb600n_init(const machine_t *); -extern int machine_at_8500ttc_init(const machine_t *); +extern int machine_at_8600ttc_init(const machine_t *); extern int machine_at_m6mi_init(const machine_t *); #ifdef EMU_DEVICE_H extern void machine_at_p65up5_common_init(const machine_t *, const device_t *northbridge); @@ -523,7 +523,7 @@ extern int machine_at_bf6_init(const machine_t *); extern int machine_at_ax6bc_init(const machine_t *); extern int machine_at_atc6310bxii_init(const machine_t *); extern int machine_at_686bx_init(const machine_t *); -extern int machine_at_tsunamiatx_init(const machine_t *); +extern int machine_at_s1846_init(const machine_t *); extern int machine_at_p6sba_init(const machine_t *); #if defined(DEV_BRANCH) && defined(NO_SIO) extern int machine_at_ergox365_init(const machine_t *); @@ -538,7 +538,7 @@ extern int machine_at_borapro_init(const machine_t *); extern int machine_at_ms6168_init(const machine_t *); #ifdef EMU_DEVICE_H -extern const device_t *at_tsunamiatx_get_device(void); +extern const device_t *at_s1846_get_device(void); #endif /* m_at_slot2.c */ @@ -553,13 +553,13 @@ extern int machine_at_cubx_init(const machine_t *); extern int machine_at_atc7020bxii_init(const machine_t *); extern int machine_at_ambx133_init(const machine_t *); extern int machine_at_awo671r_init(const machine_t *); -extern int machine_at_63a_init(const machine_t *); +extern int machine_at_63a1_init(const machine_t *); extern int machine_at_s370sba_init(const machine_t *); extern int machine_at_apas3_init(const machine_t *); extern int machine_at_gt694va_init(const machine_t *); extern int machine_at_cuv4xls_init(const machine_t *); extern int machine_at_6via90ap_init(const machine_t *); -extern int machine_at_trinity371_init(const machine_t *); +extern int machine_at_s1857_init(const machine_t *); extern int machine_at_p6bap_init(const machine_t *); /* m_at_misc.c */ diff --git a/src/machine/m_at_slot1.c b/src/machine/m_at_slot1.c index c69226ebc..050ea233c 100644 --- a/src/machine/m_at_slot1.c +++ b/src/machine/m_at_slot1.c @@ -444,11 +444,11 @@ machine_at_p6sba_init(const machine_t *model) int -machine_at_tsunamiatx_init(const machine_t *model) +machine_at_s1846_init(const machine_t *model) { int ret; - ret = bios_load_linear("roms/machines/tsunamiatx/bx46200f.rom", + ret = bios_load_linear("roms/machines/s1846/bx46200f.rom", 0x000c0000, 262144, 0); if (bios_only || !ret) @@ -484,7 +484,7 @@ machine_at_tsunamiatx_init(const machine_t *model) const device_t * -at_tsunamiatx_get_device(void) +at_s1846_get_device(void) { return &es1371_onboard_device; } diff --git a/src/machine/m_at_socket370.c b/src/machine/m_at_socket370.c index 4d8b5c5a5..8a2605145 100644 --- a/src/machine/m_at_socket370.c +++ b/src/machine/m_at_socket370.c @@ -76,11 +76,11 @@ machine_at_s370slm_init(const machine_t *model) int -machine_at_trinity371_init(const machine_t *model) +machine_at_s1857_init(const machine_t *model) { int ret; - ret = bios_load_linear("roms/machines/trinity371/BX57200A.ROM", + ret = bios_load_linear("roms/machines/s1857/BX57200A.ROM", 0x000c0000, 262144, 0); if (bios_only || !ret) @@ -278,7 +278,7 @@ machine_at_awo671r_init(const machine_t *model) int -machine_at_63a_init(const machine_t *model) +machine_at_63a1_init(const machine_t *model) { int ret; diff --git a/src/machine/m_at_socket4_5.c b/src/machine/m_at_socket4_5.c index 00dc7274e..c876844ad 100644 --- a/src/machine/m_at_socket4_5.c +++ b/src/machine/m_at_socket4_5.c @@ -468,37 +468,6 @@ machine_at_430nx_init(const machine_t *model) } -int -machine_at_p54tp4xe_init(const machine_t *model) -{ - int ret; - - ret = bios_load_linear("roms/machines/p54tp4xe/t15i0302.awd", - 0x000e0000, 131072, 0); - - if (bios_only || !ret) - return ret; - - machine_at_common_init(model); - - /* Award BIOS, SMC FDC37C665. */ - pci_init(PCI_CONFIG_TYPE_1); - pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4); - pci_register_slot(0x0B, PCI_CARD_NORMAL, 2, 3, 4, 1); - pci_register_slot(0x0A, PCI_CARD_NORMAL, 3, 4, 1, 2); - pci_register_slot(0x09, PCI_CARD_NORMAL, 4, 1, 2, 3); - pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); - device_add(&keyboard_ps2_pci_device); - device_add(&i430fx_device); - device_add(&piix_device); - device_add(&fdc37c665_device); - device_add(&intel_flash_bxt_device); - - return ret; -} - - int machine_at_endeavor_init(const machine_t *model) { @@ -631,40 +600,6 @@ machine_at_apollo_init(const machine_t *model) } -int -machine_at_vectra54_init(const machine_t *model) -{ - int ret; - - ret = bios_load_linear("roms/machines/vectra54/GT0724.22", - 0x000e0000, 131072, 0); - - if (bios_only || !ret) - return ret; - - machine_at_common_init_ex(model, 2); - - pci_init(PCI_CONFIG_TYPE_1); - pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x0F, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x0D, PCI_CARD_VIDEO, 0, 0, 0, 0); - pci_register_slot(0x06, PCI_CARD_NORMAL, 1, 2, 3, 4); - pci_register_slot(0x07, PCI_CARD_NORMAL, 2, 3, 4, 1); - pci_register_slot(0x08, PCI_CARD_NORMAL, 3, 4, 1, 2); - - if (gfxcard == VID_INTERNAL) - device_add(&s3_phoenix_trio64_onboard_pci_device); - - device_add(&keyboard_ps2_ami_pci_device); - device_add(&i430fx_device); - device_add(&piix_device); - device_add(&fdc37c931apm_device); - device_add(&sst_flash_29ee010_device); - - return ret; -} - - int machine_at_powermatev_init(const machine_t *model) { diff --git a/src/machine/m_at_socket7.c b/src/machine/m_at_socket7.c index 2edf96595..967aa024e 100644 --- a/src/machine/m_at_socket7.c +++ b/src/machine/m_at_socket7.c @@ -104,17 +104,10 @@ machine_at_chariot_init(const machine_t *model) return ret; } -int -machine_at_mr586_init(const machine_t *model) + +static void +machine_at_p54tp4xe_common_init(const machine_t *model) { - int ret; - - ret = bios_load_linear("roms/machines/mr586/TRITON.BIO", - 0x000e0000, 131072, 0); - - if (bios_only || !ret) - return ret; - machine_at_common_init(model); pci_init(PCI_CONFIG_TYPE_1); @@ -130,10 +123,43 @@ machine_at_mr586_init(const machine_t *model) device_add(&keyboard_ps2_ami_pci_device); device_add(&fdc37c665_device); device_add(&intel_flash_bxt_device); +} + + +int +machine_at_p54tp4xe_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear("roms/machines/p54tp4xe/t15i0302.awd", + 0x000e0000, 131072, 0); + + if (bios_only || !ret) + return ret; + + machine_at_p54tp4xe_common_init(model); return ret; } + +int +machine_at_p54tp4xe_mr_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear("roms/machines/p54tp4xe_mr/TRITON.BIO", + 0x000e0000, 131072, 0); + + if (bios_only || !ret) + return ret; + + machine_at_p54tp4xe_common_init(model); + + return ret; +} + + static void machine_at_thor_common_init(const machine_t *model, int mr) { @@ -531,15 +557,15 @@ machine_at_equium5200_init(const machine_t *model) // Information about that mac } int -machine_at_pcv240_init(const machine_t *model) +machine_at_pcv90_init(const machine_t *model) { int ret; - ret = bios_load_linear_combined2("roms/machines/pcv240/1010DD04.BIO", - "roms/machines/pcv240/1010DD04.BI1", - "roms/machines/pcv240/1010DD04.BI2", - "roms/machines/pcv240/1010DD04.BI3", - "roms/machines/pcv240/1010DD04.RCV", + ret = bios_load_linear_combined2("roms/machines/pcv90/1010DD04.BIO", + "roms/machines/pcv90/1010DD04.BI1", + "roms/machines/pcv90/1010DD04.BI2", + "roms/machines/pcv90/1010DD04.BI3", + "roms/machines/pcv90/1010DD04.RCV", 0x3a000, 128); if (bios_only || !ret) @@ -1312,3 +1338,37 @@ machine_at_ficpa2012_init(const machine_t *model) return ret; } + + +int +machine_at_vectra54_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear("roms/machines/vectra54/GT0724.22", + 0x000e0000, 131072, 0); + + if (bios_only || !ret) + return ret; + + machine_at_common_init_ex(model, 2); + + pci_init(PCI_CONFIG_TYPE_1); + pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x0F, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x0D, PCI_CARD_VIDEO, 0, 0, 0, 0); + pci_register_slot(0x06, PCI_CARD_NORMAL, 1, 2, 3, 4); + pci_register_slot(0x07, PCI_CARD_NORMAL, 2, 3, 4, 1); + pci_register_slot(0x08, PCI_CARD_NORMAL, 3, 4, 1, 2); + + if (gfxcard == VID_INTERNAL) + device_add(&s3_phoenix_trio64_onboard_pci_device); + + device_add(&keyboard_ps2_ami_pci_device); + device_add(&i430fx_device); + device_add(&piix_device); + device_add(&fdc37c931apm_device); + device_add(&sst_flash_29ee010_device); + + return ret; +} diff --git a/src/machine/m_at_socket8.c b/src/machine/m_at_socket8.c index 318e8dfea..659608078 100644 --- a/src/machine/m_at_socket8.c +++ b/src/machine/m_at_socket8.c @@ -228,7 +228,7 @@ machine_at_ap440fx_init(const machine_t *model) } int -machine_at_8500ttc_init(const machine_t *model) +machine_at_8600ttc_init(const machine_t *model) { int ret; diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 9dd5db1fa..03a3e01d6 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -268,8 +268,8 @@ const machine_t machines[] = { /* OPTi 596/597 */ { "[OPTi 597] AMI Excalibur VLB", "excalibur", MACHINE_TYPE_SOCKET4, CPU_PKG_SOCKET4, 0, 60000000, 66666667, 5000, 5000, MACHINE_MULTIPLIER_FIXED, MACHINE_VLB | MACHINE_IDE, 2048, 65536, 2048, 127, machine_at_excalibur_init, NULL }, - /* SiS 85C50x */ - { "[SiS 85C50x] ASUS PCI/I-P5SP4", "p5sp4", MACHINE_TYPE_SOCKET4, CPU_PKG_SOCKET4, 0, 60000000, 66666667, 5000, 5000, MACHINE_MULTIPLIER_FIXED, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_p5sp4_init, NULL }, + /* SiS 85C501/503 */ + { "[SiS 501] ASUS PCI/I-P5SP4", "p5sp4", MACHINE_TYPE_SOCKET4, CPU_PKG_SOCKET4, 0, 60000000, 66666667, 5000, 5000, MACHINE_MULTIPLIER_FIXED, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_p5sp4_init, NULL }, /* Socket 5 machines */ /* 430NX */ @@ -280,7 +280,6 @@ const machine_t machines[] = { /* 430FX */ { "[i430FX] Acer V30", "acerv30", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 2.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_acerv30_init, NULL }, { "[i430FX] AMI Apollo", "apollo", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 2.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_apollo_init, NULL }, - { "[i430FX] HP Vectra VL 5 Series 4", "vectra54", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 2.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 511, machine_at_vectra54_init, at_vectra54_get_device }, { "[i430FX] Intel Advanced/ZP", "zappa", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 2.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_zappa_init, NULL }, { "[i430FX] NEC PowerMate V", "powermatev", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 2.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_powermatev_init, NULL }, { "[i430FX] PC Partner MB500N", "mb500n", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_mb500n_init, NULL }, @@ -292,18 +291,19 @@ const machine_t machines[] = { { "[OPTi 597] Shuttle HOT-543", "hot543", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3520, 3520, 1.5, 1.5, MACHINE_PCI | MACHINE_VLB, 8192, 131072, 8192, 127, machine_at_hot543_init, NULL }, { "[OPTi 597] Supermicro P54VL-PCI", "p54vl", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, 0, 60000000, 66666667, 3520, 3520, 1.5, 1.5, MACHINE_PCI | MACHINE_VLB, 8192, 131072, 8192, 127, machine_at_p54vl_init, NULL }, - /* SiS 85C50x */ - { "[SiS 85C50x] ASUS PCI/I-P54SP4", "p54sp4", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, CPU_BLOCK(CPU_K5, CPU_5K86), 40000000, 66666667, 3380, 3520, 1.5, 1.5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_p54sp4_init, NULL }, - { "[SiS 85C50x] BCM SQ-588", "sq588", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, CPU_BLOCK(CPU_PENTIUMMMX), 50000000, 66666667, 3520, 3520, 1.5, 1.5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_sq588_init, NULL }, + /* SiS 85C501/503 */ + { "[SiS 501] ASUS PCI/I-P54SP4", "p54sp4", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, CPU_BLOCK(CPU_K5, CPU_5K86), 40000000, 66666667, 3380, 3520, 1.5, 1.5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_p54sp4_init, NULL }, + { "[SiS 501] BCM SQ-588", "sq588", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, CPU_BLOCK(CPU_PENTIUMMMX), 50000000, 66666667, 3520, 3520, 1.5, 1.5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_sq588_init, NULL }, /* UMC 889x */ - { "[UMC 889x] Shuttle HOT-539", "hot539", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, CPU_BLOCK(CPU_K5, CPU_5K86), 40000000, 66666667, 3380, 3600, 1.5, 2.0, MACHINE_PCI | MACHINE_IDE_DUAL, 8192, 262144, 8192, 127, machine_at_hot539_init, NULL }, + { "[UMC 8890] Shuttle HOT-539", "hot539", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, CPU_BLOCK(CPU_K5, CPU_5K86), 40000000, 66666667, 3380, 3600, 1.5, 2.0, MACHINE_PCI | MACHINE_IDE_DUAL, 8192, 262144, 8192, 127, machine_at_hot539_init, NULL }, /* Socket 7 (Single Voltage) machines */ /* 430FX */ { "[i430FX] ASUS P/I-P54TP4XE", "p54tp4xe", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3600, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_p54tp4xe_init, NULL }, - { "[i430FX] ASUS P/I-P54TP4XE (MR BIOS)", "mr586", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3600, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_mr586_init, NULL }, + { "[i430FX] ASUS P/I-P54TP4XE (MR BIOS)", "p54tp4xe_mr", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3600, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_p54tp4xe_mr_init, NULL }, { "[i430FX] Gateway 2000 Thor", "gw2katx", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 127, machine_at_gw2katx_init, NULL }, + { "[i430FX] HP Vectra VL 5 Series 4", "vectra54", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 2.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 511, machine_at_vectra54_init, at_vectra54_get_device }, { "[i430FX] Intel Advanced/ATX", "thor", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 127, machine_at_thor_init, NULL }, { "[i430FX] Intel Advanced/ATX (MR BIOS)", "mrthor", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 127, machine_at_mrthor_init, NULL }, { "[i430FX] Intel Advanced/EV", "endeavor", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 127, machine_at_endeavor_init, at_endeavor_get_device }, @@ -329,7 +329,7 @@ const machine_t machines[] = { { "[i430HX] Micronics M7S-Hi", "m7shi", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 2800, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 511, machine_at_m7shi_init, NULL }, { "[i430HX] Intel TC430HX", "tc430hx", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 2800, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 255, machine_at_tc430hx_init, NULL }, { "[i430HX] Toshiba Equium 5200D", "equium5200", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 2800, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 196608, 8192, 127, machine_at_equium5200_init, NULL }, - { "[i430HX] Sony Vaio PCV-240", "pcv240", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 2800, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 196608, 8192, 127, machine_at_pcv240_init, NULL }, + { "[i430HX] Sony Vaio PCV-90", "pcv90", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 2800, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 196608, 8192, 127, machine_at_pcv90_init, NULL }, { "[i430HX] ASUS P/I-P65UP5 (C-P55T2D)", "p65up5_cp55t2d", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 2500, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 524288, 8192, 127, machine_at_p65up5_cp55t2d_init, NULL }, /* 430VX */ @@ -385,7 +385,7 @@ const machine_t machines[] = { /* 440FX */ { "[i440FX] Acer V60N", "v60n", MACHINE_TYPE_SOCKET8, CPU_PKG_SOCKET8, 0, 60000000, 66666667, 2500, 3500, 1.5, 8.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 524288, 8192, 127, machine_at_v60n_init, NULL }, { "[i440FX] ASUS P/I-P65UP5 (C-P6ND)", "p65up5_cp6nd", MACHINE_TYPE_SOCKET8, CPU_PKG_SOCKET8, 0, 60000000, 66666667, 2100, 3500, 1.5, 8.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1048576, 8192, 127, machine_at_p65up5_cp6nd_init, NULL }, - { "[i440FX] Biostar MB-8600TTC", "8600ttc", MACHINE_TYPE_SOCKET8, CPU_PKG_SOCKET8, 0, 50000000, 66666667, 2900, 3300, 2.0, 5.5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1048576, 8192, 127, machine_at_8500ttc_init, NULL }, + { "[i440FX] Biostar MB-8600TTC", "8600ttc", MACHINE_TYPE_SOCKET8, CPU_PKG_SOCKET8, 0, 50000000, 66666667, 2900, 3300, 2.0, 5.5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1048576, 8192, 127, machine_at_8600ttc_init, NULL }, { "[i440FX] Gigabyte GA-686NX", "686nx", MACHINE_TYPE_SOCKET8, CPU_PKG_SOCKET8, 0, 60000000, 66666667, 2100, 3500, 2.0, 5.5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 524288, 8192, 127, machine_at_686nx_init, NULL }, { "[i440FX] Intel AP440FX", "ap440fx", MACHINE_TYPE_SOCKET8, CPU_PKG_SOCKET8, 0, 60000000, 66666667, 2100, 3500, 2.0, 3.5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_ap440fx_init, NULL }, { "[i440FX] Intel VS440FX", "vs440fx", MACHINE_TYPE_SOCKET8, CPU_PKG_SOCKET8, 0, 60000000, 66666667, 2100, 3500, 2.0, 3.5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 524288, 8192, 127, machine_at_vs440fx_init, NULL }, @@ -411,7 +411,7 @@ const machine_t machines[] = { { "[i440BX] AOpen AX6BC", "ax6bc", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 112121212, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_ax6bc_init, NULL }, { "[i440BX] Gigabyte GA-686BX", "686bx", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1048576, 8192, 255, machine_at_686bx_init, NULL }, { "[i440BX] HP Vectra VEi 8", "vei8", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1048576, 8192, 255, machine_at_vei8_init, NULL }, - { "[i440BX] Tyan Tsunami ATX", "tsunamiatx", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 112121212, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_SOUND, 8192,1048576, 8192, 255, machine_at_tsunamiatx_init, at_tsunamiatx_get_device }, + { "[i440BX] Tyan Tsunami ATX", "s1846", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 112121212, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_SOUND, 8192,1048576, 8192, 255, machine_at_s1846_init, at_s1846_get_device }, { "[i440BX] SuperMicro Super P6SBA", "p6sba", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_p6sba_init, NULL }, #if defined(DEV_BRANCH) && defined(NO_SIO) { "[i440BX] Fujitsu ErgoPro x365", "ergox365", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 393216, 8192, 511, machine_at_ergox365_init, NULL }, @@ -446,10 +446,10 @@ const machine_t machines[] = { { "[i440BX] AEWIN AW-O671R", "awo671r", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, /* limits assumed */ MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 524288, 8192, 255, machine_at_awo671r_init, NULL }, { "[i440BX] ASUS CUBX", "cubx", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 150000000, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1048576, 8192, 255, machine_at_cubx_init, NULL }, { "[i440BX] AmazePC AM-BX133", "ambx133", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, /* limits assumed */ MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_ambx133_init, NULL }, - { "[i440BX] Tyan Trinity 371", "trinity371", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_trinity371_init, NULL }, + { "[i440BX] Tyan Trinity 371", "s1857", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_s1857_init, NULL }, /* 440ZX */ - { "[i440ZX] Soltek SL-63A1", "63a", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 524288, 8192, 255, machine_at_63a_init, NULL }, + { "[i440ZX] Soltek SL-63A1", "63a1", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 524288, 8192, 255, machine_at_63a1_init, NULL }, /* SMSC VictoryBX-66 */ { "[SMSC VictoryBX-66] A-Trend ATC7020BXII","atc7020bxii", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1048576, 8192, 255, machine_at_atc7020bxii_init, NULL }, From 724accd16717697def5bd14499cfbbc337488c3a Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 10 Nov 2021 21:14:54 -0300 Subject: [PATCH 25/62] Add AGP GART implementation --- src/chipset/intel_4x0.c | 34 +++++- src/chipset/via_apollo.c | 39 ++++++- src/include/86box/video.h | 6 + src/video/CMakeLists.txt | 2 +- src/video/agpgart.c | 193 +++++++++++++++++++++++++++++++++ src/video/vid_voodoo_banshee.c | 114 +++++++++---------- src/win/Makefile.mingw | 2 +- 7 files changed, 322 insertions(+), 68 deletions(-) create mode 100644 src/video/agpgart.c diff --git a/src/chipset/intel_4x0.c b/src/chipset/intel_4x0.c index 83eabb5e8..327e89b90 100644 --- a/src/chipset/intel_4x0.c +++ b/src/chipset/intel_4x0.c @@ -29,6 +29,7 @@ #include <86box/chipset.h> #include <86box/spd.h> #include <86box/machine.h> +#include <86box/video.h> enum @@ -57,6 +58,7 @@ typedef struct uint8_t regs[256], regs_locked[256]; int type; smram_t *smram_low, *smram_high; + void *agpgart; } i4x0_t; @@ -208,14 +210,25 @@ i4x0_smram_handler_phase1(i4x0_t *dev) static void -i4x0_mask_bar(uint8_t *regs) +i4x0_mask_bar(uint8_t *regs, void *agpgart) { uint32_t bar; + /* Make sure the aperture's base is aligned to its size. */ bar = (regs[0x13] << 24) | (regs[0x12] << 16); bar &= (((uint32_t) regs[0xb4] << 22) | 0xf0000000); regs[0x12] = (bar >> 16) & 0xff; regs[0x13] = (bar >> 24) & 0xff; + + if (!agpgart) + return; + + /* Map aperture and GART. */ + agpgart_set_aperture(agpgart, + bar, + ((uint32_t) (uint8_t) (~regs[0xb4] & 0x3f) + 1) << 22, + !!(regs[0x51] & 0x02)); + agpgart_set_gart(agpgart, (regs[0xb9] << 8) | (regs[0xba] << 16) | (regs[0xbb] << 24)); } @@ -323,7 +336,7 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_440BX: case INTEL_440ZX: case INTEL_440GX: regs[0x12] = (val & 0xc0); - i4x0_mask_bar(regs); + i4x0_mask_bar(regs, dev->agpgart); break; } break; @@ -333,7 +346,7 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_440BX: case INTEL_440ZX: case INTEL_440GX: regs[0x13] = val; - i4x0_mask_bar(regs); + i4x0_mask_bar(regs, dev->agpgart); break; } break; @@ -411,15 +424,19 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) break; case INTEL_440LX: regs[0x51] = (regs[0x51] & 0x40) | (val & 0x87); + i4x0_mask_bar(regs, dev->agpgart); break; case INTEL_440EX: regs[0x51] = (val & 0x86); + i4x0_mask_bar(regs, dev->agpgart); break; case INTEL_440BX: case INTEL_440ZX: regs[0x51] = (regs[0x51] & 0x70) | (val & 0x8f); + i4x0_mask_bar(regs, dev->agpgart); break; case INTEL_440GX: regs[0x51] = (regs[0x51] & 0xb0) | (val & 0x4f); + i4x0_mask_bar(regs, dev->agpgart); break; } break; @@ -1074,7 +1091,7 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_440BX: case INTEL_440ZX: case INTEL_440GX: regs[0xb4] = (val & 0x3f); - i4x0_mask_bar(regs); + i4x0_mask_bar(regs, dev->agpgart); break; } break; @@ -1084,6 +1101,7 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_440BX: case INTEL_440ZX: case INTEL_440GX: regs[0xb9] = (val & 0xf0); + i4x0_mask_bar(regs, dev->agpgart); break; } break; @@ -1094,6 +1112,7 @@ i4x0_write(int func, int addr, uint8_t val, void *priv) case INTEL_440BX: case INTEL_440ZX: case INTEL_440GX: regs[addr] = val; + i4x0_mask_bar(regs, dev->agpgart); break; } break; @@ -1593,10 +1612,13 @@ static void pci_add_card(PCI_ADD_NORTHBRIDGE, i4x0_read, i4x0_write, dev); - if ((dev->type >= INTEL_440BX) && !(regs[0x7a] & 0x02)) + if ((dev->type >= INTEL_440BX) && !(regs[0x7a] & 0x02)) { device_add((dev->type == INTEL_440GX) ? &i440gx_agp_device : &i440bx_agp_device); - else if (dev->type >= INTEL_440LX) + dev->agpgart = device_add(&agpgart_device); + } else if (dev->type >= INTEL_440LX) { device_add(&i440lx_agp_device); + dev->agpgart = device_add(&agpgart_device); + } return dev; } diff --git a/src/chipset/via_apollo.c b/src/chipset/via_apollo.c index e2adf3657..e3475d9b8 100644 --- a/src/chipset/via_apollo.c +++ b/src/chipset/via_apollo.c @@ -33,6 +33,7 @@ #include <86box/pci.h> #include <86box/chipset.h> #include <86box/spd.h> +#include <86box/video.h> #define VIA_585 0x05851000 #define VIA_595 0x05950000 @@ -50,6 +51,7 @@ typedef struct via_apollo_t uint8_t pci_conf[256]; smram_t *smram; + void *agpgart; } via_apollo_t; @@ -86,6 +88,25 @@ apollo_smram_map(via_apollo_t *dev, int smm, uint32_t host_base, uint32_t size, } +static void +apollo_agp_map(via_apollo_t *dev) +{ + /* Make sure the aperture's base is aligned to its size. */ + dev->pci_conf[0x12] &= dev->pci_conf[0x84] << 4; + dev->pci_conf[0x13] &= 0xf0 | (dev->pci_conf[0x84] >> 4); + + if (!dev->agpgart) + return; + + /* Map aperture and GART. */ + agpgart_set_aperture(dev->agpgart, + (dev->pci_conf[0x12] << 16) | (dev->pci_conf[0x13] << 24), + ((uint32_t) (uint8_t) ~dev->pci_conf[0x84] + 1) << 20, + !!(dev->pci_conf[0x88] & 0x02)); + agpgart_set_gart(dev->agpgart, (dev->pci_conf[0x89] << 8) | (dev->pci_conf[0x8a] << 16) | (dev->pci_conf[0x8b] << 24)); +} + + static void via_apollo_setup(via_apollo_t *dev) { @@ -221,6 +242,8 @@ via_apollo_host_bridge_write(int func, int addr, uint8_t val, void *priv) ((addr >= 0xad) && (addr < 0xf0)) || ((addr >= 0xf8) && (addr < 0xfc)) || (addr == 0xfd)) return; + if (((addr == 0x12) || (addr == 0x13)) && (dev->id < VIA_597)) + return; if (((addr == 0x78) || (addr >= 0xad)) && (dev->id == VIA_597)) return; if (((addr == 0x67) || ((addr >= 0xf0) && (addr < 0xfc))) && (dev->id < VIA_691)) @@ -260,9 +283,11 @@ via_apollo_host_bridge_write(int func, int addr, uint8_t val, void *priv) break; case 0x12: /* Graphics Aperture Base */ dev->pci_conf[0x12] = (val & 0xf0); + apollo_agp_map(dev); break; case 0x13: /* Graphics Aperture Base */ dev->pci_conf[0x13] = val; + apollo_agp_map(dev); break; case 0x50: /* Cache Control 1 */ @@ -580,20 +605,23 @@ via_apollo_host_bridge_write(int func, int addr, uint8_t val, void *priv) dev->pci_conf[0x84] = val; else dev->pci_conf[0x84] = (dev->pci_conf[0x84] & ~0xf0) | (val & 0xf0); + apollo_agp_map(dev); break; case 0x88: if((dev->id == VIA_693A) || (dev->id == VIA_8601)) dev->pci_conf[0x88] = (dev->pci_conf[0x88] & ~0x06) | (val & 0x06); else dev->pci_conf[0x88] = (dev->pci_conf[0x88] & ~0x07) | (val & 0x07); + apollo_agp_map(dev); break; case 0x89: + dev->pci_conf[0x89] = val & 0xf0; + apollo_agp_map(dev); + break; case 0x8a: case 0x8b: - if((dev->id == VIA_693A) || (dev->id == VIA_8601)) - dev->pci_conf[addr] = val; - else - dev->pci_conf[0x89] = (dev->pci_conf[0x89] & ~0xf0) | (val & 0xf0); + dev->pci_conf[addr] = val; + apollo_agp_map(dev); break; case 0xa8: @@ -706,6 +734,9 @@ via_apollo_init(const device_t *info) break; } + if (dev->id >= VIA_597) + dev->agpgart = device_add(&agpgart_device); + if ((dev->id >= VIA_694) && (dev->id != VIA_8601)) dev->drb_unit = 16; else if (dev->id >= VIA_597) diff --git a/src/include/86box/video.h b/src/include/86box/video.h index 63f854fb9..263b3ff9b 100644 --- a/src/include/86box/video.h +++ b/src/include/86box/video.h @@ -193,6 +193,9 @@ extern void svga_dump_vram(void); extern uint32_t video_color_transform(uint32_t color); +extern void agpgart_set_aperture(void *handle, uint32_t base, uint32_t size, int enable); +extern void agpgart_set_gart(void *handle, uint32_t base); + #ifdef __cplusplus } #endif @@ -426,6 +429,9 @@ extern const device_t velocity_100_agp_device; /* Wyse 700 */ extern const device_t wy700_device; + +/* AGP GART */ +extern const device_t agpgart_device; #endif diff --git a/src/video/CMakeLists.txt b/src/video/CMakeLists.txt index c8cbdef62..0c3befa62 100644 --- a/src/video/CMakeLists.txt +++ b/src/video/CMakeLists.txt @@ -13,7 +13,7 @@ # Copyright 2020,2021 David Hrdlička. # -add_library(vid OBJECT video.c vid_table.c vid_cga.c vid_cga_comp.c +add_library(vid OBJECT agpgart.c video.c vid_table.c vid_cga.c vid_cga_comp.c vid_compaq_cga.c vid_mda.c vid_hercules.c vid_herculesplus.c vid_incolor.c vid_colorplus.c vid_genius.c vid_pgc.c vid_im1024.c vid_sigma.c vid_wy700.c vid_ega.c vid_ega_render.c vid_svga.c diff --git a/src/video/agpgart.c b/src/video/agpgart.c new file mode 100644 index 000000000..0bd71fa60 --- /dev/null +++ b/src/video/agpgart.c @@ -0,0 +1,193 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * AGP Graphics Address Remapping Table remapping emulation. + * + * + * + * Authors: RichardG, + * + * Copyright 2021 RichardG. + */ +#include +#include +#include +#include +#include +#define HAVE_STDARG_H +#include <86box/86box.h> +#include <86box/device.h> +#include <86box/mem.h> + + +typedef struct { + int aperture_enable; + uint32_t aperture_base, aperture_size, aperture_mask, gart_base; + mem_mapping_t aperture_mapping; +} agpgart_t; + +#define ENABLE_AGPGART_LOG 1 +#ifdef ENABLE_AGPGART_LOG +int agpgart_do_log = ENABLE_AGPGART_LOG; + +static void +agpgart_log(const char *fmt, ...) +{ + va_list ap; + + if (agpgart_do_log) { + va_start(ap, fmt); + pclog_ex(fmt, ap); + va_end(ap); + } +} +#else +#define agpgart_log(fmt, ...) +#endif + + +void +agpgart_set_aperture(void *handle, uint32_t base, uint32_t size, int enable) +{ + agpgart_t *dev = (agpgart_t *) handle; + + agpgart_log("AGP GART: set_aperture(%08X, %d, %d)\n", base, size, enable); + + /* Disable old aperture mapping. */ + mem_mapping_disable(&dev->aperture_mapping); + + /* Set new aperture base address, size and mask. */ + dev->aperture_base = base; + dev->aperture_size = size; + dev->aperture_mask = size - 1; + + /* Enable new aperture mapping if requested. */ + if (dev->aperture_base && dev->aperture_size && dev->aperture_enable) { + mem_mapping_set_addr(&dev->aperture_mapping, dev->aperture_base, dev->aperture_size); + mem_mapping_enable(&dev->aperture_mapping); + } +} + + +void +agpgart_set_gart(void *handle, uint32_t base) +{ + agpgart_t *dev = (agpgart_t *) handle; + + agpgart_log("AGP GART: set_gart(%08X)\n", base); + + /* Set GART base address. */ + dev->gart_base = base; +} + + +static uint32_t +agpgart_translate(uint32_t addr, agpgart_t *dev) +{ + /* Extract the bits we care about. */ + addr &= dev->aperture_mask; + + /* Get the GART pointer for this page. */ + register uint32_t gart_ptr = mem_readl_phys(dev->gart_base + ((addr >> 10) & 0xfffffffc)) & 0xfffff000; + + /* Return remapped address with the page offset. */ + return gart_ptr + (addr & 0x00000fff); +} + + +static uint8_t +agpgart_aperture_readb(uint32_t addr, void *priv) +{ + agpgart_t *dev = (agpgart_t *) priv; + return mem_readb_phys(agpgart_translate(addr, dev)); +} + + +static uint16_t +agpgart_aperture_readw(uint32_t addr, void *priv) +{ + agpgart_t *dev = (agpgart_t *) priv; + return mem_readw_phys(agpgart_translate(addr, dev)); +} + + +static uint32_t +agpgart_aperture_readl(uint32_t addr, void *priv) +{ + agpgart_t *dev = (agpgart_t *) priv; + return mem_readl_phys(agpgart_translate(addr, dev)); +} + + +static void +agpgart_aperture_writeb(uint32_t addr, uint8_t val, void *priv) +{ + agpgart_t *dev = (agpgart_t *) priv; + mem_writeb_phys(agpgart_translate(addr, dev), val); +} + + +static void +agpgart_aperture_writew(uint32_t addr, uint16_t val, void *priv) +{ + agpgart_t *dev = (agpgart_t *) priv; + mem_writew_phys(agpgart_translate(addr, dev), val); +} + + +static void +agpgart_aperture_writel(uint32_t addr, uint32_t val, void *priv) +{ + agpgart_t *dev = (agpgart_t *) priv; + mem_writel_phys(agpgart_translate(addr, dev), val); +} + + +static void * +agpgart_init(const device_t *info) +{ + agpgart_t *dev = malloc(sizeof(agpgart_t)); + memset(dev, 0, sizeof(agpgart_t)); + + agpgart_log("AGP GART: init()\n"); + + /* Create aperture mapping. */ + mem_mapping_add(&dev->aperture_mapping, 0, 0, + agpgart_aperture_readb, agpgart_aperture_readw, agpgart_aperture_readl, + agpgart_aperture_writeb, agpgart_aperture_writew, agpgart_aperture_writel, + NULL, MEM_MAPPING_EXTERNAL, dev); + + return dev; +} + + +static void +agpgart_close(void *priv) +{ + agpgart_t *dev = (agpgart_t *) priv; + + agpgart_log("AGP GART: close()\n"); + + /* Disable aperture. */ + mem_mapping_disable(&dev->aperture_mapping); + + free(dev); +} + + +const device_t agpgart_device = +{ + "AGP Graphics Address Remapping Table", + DEVICE_PCI, + 0, + agpgart_init, agpgart_close, NULL, + { NULL }, + NULL, + NULL, + NULL +}; diff --git a/src/video/vid_voodoo_banshee.c b/src/video/vid_voodoo_banshee.c index c77b2368e..88e2d0382 100644 --- a/src/video/vid_voodoo_banshee.c +++ b/src/video/vid_voodoo_banshee.c @@ -14,11 +14,13 @@ * * Copyright 2008-2020 Sarah Walker. */ +#include #include #include #include #include #include +#define HAVE_STDARG_H #include #include #include <86box/86box.h> @@ -244,7 +246,7 @@ enum #define MISCINIT0_Y_ORIGIN_SWAP_SHIFT (18) #define MISCINIT0_Y_ORIGIN_SWAP_MASK (0xfff << MISCINIT0_Y_ORIGIN_SWAP_SHIFT) - +#define ENABLE_BANSHEE_LOG 1 #ifdef ENABLE_BANSHEE_LOG int banshee_do_log = ENABLE_BANSHEE_LOG; @@ -385,7 +387,7 @@ static void banshee_updatemapping(banshee_t *banshee) if (!(banshee->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_MEM)) { -// banshee_log("Update mapping - PCI disabled\n"); + banshee_log("Update mapping - PCI disabled\n"); mem_mapping_disable(&svga->mapping); mem_mapping_disable(&banshee->linear_mapping); mem_mapping_disable(&banshee->reg_mapping_low); @@ -492,7 +494,7 @@ static void banshee_recalctimings(svga_t *svga) if (svga->crtc[0x1b] & 0x04) svga->dispend += 0x400; if (svga->crtc[0x1b] & 0x10) svga->vblankstart += 0x400; if (svga->crtc[0x1b] & 0x40) svga->vsyncstart += 0x400; -// banshee_log("svga->hdisp=%i\n", svga->hdisp); + banshee_log("svga->hdisp=%i\n", svga->hdisp); svga->interlace = 0; @@ -529,7 +531,7 @@ static void banshee_recalctimings(svga_t *svga) svga->rowoffset = (banshee->vidDesktopOverlayStride & 0x3fff) >> 3; svga->ma_latch = banshee->vidDesktopStartAddr >> 2; banshee->desktop_stride_tiled = (banshee->vidDesktopOverlayStride & 0x3fff) * 128 * 32; -// banshee_log("Extended shift out %i rowoffset=%i %02x\n", VIDPROCCFG_DESKTOP_PIX_FORMAT, svga->rowoffset, svga->crtc[1]); + banshee_log("Extended shift out %i rowoffset=%i %02x\n", VIDPROCCFG_DESKTOP_PIX_FORMAT, svga->rowoffset, svga->crtc[1]); svga->char_width = 8; svga->split = 99999; @@ -572,7 +574,7 @@ static void banshee_recalctimings(svga_t *svga) } else { -// banshee_log("Normal shift out\n"); + banshee_log("Normal shift out\n"); svga->bpp = 8; } @@ -588,7 +590,7 @@ static void banshee_recalctimings(svga_t *svga) svga->clock = (cpuclock * (float)(1ull << 32)) / freq; // svga->clock = cpuclock / freq; -// banshee_log("svga->clock = %g %g m=%i k=%i n=%i\n", freq, freq / 1000000.0, m, k, n); + banshee_log("svga->clock = %g %g m=%i k=%i n=%i\n", freq, freq / 1000000.0, m, k, n); } } @@ -597,7 +599,7 @@ static void banshee_ext_out(uint16_t addr, uint8_t val, void *p) // banshee_t *banshee = (banshee_t *)p; // svga_t *svga = &banshee->svga; -// banshee_log("banshee_ext_out: addr=%04x val=%02x\n", addr, val); + banshee_log("banshee_ext_out: addr=%04x val=%02x\n", addr, val); switch (addr & 0xff) { @@ -626,7 +628,7 @@ static void banshee_ext_outl(uint16_t addr, uint32_t val, void *p) voodoo_t *voodoo = banshee->voodoo; svga_t *svga = &banshee->svga; -// banshee_log("banshee_ext_outl: addr=%04x val=%08x %04x(%08x):%08x\n", addr, val, CS,cs,cpu_state.pc); + banshee_log("banshee_ext_outl: addr=%04x val=%08x %04x(%08x):%08x\n", addr, val, CS,cs,cpu_state.pc); switch (addr & 0xff) { @@ -639,7 +641,7 @@ static void banshee_ext_outl(uint16_t addr, uint32_t val, void *p) case Init_lfbMemoryConfig: banshee->lfbMemoryConfig = val; -// banshee_log("lfbMemoryConfig=%08x\n", val); + banshee_log("lfbMemoryConfig=%08x\n", val); voodoo->tile_base = (val & 0x1fff) << 12; voodoo->tile_stride = 1024 << ((val >> 13) & 7); voodoo->tile_stride_shift = 10 + ((val >> 13) & 7); @@ -705,7 +707,7 @@ static void banshee_ext_outl(uint16_t addr, uint32_t val, void *p) case Video_vidProcCfg: banshee->vidProcCfg = val; -// banshee_log("vidProcCfg=%08x\n", val); + banshee_log("vidProcCfg=%08x\n", val); banshee->overlay_pix_fmt = (val & VIDPROCCFG_OVERLAY_PIX_FORMAT_MASK) >> VIDPROCCFG_OVERLAY_PIX_FORMAT_SHIFT; svga->hwcursor.ena = val & VIDPROCCFG_HWCURSOR_ENA; svga->fullchange = changeframecount; @@ -740,7 +742,7 @@ static void banshee_ext_outl(uint16_t addr, uint32_t val, void *p) svga->hwcursor.addr = (banshee->hwCurPatAddr & 0xfffff0) + (svga->hwcursor.yoff * 16); svga->hwcursor.xsize = 64; svga->hwcursor.ysize = 64; -// banshee_log("hwCurLoc %08x %i\n", val, svga->hwcursor.y); + banshee_log("hwCurLoc %08x %i\n", val, svga->hwcursor.y); break; case Video_hwCurC0: banshee->hwCurC0 = val; @@ -751,7 +753,7 @@ static void banshee_ext_outl(uint16_t addr, uint32_t val, void *p) case Video_vidSerialParallelPort: banshee->vidSerialParallelPort = val; -// banshee_log("vidSerialParallelPort: write %08x %08x %04x(%08x):%08x\n", val, val & (VIDSERIAL_DDC_DCK_W | VIDSERIAL_DDC_DDA_W), CS,cs,cpu_state.pc); + banshee_log("vidSerialParallelPort: write %08x %08x %04x(%08x):%08x\n", val, val & (VIDSERIAL_DDC_DCK_W | VIDSERIAL_DDC_DDA_W), CS,cs,cpu_state.pc); i2c_gpio_set(banshee->i2c_ddc, !!(val & VIDSERIAL_DDC_DCK_W), !!(val & VIDSERIAL_DDC_DDA_W)); i2c_gpio_set(banshee->i2c, !!(val & VIDSERIAL_I2C_SCK_W), !!(val & VIDSERIAL_I2C_SDA_W)); break; @@ -779,16 +781,16 @@ static void banshee_ext_outl(uint16_t addr, uint32_t val, void *p) break; case Video_vidOverlayDudx: voodoo->overlay.vidOverlayDudx = val & VID_DUDX_MASK; -// banshee_log("vidOverlayDudx=%08x\n", val); + banshee_log("vidOverlayDudx=%08x\n", val); break; case Video_vidOverlayDudxOffsetSrcWidth: voodoo->overlay.vidOverlayDudxOffsetSrcWidth = val; voodoo->overlay.overlay_bytes = (val & OVERLAY_SRC_WIDTH_MASK) >> OVERLAY_SRC_WIDTH_SHIFT; -// banshee_log("vidOverlayDudxOffsetSrcWidth=%08x\n", val); + banshee_log("vidOverlayDudxOffsetSrcWidth=%08x\n", val); break; case Video_vidOverlayDvdy: voodoo->overlay.vidOverlayDvdy = val & VID_DVDY_MASK; -// banshee_log("vidOverlayDvdy=%08x\n", val); + banshee_log("vidOverlayDvdy=%08x\n", val); break; case Video_vidOverlayDvdyOffset: voodoo->overlay.vidOverlayDvdyOffset = val; @@ -797,13 +799,13 @@ static void banshee_ext_outl(uint16_t addr, uint32_t val, void *p) case Video_vidDesktopStartAddr: banshee->vidDesktopStartAddr = val & 0xffffff; -// banshee_log("vidDesktopStartAddr=%08x\n", val); + banshee_log("vidDesktopStartAddr=%08x\n", val); svga->fullchange = changeframecount; svga_recalctimings(svga); break; case Video_vidDesktopOverlayStride: banshee->vidDesktopOverlayStride = val; -// banshee_log("vidDesktopOverlayStride=%08x\n", val); + banshee_log("vidDesktopOverlayStride=%08x\n", val); svga->fullchange = changeframecount; svga_recalctimings(svga); break; @@ -822,7 +824,7 @@ static uint8_t banshee_ext_in(uint16_t addr, void *p) { case Init_status: case Init_status+1: case Init_status+2: case Init_status+3: ret = (banshee_status(banshee) >> ((addr & 3) * 8)) & 0xff; -// banshee_log("Read status reg! %04x(%08x):%08x\n", CS, cs, cpu_state.pc); + banshee_log("Read status reg! %04x(%08x):%08x\n", CS, cs, cpu_state.pc); break; case 0xb0: case 0xb1: case 0xb2: case 0xb3: @@ -845,7 +847,7 @@ static uint8_t banshee_ext_in(uint16_t addr, void *p) break; } -// banshee_log("banshee_ext_in: addr=%04x val=%02x\n", addr, ret); + banshee_log("banshee_ext_in: addr=%04x val=%02x\n", addr, ret); return ret; } @@ -886,7 +888,7 @@ static uint32_t banshee_status(banshee_t *banshee) if (!voodoo->voodoo_busy) voodoo_wake_fifo_thread(voodoo); -// banshee_log("banshee_status: busy %i %i (%i %i) %i %i %i %04x(%08x):%08x %08x\n", busy, written, voodoo->cmd_written, voodoo->cmd_written_fifo, voodoo->cmd_read, voodoo->cmdfifo_depth_rd, voodoo->cmdfifo_depth_wr, CS,cs,cpu_state.pc, ret); + banshee_log("banshee_status: busy %i %i (%i %i) %i %i %i %04x(%08x):%08x %08x\n", busy, written, voodoo->cmd_written, voodoo->cmd_written_fifo, voodoo->cmd_read, voodoo->cmdfifo_depth_rd, voodoo->cmdfifo_depth_wr, CS,cs,cpu_state.pc, ret); return ret; } @@ -904,7 +906,7 @@ static uint32_t banshee_ext_inl(uint16_t addr, void *p) { case Init_status: ret = banshee_status(banshee); -// banshee_log("Read status reg! %04x(%08x):%08x\n", CS, cs, cpu_state.pc); + banshee_log("Read status reg! %04x(%08x):%08x\n", CS, cs, cpu_state.pc); break; case Init_pciInit0: ret = banshee->pciInit0; @@ -997,7 +999,7 @@ static uint32_t banshee_ext_inl(uint16_t addr, void *p) if (i2c_gpio_get_sda(banshee->i2c)) ret |= VIDSERIAL_I2C_SDA_R; } -// banshee_log("vidSerialParallelPort: read %08x %08x %04x(%08x):%08x\n", ret, ret & (VIDSERIAL_DDC_DCK_R | VIDSERIAL_DDC_DDA_R), CS,cs,cpu_state.pc); + banshee_log("vidSerialParallelPort: read %08x %08x %04x(%08x):%08x\n", ret, ret & (VIDSERIAL_DDC_DCK_R | VIDSERIAL_DDC_DDA_R), CS,cs,cpu_state.pc); break; case Video_vidScreenSize: @@ -1044,13 +1046,13 @@ static uint32_t banshee_reg_readl(uint32_t addr, void *p); static uint8_t banshee_reg_read(uint32_t addr, void *p) { -// banshee_log("banshee_reg_read: addr=%08x\n", addr); + banshee_log("banshee_reg_read: addr=%08x\n", addr); return banshee_reg_readl(addr & ~3, p) >> (8*(addr & 3)); } static uint16_t banshee_reg_readw(uint32_t addr, void *p) { -// banshee_log("banshee_reg_readw: addr=%08x\n", addr); + banshee_log("banshee_reg_readw: addr=%08x\n", addr); return banshee_reg_readl(addr & ~3, p) >> (8*(addr & 2)); } @@ -1063,17 +1065,17 @@ static uint32_t banshee_cmd_read(banshee_t *banshee, uint32_t addr) { case cmdBaseAddr0: ret = voodoo->cmdfifo_base >> 12; -// banshee_log("Read cmdfifo_base %08x\n", ret); + banshee_log("Read cmdfifo_base %08x\n", ret); break; case cmdRdPtrL0: ret = voodoo->cmdfifo_rp; -// banshee_log("Read cmdfifo_rp %08x\n", ret); + banshee_log("Read cmdfifo_rp %08x\n", ret); break; case cmdFifoDepth0: ret = voodoo->cmdfifo_depth_wr - voodoo->cmdfifo_depth_rd; -// banshee_log("Read cmdfifo_depth %08x\n", ret); + banshee_log("Read cmdfifo_depth %08x\n", ret); break; case 0x108: @@ -1244,7 +1246,7 @@ static uint32_t banshee_reg_readl(uint32_t addr, void *p) static void banshee_reg_write(uint32_t addr, uint8_t val, void *p) { -// banshee_log("banshee_reg_writeb: addr=%08x val=%02x\n", addr, val); + banshee_log("banshee_reg_writeb: addr=%08x val=%02x\n", addr, val); } static void banshee_reg_writew(uint32_t addr, uint16_t val, void *p) @@ -1254,7 +1256,7 @@ static void banshee_reg_writew(uint32_t addr, uint16_t val, void *p) cycles -= voodoo->write_time; -// banshee_log("banshee_reg_writew: addr=%08x val=%04x\n", addr, val); + banshee_log("banshee_reg_writew: addr=%08x val=%04x\n", addr, val); switch (addr & 0x1f00000) { case 0x1000000: case 0x1100000: case 0x1200000: case 0x1300000: /*3D LFB*/ @@ -1269,13 +1271,13 @@ static void banshee_reg_writew(uint32_t addr, uint16_t val, void *p) static void banshee_cmd_write(banshee_t *banshee, uint32_t addr, uint32_t val) { voodoo_t *voodoo = banshee->voodoo; -// banshee_log("banshee_cmd_write: addr=%03x val=%08x\n", addr & 0x1fc, val); + banshee_log("banshee_cmd_write: addr=%03x val=%08x\n", addr & 0x1fc, val); switch (addr & 0x1fc) { case cmdBaseAddr0: voodoo->cmdfifo_base = (val & 0xfff) << 12; voodoo->cmdfifo_end = voodoo->cmdfifo_base + (((voodoo->cmdfifo_size & 0xff) + 1) << 12); -// banshee_log("cmdfifo_base=%08x cmdfifo_end=%08x %08x\n", voodoo->cmdfifo_base, voodoo->cmdfifo_end, val); + banshee_log("cmdfifo_base=%08x cmdfifo_end=%08x %08x\n", voodoo->cmdfifo_base, voodoo->cmdfifo_end, val); break; case cmdBaseSize0: @@ -1284,11 +1286,11 @@ static void banshee_cmd_write(banshee_t *banshee, uint32_t addr, uint32_t val) voodoo->cmdfifo_enabled = val & 0x100; if (!voodoo->cmdfifo_enabled) voodoo->cmdfifo_in_sub = 0; /*Not sure exactly when this should be reset*/ -// banshee_log("cmdfifo_base=%08x cmdfifo_end=%08x\n", voodoo->cmdfifo_base, voodoo->cmdfifo_end); + banshee_log("cmdfifo_base=%08x cmdfifo_end=%08x\n", voodoo->cmdfifo_base, voodoo->cmdfifo_end); break; // voodoo->cmdfifo_end = ((val >> 16) & 0x3ff) << 12; -// banshee_log("CMDFIFO base=%08x end=%08x\n", voodoo->cmdfifo_base, voodoo->cmdfifo_end); + banshee_log("CMDFIFO base=%08x end=%08x\n", voodoo->cmdfifo_base, voodoo->cmdfifo_end); // break; case cmdRdPtrL0: @@ -1332,7 +1334,7 @@ static void banshee_reg_writel(uint32_t addr, uint32_t val, void *p) cycles -= voodoo->write_time; voodoo->last_write_addr = addr; -// banshee_log("banshee_reg_writel: addr=%08x val=%08x\n", addr, val); + banshee_log("banshee_reg_writel: addr=%08x val=%08x\n", addr, val); switch (addr & 0x1f00000) { @@ -1341,7 +1343,7 @@ static void banshee_reg_writel(uint32_t addr, uint32_t val, void *p) banshee_ext_outl(addr & 0xff, val, banshee); else banshee_cmd_write(banshee, addr, val); -// banshee_log("CMD!!! write %08x %08x\n", addr, val); + banshee_log("CMD!!! write %08x %08x\n", addr, val); break; case 0x0100000: /*2D registers*/ @@ -1357,7 +1359,7 @@ static void banshee_reg_writel(uint32_t addr, uint32_t val, void *p) { case SST_intrCtrl: banshee->intrCtrl = val & 0x0030003f; -// banshee_log("intrCtrl=%08x\n", val); + banshee_log("intrCtrl=%08x\n", val); break; case SST_userIntrCMD: @@ -1369,7 +1371,7 @@ static void banshee_reg_writel(uint32_t addr, uint32_t val, void *p) voodoo_queue_command(voodoo, (addr & 0x3fc) | FIFO_WRITEL_REG, val); if (!voodoo->voodoo_busy) voodoo_wake_fifo_threads(voodoo->set, voodoo); -// banshee_log("SST_swapbufferCMD write: %i %i\n", voodoo->cmd_written, voodoo->cmd_written_fifo); + banshee_log("SST_swapbufferCMD write: %i %i\n", voodoo->cmd_written, voodoo->cmd_written_fifo); break; case SST_triangleCMD: voodoo->cmd_written++; @@ -1441,14 +1443,14 @@ static uint8_t banshee_read_linear(uint32_t addr, void *p) y = addr >> voodoo->tile_stride_shift; addr = voodoo->tile_base + (x & 127) + ((x >> 7) * 128*32) + ((y & 31) * 128) + (y >> 5)*voodoo->tile_x_real; -// banshee_log(" Tile rb %08x->%08x %i %i\n", old_addr, addr, x, y); + banshee_log(" Tile rb %08x->%08x %i %i\n", 0, addr, x, y); } if (addr >= svga->vram_max) return 0xff; cycles -= video_timing_read_b; -// banshee_log("read_linear: addr=%08x val=%02x\n", addr, svga->vram[addr & svga->vram_mask]); + banshee_log("read_linear: addr=%08x val=%02x\n", addr, svga->vram[addr & svga->vram_mask]); return svga->vram[addr & svga->vram_mask]; } @@ -1473,14 +1475,14 @@ static uint16_t banshee_read_linear_w(uint32_t addr, void *p) y = addr >> voodoo->tile_stride_shift; addr = voodoo->tile_base + (x & 127) + ((x >> 7) * 128*32) + ((y & 31) * 128) + (y >> 5)*voodoo->tile_x_real; -// banshee_log(" Tile rb %08x->%08x %i %i\n", old_addr, addr, x, y); + banshee_log(" Tile rb %08x->%08x %i %i\n", 0, addr, x, y); } if (addr >= svga->vram_max) return 0xff; cycles -= video_timing_read_w; -// banshee_log("read_linear: addr=%08x val=%02x\n", addr, svga->vram[addr & svga->vram_mask]); + banshee_log("read_linear: addr=%08x val=%02x\n", addr, svga->vram[addr & svga->vram_mask]); return *(uint16_t *)&svga->vram[addr & svga->vram_mask]; } @@ -1506,14 +1508,14 @@ static uint32_t banshee_read_linear_l(uint32_t addr, void *p) y = addr >> voodoo->tile_stride_shift; addr = voodoo->tile_base + (x & 127) + ((x >> 7) * 128*32) + ((y & 31) * 128) + (y >> 5)*voodoo->tile_x_real; -// banshee_log(" Tile rb %08x->%08x %i %i\n", old_addr, addr, x, y); + banshee_log(" Tile rb %08x->%08x %i %i\n", 0, addr, x, y); } if (addr >= svga->vram_max) return 0xff; cycles -= video_timing_read_l; -// banshee_log("read_linear: addr=%08x val=%02x\n", addr, svga->vram[addr & svga->vram_mask]); + banshee_log("read_linear: addr=%08x val=%02x\n", addr, svga->vram[addr & svga->vram_mask]); return *(uint32_t *)&svga->vram[addr & svga->vram_mask]; } @@ -1526,7 +1528,7 @@ static void banshee_write_linear(uint32_t addr, uint8_t val, void *p) cycles -= voodoo->write_time; -// banshee_log("write_linear: addr=%08x val=%02x\n", addr, val); + banshee_log("write_linear: addr=%08x val=%02x\n", addr, val); addr &= svga->decode_mask; if (addr >= voodoo->tile_base) { @@ -1537,7 +1539,7 @@ static void banshee_write_linear(uint32_t addr, uint8_t val, void *p) y = addr >> voodoo->tile_stride_shift; addr = voodoo->tile_base + (x & 127) + ((x >> 7) * 128*32) + ((y & 31) * 128) + (y >> 5)*voodoo->tile_x_real; -// banshee_log(" Tile b %08x->%08x %i %i\n", old_addr, addr, x, y); + banshee_log(" Tile b %08x->%08x %i %i\n", 0, addr, x, y); } if (addr >= svga->vram_max) return; @@ -1562,7 +1564,7 @@ static void banshee_write_linear_w(uint32_t addr, uint16_t val, void *p) } cycles -= voodoo->write_time; -// banshee_log("write_linear: addr=%08x val=%02x\n", addr, val); + banshee_log("write_linear: addr=%08x val=%02x\n", addr, val); addr &= svga->decode_mask; if (addr >= voodoo->tile_base) { @@ -1573,7 +1575,7 @@ static void banshee_write_linear_w(uint32_t addr, uint16_t val, void *p) y = addr >> voodoo->tile_stride_shift; addr = voodoo->tile_base + (x & 127) + ((x >> 7) * 128*32) + ((y & 31) * 128) + (y >> 5)*voodoo->tile_x_real; -// banshee_log(" Tile b %08x->%08x %i %i\n", old_addr, addr, x, y); + banshee_log(" Tile b %08x->%08x %i %i\n", 0, addr, x, y); } if (addr >= svga->vram_max) return; @@ -1616,7 +1618,7 @@ static void banshee_write_linear_l(uint32_t addr, uint32_t val, void *p) y = addr >> voodoo->tile_stride_shift; addr = voodoo->tile_base + (x & 127) + ((x >> 7) * 128*32) + ((y & 31) * 128) + (y >> 5)*voodoo->tile_x_real; -// banshee_log(" Tile %08x->%08x->%08x->%08x %i %i tile_x=%i\n", old_addr, addr_off, addr2, addr, x, y, voodoo->tile_x_real); + banshee_log(" Tile %08x->%08x->%08x->%08x %i %i tile_x=%i\n", 0, 0, 0, addr, x, y, voodoo->tile_x_real); } if (addr >= svga->vram_max) @@ -1628,7 +1630,7 @@ static void banshee_write_linear_l(uint32_t addr, uint32_t val, void *p) *(uint32_t *)&svga->vram[addr & svga->vram_mask] = val; if (voodoo->cmdfifo_enabled && addr >= voodoo->cmdfifo_base && addr < voodoo->cmdfifo_end) { -// banshee_log("CMDFIFO write %08x %08x old amin=%08x amax=%08x hlcnt=%i depth_wr=%i rp=%08x\n", addr, val, voodoo->cmdfifo_amin, voodoo->cmdfifo_amax, voodoo->cmdfifo_holecount, voodoo->cmdfifo_depth_wr, voodoo->cmdfifo_rp); + banshee_log("CMDFIFO write %08x %08x old amin=%08x amax=%08x hlcnt=%i depth_wr=%i rp=%08x\n", addr, val, voodoo->cmdfifo_amin, voodoo->cmdfifo_amax, voodoo->cmdfifo_holecount, voodoo->cmdfifo_depth_wr, voodoo->cmdfifo_rp); if (addr == voodoo->cmdfifo_base && !voodoo->cmdfifo_holecount) { // if (voodoo->cmdfifo_holecount) @@ -1643,7 +1645,7 @@ static void banshee_write_linear_l(uint32_t addr, uint32_t val, void *p) { // if ((addr <= voodoo->cmdfifo_amin && voodoo->cmdfifo_amin != -4) || addr >= voodoo->cmdfifo_amax) // fatal("CMDFIFO holecount write outside of amin/amax - amin=%08x amax=%08x holecount=%i\n", voodoo->cmdfifo_amin, voodoo->cmdfifo_amax, voodoo->cmdfifo_holecount); -// banshee_log("holecount %i\n", voodoo->cmdfifo_holecount); + banshee_log("holecount %i\n", voodoo->cmdfifo_holecount); voodoo->cmdfifo_holecount--; if (!voodoo->cmdfifo_holecount) { @@ -1651,7 +1653,7 @@ static void banshee_write_linear_l(uint32_t addr, uint32_t val, void *p) voodoo->cmdfifo_depth_wr += ((voodoo->cmdfifo_amax - voodoo->cmdfifo_amin) >> 2); voodoo->cmdfifo_amin = voodoo->cmdfifo_amax; voodoo_wake_fifo_thread(voodoo); -// banshee_log("hole filled! amin=%08x amax=%08x added %i words\n", voodoo->cmdfifo_amin, voodoo->cmdfifo_amax, words_to_add); + banshee_log("hole filled! amin=%08x amax=%08x added %i words\n", voodoo->cmdfifo_amin, voodoo->cmdfifo_amax, 0); } } else if (addr == voodoo->cmdfifo_amax+4) @@ -1675,7 +1677,7 @@ static void banshee_write_linear_l(uint32_t addr, uint32_t val, void *p) // fatal("Out-of-order write really out of order\n"); voodoo->cmdfifo_amax = addr; voodoo->cmdfifo_holecount = ((voodoo->cmdfifo_amax - voodoo->cmdfifo_amin) >> 2) - 1; -// banshee_log("CMDFIFO out of order: amin=%08x amax=%08x holecount=%i\n", voodoo->cmdfifo_amin, voodoo->cmdfifo_amax, voodoo->cmdfifo_holecount); + banshee_log("CMDFIFO out of order: amin=%08x amax=%08x holecount=%i\n", voodoo->cmdfifo_amin, voodoo->cmdfifo_amax, voodoo->cmdfifo_holecount); } } } @@ -2401,7 +2403,7 @@ static uint8_t banshee_pci_read(int func, int addr, void *p) if (func) return 0xff; -// banshee_log("Banshee PCI read %08X ", addr); + banshee_log("Banshee PCI read %08X ", addr); switch (addr) { case 0x00: ret = 0x1a; break; /*3DFX*/ @@ -2482,7 +2484,7 @@ static uint8_t banshee_pci_read(int func, int addr, void *p) case 0x66: ret = banshee->pci_regs[0x66]; break; case 0x67: ret = banshee->pci_regs[0x67]; break; } -// banshee_log("%02X\n", ret); + banshee_log("%02X\n", ret); return ret; } @@ -2493,7 +2495,7 @@ static void banshee_pci_write(int func, int addr, uint8_t val, void *p) if (func) return; -// banshee_log("Banshee write %08X %02X %04X:%08X\n", addr, val, CS, cpu_state.pc); + banshee_log("Banshee write %08X %02X %04X:%08X\n", addr, val, CS, cpu_state.pc); switch (addr) { case 0x00: case 0x01: case 0x02: case 0x03: @@ -2874,7 +2876,7 @@ static void *banshee_init_common(const device_t *info, char *fn, int has_sgram, static void *banshee_init(const device_t *info) { - return banshee_init_common(info, "roms/video/voodoo/Pci_sg.rom", 1, TYPE_BANSHEE, VOODOO_BANSHEE, 0); + return banshee_init_common(info, "roms/video/voodoo/Pci_sg.rom", 1, TYPE_BANSHEE, VOODOO_BANSHEE, 1); } static void *creative_banshee_init(const device_t *info) { diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index 90ef6136a..74eb7d0b5 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -734,7 +734,7 @@ SNDOBJ := sound.o \ snd_wss.o \ snd_ym7128.o -VIDOBJ := video.o \ +VIDOBJ := agpgart.o video.o \ vid_table.o \ vid_cga.o vid_cga_comp.o \ vid_compaq_cga.o \ From c38e8138ba08f7e8fa6010ed2ba00b31bb4b231b Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 10 Nov 2021 21:16:12 -0300 Subject: [PATCH 26/62] Give the Apollo Pro variants the space they should have --- src/machine/machine_table.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 03a3e01d6..33e6ceedf 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -456,10 +456,10 @@ const machine_t machines[] = { /* VIA Apollo Pro */ { "[VIA Apollo Pro] PC Partner APAS3", "apas3", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_apas3_init, NULL }, - { "[VIA Apollo Pro133] ECS P6BAP", "p6bap", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 150000000, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1572864, 8192, 255, machine_at_p6bap_init, NULL }, - { "[VIA Apollo Pro133A] BCM GT694VA", "gt694va", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 16384,3145728, 8192, 255, machine_at_gt694va_init, NULL }, - { "[VIA Apollo Pro133A] ASUS CUV4X-LS", "cuv4xls", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 150000000, 1300, 3500, 1.5, 8.0, (MACHINE_AGP & ~MACHINE_AT) | MACHINE_BUS_PS2 | MACHINE_BUS_AC97 | MACHINE_IDE_DUAL,16384,4194304, 8192, 255, machine_at_cuv4xls_init, NULL }, - { "[VIA Apollo Pro133A] Acorp 6VIA90AP", "6via90ap", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 150000000, 1300, 3500, MACHINE_MULTIPLIER_FIXED, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_GAMEPORT, 16384,3145728, 8192, 255, machine_at_6via90ap_init, NULL }, + { "[VIA Apollo Pro 133] ECS P6BAP", "p6bap", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 150000000, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1572864, 8192, 255, machine_at_p6bap_init, NULL }, + { "[VIA Apollo Pro 133A] BCM GT694VA", "gt694va", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 16384,3145728, 8192, 255, machine_at_gt694va_init, NULL }, + { "[VIA Apollo Pro 133A] ASUS CUV4X-LS", "cuv4xls", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 150000000, 1300, 3500, 1.5, 8.0, (MACHINE_AGP & ~MACHINE_AT) | MACHINE_BUS_PS2 | MACHINE_BUS_AC97 | MACHINE_IDE_DUAL,16384,4194304, 8192, 255, machine_at_cuv4xls_init, NULL }, + { "[VIA Apollo Pro 133A] Acorp 6VIA90AP", "6via90ap", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 150000000, 1300, 3500, MACHINE_MULTIPLIER_FIXED, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_GAMEPORT, 16384,3145728, 8192, 255, machine_at_6via90ap_init, NULL }, /* Miscellaneous/Fake/Hypervisor machines */ { "[i440BX] Microsoft Virtual PC 2007", "vpc2007", MACHINE_TYPE_MISC, CPU_PKG_SLOT1, CPU_BLOCK(CPU_PENTIUM2, CPU_CYRIX3S), 0, 0, 0, 0, 0, 0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1048576, 8192, 255, machine_at_vpc2007_init, NULL }, From 6a7a215f342aa1a28ebde040da84ada6b70f67a1 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 11 Nov 2021 15:55:59 -0300 Subject: [PATCH 27/62] Port the correct QDI FMB from machine_and_kb and apply misc machine table fixes --- src/include/86box/machine.h | 2 +- src/machine/m_at_socket7.c | 10 ++++++---- src/machine/machine_table.c | 18 +++++++++--------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index f87dc277b..335773db7 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -426,7 +426,7 @@ extern const device_t *at_thor_get_device(void); /* m_at_socket7_s7.c */ extern int machine_at_ap5s_init(const machine_t *); -extern int machine_at_chariot_init(const machine_t *); +extern int machine_at_fmb_init(const machine_t *); extern int machine_at_p54tp4xe_init(const machine_t *); extern int machine_at_p54tp4xe_mr_init(const machine_t *); extern int machine_at_thor_init(const machine_t *); diff --git a/src/machine/m_at_socket7.c b/src/machine/m_at_socket7.c index 967aa024e..6545cbebb 100644 --- a/src/machine/m_at_socket7.c +++ b/src/machine/m_at_socket7.c @@ -45,6 +45,7 @@ #include <86box/fdc.h> #include <86box/nvr.h> + int machine_at_ap5s_init(const machine_t *model) { @@ -74,12 +75,13 @@ machine_at_ap5s_init(const machine_t *model) return ret; } + int -machine_at_chariot_init(const machine_t *model) +machine_at_fmb_init(const machine_t *model) { int ret; - ret = bios_load_linear("roms/machines/chariot/P5IV183.ROM", + ret = bios_load_linear("roms/machines/fmb/P5IV183.ROM", 0x000e0000, 131072, 0); if (bios_only || !ret) @@ -94,11 +96,11 @@ machine_at_chariot_init(const machine_t *model) pci_register_slot(0x13, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x12, PCI_CARD_NORMAL, 3, 4, 2, 1); pci_register_slot(0x11, PCI_CARD_NORMAL, 4, 3, 2, 1); - + device_add(&i430fx_device); device_add(&piix_device); device_add(&keyboard_ps2_ami_pci_device); - device_add(&pc87306_device); + device_add(&w83787f_device); device_add(&intel_flash_bxt_device); return ret; diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 33e6ceedf..889d4ce85 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -266,7 +266,7 @@ const machine_t machines[] = { { "[i430LX] Packard Bell PB520R", "pb520r", MACHINE_TYPE_SOCKET4, CPU_PKG_SOCKET4, 0, 60000000, 66666667, 5000, 5000, MACHINE_MULTIPLIER_FIXED, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 139264, 2048, 127, machine_at_pb520r_init, at_pb520r_get_device }, /* OPTi 596/597 */ - { "[OPTi 597] AMI Excalibur VLB", "excalibur", MACHINE_TYPE_SOCKET4, CPU_PKG_SOCKET4, 0, 60000000, 66666667, 5000, 5000, MACHINE_MULTIPLIER_FIXED, MACHINE_VLB | MACHINE_IDE, 2048, 65536, 2048, 127, machine_at_excalibur_init, NULL }, + { "[OPTi 597] AMI Excalibur VLB", "excalibur", MACHINE_TYPE_SOCKET4, CPU_PKG_SOCKET4, 0, 60000000, 60000000, 5000, 5000, MACHINE_MULTIPLIER_FIXED, MACHINE_VLB | MACHINE_IDE, 2048, 65536, 2048, 127, machine_at_excalibur_init, NULL }, /* SiS 85C501/503 */ { "[SiS 501] ASUS PCI/I-P5SP4", "p5sp4", MACHINE_TYPE_SOCKET4, CPU_PKG_SOCKET4, 0, 60000000, 66666667, 5000, 5000, MACHINE_MULTIPLIER_FIXED, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_p5sp4_init, NULL }, @@ -288,7 +288,7 @@ const machine_t machines[] = { { "[OPTi 597] TMC PAT54PV", "pat54pv", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, CPU_BLOCK(CPU_K5, CPU_5K86), 50000000, 66666667, 3520, 3520, 1.5, 1.5, MACHINE_VLB, 2048, 65536, 2048, 127, machine_at_pat54pv_init, NULL }, /* OPTi 596/597/822 */ - { "[OPTi 597] Shuttle HOT-543", "hot543", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3520, 3520, 1.5, 1.5, MACHINE_PCI | MACHINE_VLB, 8192, 131072, 8192, 127, machine_at_hot543_init, NULL }, + { "[OPTi 597] Shuttle HOT-543", "hot543", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3520, 3520, 1.5, 2.0, MACHINE_PCI | MACHINE_VLB, 8192, 131072, 8192, 127, machine_at_hot543_init, NULL }, { "[OPTi 597] Supermicro P54VL-PCI", "p54vl", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, 0, 60000000, 66666667, 3520, 3520, 1.5, 1.5, MACHINE_PCI | MACHINE_VLB, 8192, 131072, 8192, 127, machine_at_p54vl_init, NULL }, /* SiS 85C501/503 */ @@ -296,7 +296,7 @@ const machine_t machines[] = { { "[SiS 501] BCM SQ-588", "sq588", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, CPU_BLOCK(CPU_PENTIUMMMX), 50000000, 66666667, 3520, 3520, 1.5, 1.5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_sq588_init, NULL }, /* UMC 889x */ - { "[UMC 8890] Shuttle HOT-539", "hot539", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, CPU_BLOCK(CPU_K5, CPU_5K86), 40000000, 66666667, 3380, 3600, 1.5, 2.0, MACHINE_PCI | MACHINE_IDE_DUAL, 8192, 262144, 8192, 127, machine_at_hot539_init, NULL }, + { "[UMC 8890] Shuttle HOT-539", "hot539", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, CPU_BLOCK(CPU_WINCHIP, CPU_WINCHIP2, CPU_K5, CPU_5K86), 50000000, 66666667, 3380, 3600, 1.5, 3.0, MACHINE_PCI | MACHINE_IDE_DUAL, 8192, 262144, 8192, 127, machine_at_hot539_init, NULL }, /* Socket 7 (Single Voltage) machines */ /* 430FX */ @@ -308,13 +308,13 @@ const machine_t machines[] = { { "[i430FX] Intel Advanced/ATX (MR BIOS)", "mrthor", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 127, machine_at_mrthor_init, NULL }, { "[i430FX] Intel Advanced/EV", "endeavor", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 127, machine_at_endeavor_init, at_endeavor_get_device }, { "[i430FX] Packard Bell PB640", "pb640", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 127, machine_at_pb640_init, at_pb640_get_device }, - { "[i430FX] QDI Chariot", "chariot", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, CPU_BLOCK(CPU_WINCHIP, CPU_WINCHIP2, CPU_Cx6x86, CPU_Cx6x86L, CPU_Cx6x86MX), 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_chariot_init, NULL }, + { "[i430FX] QDI FMB", "fmb", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, CPU_BLOCK(CPU_WINCHIP, CPU_WINCHIP2), 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_fmb_init, NULL }, /* 430HX */ { "[i430HX] Acer M3A", "acerm3a", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3300, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 196608, 8192, 127, machine_at_acerm3a_init, NULL }, { "[i430HX] AOpen AP53", "ap53", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3450, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 524288, 8192, 127, machine_at_ap53_init, NULL }, { "[i430HX] Biostar MB-8500TUC", "8500tuc", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 524288, 8192, 127, machine_at_8500tuc_init, NULL }, - { "[i430HX] SuperMicro Super P55T2S", "p55t2s", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3300, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 127, machine_at_p55t2s_init, NULL }, + { "[i430HX] Supermicro P55T2S", "p55t2s", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3300, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 127, machine_at_p55t2s_init, NULL }, /* 430VX */ { "[i430VX] Gateway 2000 Tigereye", "gw2kte", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_gw2kte_init, NULL }, @@ -352,7 +352,7 @@ const machine_t machines[] = { #endif { "[i430TX] Intel YM430TX", "ym430tx", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 60000000, 66666667, 2800, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 262144, 8192, 255, machine_at_ym430tx_init, NULL }, { "[i430TX] PC Partner MB540N", "mb540n", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 60000000, 66666667, 2700, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 262144, 8192, 255, machine_at_mb540n_init, NULL }, - { "[i430TX] SuperMicro Super P5MMS98", "p5mms98", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 2100, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 262144, 8192, 255, machine_at_p5mms98_init, NULL }, + { "[i430TX] Supermicro P5MMS98", "p5mms98", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 2100, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 262144, 8192, 255, machine_at_p5mms98_init, NULL }, /* Apollo VPX */ { "[VIA VPX] FIC VA-502", "ficva502", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 50000000, 75000000, 2800, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 524288, 8192, 127, machine_at_ficva502_init, NULL }, @@ -412,7 +412,7 @@ const machine_t machines[] = { { "[i440BX] Gigabyte GA-686BX", "686bx", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1048576, 8192, 255, machine_at_686bx_init, NULL }, { "[i440BX] HP Vectra VEi 8", "vei8", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1048576, 8192, 255, machine_at_vei8_init, NULL }, { "[i440BX] Tyan Tsunami ATX", "s1846", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 112121212, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_SOUND, 8192,1048576, 8192, 255, machine_at_s1846_init, at_s1846_get_device }, - { "[i440BX] SuperMicro Super P6SBA", "p6sba", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_p6sba_init, NULL }, + { "[i440BX] Supermicro P6SBA", "p6sba", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_p6sba_init, NULL }, #if defined(DEV_BRANCH) && defined(NO_SIO) { "[i440BX] Fujitsu ErgoPro x365", "ergox365", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 393216, 8192, 511, machine_at_ergox365_init, NULL }, #endif @@ -436,11 +436,11 @@ const machine_t machines[] = { /* Slot 2 machines */ /* 440GX */ { "[i440GX] Gigabyte GA-6GXU", "6gxu", MACHINE_TYPE_SLOT2, CPU_PKG_SLOT2, 0, 100000000, 133333333, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 16384,2097152,16384, 511, machine_at_6gxu_init, NULL }, - { "[i440GX] SuperMicro Super S2DGE", "s2dge", MACHINE_TYPE_SLOT2, CPU_PKG_SLOT2, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 16384,2097152,16384, 511, machine_at_s2dge_init, NULL }, + { "[i440GX] Supermicro S2DGE", "s2dge", MACHINE_TYPE_SLOT2, CPU_PKG_SLOT2, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 16384,2097152,16384, 511, machine_at_s2dge_init, NULL }, /* PGA370 machines */ /* 440LX */ - { "[i440LX] SuperMicro Super 370SLM", "s370slm", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 100000000, 1800, 3500, MACHINE_MULTIPLIER_FIXED, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_s370slm_init, NULL }, + { "[i440LX] Supermicro 370SLM", "s370slm", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 100000000, 1800, 3500, MACHINE_MULTIPLIER_FIXED, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_s370slm_init, NULL }, /* 440BX */ { "[i440BX] AEWIN AW-O671R", "awo671r", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, /* limits assumed */ MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 524288, 8192, 255, machine_at_awo671r_init, NULL }, From 6ed9e52e0f3ce2aaac3a1704d601e9d6facbbeab Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 11 Nov 2021 22:01:41 -0300 Subject: [PATCH 28/62] Revert some Voodoo Banshee stuff that shouldn't have shipped --- src/video/vid_voodoo_banshee.c | 114 ++++++++++++++++----------------- 1 file changed, 56 insertions(+), 58 deletions(-) diff --git a/src/video/vid_voodoo_banshee.c b/src/video/vid_voodoo_banshee.c index 88e2d0382..c77b2368e 100644 --- a/src/video/vid_voodoo_banshee.c +++ b/src/video/vid_voodoo_banshee.c @@ -14,13 +14,11 @@ * * Copyright 2008-2020 Sarah Walker. */ -#include #include #include #include #include #include -#define HAVE_STDARG_H #include #include #include <86box/86box.h> @@ -246,7 +244,7 @@ enum #define MISCINIT0_Y_ORIGIN_SWAP_SHIFT (18) #define MISCINIT0_Y_ORIGIN_SWAP_MASK (0xfff << MISCINIT0_Y_ORIGIN_SWAP_SHIFT) -#define ENABLE_BANSHEE_LOG 1 + #ifdef ENABLE_BANSHEE_LOG int banshee_do_log = ENABLE_BANSHEE_LOG; @@ -387,7 +385,7 @@ static void banshee_updatemapping(banshee_t *banshee) if (!(banshee->pci_regs[PCI_REG_COMMAND] & PCI_COMMAND_MEM)) { - banshee_log("Update mapping - PCI disabled\n"); +// banshee_log("Update mapping - PCI disabled\n"); mem_mapping_disable(&svga->mapping); mem_mapping_disable(&banshee->linear_mapping); mem_mapping_disable(&banshee->reg_mapping_low); @@ -494,7 +492,7 @@ static void banshee_recalctimings(svga_t *svga) if (svga->crtc[0x1b] & 0x04) svga->dispend += 0x400; if (svga->crtc[0x1b] & 0x10) svga->vblankstart += 0x400; if (svga->crtc[0x1b] & 0x40) svga->vsyncstart += 0x400; - banshee_log("svga->hdisp=%i\n", svga->hdisp); +// banshee_log("svga->hdisp=%i\n", svga->hdisp); svga->interlace = 0; @@ -531,7 +529,7 @@ static void banshee_recalctimings(svga_t *svga) svga->rowoffset = (banshee->vidDesktopOverlayStride & 0x3fff) >> 3; svga->ma_latch = banshee->vidDesktopStartAddr >> 2; banshee->desktop_stride_tiled = (banshee->vidDesktopOverlayStride & 0x3fff) * 128 * 32; - banshee_log("Extended shift out %i rowoffset=%i %02x\n", VIDPROCCFG_DESKTOP_PIX_FORMAT, svga->rowoffset, svga->crtc[1]); +// banshee_log("Extended shift out %i rowoffset=%i %02x\n", VIDPROCCFG_DESKTOP_PIX_FORMAT, svga->rowoffset, svga->crtc[1]); svga->char_width = 8; svga->split = 99999; @@ -574,7 +572,7 @@ static void banshee_recalctimings(svga_t *svga) } else { - banshee_log("Normal shift out\n"); +// banshee_log("Normal shift out\n"); svga->bpp = 8; } @@ -590,7 +588,7 @@ static void banshee_recalctimings(svga_t *svga) svga->clock = (cpuclock * (float)(1ull << 32)) / freq; // svga->clock = cpuclock / freq; - banshee_log("svga->clock = %g %g m=%i k=%i n=%i\n", freq, freq / 1000000.0, m, k, n); +// banshee_log("svga->clock = %g %g m=%i k=%i n=%i\n", freq, freq / 1000000.0, m, k, n); } } @@ -599,7 +597,7 @@ static void banshee_ext_out(uint16_t addr, uint8_t val, void *p) // banshee_t *banshee = (banshee_t *)p; // svga_t *svga = &banshee->svga; - banshee_log("banshee_ext_out: addr=%04x val=%02x\n", addr, val); +// banshee_log("banshee_ext_out: addr=%04x val=%02x\n", addr, val); switch (addr & 0xff) { @@ -628,7 +626,7 @@ static void banshee_ext_outl(uint16_t addr, uint32_t val, void *p) voodoo_t *voodoo = banshee->voodoo; svga_t *svga = &banshee->svga; - banshee_log("banshee_ext_outl: addr=%04x val=%08x %04x(%08x):%08x\n", addr, val, CS,cs,cpu_state.pc); +// banshee_log("banshee_ext_outl: addr=%04x val=%08x %04x(%08x):%08x\n", addr, val, CS,cs,cpu_state.pc); switch (addr & 0xff) { @@ -641,7 +639,7 @@ static void banshee_ext_outl(uint16_t addr, uint32_t val, void *p) case Init_lfbMemoryConfig: banshee->lfbMemoryConfig = val; - banshee_log("lfbMemoryConfig=%08x\n", val); +// banshee_log("lfbMemoryConfig=%08x\n", val); voodoo->tile_base = (val & 0x1fff) << 12; voodoo->tile_stride = 1024 << ((val >> 13) & 7); voodoo->tile_stride_shift = 10 + ((val >> 13) & 7); @@ -707,7 +705,7 @@ static void banshee_ext_outl(uint16_t addr, uint32_t val, void *p) case Video_vidProcCfg: banshee->vidProcCfg = val; - banshee_log("vidProcCfg=%08x\n", val); +// banshee_log("vidProcCfg=%08x\n", val); banshee->overlay_pix_fmt = (val & VIDPROCCFG_OVERLAY_PIX_FORMAT_MASK) >> VIDPROCCFG_OVERLAY_PIX_FORMAT_SHIFT; svga->hwcursor.ena = val & VIDPROCCFG_HWCURSOR_ENA; svga->fullchange = changeframecount; @@ -742,7 +740,7 @@ static void banshee_ext_outl(uint16_t addr, uint32_t val, void *p) svga->hwcursor.addr = (banshee->hwCurPatAddr & 0xfffff0) + (svga->hwcursor.yoff * 16); svga->hwcursor.xsize = 64; svga->hwcursor.ysize = 64; - banshee_log("hwCurLoc %08x %i\n", val, svga->hwcursor.y); +// banshee_log("hwCurLoc %08x %i\n", val, svga->hwcursor.y); break; case Video_hwCurC0: banshee->hwCurC0 = val; @@ -753,7 +751,7 @@ static void banshee_ext_outl(uint16_t addr, uint32_t val, void *p) case Video_vidSerialParallelPort: banshee->vidSerialParallelPort = val; - banshee_log("vidSerialParallelPort: write %08x %08x %04x(%08x):%08x\n", val, val & (VIDSERIAL_DDC_DCK_W | VIDSERIAL_DDC_DDA_W), CS,cs,cpu_state.pc); +// banshee_log("vidSerialParallelPort: write %08x %08x %04x(%08x):%08x\n", val, val & (VIDSERIAL_DDC_DCK_W | VIDSERIAL_DDC_DDA_W), CS,cs,cpu_state.pc); i2c_gpio_set(banshee->i2c_ddc, !!(val & VIDSERIAL_DDC_DCK_W), !!(val & VIDSERIAL_DDC_DDA_W)); i2c_gpio_set(banshee->i2c, !!(val & VIDSERIAL_I2C_SCK_W), !!(val & VIDSERIAL_I2C_SDA_W)); break; @@ -781,16 +779,16 @@ static void banshee_ext_outl(uint16_t addr, uint32_t val, void *p) break; case Video_vidOverlayDudx: voodoo->overlay.vidOverlayDudx = val & VID_DUDX_MASK; - banshee_log("vidOverlayDudx=%08x\n", val); +// banshee_log("vidOverlayDudx=%08x\n", val); break; case Video_vidOverlayDudxOffsetSrcWidth: voodoo->overlay.vidOverlayDudxOffsetSrcWidth = val; voodoo->overlay.overlay_bytes = (val & OVERLAY_SRC_WIDTH_MASK) >> OVERLAY_SRC_WIDTH_SHIFT; - banshee_log("vidOverlayDudxOffsetSrcWidth=%08x\n", val); +// banshee_log("vidOverlayDudxOffsetSrcWidth=%08x\n", val); break; case Video_vidOverlayDvdy: voodoo->overlay.vidOverlayDvdy = val & VID_DVDY_MASK; - banshee_log("vidOverlayDvdy=%08x\n", val); +// banshee_log("vidOverlayDvdy=%08x\n", val); break; case Video_vidOverlayDvdyOffset: voodoo->overlay.vidOverlayDvdyOffset = val; @@ -799,13 +797,13 @@ static void banshee_ext_outl(uint16_t addr, uint32_t val, void *p) case Video_vidDesktopStartAddr: banshee->vidDesktopStartAddr = val & 0xffffff; - banshee_log("vidDesktopStartAddr=%08x\n", val); +// banshee_log("vidDesktopStartAddr=%08x\n", val); svga->fullchange = changeframecount; svga_recalctimings(svga); break; case Video_vidDesktopOverlayStride: banshee->vidDesktopOverlayStride = val; - banshee_log("vidDesktopOverlayStride=%08x\n", val); +// banshee_log("vidDesktopOverlayStride=%08x\n", val); svga->fullchange = changeframecount; svga_recalctimings(svga); break; @@ -824,7 +822,7 @@ static uint8_t banshee_ext_in(uint16_t addr, void *p) { case Init_status: case Init_status+1: case Init_status+2: case Init_status+3: ret = (banshee_status(banshee) >> ((addr & 3) * 8)) & 0xff; - banshee_log("Read status reg! %04x(%08x):%08x\n", CS, cs, cpu_state.pc); +// banshee_log("Read status reg! %04x(%08x):%08x\n", CS, cs, cpu_state.pc); break; case 0xb0: case 0xb1: case 0xb2: case 0xb3: @@ -847,7 +845,7 @@ static uint8_t banshee_ext_in(uint16_t addr, void *p) break; } - banshee_log("banshee_ext_in: addr=%04x val=%02x\n", addr, ret); +// banshee_log("banshee_ext_in: addr=%04x val=%02x\n", addr, ret); return ret; } @@ -888,7 +886,7 @@ static uint32_t banshee_status(banshee_t *banshee) if (!voodoo->voodoo_busy) voodoo_wake_fifo_thread(voodoo); - banshee_log("banshee_status: busy %i %i (%i %i) %i %i %i %04x(%08x):%08x %08x\n", busy, written, voodoo->cmd_written, voodoo->cmd_written_fifo, voodoo->cmd_read, voodoo->cmdfifo_depth_rd, voodoo->cmdfifo_depth_wr, CS,cs,cpu_state.pc, ret); +// banshee_log("banshee_status: busy %i %i (%i %i) %i %i %i %04x(%08x):%08x %08x\n", busy, written, voodoo->cmd_written, voodoo->cmd_written_fifo, voodoo->cmd_read, voodoo->cmdfifo_depth_rd, voodoo->cmdfifo_depth_wr, CS,cs,cpu_state.pc, ret); return ret; } @@ -906,7 +904,7 @@ static uint32_t banshee_ext_inl(uint16_t addr, void *p) { case Init_status: ret = banshee_status(banshee); - banshee_log("Read status reg! %04x(%08x):%08x\n", CS, cs, cpu_state.pc); +// banshee_log("Read status reg! %04x(%08x):%08x\n", CS, cs, cpu_state.pc); break; case Init_pciInit0: ret = banshee->pciInit0; @@ -999,7 +997,7 @@ static uint32_t banshee_ext_inl(uint16_t addr, void *p) if (i2c_gpio_get_sda(banshee->i2c)) ret |= VIDSERIAL_I2C_SDA_R; } - banshee_log("vidSerialParallelPort: read %08x %08x %04x(%08x):%08x\n", ret, ret & (VIDSERIAL_DDC_DCK_R | VIDSERIAL_DDC_DDA_R), CS,cs,cpu_state.pc); +// banshee_log("vidSerialParallelPort: read %08x %08x %04x(%08x):%08x\n", ret, ret & (VIDSERIAL_DDC_DCK_R | VIDSERIAL_DDC_DDA_R), CS,cs,cpu_state.pc); break; case Video_vidScreenSize: @@ -1046,13 +1044,13 @@ static uint32_t banshee_reg_readl(uint32_t addr, void *p); static uint8_t banshee_reg_read(uint32_t addr, void *p) { - banshee_log("banshee_reg_read: addr=%08x\n", addr); +// banshee_log("banshee_reg_read: addr=%08x\n", addr); return banshee_reg_readl(addr & ~3, p) >> (8*(addr & 3)); } static uint16_t banshee_reg_readw(uint32_t addr, void *p) { - banshee_log("banshee_reg_readw: addr=%08x\n", addr); +// banshee_log("banshee_reg_readw: addr=%08x\n", addr); return banshee_reg_readl(addr & ~3, p) >> (8*(addr & 2)); } @@ -1065,17 +1063,17 @@ static uint32_t banshee_cmd_read(banshee_t *banshee, uint32_t addr) { case cmdBaseAddr0: ret = voodoo->cmdfifo_base >> 12; - banshee_log("Read cmdfifo_base %08x\n", ret); +// banshee_log("Read cmdfifo_base %08x\n", ret); break; case cmdRdPtrL0: ret = voodoo->cmdfifo_rp; - banshee_log("Read cmdfifo_rp %08x\n", ret); +// banshee_log("Read cmdfifo_rp %08x\n", ret); break; case cmdFifoDepth0: ret = voodoo->cmdfifo_depth_wr - voodoo->cmdfifo_depth_rd; - banshee_log("Read cmdfifo_depth %08x\n", ret); +// banshee_log("Read cmdfifo_depth %08x\n", ret); break; case 0x108: @@ -1246,7 +1244,7 @@ static uint32_t banshee_reg_readl(uint32_t addr, void *p) static void banshee_reg_write(uint32_t addr, uint8_t val, void *p) { - banshee_log("banshee_reg_writeb: addr=%08x val=%02x\n", addr, val); +// banshee_log("banshee_reg_writeb: addr=%08x val=%02x\n", addr, val); } static void banshee_reg_writew(uint32_t addr, uint16_t val, void *p) @@ -1256,7 +1254,7 @@ static void banshee_reg_writew(uint32_t addr, uint16_t val, void *p) cycles -= voodoo->write_time; - banshee_log("banshee_reg_writew: addr=%08x val=%04x\n", addr, val); +// banshee_log("banshee_reg_writew: addr=%08x val=%04x\n", addr, val); switch (addr & 0x1f00000) { case 0x1000000: case 0x1100000: case 0x1200000: case 0x1300000: /*3D LFB*/ @@ -1271,13 +1269,13 @@ static void banshee_reg_writew(uint32_t addr, uint16_t val, void *p) static void banshee_cmd_write(banshee_t *banshee, uint32_t addr, uint32_t val) { voodoo_t *voodoo = banshee->voodoo; - banshee_log("banshee_cmd_write: addr=%03x val=%08x\n", addr & 0x1fc, val); +// banshee_log("banshee_cmd_write: addr=%03x val=%08x\n", addr & 0x1fc, val); switch (addr & 0x1fc) { case cmdBaseAddr0: voodoo->cmdfifo_base = (val & 0xfff) << 12; voodoo->cmdfifo_end = voodoo->cmdfifo_base + (((voodoo->cmdfifo_size & 0xff) + 1) << 12); - banshee_log("cmdfifo_base=%08x cmdfifo_end=%08x %08x\n", voodoo->cmdfifo_base, voodoo->cmdfifo_end, val); +// banshee_log("cmdfifo_base=%08x cmdfifo_end=%08x %08x\n", voodoo->cmdfifo_base, voodoo->cmdfifo_end, val); break; case cmdBaseSize0: @@ -1286,11 +1284,11 @@ static void banshee_cmd_write(banshee_t *banshee, uint32_t addr, uint32_t val) voodoo->cmdfifo_enabled = val & 0x100; if (!voodoo->cmdfifo_enabled) voodoo->cmdfifo_in_sub = 0; /*Not sure exactly when this should be reset*/ - banshee_log("cmdfifo_base=%08x cmdfifo_end=%08x\n", voodoo->cmdfifo_base, voodoo->cmdfifo_end); +// banshee_log("cmdfifo_base=%08x cmdfifo_end=%08x\n", voodoo->cmdfifo_base, voodoo->cmdfifo_end); break; // voodoo->cmdfifo_end = ((val >> 16) & 0x3ff) << 12; - banshee_log("CMDFIFO base=%08x end=%08x\n", voodoo->cmdfifo_base, voodoo->cmdfifo_end); +// banshee_log("CMDFIFO base=%08x end=%08x\n", voodoo->cmdfifo_base, voodoo->cmdfifo_end); // break; case cmdRdPtrL0: @@ -1334,7 +1332,7 @@ static void banshee_reg_writel(uint32_t addr, uint32_t val, void *p) cycles -= voodoo->write_time; voodoo->last_write_addr = addr; - banshee_log("banshee_reg_writel: addr=%08x val=%08x\n", addr, val); +// banshee_log("banshee_reg_writel: addr=%08x val=%08x\n", addr, val); switch (addr & 0x1f00000) { @@ -1343,7 +1341,7 @@ static void banshee_reg_writel(uint32_t addr, uint32_t val, void *p) banshee_ext_outl(addr & 0xff, val, banshee); else banshee_cmd_write(banshee, addr, val); - banshee_log("CMD!!! write %08x %08x\n", addr, val); +// banshee_log("CMD!!! write %08x %08x\n", addr, val); break; case 0x0100000: /*2D registers*/ @@ -1359,7 +1357,7 @@ static void banshee_reg_writel(uint32_t addr, uint32_t val, void *p) { case SST_intrCtrl: banshee->intrCtrl = val & 0x0030003f; - banshee_log("intrCtrl=%08x\n", val); +// banshee_log("intrCtrl=%08x\n", val); break; case SST_userIntrCMD: @@ -1371,7 +1369,7 @@ static void banshee_reg_writel(uint32_t addr, uint32_t val, void *p) voodoo_queue_command(voodoo, (addr & 0x3fc) | FIFO_WRITEL_REG, val); if (!voodoo->voodoo_busy) voodoo_wake_fifo_threads(voodoo->set, voodoo); - banshee_log("SST_swapbufferCMD write: %i %i\n", voodoo->cmd_written, voodoo->cmd_written_fifo); +// banshee_log("SST_swapbufferCMD write: %i %i\n", voodoo->cmd_written, voodoo->cmd_written_fifo); break; case SST_triangleCMD: voodoo->cmd_written++; @@ -1443,14 +1441,14 @@ static uint8_t banshee_read_linear(uint32_t addr, void *p) y = addr >> voodoo->tile_stride_shift; addr = voodoo->tile_base + (x & 127) + ((x >> 7) * 128*32) + ((y & 31) * 128) + (y >> 5)*voodoo->tile_x_real; - banshee_log(" Tile rb %08x->%08x %i %i\n", 0, addr, x, y); +// banshee_log(" Tile rb %08x->%08x %i %i\n", old_addr, addr, x, y); } if (addr >= svga->vram_max) return 0xff; cycles -= video_timing_read_b; - banshee_log("read_linear: addr=%08x val=%02x\n", addr, svga->vram[addr & svga->vram_mask]); +// banshee_log("read_linear: addr=%08x val=%02x\n", addr, svga->vram[addr & svga->vram_mask]); return svga->vram[addr & svga->vram_mask]; } @@ -1475,14 +1473,14 @@ static uint16_t banshee_read_linear_w(uint32_t addr, void *p) y = addr >> voodoo->tile_stride_shift; addr = voodoo->tile_base + (x & 127) + ((x >> 7) * 128*32) + ((y & 31) * 128) + (y >> 5)*voodoo->tile_x_real; - banshee_log(" Tile rb %08x->%08x %i %i\n", 0, addr, x, y); +// banshee_log(" Tile rb %08x->%08x %i %i\n", old_addr, addr, x, y); } if (addr >= svga->vram_max) return 0xff; cycles -= video_timing_read_w; - banshee_log("read_linear: addr=%08x val=%02x\n", addr, svga->vram[addr & svga->vram_mask]); +// banshee_log("read_linear: addr=%08x val=%02x\n", addr, svga->vram[addr & svga->vram_mask]); return *(uint16_t *)&svga->vram[addr & svga->vram_mask]; } @@ -1508,14 +1506,14 @@ static uint32_t banshee_read_linear_l(uint32_t addr, void *p) y = addr >> voodoo->tile_stride_shift; addr = voodoo->tile_base + (x & 127) + ((x >> 7) * 128*32) + ((y & 31) * 128) + (y >> 5)*voodoo->tile_x_real; - banshee_log(" Tile rb %08x->%08x %i %i\n", 0, addr, x, y); +// banshee_log(" Tile rb %08x->%08x %i %i\n", old_addr, addr, x, y); } if (addr >= svga->vram_max) return 0xff; cycles -= video_timing_read_l; - banshee_log("read_linear: addr=%08x val=%02x\n", addr, svga->vram[addr & svga->vram_mask]); +// banshee_log("read_linear: addr=%08x val=%02x\n", addr, svga->vram[addr & svga->vram_mask]); return *(uint32_t *)&svga->vram[addr & svga->vram_mask]; } @@ -1528,7 +1526,7 @@ static void banshee_write_linear(uint32_t addr, uint8_t val, void *p) cycles -= voodoo->write_time; - banshee_log("write_linear: addr=%08x val=%02x\n", addr, val); +// banshee_log("write_linear: addr=%08x val=%02x\n", addr, val); addr &= svga->decode_mask; if (addr >= voodoo->tile_base) { @@ -1539,7 +1537,7 @@ static void banshee_write_linear(uint32_t addr, uint8_t val, void *p) y = addr >> voodoo->tile_stride_shift; addr = voodoo->tile_base + (x & 127) + ((x >> 7) * 128*32) + ((y & 31) * 128) + (y >> 5)*voodoo->tile_x_real; - banshee_log(" Tile b %08x->%08x %i %i\n", 0, addr, x, y); +// banshee_log(" Tile b %08x->%08x %i %i\n", old_addr, addr, x, y); } if (addr >= svga->vram_max) return; @@ -1564,7 +1562,7 @@ static void banshee_write_linear_w(uint32_t addr, uint16_t val, void *p) } cycles -= voodoo->write_time; - banshee_log("write_linear: addr=%08x val=%02x\n", addr, val); +// banshee_log("write_linear: addr=%08x val=%02x\n", addr, val); addr &= svga->decode_mask; if (addr >= voodoo->tile_base) { @@ -1575,7 +1573,7 @@ static void banshee_write_linear_w(uint32_t addr, uint16_t val, void *p) y = addr >> voodoo->tile_stride_shift; addr = voodoo->tile_base + (x & 127) + ((x >> 7) * 128*32) + ((y & 31) * 128) + (y >> 5)*voodoo->tile_x_real; - banshee_log(" Tile b %08x->%08x %i %i\n", 0, addr, x, y); +// banshee_log(" Tile b %08x->%08x %i %i\n", old_addr, addr, x, y); } if (addr >= svga->vram_max) return; @@ -1618,7 +1616,7 @@ static void banshee_write_linear_l(uint32_t addr, uint32_t val, void *p) y = addr >> voodoo->tile_stride_shift; addr = voodoo->tile_base + (x & 127) + ((x >> 7) * 128*32) + ((y & 31) * 128) + (y >> 5)*voodoo->tile_x_real; - banshee_log(" Tile %08x->%08x->%08x->%08x %i %i tile_x=%i\n", 0, 0, 0, addr, x, y, voodoo->tile_x_real); +// banshee_log(" Tile %08x->%08x->%08x->%08x %i %i tile_x=%i\n", old_addr, addr_off, addr2, addr, x, y, voodoo->tile_x_real); } if (addr >= svga->vram_max) @@ -1630,7 +1628,7 @@ static void banshee_write_linear_l(uint32_t addr, uint32_t val, void *p) *(uint32_t *)&svga->vram[addr & svga->vram_mask] = val; if (voodoo->cmdfifo_enabled && addr >= voodoo->cmdfifo_base && addr < voodoo->cmdfifo_end) { - banshee_log("CMDFIFO write %08x %08x old amin=%08x amax=%08x hlcnt=%i depth_wr=%i rp=%08x\n", addr, val, voodoo->cmdfifo_amin, voodoo->cmdfifo_amax, voodoo->cmdfifo_holecount, voodoo->cmdfifo_depth_wr, voodoo->cmdfifo_rp); +// banshee_log("CMDFIFO write %08x %08x old amin=%08x amax=%08x hlcnt=%i depth_wr=%i rp=%08x\n", addr, val, voodoo->cmdfifo_amin, voodoo->cmdfifo_amax, voodoo->cmdfifo_holecount, voodoo->cmdfifo_depth_wr, voodoo->cmdfifo_rp); if (addr == voodoo->cmdfifo_base && !voodoo->cmdfifo_holecount) { // if (voodoo->cmdfifo_holecount) @@ -1645,7 +1643,7 @@ static void banshee_write_linear_l(uint32_t addr, uint32_t val, void *p) { // if ((addr <= voodoo->cmdfifo_amin && voodoo->cmdfifo_amin != -4) || addr >= voodoo->cmdfifo_amax) // fatal("CMDFIFO holecount write outside of amin/amax - amin=%08x amax=%08x holecount=%i\n", voodoo->cmdfifo_amin, voodoo->cmdfifo_amax, voodoo->cmdfifo_holecount); - banshee_log("holecount %i\n", voodoo->cmdfifo_holecount); +// banshee_log("holecount %i\n", voodoo->cmdfifo_holecount); voodoo->cmdfifo_holecount--; if (!voodoo->cmdfifo_holecount) { @@ -1653,7 +1651,7 @@ static void banshee_write_linear_l(uint32_t addr, uint32_t val, void *p) voodoo->cmdfifo_depth_wr += ((voodoo->cmdfifo_amax - voodoo->cmdfifo_amin) >> 2); voodoo->cmdfifo_amin = voodoo->cmdfifo_amax; voodoo_wake_fifo_thread(voodoo); - banshee_log("hole filled! amin=%08x amax=%08x added %i words\n", voodoo->cmdfifo_amin, voodoo->cmdfifo_amax, 0); +// banshee_log("hole filled! amin=%08x amax=%08x added %i words\n", voodoo->cmdfifo_amin, voodoo->cmdfifo_amax, words_to_add); } } else if (addr == voodoo->cmdfifo_amax+4) @@ -1677,7 +1675,7 @@ static void banshee_write_linear_l(uint32_t addr, uint32_t val, void *p) // fatal("Out-of-order write really out of order\n"); voodoo->cmdfifo_amax = addr; voodoo->cmdfifo_holecount = ((voodoo->cmdfifo_amax - voodoo->cmdfifo_amin) >> 2) - 1; - banshee_log("CMDFIFO out of order: amin=%08x amax=%08x holecount=%i\n", voodoo->cmdfifo_amin, voodoo->cmdfifo_amax, voodoo->cmdfifo_holecount); +// banshee_log("CMDFIFO out of order: amin=%08x amax=%08x holecount=%i\n", voodoo->cmdfifo_amin, voodoo->cmdfifo_amax, voodoo->cmdfifo_holecount); } } } @@ -2403,7 +2401,7 @@ static uint8_t banshee_pci_read(int func, int addr, void *p) if (func) return 0xff; - banshee_log("Banshee PCI read %08X ", addr); +// banshee_log("Banshee PCI read %08X ", addr); switch (addr) { case 0x00: ret = 0x1a; break; /*3DFX*/ @@ -2484,7 +2482,7 @@ static uint8_t banshee_pci_read(int func, int addr, void *p) case 0x66: ret = banshee->pci_regs[0x66]; break; case 0x67: ret = banshee->pci_regs[0x67]; break; } - banshee_log("%02X\n", ret); +// banshee_log("%02X\n", ret); return ret; } @@ -2495,7 +2493,7 @@ static void banshee_pci_write(int func, int addr, uint8_t val, void *p) if (func) return; - banshee_log("Banshee write %08X %02X %04X:%08X\n", addr, val, CS, cpu_state.pc); +// banshee_log("Banshee write %08X %02X %04X:%08X\n", addr, val, CS, cpu_state.pc); switch (addr) { case 0x00: case 0x01: case 0x02: case 0x03: @@ -2876,7 +2874,7 @@ static void *banshee_init_common(const device_t *info, char *fn, int has_sgram, static void *banshee_init(const device_t *info) { - return banshee_init_common(info, "roms/video/voodoo/Pci_sg.rom", 1, TYPE_BANSHEE, VOODOO_BANSHEE, 1); + return banshee_init_common(info, "roms/video/voodoo/Pci_sg.rom", 1, TYPE_BANSHEE, VOODOO_BANSHEE, 0); } static void *creative_banshee_init(const device_t *info) { From d95f7cb8d270c3fc3bc9aa8c7f6d47a9fe43c417 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 11 Nov 2021 22:48:21 -0300 Subject: [PATCH 29/62] Disable AGP GART logging --- src/video/agpgart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/agpgart.c b/src/video/agpgart.c index 0bd71fa60..731cc3f71 100644 --- a/src/video/agpgart.c +++ b/src/video/agpgart.c @@ -31,7 +31,7 @@ typedef struct { mem_mapping_t aperture_mapping; } agpgart_t; -#define ENABLE_AGPGART_LOG 1 + #ifdef ENABLE_AGPGART_LOG int agpgart_do_log = ENABLE_AGPGART_LOG; @@ -96,7 +96,7 @@ agpgart_translate(uint32_t addr, agpgart_t *dev) register uint32_t gart_ptr = mem_readl_phys(dev->gart_base + ((addr >> 10) & 0xfffffffc)) & 0xfffff000; /* Return remapped address with the page offset. */ - return gart_ptr + (addr & 0x00000fff); + return gart_ptr | (addr & 0x00000fff); } From 6527fe99939ce9acd7dd8e0260685e60e8d7f0fc Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 12 Nov 2021 00:43:03 -0300 Subject: [PATCH 30/62] AC97 codec overhaul, now with proper enabling through settings and proper codec features --- src/include/86box/snd_ac97.h | 91 +++++- src/machine/m_at_socket370.c | 4 +- src/machine/m_at_sockets7.c | 4 +- src/machine/machine_table.c | 4 +- src/sound/snd_ac97_codec.c | 537 ++++++++++++++++++++++++++--------- src/sound/snd_ac97_via.c | 13 +- src/sound/snd_audiopci.c | 7 +- src/sound/sound.c | 1 + 8 files changed, 502 insertions(+), 159 deletions(-) diff --git a/src/include/86box/snd_ac97.h b/src/include/86box/snd_ac97.h index 08f5747f6..7eb2d1cc5 100644 --- a/src/include/86box/snd_ac97.h +++ b/src/include/86box/snd_ac97.h @@ -18,14 +18,97 @@ # define EMU_SND_AC97_H +#define AC97_VENDOR_ID(f, s, t, dev) ((((f) & 0xff) << 24) | (((s) & 0xff) << 16) | (((t) & 0xff) << 8) | ((dev) & 0xff)) + +/* Misc support bits (misc_flags). Most of these are not part of any + registers, but control enabling/disabling of registers and bits. */ +#define AC97_MASTER_6B (1 << 0) /* register 02 bits [13,5] (ML5/MR5) */ +#define AC97_AUXOUT (1 << 1) /* register 04 */ +#define AC97_AUXOUT_6B (1 << 2) /* register 04 bits [13,5] (ML5/MR5) */ +#define AC97_MONOOUT (1 << 3) /* register 06 */ +#define AC97_MONOOUT_6B (1 << 4) /* register 06 bit 5 (MM5) */ +#define AC97_PCBEEP (1 << 5) /* register 0A */ +#define AC97_PCBEEP_GEN (1 << 6) /* register 0A bits [12:5] (F[7:0]) */ +#define AC97_PHONE (1 << 9) /* register 0C */ +#define AC97_VIDEO (1 << 10) /* register 14 */ +#define AC97_AUXIN (1 << 11) /* register 16 */ +#define AC97_POP (1 << 15) /* register 20 bit 15 (POP) - definition shared with General Purpose bits */ +#define AC97_MS (1 << 8) /* register 20 bit 8 (MS) - definition shared with General Purpose bits */ +#define AC97_LPBK (1 << 7) /* register 20 bit 7 (LPBK) - definition shared with General Purpose bits */ +#define AC97_DSA (1 << 12) /* register 28 bits [5:4] (DSA[1:0]) */ +#define AC97_LFE_6B (1 << 13) /* register 36 bit 13 (LFE5) */ +#define AC97_CENTER_6B (1 << 14) /* register 36 bit 5 (CNT5) */ +#define AC97_SURR_6B (1 << 16) /* register 38 bits [13,5] (LSR5/RSR5) */ + +/* Reset bits (reset_flags), register 00. */ +#define AC97_MICPCM (1 << 0) +#define AC97_MODEMLINE (1 << 1) +#define AC97_TONECTL (1 << 2) +#define AC97_SIMSTEREO (1 << 3) +#define AC97_HPOUT (1 << 4) +#define AC97_LOUDNESS (1 << 5) +#define AC97_DAC_18B (1 << 6) +#define AC97_DAC_20B (1 << 7) +#define AC97_ADC_18B (1 << 8) +#define AC97_ADC_20B (1 << 9) +#define AC97_3D_SHIFT 10 + +/* Extended Audio ID bits (extid_flags), register 28. */ +#define AC97_VRA (1 << 0) +#define AC97_DRA (1 << 1) +#define AC97_SPDIF (1 << 2) +#define AC97_VRM (1 << 3) +#define AC97_CDAC (1 << 6) +#define AC97_SDAC (1 << 7) +#define AC97_LDAC (1 << 8) +#define AC97_AMAP (1 << 9) +#define AC97_REV_2_1 (0 << 10) +#define AC97_REV_2_2 (1 << 10) +#define AC97_REV_2_3 (2 << 10) +#define AC97_REV_MASK (3 << 10) + +/* Volume bits. */ +#define AC97_MUTE (1 << 15) +#define AC97_MUTE_L (1 << 15) +#define AC97_MUTE_R (1 << 7) + +/* General Purpose bits, register 20. */ +/* POP already defined */ +#define AC97_ST (1 << 14) +#define AC97_3D (1 << 13) +#define AC97_LD (1 << 12) +#define AC97_DRSS_MASK (3 << 10) +#define AC97_MIX (1 << 9) +/* MS already defined */ +/* LPBK already defined */ + +/* Extended Audio Status/Control bits, register 2A. */ +#define AC97_SPSA_SHIFT 4 +#define AC97_SPSA_MASK 3 +#define AC97_MADC (1 << 9) +#define AC97_SPCV (1 << 10) +#define AC97_PRI (1 << 11) +#define AC97_PRJ (1 << 12) +#define AC97_PRK (1 << 13) +#define AC97_PRL (1 << 14) + + typedef struct { - uint32_t vendor_id; - uint8_t codec_id, regs[128]; + const uint16_t index, value, write_mask; +} ac97_vendor_reg_t; + +typedef struct { + uint32_t vendor_id, max_rate, misc_flags; + uint16_t reset_flags, extid_flags, + powerdown_mask, regs[64]; + uint8_t codec_id, vendor_reg_page_max; + const ac97_vendor_reg_t *vendor_regs; + uint16_t *vendor_reg_pages; } ac97_codec_t; -extern uint8_t ac97_codec_read(ac97_codec_t *dev, uint8_t reg); -extern void ac97_codec_write(ac97_codec_t *dev, uint8_t reg, uint8_t val); +extern uint16_t ac97_codec_readw(ac97_codec_t *dev, uint8_t reg); +extern void ac97_codec_writew(ac97_codec_t *dev, uint8_t reg, uint16_t val); extern void ac97_codec_reset(void *priv); extern void ac97_codec_getattn(void *priv, uint8_t reg, int *l, int *r); extern uint32_t ac97_codec_getrate(void *priv, uint8_t reg); diff --git a/src/machine/m_at_socket370.c b/src/machine/m_at_socket370.c index 8a2605145..4475ee984 100644 --- a/src/machine/m_at_socket370.c +++ b/src/machine/m_at_socket370.c @@ -37,6 +37,7 @@ #include "cpu.h" #include <86box/machine.h> #include <86box/clock.h> +#include <86box/sound.h> #include <86box/snd_ac97.h> @@ -452,7 +453,8 @@ machine_at_6via90ap_init(const machine_t *model) hwm_values.temperatures[1] += 2; /* System offset */ hwm_values.temperatures[2] = 0; /* unused */ - device_add(&alc100_device); /* ALC100P identified on similar Acorp boards (694TA, 6VIA90A1) */ + if (sound_card_current == SOUND_INTERNAL) + device_add(&alc100_device); /* ALC100P identified on similar Acorp boards (694TA, 6VIA90A1) */ return ret; } diff --git a/src/machine/m_at_sockets7.c b/src/machine/m_at_sockets7.c index ca6c957e2..05c0e4644 100644 --- a/src/machine/m_at_sockets7.c +++ b/src/machine/m_at_sockets7.c @@ -40,6 +40,7 @@ #include <86box/video.h> #include "cpu.h" #include <86box/machine.h> +#include <86box/sound.h> #include <86box/snd_ac97.h> @@ -141,7 +142,8 @@ machine_at_ficva503a_init(const machine_t *model) hwm_values.temperatures[1] += 2; /* System offset */ hwm_values.temperatures[2] = 0; /* unused */ - device_add(&wm9701a_device); /* on daughtercard */ + if (sound_card_current == SOUND_INTERNAL) + device_add(&wm9701a_device); /* on daughtercard */ return ret; } diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 889d4ce85..731400de0 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -374,7 +374,7 @@ const machine_t machines[] = { /* Apollo MVP3 */ { "[VIA MVP3] AOpen AX59 Pro", "ax59pro", MACHINE_TYPE_SOCKETS7, CPU_PKG_SOCKET5_7, 0, 66666667, 124242424, 1300, 3520, 1.5, 5.5, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1048576, 8192, 255, machine_at_ax59pro_init, NULL }, { "[VIA MVP3] FIC VA-503+", "ficva503p", MACHINE_TYPE_SOCKETS7, CPU_PKG_SOCKET5_7, 0, 66666667, 124242424, 2000, 3200, 1.5, 5.5, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1048576, 8192, 255, machine_at_mvp3_init, NULL }, - { "[VIA MVP3] FIC VA-503A", "ficva503a", MACHINE_TYPE_SOCKETS7, CPU_PKG_SOCKET5_7, 0, 66666667, 124242424, 1800, 3100, 1.5, 5.5, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_ficva503a_init, NULL }, + { "[VIA MVP3] FIC VA-503A", "ficva503a", MACHINE_TYPE_SOCKETS7, CPU_PKG_SOCKET5_7, 0, 66666667, 124242424, 1800, 3100, 1.5, 5.5, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_BUS_AC97 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_ficva503a_init, NULL }, /* Socket 8 machines */ /* 450KX */ @@ -459,7 +459,7 @@ const machine_t machines[] = { { "[VIA Apollo Pro 133] ECS P6BAP", "p6bap", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 150000000, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1572864, 8192, 255, machine_at_p6bap_init, NULL }, { "[VIA Apollo Pro 133A] BCM GT694VA", "gt694va", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 16384,3145728, 8192, 255, machine_at_gt694va_init, NULL }, { "[VIA Apollo Pro 133A] ASUS CUV4X-LS", "cuv4xls", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 150000000, 1300, 3500, 1.5, 8.0, (MACHINE_AGP & ~MACHINE_AT) | MACHINE_BUS_PS2 | MACHINE_BUS_AC97 | MACHINE_IDE_DUAL,16384,4194304, 8192, 255, machine_at_cuv4xls_init, NULL }, - { "[VIA Apollo Pro 133A] Acorp 6VIA90AP", "6via90ap", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 150000000, 1300, 3500, MACHINE_MULTIPLIER_FIXED, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_GAMEPORT, 16384,3145728, 8192, 255, machine_at_6via90ap_init, NULL }, + { "[VIA Apollo Pro 133A] Acorp 6VIA90AP", "6via90ap", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 150000000, 1300, 3500, MACHINE_MULTIPLIER_FIXED, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_BUS_AC97 | MACHINE_IDE_DUAL | MACHINE_SOUND | MACHINE_GAMEPORT,16384,3145728, 8192, 255, machine_at_6via90ap_init, NULL }, /* Miscellaneous/Fake/Hypervisor machines */ { "[i440BX] Microsoft Virtual PC 2007", "vpc2007", MACHINE_TYPE_MISC, CPU_PKG_SLOT1, CPU_BLOCK(CPU_PENTIUM2, CPU_CYRIX3S), 0, 0, 0, 0, 0, 0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1048576, 8192, 255, machine_at_vpc2007_init, NULL }, diff --git a/src/sound/snd_ac97_codec.c b/src/sound/snd_ac97_codec.c index e0a27a4e5..b992b0e6a 100644 --- a/src/sound/snd_ac97_codec.c +++ b/src/sound/snd_ac97_codec.c @@ -25,15 +25,63 @@ #include <86box/io.h> #include <86box/snd_ac97.h> -#define AC97_VENDOR_ID(f, s, t, dev) ((((f) & 0xff) << 24) | (((s) & 0xff) << 16) | (((t) & 0xff) << 8) | ((dev) & 0xff)) - enum { - AC97_CODEC_AD1881 = AC97_VENDOR_ID('A', 'D', 'S', 0x40), - AC97_CODEC_ALC100 = AC97_VENDOR_ID('A', 'L', 'C', 0x20), - AC97_CODEC_CS4297 = AC97_VENDOR_ID('C', 'R', 'Y', 0x03), - AC97_CODEC_CS4297A = AC97_VENDOR_ID('C', 'R', 'Y', 0x11), - AC97_CODEC_WM9701A = AC97_VENDOR_ID('W', 'M', 'L', 0x00) + AC97_CODEC_AD1881, + AC97_CODEC_ALC100, + AC97_CODEC_CS4297, + AC97_CODEC_CS4297A, + AC97_CODEC_WM9701A +}; + +static const struct { + const uint32_t vendor_id, max_rate, misc_flags; /* definitions for misc_flags in snd_ac97.h */ + const uint16_t reset_flags, extid_flags, /* definitions in snd_ac97.h */ + powerdown_mask; /* bits [7:0] => register 26 bits [15:8]; bits [11:8] => register 2A bits [14:11] */ + const ac97_vendor_reg_t *vendor_regs; /* bits [11:8] of index are the page number if applicable (registers [60:6F]) */ +} ac97_codecs[] = { + [AC97_CODEC_AD1881] = { + .vendor_id = AC97_VENDOR_ID('A', 'D', 'S', 0x40), + .max_rate = 48000, + .misc_flags = AC97_MASTER_6B | AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_POP | AC97_MS | AC97_LPBK, + .reset_flags = (1 << AC97_3D_SHIFT), /* datasheet contradicts itself on AC97_HPOUT */ + .extid_flags = AC97_VRA, + .powerdown_mask = 0x0bf + }, + [AC97_CODEC_ALC100] = { + .vendor_id = AC97_VENDOR_ID('A', 'L', 'C', 0x20), + .max_rate = 48000, + .misc_flags = AC97_AUXOUT | AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_POP | AC97_MS | AC97_LPBK, + .reset_flags = (22 << AC97_3D_SHIFT), + .extid_flags = AC97_AMAP, + .powerdown_mask = 0x0bf + }, + [AC97_CODEC_CS4297] = { + .vendor_id = AC97_VENDOR_ID('C', 'R', 'Y', 0x03), + .max_rate = 48000, + .misc_flags = AC97_MASTER_6B | AC97_AUXOUT | AC97_AUXOUT_6B | AC97_MONOOUT | AC97_MONOOUT_6B | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_MS | AC97_LPBK, + .reset_flags = AC97_HPOUT | AC97_DAC_18B | AC97_ADC_18B, + .extid_flags = 0, + .powerdown_mask = 0x07f, + .vendor_regs = (const ac97_vendor_reg_t[]) {{0x05a, 0x0301, 0x0000}, {0}} + }, + [AC97_CODEC_CS4297A] = { + .vendor_id = AC97_VENDOR_ID('C', 'R', 'Y', 0x11), + .max_rate = 48000, + .misc_flags = AC97_MASTER_6B | AC97_AUXOUT | AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_MS | AC97_LPBK, + .reset_flags = AC97_HPOUT | AC97_DAC_20B | AC97_ADC_18B | (6 << AC97_3D_SHIFT), + .extid_flags = AC97_AMAP, + .powerdown_mask = 0x0ff, + .vendor_regs = (const ac97_vendor_reg_t[]) {{0x05e, 0x0000, 0x01b0}, {0x060, 0x0023, 0x0001}, {0x068, 0x0000, 0xdfff}, {0}} + }, + [AC97_CODEC_WM9701A] = { + .vendor_id = AC97_VENDOR_ID('W', 'M', 'L', 0x00), + .max_rate = 48000, + .misc_flags = AC97_AUXOUT | AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_MS | AC97_LPBK, + .reset_flags = AC97_DAC_18B | AC97_ADC_18B, + .extid_flags = 0, + .powerdown_mask = 0x03f + } }; @@ -56,6 +104,8 @@ ac97_codec_log(const char *fmt, ...) #endif static const int32_t codec_attn[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 2, 2, 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 25, 32, 41, 51, 65, 82, 103, 130, 164, 206, 260, 327, 412, 519, 653, 822, 1036, 1304, 1641, 2067, 2602, 3276, 4125, 5192, 6537, 8230, 10362, 13044, 16422, 20674, 26027, 32767, 41305, 52068, 65636, 82739, 104299, 131477, 165737, 208925 @@ -66,147 +116,296 @@ int ac97_codec_count = 0, ac97_modem_codec_count = 0, ac97_codec_id = 0, ac97_modem_codec_id = 0; -uint8_t -ac97_codec_read(ac97_codec_t *dev, uint8_t reg) +uint16_t +ac97_codec_readw(ac97_codec_t *dev, uint8_t reg) { - uint8_t ret = dev->regs[reg & 0x7f]; + /* Redirect a read from extended pages 1+ to the right array. */ + reg &= 0x7e; + uint16_t ret = dev->regs[0x24 >> 1] & 0x000f; + if ((ret > 0) && (reg >= 0x60) && (reg < 0x6f)) + ret = (ret <= dev->vendor_reg_page_max) ? dev->vendor_reg_pages[(ret << 3) | ((reg & 0x0e) >> 1)] : 0; + else + ret = dev->regs[reg >> 1]; - ac97_codec_log("AC97 Codec %d: read(%02X) = %02X\n", dev->codec_id, reg, ret); + ac97_codec_log("AC97 Codec %d: readw(%02X) = %04X\n", dev->codec_id, reg, ret); return ret; } void -ac97_codec_write(ac97_codec_t *dev, uint8_t reg, uint8_t val) +ac97_codec_writew(ac97_codec_t *dev, uint8_t reg, uint16_t val) { - uint8_t i; + ac97_codec_log("AC97 Codec %d: writew(%02X, %04X)\n", dev->codec_id, reg, val); - ac97_codec_log("AC97 Codec %d: write(%02X, %02X)\n", dev->codec_id, reg, val); - - reg &= 0x7f; + reg &= 0x7e; + uint16_t i = 0, prev = dev->regs[reg >> 1]; + int j; switch (reg) { - case 0x00: case 0x01: /* Reset / ID code */ + case 0x00: /* Reset / ID code */ ac97_codec_reset(dev); return; - case 0x08: case 0x09: /* Master Tone Control (optional) */ - case 0x0d: /* Phone Volume MSB */ - case 0x0f: /* Mic Volume MSB */ - case 0x1e: case 0x1f: /* Record Gain Mic (optional) */ - case 0x22: case 0x23: /* 3D Control (optional) */ - case 0x24: case 0x25: /* Audio Interrupt and Paging Mechanism (optional) */ - case 0x26: /* Powerdown Ctrl/Stat LSB */ - case 0x28: case 0x29: /* Extended Audio ID */ - case 0x2b: /* Extended Audio Status/Control MSB */ - //case 0x36 ... 0x59: /* Linux tests for audio capability by writing to 38-39 */ - case 0x5a ... 0x5f: /* Vendor Reserved */ - //case 0x60 ... 0x6f: - case 0x70 ... 0x7f: /* Vendor Reserved */ - /* Read-only registers. */ - return; + case 0x02: /* Master Volume */ + val &= 0xbf3f; - case 0x02: /* Master Volume LSB */ - case 0x04: /* Aux Out Volume LSB */ - case 0x06: /* Mono Volume LSB */ - val &= 0x3f; - /* fall-through */ - - case 0x03: /* Master Volume MSB */ - case 0x05: /* Aux Out Volume MSB */ - val &= 0xbf; - - /* Limit level to a maximum of 011111. */ - if (val & 0x20) { - val &= ~0x20; - val |= 0x1f; + /* Convert 1xxxxx to 011111 where unsupported, per specification. */ + if (!(dev->misc_flags & AC97_MASTER_6B)) { +clamp_5b: if (val & 0x2000) + val = (val & ~0x2000) | 0x1f00; +clamp_5b_r: if (val & 0x0020) + val = (val & ~0x0020) | 0x001f; } break; - case 0x07: /* Mono Volume MSB */ - case 0x0b: /* PC Beep Volume MSB */ - case 0x20: /* General Purpose LSB */ - val &= 0x80; + case 0x04: /* Aux Out Volume */ + if (!(dev->misc_flags & AC97_AUXOUT)) + return; + val &= 0xbf3f; + + /* Convert 1xxxxx to 011111 where unsupported, per specification. */ + if (!(dev->misc_flags & AC97_AUXOUT_6B)) + goto clamp_5b; break; - case 0x0a: /* PC Beep Volume LSB */ - val &= 0x1e; + case 0x06: /* Mono Out Volume */ + if (!(dev->misc_flags & AC97_MONOOUT)) + return; + val &= 0x803f; + + /* Convert 1xxxxx to 011111 where unsupported, per specification. */ + if (!(dev->misc_flags & AC97_MONOOUT_6B)) + goto clamp_5b_r; break; - case 0x0c: /* Phone Volume LSB */ - case 0x10: /* Line In Volume LSB */ - case 0x12: /* CD Volume LSB */ - case 0x14: /* Video Volume LSB */ - case 0x16: /* Aux In Volume LSB */ - case 0x18: /* PCM Out Volume LSB */ - val &= 0x1f; + case 0x08: /* Master Tone Control */ + if (!(dev->reset_flags & AC97_TONECTL)) + return; + val &= 0x0f0f; break; - case 0x0e: /* Mic Volume LSB */ - val &= 0x5f; + case 0x0a: /* PC Beep Volume */ + if (dev->misc_flags & AC97_PCBEEP) + i |= 0x801e; + if (dev->misc_flags & AC97_PCBEEP_GEN) + i |= 0x1fe0; + val &= i; break; - case 0x11: /* Line In Volume MSB */ - case 0x13: /* CD Volume MSB */ - case 0x15: /* Video Volume MSB */ - case 0x17: /* Aux In Volume MSB */ - case 0x19: /* PCM Out Volume MSB */ - val &= 0x9f; + case 0x0c: /* Phone Volume */ + if (!(dev->misc_flags & AC97_PHONE)) + return; + val &= 0x801f; break; - case 0x1a: case 0x1b: /* Record Select */ - val &= 0x07; + case 0x0e: /* Mic Volume */ + val &= 0x805f; break; - case 0x1c: /* Record Gain LSB */ - val &= 0x0f; + case 0x10: /* Line In Volume */ + case 0x12: /* CD Volume */ + case 0x18: /* PCM Out Volume */ +line_gain: val &= 0x9f1f; break; - case 0x1d: /* Record Gain MSB */ - val &= 0x8f; + case 0x14: /* Video Volume */ + if (!(dev->misc_flags & AC97_VIDEO)) + return; + goto line_gain; + + case 0x16: /* Aux In Volume */ + if (!(dev->misc_flags & AC97_AUXIN)) + return; + goto line_gain; + + case 0x1a: /* Record Select Control */ + val &= 0x0707; break; - case 0x21: /* General Purpose MSB */ - val &= 0x83; + case 0x1c: /* Record Gain */ + val &= 0x8f0f; break; - case 0x2a: /* Extended Audio Status/Control LSB */ -#ifdef AC97_CODEC_FULL_RATE_RANGE /* enable DRA (double rate) support */ - val &= 0x0b; -#else - val &= 0x09; -#endif + case 0x1e: /* Record Gain Mic */ + if (!(dev->reset_flags & AC97_MICPCM)) + return; + val &= 0x800f; + break; + + case 0x20: /* General Purpose */ + i = AC97_MIX | (dev->misc_flags & (AC97_POP | AC97_MS | AC97_LPBK)); + if (dev->reset_flags >> AC97_3D_SHIFT) + i |= AC97_3D; + if (dev->reset_flags & AC97_SIMSTEREO) + i |= AC97_ST; + if (dev->reset_flags & AC97_LOUDNESS) + i |= AC97_LD; + if (dev->extid_flags & AC97_DRA) + i |= AC97_DRSS_MASK; + val &= i; + break; + + case 0x22: /* 3D Control */ + switch (dev->reset_flags >> AC97_3D_SHIFT) { + case 1: /* Analog Devices */ + case 6: /* Crystal */ + val &= 0x000f; + break; + + case 22: /* Avance Logic / Realtek */ + val &= 0x0003; + break; + + default: + return; + } + break; + + case 0x24: /* Audio Interrupt and Paging Mechanism */ + if ((dev->extid_flags & AC97_REV_MASK) < AC97_REV_2_3) + return; + val &= 0x000f; + break; + + case 0x26: /* Powerdown Control/Status */ + i = dev->powerdown_mask << 8; + val = (val & i) | (prev & ~i); + break; + + case 0x28: /* Extended Audio ID */ + if (dev->misc_flags & AC97_DSA) + i |= 0x0030; + val = (val & i) | (prev & ~i); + break; + + case 0x2a: /* Extended Audio Status/Control */ + i = dev->extid_flags & (AC97_VRA | AC97_DRA | AC97_SPDIF | AC97_VRM); + if (dev->extid_flags & AC97_SPDIF) + i |= AC97_SPSA_MASK << AC97_SPSA_SHIFT; + i |= (dev->powerdown_mask << 3) & 0x7800; /* multichannel powerdowns */ + val = (val & i) | (prev & ~i); + /* Reset DAC sample rates to 48 KHz (96 KHz with DRA) if VRA is being cleared. */ - if (!(val & 0x01)) { + if (!(val & AC97_VRA)) { for (i = 0x2c; i <= 0x30; i += 2) - *((uint16_t *) &dev->regs[i]) = 48000; + dev->regs[i >> 1] = 48000; } /* Reset ADC sample rates to 48 KHz if VRM is being cleared. */ - if (!(val & 0x08)) { + if (!(val & AC97_VRM)) { for (i = 0x32; i <= 0x34; i += 2) - *((uint16_t *) &dev->regs[i]) = 48000; + dev->regs[i >> 1] = 48000; } break; - case 0x2c ... 0x35: /* DAC/ADC Rates */ - /* Writable only if VRA/VRM is set. */ - i = (reg >= 0x32) ? 0x08 : 0x01; - if (!(dev->regs[0x2a] & i)) + case 0x2c: /* PCM Front DAC Rate */ + case 0x32: /* PCM L/R ADC Rate */ +rate: /* Writable only if VRA/VRM is set. */ + i = (reg >= 0x32) ? AC97_VRM : AC97_VRA; + if (!(dev->extid_flags & i)) return; -#ifndef AC97_CODEC_FULL_RATE_RANGE - /* Limit to 48 KHz on MSB write. */ - if ((reg & 1) && (((val << 8) | dev->regs[reg & 0x7e]) > 48000)) { - *((uint16_t *) &dev->regs[reg & 0x7e]) = 48000; + /* Limit to maximum rate. */ + if (val > dev->max_rate) + val = dev->max_rate; + break; + + case 0x2e: /* PCM Surround DAC Rate */ + if (!(dev->extid_flags & AC97_SDAC)) + return; + goto rate; + + case 0x30: /* PCM LFE DAC Rate */ + if (!(dev->extid_flags & AC97_LDAC)) + return; + goto rate; + + case 0x34: /* Mic ADC Rate */ + if (!(dev->reset_flags & AC97_MICPCM)) + return; + goto rate; + + case 0x36: /* Center/LFE Volume */ + if (dev->extid_flags & AC97_LDAC) + i |= 0xbf00; + if (dev->extid_flags & AC97_CDAC) + i |= 0x00bf; + val &= i; + + /* Convert 1xxxxx to 011111 where unsupported, per specification. */ + if (!(dev->misc_flags & AC97_LFE_6B) && (val & 0x2000)) + val = (val & ~0x2000) | 0x1f00; + if (!(dev->misc_flags & AC97_CENTER_6B)) + goto clamp_5b_r; + break; + + case 0x38: /* Surround Volume */ + if (!(dev->extid_flags & AC97_SDAC)) + return; + val &= 0xbfbf; + + /* Convert 1xxxxx to 011111 where unsupported, per specification. */ + if (!(dev->misc_flags & AC97_SURR_6B)) + goto clamp_5b; + break; + + case 0x3a: /* S/PDIF Control */ + if (!(dev->extid_flags & AC97_SPDIF)) + return; + break; + + case 0x60 ... 0x6e: /* Extended */ + /* Get extended register page. */ + i = dev->regs[0x24 >> 1] & 0x000f; + + /* Redirect a write to page 1+ to the right array, part 1. */ + if (i > 0) { + /* Don't overflow the pages. */ + if (i > dev->vendor_reg_page_max) + return; + + /* Get actual previous value. */ + prev = dev->vendor_reg_pages[(i << 3) | ((reg & 0x0e) >> 1)]; + } + + i <<= 8; + /* fall-through */ + + case 0x5a ... 0x5e: /* Vendor Reserved */ + case 0x70 ... 0x7a: + /* Stop if no vendor-specific registers are defined. */ + if (!dev->vendor_regs) + return; + + /* Look for a matching vendor-specific register. */ + i |= reg; + for (j = 0; dev->vendor_regs[j].index; j++) { + /* If a match was found, inject written bits. */ + if (dev->vendor_regs[j].index == i) { + val = (val & dev->vendor_regs[j].write_mask) | (prev & ~dev->vendor_regs[j].write_mask); + break; + } + } + + /* No match found. */ + if (!dev->vendor_regs[j].index) + return; + + /* Redirect a write to page 1+ to the right array, part 2. */ + i >>= 8; + if (i > 0) { + dev->vendor_reg_pages[(i << 3) | ((reg & 0x0e) >> 1)] = val; return; } -#endif break; + + case 0x7c: /* Vendor ID1 */ + case 0x7e: /* Vendor ID2 */ + return; } - dev->regs[reg] = val; + dev->regs[reg >> 1] = val; } @@ -214,38 +413,59 @@ void ac97_codec_reset(void *priv) { ac97_codec_t *dev = (ac97_codec_t *) priv; - uint8_t i; + uint16_t i, j; ac97_codec_log("AC97 Codec %d: reset()\n", dev->codec_id); memset(dev->regs, 0, sizeof(dev->regs)); /* Set default level and gain values. */ - for (i = 0x02; i <= 0x18; i += 2) { - if (i == 0x08) - continue; - if (i >= 0x0c) - dev->regs[i] = 0x08; - dev->regs[i | 1] = (i >= 0x10) ? 0x88 : 0x80; + dev->regs[0x02 >> 1] = AC97_MUTE; + if (dev->misc_flags & AC97_AUXOUT) + dev->regs[0x04 >> 1] = AC97_MUTE; + if (dev->misc_flags & AC97_MONOOUT) + dev->regs[0x06 >> 1] = AC97_MUTE; + if (dev->misc_flags & AC97_PHONE) + dev->regs[0x0c >> 1] = AC97_MUTE | 0x0008; + dev->regs[0x0e >> 1] = AC97_MUTE | 0x0008; /* mic */ + dev->regs[0x10 >> 1] = dev->regs[0x12 >> 1] = dev->regs[0x18 >> 1] = AC97_MUTE | 0x0808; /* line in, CD, PCM out */ + if (dev->misc_flags & AC97_VIDEO) + dev->regs[0x14 >> 1] = AC97_MUTE | 0x0808; + if (dev->misc_flags & AC97_AUXIN) + dev->regs[0x14 >> 1] = AC97_MUTE | 0x0808; + if (dev->misc_flags & AC97_LDAC) + dev->regs[0x36 >> 1] = AC97_MUTE_L; + if (dev->misc_flags & AC97_CDAC) + dev->regs[0x36 >> 1] |= AC97_MUTE_R; + if (dev->misc_flags & AC97_SDAC) + dev->regs[0x38 >> 1] = AC97_MUTE_L | AC97_MUTE_R; + + /* Set flags. */ + dev->regs[0x00 >> 1] = dev->reset_flags; + dev->regs[0x26 >> 1] = 0x000f; /* codec ready */ + dev->regs[0x28 >> 1] = (dev->codec_id << 14) | dev->extid_flags; + ac97_codec_writew(dev, 0x2a, 0x0000); /* reset variable DAC/ADC sample rates */ + i = dev->extid_flags & (AC97_CDAC | AC97_SDAC | AC97_LDAC); + dev->regs[0x2a >> 1] |= i | (i << 5); /* any additional DACs are ready but powered down */ + if (dev->extid_flags & AC97_SPDIF) + dev->regs[0x2a >> 1] |= AC97_SPCV; + if (dev->reset_flags & AC97_MICPCM) + dev->regs[0x2a >> 1] |= AC97_MADC | AC97_PRL; + + /* Set vendor ID. */ + dev->regs[0x7c >> 1] = dev->vendor_id >> 16; + dev->regs[0x7e >> 1] = dev->vendor_id; + + /* Set vendor-specific registers. */ + if (dev->vendor_regs) { + for (j = 0; dev->vendor_regs[j].index; j++) { + i = (dev->vendor_regs[j].index >> 8) & 0x000f; + if (i > 0) + dev->vendor_reg_pages[(i << 3) | (dev->vendor_regs[j].index >> 1)] = dev->vendor_regs[j].value; + else + dev->regs[dev->vendor_regs[j].index >> 1] = dev->vendor_regs[j].value; + } } - - /* Flag codec as ready. */ - dev->regs[0x26] = 0x0f; - - /* Set up variable sample rate support. */ -#ifdef AC97_CODEC_FULL_RATE_RANGE /* enable DRA (double rate) support */ - dev->regs[0x28] = 0x0b; -#else - dev->regs[0x28] = 0x09; -#endif - ac97_codec_write(dev, 0x2a, 0x00); /* reset DAC/ADC sample rates */ - - /* Set codec and vendor IDs. */ - dev->regs[0x29] = (dev->codec_id << 6) | 0x02; - dev->regs[0x7c] = dev->vendor_id >> 16; - dev->regs[0x7d] = dev->vendor_id >> 24; - dev->regs[0x7e] = dev->vendor_id; - dev->regs[0x7f] = dev->vendor_id >> 8; } @@ -253,24 +473,38 @@ void ac97_codec_getattn(void *priv, uint8_t reg, int *l, int *r) { ac97_codec_t *dev = (ac97_codec_t *) priv; - uint8_t r_val = dev->regs[reg], - l_val = dev->regs[reg | 1]; + uint16_t val = dev->regs[reg >> 1]; - if (l_val & 0x80) { /* mute */ + /* Apply full mute and powerdowns. */ + int full_mute = (reg < 0x36); + if ((full_mute && (val & AC97_MUTE)) || /* full mute */ + (dev->regs[0x26 >> 1] & 0x3e00) || /* DAC powerdown */ + ((reg == 0x38) && (dev->regs[0x2a >> 1] & AC97_PRJ))) { /* surround DAC powerdown */ *l = 0; *r = 0; - return; + } else { /* per-channel mute */ + /* Determine attenuation value. */ + uint8_t l_val = val >> 8, r_val = val; + if (reg <= 0x06) { /* 6-bit level */ + *l = codec_attn[0x3f - (l_val & 0x3f)]; + *r = codec_attn[0x3f - (r_val & 0x3f)]; + } else { /* 5-bit gain */ + *l = codec_attn[0x47 - (l_val & 0x1f)]; + *r = codec_attn[0x47 - (r_val & 0x1f)]; + } + + /* Apply per-channel mute and center/LFE powerdowns where applicable. */ + if (!full_mute) { + if ((val & AC97_MUTE_L) || /* left mute */ + ((reg == 0x36) && (dev->regs[0x2a >> 1] & AC97_PRK))) /* LFE DAC powerdown */ + *l = 0; + if ((val & AC97_MUTE_R) || /* right mute */ + ((reg == 0x36) && (dev->regs[0x2a >> 1] & AC97_PRI))) /* center DAC powerdown */ + *r = 0; + } } - l_val &= 0x1f; - r_val &= 0x1f; - if (reg < 0x10) { /* 5-bit level (converted from 6-bit on register write) */ - *l = codec_attn[0x1f - l_val]; - *r = codec_attn[0x1f - r_val]; - } else { /* 5-bit gain */ - *l = codec_attn[0x27 - l_val]; - *r = codec_attn[0x27 - r_val]; - } + ac97_codec_log("AC97 Codec %d: getattn(%02X) = %d %d\n", dev->codec_id, reg, *l, *r); } @@ -280,13 +514,11 @@ ac97_codec_getrate(void *priv, uint8_t reg) ac97_codec_t *dev = (ac97_codec_t *) priv; /* Get configured sample rate, which is always 48000 if VRA/VRM is not set. */ - uint32_t ret = *((uint16_t *) &dev->regs[reg]); + uint32_t ret = dev->regs[reg >> 1]; -#ifdef AC97_CODEC_FULL_RATE_RANGE - /* If this is a DAC, double sample rate if DRA is set. */ - if ((reg < 0x32) && (dev->regs[0x2a] & 0x02)) + /* If this is the PCM DAC, double sample rate if DRA is set. */ + if ((reg == 0x2c) && (dev->regs[0x2a >> 1] & AC97_DRA)) ret <<= 1; -#endif ac97_codec_log("AC97 Codec %d: getrate(%02X) = %d\n", dev->codec_id, reg, ret); @@ -300,7 +532,12 @@ ac97_codec_init(const device_t *info) ac97_codec_t *dev = malloc(sizeof(ac97_codec_t)); memset(dev, 0, sizeof(ac97_codec_t)); - dev->vendor_id = info->local; + dev->vendor_id = ac97_codecs[info->local].vendor_id; + dev->max_rate = ac97_codecs[info->local].max_rate; + dev->extid_flags = ac97_codecs[info->local].extid_flags; + dev->misc_flags = ac97_codecs[info->local].misc_flags; + dev->powerdown_mask = ac97_codecs[info->local].powerdown_mask; + dev->vendor_regs = ac97_codecs[info->local].vendor_regs; ac97_codec_log("AC97 Codec %d: init(%c%c%c%02X)\n", ac97_codec_id, (dev->vendor_id >> 24) & 0xff, (dev->vendor_id >> 16) & 0xff, (dev->vendor_id >> 8) & 0xff, dev->vendor_id & 0xff); /* Associate this codec to the current controller. */ @@ -315,6 +552,26 @@ ac97_codec_init(const device_t *info) ac97_codec += sizeof(ac97_codec_t *); dev->codec_id = ac97_codec_id++; + /* Allocate vendor-specific register pages if required. */ + if (dev->vendor_regs) { + /* Get the highest vendor-specific register page number. */ + int i, j; + dev->vendor_reg_page_max = 0; + for (j = 0; dev->vendor_regs[j].index; j++) { + i = (dev->vendor_regs[j].index >> 8) & 0x000f; + if (i > dev->vendor_reg_page_max) + dev->vendor_reg_page_max = i; + } + + /* Allocate pages 1+. */ + if (dev->vendor_reg_page_max > 0) { + ac97_codec_log("AC97 Codec %d: Allocating %d vendor-specific register pages\n", dev->codec_id, dev->vendor_reg_page_max); + i = 16 * dev->vendor_reg_page_max; + dev->vendor_reg_pages = (uint16_t *) malloc(i); + memset(dev->vendor_reg_pages, 0, i); + } + } + /* Initialize codec registers. */ ac97_codec_reset(dev); @@ -329,6 +586,8 @@ ac97_codec_close(void *priv) ac97_codec_log("AC97 Codec %d: close()\n", dev->codec_id); + if (dev->vendor_reg_pages) + free(dev->vendor_reg_pages); free(dev); } diff --git a/src/sound/snd_ac97_via.c b/src/sound/snd_ac97_via.c index 2ca80e538..b44ac9c7c 100644 --- a/src/sound/snd_ac97_via.c +++ b/src/sound/snd_ac97_via.c @@ -376,19 +376,18 @@ ac97_via_sgd_write(uint16_t addr, uint8_t val, void *priv) if (codec) { /* Read from or write to codec. */ if (val & 0x80) { - if (val & 1) { /* return 0x00 on unaligned reads */ + if (val & 1) { /* return 0x0000 on unaligned reads (real 686B behavior) */ dev->sgd_regs[0x80] = dev->sgd_regs[0x81] = 0x00; } else { - dev->sgd_regs[0x80] = dev->codec_shadow[modem].regs_codec[i][(val & 0x7f)] = ac97_codec_read(codec, val); - dev->sgd_regs[0x81] = dev->codec_shadow[modem].regs_codec[i][(val & 0x7f) | 1] = ac97_codec_read(codec, val | 1); + *((uint16_t *) &dev->codec_shadow[modem].regs_codec[i][val & 0x7f]) = *((uint16_t *) &dev->sgd_regs[0x80]) = + ac97_codec_readw(codec, val); } /* Flag data/status/index for this codec as valid. */ - if (val & 0x80) - dev->sgd_regs[0x83] |= 0x02 << (i << 1); + dev->sgd_regs[0x83] |= 0x02 << (i << 1); } else if (!(val & 1)) { /* do nothing on unaligned writes */ - ac97_codec_write(codec, val, dev->codec_shadow[modem].regs_codec[i][(val & 0x7f)] = dev->sgd_regs[0x80]); - ac97_codec_write(codec, val | 1, dev->codec_shadow[modem].regs_codec[i][(val & 0x7f) | 1] = dev->sgd_regs[0x81]); + ac97_codec_writew(codec, val, + *((uint16_t *) &dev->codec_shadow[modem].regs_codec[i][val & 0x7f]) = *((uint16_t *) &dev->sgd_regs[0x80])); /* Update primary audio codec state if that codec was written to. */ if (!modem && !i) diff --git a/src/sound/snd_audiopci.c b/src/sound/snd_audiopci.c index 4956f7742..49dc2df4f 100644 --- a/src/sound/snd_audiopci.c +++ b/src/sound/snd_audiopci.c @@ -1013,13 +1013,10 @@ es1371_outl(uint16_t port, uint32_t val, void *p) case 0x14: if (val & CODEC_READ) { dev->codec_ctrl &= 0x00ff0000; - val = (val >> 16) & 0x7e; - dev->codec_ctrl |= ac97_codec_read(dev->codec, val); - dev->codec_ctrl |= ac97_codec_read(dev->codec, val | 1) << 8; + dev->codec_ctrl |= ac97_codec_readw(dev->codec, val >> 16); } else { dev->codec_ctrl = val & 0x00ffffff; - ac97_codec_write(dev->codec, (val >> 16) & 0x7e, val & 0xff); - ac97_codec_write(dev->codec, ((val >> 16) & 0x7e) | 1, val >> 8); + ac97_codec_writew(dev->codec, val >> 16, val); ac97_codec_getattn(dev->codec, 0x02, &dev->master_vol_l, &dev->master_vol_r); ac97_codec_getattn(dev->codec, 0x12, &dev->cd_vol_l, &dev->cd_vol_r); diff --git a/src/sound/sound.c b/src/sound/sound.c index 663983738..b223e706a 100644 --- a/src/sound/sound.c +++ b/src/sound/sound.c @@ -110,6 +110,7 @@ static const SOUND_CARD sound_cards[] = { "sbmcv", &sb_mcv_device }, { "sbpromcv", &sb_pro_mcv_device }, { "es1371", &es1371_device }, + { "ad1881", &ad1881_device }, { "cs4297a", &cs4297a_device }, { "", NULL } }; From c4bb7e79a7367e08bfbc60f1d64bef82d9ac9c56 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 12 Nov 2021 15:16:19 -0300 Subject: [PATCH 31/62] Upgrade build script to 8-character git hashes per the old system --- .ci/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/build.sh b/.ci/build.sh index ddd90d6b8..14028d556 100644 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -67,7 +67,7 @@ build() { local job_name=$JOB_BASE_NAME local build_type=$BUILD_TYPE local build_number=$BUILD_NUMBER - local git_hash=$(echo $GIT_COMMIT | cut -c1-7) + local git_hash=$(echo $GIT_COMMIT | cut -c1-8) local arch=$1 shift local cmake_flags=$* From a6493147981a3097a18ee57f7ac3f7f8d8730a4c Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 12 Nov 2021 20:33:43 -0300 Subject: [PATCH 32/62] VIA AC97: Move some variables to SGD structure to ease future expansion --- src/sound/snd_ac97_via.c | 102 ++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 54 deletions(-) diff --git a/src/sound/snd_ac97_via.c b/src/sound/snd_ac97_via.c index b44ac9c7c..de12edf75 100644 --- a/src/sound/snd_ac97_via.c +++ b/src/sound/snd_ac97_via.c @@ -39,7 +39,12 @@ typedef struct { int32_t sample_count; uint8_t entry_flags, fifo[32], restart; - pc_timer_t timer; + int16_t out_l, out_r; + int vol_l, vol_r, pos; + int32_t buffer[SOUNDBUFLEN * 2]; + uint64_t timer_latch; + + pc_timer_t dma_timer, poll_timer; } ac97_via_sgd_t; typedef struct _ac97_via_ { @@ -56,12 +61,7 @@ typedef struct _ac97_via_ { ac97_codec_t *codec[2][2]; ac97_via_sgd_t sgd[6]; - pc_timer_t timer_count, timer_count_fm; - uint64_t timer_latch, timer_latch_fm; - int16_t out_l, out_r, fm_out_l, fm_out_r; - int master_vol_l, master_vol_r, pcm_vol_l, pcm_vol_r, cd_vol_l, cd_vol_r; - int32_t buffer[SOUNDBUFLEN * 2], fm_buffer[SOUNDBUFLEN * 2]; - int pos, fm_pos; + int master_vol_l, master_vol_r, cd_vol_l, cd_vol_r; } ac97_via_t; @@ -142,13 +142,13 @@ ac97_via_write_control(void *priv, uint8_t modem, uint8_t val) /* Start or stop PCM playback. */ i = (val & 0xf4) == 0xc4; if (i && !dev->pcm_enabled) - timer_advance_u64(&dev->timer_count, dev->timer_latch); + timer_advance_u64(&dev->sgd[0].poll_timer, dev->sgd[0].timer_latch); dev->pcm_enabled = i; /* Start or stop FM playback. */ i = (val & 0xf2) == 0xc2; if (i && !dev->fm_enabled) - timer_advance_u64(&dev->timer_count_fm, dev->timer_latch); + timer_advance_u64(&dev->sgd[2].poll_timer, dev->sgd[2].timer_latch); dev->fm_enabled = i; /* Update primary audio codec state. */ @@ -183,7 +183,7 @@ ac97_via_update_codec(ac97_via_t *dev) /* Update volumes according to codec registers. */ ac97_codec_getattn(codec, 0x02, &dev->master_vol_l, &dev->master_vol_r); - ac97_codec_getattn(codec, 0x18, &dev->pcm_vol_l, &dev->pcm_vol_r); + ac97_codec_getattn(codec, 0x18, &dev->sgd[0].vol_l, &dev->sgd[0].vol_r); ac97_codec_getattn(codec, 0x12, &dev->cd_vol_l, &dev->cd_vol_r); /* Update sample rate according to codec registers and the variable sample rate flag. */ @@ -503,10 +503,10 @@ ac97_via_remap_modem_codec(void *priv, uint16_t new_io_base, uint8_t enable) static void -ac97_via_update(ac97_via_t *dev) +ac97_via_update_stereo(ac97_via_t *dev, ac97_via_sgd_t *sgd) { - int32_t l = (((dev->out_l * dev->pcm_vol_l) >> 15) * dev->master_vol_l) >> 15, - r = (((dev->out_r * dev->pcm_vol_r) >> 15) * dev->master_vol_r) >> 15; + int32_t l = (((sgd->out_l * sgd->vol_l) >> 15) * dev->master_vol_l) >> 15, + r = (((sgd->out_r * sgd->vol_r) >> 15) * dev->master_vol_r) >> 15; if (l < -32768) l = -32768; @@ -517,19 +517,9 @@ ac97_via_update(ac97_via_t *dev) else if (r > 32767) r = 32767; - for (; dev->pos < sound_pos_global; dev->pos++) { - dev->buffer[dev->pos*2] = l; - dev->buffer[dev->pos*2 + 1] = r; - } -} - - -static void -ac97_via_update_fm(ac97_via_t *dev) -{ - for (; dev->fm_pos < sound_pos_global; dev->fm_pos++) { - dev->fm_buffer[dev->fm_pos*2] = dev->fm_out_l; - dev->fm_buffer[dev->fm_pos*2 + 1] = dev->fm_out_r; + for (; sgd->pos < sound_pos_global; sgd->pos++) { + sgd->buffer[sgd->pos*2] = l; + sgd->buffer[sgd->pos*2 + 1] = r; } } @@ -546,7 +536,7 @@ ac97_via_sgd_process(void *priv) return; /* Schedule next run. */ - timer_on_auto(&sgd->timer, 10.0); + timer_on_auto(&sgd->dma_timer, 10.0); /* Process SGD if it's active, and the FIFO has room or is disabled. */ if ((sgd_status == 0x80) && (sgd->always_run || ((sgd->fifo_end - sgd->fifo_pos) <= (sizeof(sgd->fifo) - 4)))) { @@ -652,38 +642,38 @@ ac97_via_sgd_process(void *priv) static void -ac97_via_poll(void *priv) +ac97_via_poll_stereo(void *priv) { ac97_via_t *dev = (ac97_via_t *) priv; ac97_via_sgd_t *sgd = &dev->sgd[0]; /* Audio Read */ /* Schedule next run if PCM playback is enabled. */ if (dev->pcm_enabled) - timer_advance_u64(&dev->timer_count, dev->timer_latch); + timer_advance_u64(&sgd->poll_timer, sgd->timer_latch); - /* Update audio buffer. */ - ac97_via_update(dev); + /* Update stereo audio buffer. */ + ac97_via_update_stereo(dev, sgd); /* Feed next sample from the FIFO. */ - switch (dev->sgd_regs[0x02] & 0x30) { + switch (dev->sgd_regs[sgd->id | 0x2] & 0x30) { case 0x00: /* Mono, 8-bit PCM */ if ((sgd->fifo_end - sgd->fifo_pos) >= 1) { - dev->out_l = dev->out_r = (sgd->fifo[sgd->fifo_pos++ & (sizeof(sgd->fifo) - 1)] ^ 0x80) << 8; + sgd->out_l = sgd->out_r = (sgd->fifo[sgd->fifo_pos++ & (sizeof(sgd->fifo) - 1)] ^ 0x80) << 8; return; } break; case 0x10: /* Stereo, 8-bit PCM */ if ((sgd->fifo_end - sgd->fifo_pos) >= 2) { - dev->out_l = (sgd->fifo[sgd->fifo_pos++ & (sizeof(sgd->fifo) - 1)] ^ 0x80) << 8; - dev->out_r = (sgd->fifo[sgd->fifo_pos++ & (sizeof(sgd->fifo) - 1)] ^ 0x80) << 8; + sgd->out_l = (sgd->fifo[sgd->fifo_pos++ & (sizeof(sgd->fifo) - 1)] ^ 0x80) << 8; + sgd->out_r = (sgd->fifo[sgd->fifo_pos++ & (sizeof(sgd->fifo) - 1)] ^ 0x80) << 8; return; } break; case 0x20: /* Mono, 16-bit PCM */ if ((sgd->fifo_end - sgd->fifo_pos) >= 2) { - dev->out_l = dev->out_r = *((uint16_t *) &sgd->fifo[sgd->fifo_pos & (sizeof(sgd->fifo) - 1)]); + sgd->out_l = sgd->out_r = *((uint16_t *) &sgd->fifo[sgd->fifo_pos & (sizeof(sgd->fifo) - 1)]); sgd->fifo_pos += 2; return; } @@ -691,9 +681,9 @@ ac97_via_poll(void *priv) case 0x30: /* Stereo, 16-bit PCM */ if ((sgd->fifo_end - sgd->fifo_pos) >= 4) { - dev->out_l = *((uint16_t *) &sgd->fifo[sgd->fifo_pos & (sizeof(sgd->fifo) - 1)]); + sgd->out_l = *((uint16_t *) &sgd->fifo[sgd->fifo_pos & (sizeof(sgd->fifo) - 1)]); sgd->fifo_pos += 2; - dev->out_r = *((uint16_t *) &sgd->fifo[sgd->fifo_pos & (sizeof(sgd->fifo) - 1)]); + sgd->out_r = *((uint16_t *) &sgd->fifo[sgd->fifo_pos & (sizeof(sgd->fifo) - 1)]); sgd->fifo_pos += 2; return; } @@ -701,7 +691,7 @@ ac97_via_poll(void *priv) } /* Feed silence if the FIFO is empty. */ - dev->out_l = dev->out_r = 0; + sgd->out_l = sgd->out_r = 0; } @@ -713,23 +703,23 @@ ac97_via_poll_fm(void *priv) /* Schedule next run if FM playback is enabled. */ if (dev->fm_enabled) - timer_advance_u64(&dev->timer_count_fm, dev->timer_latch_fm); + timer_advance_u64(&sgd->poll_timer, sgd->timer_latch); /* Update FM audio buffer. */ - ac97_via_update_fm(dev); + ac97_via_update_stereo(dev, sgd); /* Feed next sample from the FIFO. The data format is not documented, but it probes as 16-bit stereo at 24 KHz. */ if ((sgd->fifo_end - sgd->fifo_pos) >= 4) { - dev->out_l = *((uint16_t *) &sgd->fifo[sgd->fifo_pos & (sizeof(sgd->fifo) - 1)]); + sgd->out_l = *((uint16_t *) &sgd->fifo[sgd->fifo_pos & (sizeof(sgd->fifo) - 1)]); sgd->fifo_pos += 2; - dev->out_r = *((uint16_t *) &sgd->fifo[sgd->fifo_pos & (sizeof(sgd->fifo) - 1)]); + sgd->out_r = *((uint16_t *) &sgd->fifo[sgd->fifo_pos & (sizeof(sgd->fifo) - 1)]); sgd->fifo_pos += 2; return; } /* Feed silence if the FIFO is empty. */ - dev->fm_out_l = dev->fm_out_r = 0; + sgd->out_l = sgd->out_r = 0; } @@ -738,15 +728,15 @@ ac97_via_get_buffer(int32_t *buffer, int len, void *priv) { ac97_via_t *dev = (ac97_via_t *) priv; - ac97_via_update(dev); - ac97_via_update_fm(dev); + ac97_via_update_stereo(dev, &dev->sgd[0]); + ac97_via_update_stereo(dev, &dev->sgd[2]); for (int c = 0; c < len * 2; c++) { - buffer[c] += dev->buffer[c] / 2; - buffer[c] += dev->fm_buffer[c] / 2; + buffer[c] += dev->sgd[0].buffer[c] / 2; + buffer[c] += dev->sgd[2].buffer[c] / 2; } - dev->pos = dev->fm_pos = 0; + dev->sgd[0].pos = dev->sgd[2].pos = 0; } @@ -773,8 +763,8 @@ ac97_via_speed_changed(void *priv) else freq = 48000.0; - dev->timer_latch = (uint64_t) ((double) TIMER_USEC * (1000000.0 / freq)); - dev->timer_latch_fm = (uint64_t) ((double) TIMER_USEC * (1000000.0 / 24000.0)); + dev->sgd[0].timer_latch = (uint64_t) ((double) TIMER_USEC * (1000000.0 / freq)); + dev->sgd[2].timer_latch = (uint64_t) ((double) TIMER_USEC * (1000000.0 / 24000.0)); } @@ -801,12 +791,16 @@ ac97_via_init(const device_t *info) if ((i != 0) && (i != 2)) dev->sgd[i].always_run = 1; - timer_add(&dev->sgd[i].timer, ac97_via_sgd_process, &dev->sgd[i], 0); + /* No volume control on FM SGD that I know of. */ + if (i == 2) + dev->sgd[i].vol_l = dev->sgd[i].vol_r = 32767; + + timer_add(&dev->sgd[i].dma_timer, ac97_via_sgd_process, &dev->sgd[i], 0); } /* Set up playback pollers. */ - timer_add(&dev->timer_count, ac97_via_poll, dev, 0); - timer_add(&dev->timer_count_fm, ac97_via_poll_fm, dev, 0); + timer_add(&dev->sgd[0].poll_timer, ac97_via_poll_stereo, dev, 0); + timer_add(&dev->sgd[2].poll_timer, ac97_via_poll_fm, dev, 0); ac97_via_speed_changed(dev); /* Set up playback handler. */ From f237e470228c6315b1c5c7ce9877da9d31243e93 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 12 Nov 2021 20:48:49 -0300 Subject: [PATCH 33/62] Add onboard ES1371 to two machines where it was missed --- src/machine/m_at_slot1.c | 13 ++++--------- src/machine/m_at_socket370.c | 10 ++++++++++ src/machine/machine_table.c | 4 ++-- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/machine/m_at_slot1.c b/src/machine/m_at_slot1.c index 050ea233c..7f41ea380 100644 --- a/src/machine/m_at_slot1.c +++ b/src/machine/m_at_slot1.c @@ -468,17 +468,16 @@ machine_at_s1846_init(const machine_t *model) pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); device_add(&i440bx_device); device_add(&piix4e_device); + device_add(&pc87309_device); + device_add(&keyboard_ps2_ami_pci_device); + device_add(&intel_flash_bxt_device); + spd_register(SPD_TYPE_SDRAM, 0x7, 256); if (sound_card_current == SOUND_INTERNAL) { device_add(&es1371_onboard_device); device_add(&cs4297_device); /* found on other Tyan boards around the same time */ } - device_add(&pc87309_device); - device_add(&keyboard_ps2_ami_pci_device); - device_add(&intel_flash_bxt_device); - spd_register(SPD_TYPE_SDRAM, 0x7, 256); - return ret; } @@ -691,10 +690,6 @@ machine_at_ms6168_common_init(const machine_t *model) int machine_at_borapro_init(const machine_t *model) { - /* AMI 440ZX Board. Packard Bell OEM of the MSI MS-6168 - MIGHT REQUIRE MORE EXCESSIVE TESTING! - Reports emmersive amounts of RAM like few Intel OEM boards - we have. */ int ret; ret = bios_load_linear("roms/machines/borapro/MS6168V2.50", diff --git a/src/machine/m_at_socket370.c b/src/machine/m_at_socket370.c index 4475ee984..69b54540f 100644 --- a/src/machine/m_at_socket370.c +++ b/src/machine/m_at_socket370.c @@ -105,6 +105,11 @@ machine_at_s1857_init(const machine_t *model) device_add(&w83977f_370_device); device_add(&intel_flash_bxt_device); + if (sound_card_current == SOUND_INTERNAL) { + device_add(&es1371_onboard_device); + device_add(&cs4297_device); /* found on other Tyan boards around the same time */ + } + return ret; } @@ -377,6 +382,11 @@ machine_at_gt694va_init(const machine_t *model) hwm_values.fans[2] = 0; /* unused */ hwm_values.temperatures[2] = 0; /* unused */ + if (sound_card_current == SOUND_INTERNAL) { + device_add(&es1371_onboard_device); + device_add(&cs4297_device); /* assumed */ + } + return ret; } diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 731400de0..6e7c1fb00 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -446,7 +446,7 @@ const machine_t machines[] = { { "[i440BX] AEWIN AW-O671R", "awo671r", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, /* limits assumed */ MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 524288, 8192, 255, machine_at_awo671r_init, NULL }, { "[i440BX] ASUS CUBX", "cubx", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 150000000, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1048576, 8192, 255, machine_at_cubx_init, NULL }, { "[i440BX] AmazePC AM-BX133", "ambx133", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, /* limits assumed */ MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_ambx133_init, NULL }, - { "[i440BX] Tyan Trinity 371", "s1857", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_s1857_init, NULL }, + { "[i440BX] Tyan Trinity 371", "s1857", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_SOUND, 8192, 786432, 8192, 255, machine_at_s1857_init, NULL }, /* 440ZX */ { "[i440ZX] Soltek SL-63A1", "63a1", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 524288, 8192, 255, machine_at_63a1_init, NULL }, @@ -457,7 +457,7 @@ const machine_t machines[] = { /* VIA Apollo Pro */ { "[VIA Apollo Pro] PC Partner APAS3", "apas3", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_apas3_init, NULL }, { "[VIA Apollo Pro 133] ECS P6BAP", "p6bap", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 150000000, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1572864, 8192, 255, machine_at_p6bap_init, NULL }, - { "[VIA Apollo Pro 133A] BCM GT694VA", "gt694va", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 16384,3145728, 8192, 255, machine_at_gt694va_init, NULL }, + { "[VIA Apollo Pro 133A] BCM GT694VA", "gt694va", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_SOUND, 16384,3145728, 8192, 255, machine_at_gt694va_init, NULL }, { "[VIA Apollo Pro 133A] ASUS CUV4X-LS", "cuv4xls", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 150000000, 1300, 3500, 1.5, 8.0, (MACHINE_AGP & ~MACHINE_AT) | MACHINE_BUS_PS2 | MACHINE_BUS_AC97 | MACHINE_IDE_DUAL,16384,4194304, 8192, 255, machine_at_cuv4xls_init, NULL }, { "[VIA Apollo Pro 133A] Acorp 6VIA90AP", "6via90ap", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 150000000, 1300, 3500, MACHINE_MULTIPLIER_FIXED, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_BUS_AC97 | MACHINE_IDE_DUAL | MACHINE_SOUND | MACHINE_GAMEPORT,16384,3145728, 8192, 255, machine_at_6via90ap_init, NULL }, From e152eee822fe2394806cefc609c0cafe904df0b1 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 12 Nov 2021 20:52:07 -0300 Subject: [PATCH 34/62] ci: Make some build script variables local as they should be --- .ci/build.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.ci/build.sh b/.ci/build.sh index 14028d556..d73a89af0 100644 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -108,8 +108,8 @@ build() { if is_windows then # Switch into the correct MSYSTEM if required. - msys=MINGW$arch - [ ! -d "/$msys" ] && msys=CLANG$arch + local msys=MINGW$arch + [ ! -d "/$msys" ] && local msys=CLANG$arch if [ -d "/$msys" ] then if [ "$MSYSTEM" != "$msys" ] @@ -133,10 +133,10 @@ build() { else # Determine Debian architecture. case $arch in - x86) arch_deb="i386";; - x86_64) arch_deb="amd64";; - arm32) arch_deb="armhf";; - *) arch_deb="$arch";; + x86) local arch_deb="i386";; + x86_64) local arch_deb="amd64";; + arm32) local arch_deb="armhf";; + *) local arch_deb="$arch";; esac # Establish general and architecture-specific dependencies. @@ -153,16 +153,16 @@ build() { for pkg in libc6-dev linux-libc-dev libopenal-dev libfreetype6-dev libsdl2-dev libpng-dev do local libpkgs="$libpkgs $pkg:$arch_deb" - length=$(echo -n $pkg | sed 's/-dev$//g' | wc -c) + local length=$(echo -n $pkg | sed 's/-dev$//g' | wc -c) [ $length -gt $longest_libpkg ] && longest_libpkg=$length done # Determine GNU toolchain architecture. case $arch in - x86) arch_gnu="i686-linux-gnu";; - arm32) arch_gnu="arm-linux-gnueabihf";; - arm64) arch_gnu="aarch64-linux-gnu";; - *) arch_gnu="$arch-linux-gnu";; + x86) local arch_gnu="i686-linux-gnu";; + arm32) local arch_gnu="arm-linux-gnueabihf";; + arm64) local arch_gnu="aarch64-linux-gnu";; + *) local arch_gnu="$arch-linux-gnu";; esac # Create CMake toolchain file. @@ -254,8 +254,8 @@ EOF then # Determine Program Files directory for Ghostscript and 7-Zip. # Manual checks because MSYS is bad at passing the ProgramFiles variables. - pf="/c/Program Files" - sevenzip="$pf/7-Zip/7z.exe" + local pf="/c/Program Files" + local sevenzip="$pf/7-Zip/7z.exe" [ "$arch" = "32" -a -d "/c/Program Files (x86)" ] && pf="/c/Program Files (x86)" # Archive freetype from local MSYS installation. From bfe19db5b472b89c393e152c779b3930176d75cf Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 12 Nov 2021 21:53:12 -0300 Subject: [PATCH 35/62] Shuffle around and improve build number injection --- .ci/build.sh | 61 +++++++++++++++++--------------- src/CMakeLists.txt | 9 +++++ src/include/86box/version.h.in | 6 ++-- src/include_make/86box/version.h | 3 ++ src/win/86Box.rc | 6 ++-- 5 files changed, 52 insertions(+), 33 deletions(-) diff --git a/.ci/build.sh b/.ci/build.sh index d73a89af0..7e3a58ab3 100644 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -66,7 +66,6 @@ build() { # Set argument and environment variables. local job_name=$JOB_BASE_NAME local build_type=$BUILD_TYPE - local build_number=$BUILD_NUMBER local git_hash=$(echo $GIT_COMMIT | cut -c1-8) local arch=$1 shift @@ -76,29 +75,11 @@ build() { # Check if at least the job name was received. if [ -z "$job_name" ] then - echo [!] Missing environment variables: received JOB_BASE_NAME=[$job_name] BUILD_NUMBER=[$build_number] GIT_COMMIT=[$git_hash] + echo [!] Missing environment variables: received JOB_BASE_NAME=[$JOB_BASE_NAME] BUILD_TYPE=[$BUILD_TYPE] BUILD_NUMBER=[$BUILD_NUMBER] GIT_COMMIT=[$GIT_COMMIT] return 1 fi - # Generate the build qualifier and filename. - if echo $build_number | grep -q " " - then - # Full build qualifier. - build_qualifier="$build_number" - build_fn="-"$(echo "$build_number" | rev | cut -f1 -d" " | rev | tr '\\/:*?"<>|' '_') - elif [ ! -z "$build_number" ] - then - # Build number. - build_number=$(echo "$build_number" | sed "s/[^0-9]//g") # remove non-numeric characters - build_qualifier="build $build_number" - build_fn="-b$build_number" - else - # No build information. - build_qualifier= - build_fn= - fi - - echo [-] Building [$job_name] [$build_number] [$git_hash] for [$arch] with flags [$cmake_flags] + echo [-] Building [$job_name] [$build_type] [$build_qualifier] [$git_hash] for [$arch] with flags [$cmake_flags] # Switch to the correct directory. cd "$cwd" @@ -117,8 +98,8 @@ build() { # Call build with the correct MSYSTEM. echo [-] Switching to MSYSTEM [$msys] cd "$cwd" - CHERE_INVOKING=yes MSYSTEM=$msys JOB_BASE_NAME=$JOB_BASE_NAME BUILD_TYPE=$BUILD_TYPE BUILD_NUMBER=$BUILD_NUMBER GIT_COMMIT=$GIT_COMMIT \ - bash -lc 'exec "'$0'" -b "'$arch'" '$cmake_flags && job_exit=0 # make sure the main script exits cleanly on any success + CHERE_INVOKING=yes MSYSTEM="$msys" JOB_BASE_NAME="$JOB_BASE_NAME" BUILD_TYPE="$BUILD_TYPE" BUILD_NUMBER="$BUILD_NUMBER" GIT_COMMIT="$GIT_COMMIT" \ + bash -lc 'exec "'$0'" -b "'$arch'" '$cmake_flags && job_status=0 # make sure the main script exits cleanly on any success return $? fi else @@ -215,7 +196,9 @@ EOF # Determine additional CMake flags. [ ! -z "$build_type" ] && local cmake_flags_extra="$cmake_flags_extra -D BUILD_TYPE=\"$build_type\"" [ ! -z "$build_qualifier" ] && local cmake_flags_extra="$cmake_flags_extra -D EMU_BUILD=\"$build_qualifier\"" + [ ! -z "$build_number" ] && local cmake_flags_extra="$cmake_flags_extra -D EMU_BUILD_NUM=\"$build_number\"" [ ! -z "$git_hash" ] && local cmake_flags_extra="$cmake_flags_extra -D EMU_GIT_HASH=\"$git_hash\"" + local cmake_flags_extra="$cmake_flags_extra -D EMU_COPYRIGHT_YEAR=\"$(date +%Y)\"" # Run CMake. echo [-] Running CMake with flags [$cmake_flags $cmake_flags_extra] @@ -338,15 +321,15 @@ EOF fi # All good. - echo [-] Build of [$job_name] [$build_number] [$git_hash] for [$arch] with flags [$cmake_flags] successful - job_exit=0 + echo [-] Build of [$job_name] [$build_type] [$build_qualifier] [$git_hash] for [$arch] with flags [$cmake_flags] successful + job_status=0 } # Set common variables. project=86Box cwd=$(pwd) first_build=1 -job_exit=1 +job_status=1 # Parse arguments. single_build=0 @@ -393,6 +376,27 @@ then exit 100 fi +# Generate build information. Note that variable names are case sensitive. +build_number=$BUILD_NUMBER +if echo $build_number | grep -q " " +then + # A full build qualifier was specified. + build_qualifier="$build_number" + build_fn="-"$(echo "$build_number" | rev | cut -f1 -d" " | rev | tr '\\/:*?"<>|' '_') + build_number= # no build number +elif [ ! -z "$build_number" ] +then + # A build number was specified. + build_qualifier="build $build_number" + build_fn="-b$build_number" + build_number=$(echo "$build_number" | sed "s/[^0-9]//g") # remove non-numeric characters from build number +else + # No build data was specified. + build_number= + build_qualifier= + build_fn= +fi + # Run single build if requested. if [ $single_build -ne 0 ] then @@ -406,6 +410,7 @@ case $JOB_BASE_NAME in if is_windows then build 32 --preset=regular + build 64 --preset=regular elif is_mac then build Universal --preset=regular @@ -456,5 +461,5 @@ case $JOB_BASE_NAME in esac echo -echo [-] Exiting with code [$job_exit] -exit $job_exit +echo [-] Exiting with status [$job_status] +exit $job_status diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 49025d4dd..232942773 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -93,6 +93,15 @@ find_package(PNG REQUIRED) include_directories(${PNG_INCLUDE_DIRS}) target_link_libraries(86Box PNG::PNG) +if(NOT CMAKE_PROJECT_VERSION_PATCH) + set(CMAKE_PROJECT_VERSION_PATCH 0) +endif() +if(NOT EMU_BUILD_NUM) + set(EMU_BUILD_NUM 0) +endif() +if(NOT EMU_COPYRIGHT_YEAR) + set(EMU_COPYRIGHT_YEAR 2021) +endif() configure_file(include/86box/version.h.in include/86box/version.h @ONLY) include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) diff --git a/src/include/86box/version.h.in b/src/include/86box/version.h.in index f0a92a008..bbd751e77 100644 --- a/src/include/86box/version.h.in +++ b/src/include/86box/version.h.in @@ -22,11 +22,13 @@ #define EMU_VERSION "@CMAKE_PROJECT_VERSION@" #define EMU_VERSION_W LSTR(EMU_VERSION) -#define EMU_VERSION_EX "@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@0" +#define EMU_VERSION_EX "@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@@CMAKE_PROJECT_VERSION_PATCH@" #define EMU_VERSION_MAJ @CMAKE_PROJECT_VERSION_MAJOR@ #define EMU_VERSION_MIN @CMAKE_PROJECT_VERSION_MINOR@ +#define EMU_VERSION_PATCH @CMAKE_PROJECT_VERSION_PATCH@ #cmakedefine EMU_BUILD "@EMU_BUILD@" +#define EMU_BUILD_NUM @EMU_BUILD_NUM@ #cmakedefine EMU_GIT_HASH "@EMU_GIT_HASH@" #ifdef EMU_BUILD @@ -41,7 +43,7 @@ # define EMU_GIT_HASH_W LSTR(EMU_GIT_HASH) #endif -#define COPYRIGHT_YEAR "2021" +#define COPYRIGHT_YEAR "@EMU_COPYRIGHT_YEAR@" /* Web URL info. */ #define EMU_SITE L"86box.net" diff --git a/src/include_make/86box/version.h b/src/include_make/86box/version.h index 6574d0049..76db25017 100644 --- a/src/include_make/86box/version.h +++ b/src/include_make/86box/version.h @@ -25,6 +25,9 @@ #define EMU_VERSION_EX "3.00" #define EMU_VERSION_MAJ 3 #define EMU_VERSION_MIN 0 +#define EMU_VERSION_PATCH 0 + +#define EMU_BUILD_NUM 0 #define EMU_VERSION_FULL EMU_VERSION #define EMU_VERSION_FULL_W EMU_VERSION_W diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 05990324f..15b73567d 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -1283,8 +1283,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION EMU_VERSION_MAJ,EMU_VERSION_MIN,0,0 - PRODUCTVERSION EMU_VERSION_MAJ,EMU_VERSION_MIN,0,0 + FILEVERSION EMU_VERSION_MAJ,EMU_VERSION_MIN,EMU_VERSION_PATCH,EMU_BUILD_NUM + PRODUCTVERSION EMU_VERSION_MAJ,EMU_VERSION_MIN,EMU_VERSION_PATCH,EMU_BUILD_NUM FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -1303,7 +1303,7 @@ BEGIN VALUE "FileDescription", EMU_NAME "\0" VALUE "FileVersion", EMU_VERSION "\0" VALUE "InternalName", EMU_NAME "\0" - VALUE "LegalCopyright", "Copyright \xc2\xa9 2007-2020 " EMU_NAME " contributors\0" + VALUE "LegalCopyright", "Copyright \xc2\xa9 2007-" COPYRIGHT_YEAR " " EMU_NAME " contributors\0" VALUE "OriginalFilename", "86box.exe\0" VALUE "ProductName", EMU_NAME "\0" VALUE "ProductVersion", EMU_VERSION "\0" From e6fddf9823d46917a69aef6f638b90ed2022604c Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 12 Nov 2021 21:54:05 -0300 Subject: [PATCH 36/62] Flip freetype back to the old name on Windows to ease upgrading (at least on 32-bit builds) --- .ci/build.sh | 2 +- src/printer/prt_escp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/build.sh b/.ci/build.sh index 7e3a58ab3..afaba3c2e 100644 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -242,7 +242,7 @@ EOF [ "$arch" = "32" -a -d "/c/Program Files (x86)" ] && pf="/c/Program Files (x86)" # Archive freetype from local MSYS installation. - .ci/static2dll.sh -p freetype2 /$MSYSTEM/lib/libfreetype.a archive_tmp/libfreetype-6.dll + .ci/static2dll.sh -p freetype2 /$MSYSTEM/lib/libfreetype.a archive_tmp/libfreetype.dll # Archive Ghostscript DLL from local official distribution installation. for gs in "$pf"/gs/gs*.*.* diff --git a/src/printer/prt_escp.c b/src/printer/prt_escp.c index 1cd3b8ebe..08b6cd58e 100644 --- a/src/printer/prt_escp.c +++ b/src/printer/prt_escp.c @@ -87,7 +87,7 @@ #ifdef _WIN32 -# define PATH_FREETYPE_DLL "libfreetype-6.dll" +# define PATH_FREETYPE_DLL "libfreetype.dll" #else # define PATH_FREETYPE_DLL "libfreetype.so.6" #endif From 5021457017b05b694a6396aaed3312ecbff1c0c7 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 00:30:42 -0300 Subject: [PATCH 37/62] Optimize static2dll script --- .ci/static2dll.sh | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/.ci/static2dll.sh b/.ci/static2dll.sh index 2148537d1..82b996f9a 100644 --- a/.ci/static2dll.sh +++ b/.ci/static2dll.sh @@ -37,11 +37,12 @@ find_lib() { add_lib() { # Always make sure this lib is listed after the last lib that depends on it. - if grep -q -- '^'"$*"'$' "$libs_file" - then - cp "$libs_file" "$libs_file.tmp" - grep -v -- '^'"$*"'$' "$libs_file.tmp" > "$libs_file" - fi + old_libs=$(cat "$libs_file") + rm -f "$libs_file" + for lib in $old_libs + do + [ "$lib" != "$*" ] && echo "$lib" >> "$libs_file" + done echo "$*" >> "$libs_file" # Add libstdc++ in the end if required. @@ -63,6 +64,16 @@ add_lib() { fi } +run_pkgconfig() { + local cache_file="static2dll.$1.cache" + if [ -e "$cache_file" ] + then + cat "$cache_file" + else + pkg-config --static --libs "$1" 2> /dev/null | tee "$cache_file" + fi +} + parse_pkgconfig() { # Parse arguments. local layers=$1 @@ -80,6 +91,7 @@ parse_pkgconfig() { for arg in $* do local arg_base="$(echo $arg | cut -c1-2)" + echo $arg if [ "x$arg_base" = "x-l" ] then # Don't process the same lib again. @@ -90,7 +102,7 @@ parse_pkgconfig() { add_lib "$(find_lib $lib_name)" # Get this lib's dependencies through pkg-config. - local pkgconfig="$(pkg-config --static --libs "$lib_name" 2>/dev/null)" + local pkgconfig="$(run_pkgconfig "$lib_name")" [ $? -eq 0 ] && parse_pkgconfig "$layers"'>' "$lib_name" $pkgconfig || echo $lib_name >> "$seen_file" elif [ "x$(echo $arg_base | cut -c1)" = "x-" ] then @@ -107,7 +119,7 @@ parse_pkgconfig() { case $1 in -p) # -p pkg_config_name static_lib_path out_dll shift - base_pkgconfig=$(pkg-config --static --libs "$1") + base_pkgconfig=$(run_pkgconfig "$1") base_path="$2" base_name="$1" ;; @@ -141,6 +153,7 @@ parse_pkgconfig '>' $base_name $base_pkgconfig # Produce final DLL. dllwrap --def "$def_file" -o "$3" -Wl,--allow-multiple-definition "$base_path" $(cat "$libs_file") status=$? +[ $status -eq 0 ] && rm -f "$def_file" "$seen_file" "$libs_file" "static2dll.*.cache" # Update final DLL timestamp. touch -r "$base_path" "$3" From 54e9f3dd9811493105e94063256bcb93c4b504f3 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 01:06:53 -0300 Subject: [PATCH 38/62] Use version-specific docs URL for release builds --- src/include/86box/version.h.in | 6 +++++- src/include_make/86box/version.h | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/include/86box/version.h.in b/src/include/86box/version.h.in index bbd751e77..170154423 100644 --- a/src/include/86box/version.h.in +++ b/src/include/86box/version.h.in @@ -48,4 +48,8 @@ /* Web URL info. */ #define EMU_SITE L"86box.net" #define EMU_ROMS_URL L"https://github.com/86Box/roms/releases/latest" -#define EMU_DOCS_URL L"https://86box.readthedocs.io" +#ifdef RELEASE_BUILD +# define EMU_DOCS_URL L"https://86box.readthedocs.io/en/v@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@/" +#else +# define EMU_DOCS_URL L"https://86box.readthedocs.io" +#endif diff --git a/src/include_make/86box/version.h b/src/include_make/86box/version.h index 76db25017..b52c362f8 100644 --- a/src/include_make/86box/version.h +++ b/src/include_make/86box/version.h @@ -37,4 +37,8 @@ /* Web URL info. */ #define EMU_SITE L"86box.net" #define EMU_ROMS_URL L"https://github.com/86Box/roms/releases/latest" -#define EMU_DOCS_URL L"https://86box.readthedocs.io" +#ifdef RELEASE_BUILD +# define EMU_DOCS_URL L"https://86box.readthedocs.io/en/v3.0/" +#else +# define EMU_DOCS_URL L"https://86box.readthedocs.io" +#endif From 6101ceff18ebcdbed3142082c058205f9f60cdd5 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 01:09:05 -0300 Subject: [PATCH 39/62] Remove debug print from static2dll --- .ci/Jenkinsfile | 2 +- .ci/static2dll.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 106fdfffd..bd2bd37b0 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -18,7 +18,7 @@ def gitClone() { cleanWs() def scmVars = git url: 'https://github.com/richardg867/86Box.git', - branch: 'cleanup30' + branch: 'cleanup30' env.GIT_COMMIT = scmVars.GIT_COMMIT } diff --git a/.ci/static2dll.sh b/.ci/static2dll.sh index 82b996f9a..f6e5b63b9 100644 --- a/.ci/static2dll.sh +++ b/.ci/static2dll.sh @@ -91,7 +91,6 @@ parse_pkgconfig() { for arg in $* do local arg_base="$(echo $arg | cut -c1-2)" - echo $arg if [ "x$arg_base" = "x-l" ] then # Don't process the same lib again. From 697827d70a2e80865156d67ebfb9a97228d88858 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 01:53:00 -0300 Subject: [PATCH 40/62] Add source tarball generation to build script --- .ci/build.sh | 105 +++++++++++++++++++++++++++++++++++++++++++++++++-- .gitignore | 4 +- 2 files changed, 104 insertions(+), 5 deletions(-) diff --git a/.ci/build.sh b/.ci/build.sh index afaba3c2e..a43ace764 100644 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -58,6 +58,46 @@ try_make() { fi } +make_tar() { + # Determine the best supported compression type. + local compression_flag= + local compression_ext= + if which xz > /dev/null 2>&1 + then + local compression_flag=-J + local compression_ext=.xz + elif which bzip2 > /dev/null 2>&1 + then + local compression_flag=-j + local compression_ext=.bz2 + elif which gzip > /dev/null 2>&1 + then + local compression_flag=-z + local compression_ext=.gz + fi + + # Make tar verbose if requested. + [ ! -z "$VERBOSE" ] && local compression_flag="$compression_flag -v" + + # tar is notorious for having many diverging implementations. For instance, + # the flags we use to strip UID/GID metadata can be --owner/group (GNU), + # --uid/gid (bsdtar) or even none at all (MSYS2 bsdtar). Account for such + # flag differences by checking if they're mentioned on the help text. + local ownership_flags= + local tar_help=$(tar --help 2>&1) + if echo $tar_help | grep -q -- --owner + then + local ownership_flags="--owner=0 --group=0" + elif echo $tar_help | grep -q -- --uid + then + local ownership_flags="--uid 0 --gid 0" + fi + + # Run tar. + tar -c $compression_flag -f "$1$compression_ext" $ownership_flags * + return $? +} + build() { # Create a line gap between builds. [ $first_build -eq 0 ] && echo @@ -307,8 +347,8 @@ EOF # TBD : else - # Create tarball. - tar Jcvf ../$job_name-Linux-$arch$build_fn.tar.xz --owner=0 --group=0 * # strip UID/GID metadata + # Create binary tarball. + make_tar ../$job_name-Linux-$arch$build_fn.tar local status=$? fi cd .. @@ -325,6 +365,46 @@ EOF job_status=0 } +tarball() { + # Create a line gap between builds. + [ $first_build -eq 0 ] && echo + first_build=0 + + # Set argument and environment variables. + local job_name=$JOB_BASE_NAME + + # Check if the job name was received. + if [ -z "$job_name" ] + then + echo [!] Missing environment variable: received JOB_BASE_NAME=[$JOB_BASE_NAME] + return 1 + fi + + echo [-] Making source tarball for [$job_name] + + # Switch to the correct directory. + cd "$cwd" + [ -e "build.sh" ] && cd .. + + # Clean local tree of gitignored files. + git clean -dfX + + # Save current HEAD commit to VERSION. + git log -1 > VERSION || rm -f VERSION + + # Archive source. + make_tar $job_name-Source$build_fn.tar + + # Check if the archival succeeded. + if [ $? -gt 0 ] + then + echo [!] Tarball creation failed with status [$status] + return 2 + fi + + echo [-] Source tarball for [$job_name] created successfully +} + # Set common variables. project=86Box cwd=$(pwd) @@ -333,18 +413,26 @@ job_status=1 # Parse arguments. single_build=0 +tarball=0 args=0 while [ $# -gt 0 ] do case $1 in -b) # Execute single build. - shift [ -z "$JOB_BASE_NAME" ] && JOB_BASE_NAME=$project-Custom single_build=1 + shift break ;; + -t) + # Create tarball. + [ -z "$JOB_BASE_NAME" ] && JOB_BASE_NAME=$project + tarball=1 + shift + ;; + *) # Allow for manually specifying Jenkins variables. if [ $args -eq 0 ] @@ -372,7 +460,7 @@ done # Check if at least the job name was specified. if [ -z "$JOB_BASE_NAME" ] then - echo [!] Manual usage: build.sh [{job_name} [{build_type} [{build_number|build_qualifier} [git_hash]]]] [-b {architecture} [cmake_flags...]] + echo [!] Manual usage: build.sh [{job_name} [{build_type} [{build_number'|"'build_qualifier'"'} [git_hash]]]] [-t] [-b {architecture} [cmake_flags...]] exit 100 fi @@ -397,6 +485,14 @@ else build_fn= fi +# Make tarball if requested. +if [ $tarball -ne 0 ] +then + tarball + status=$? + [ $single_build -eq 0 ] && exit $status +fi + # Run single build if requested. if [ $single_build -ne 0 ] then @@ -415,6 +511,7 @@ case $JOB_BASE_NAME in then build Universal --preset=regular else + tarball build x86 --preset=regular build x86_64 --preset=regular build arm32 --preset=regular diff --git a/.gitignore b/.gitignore index 4103ce839..641660680 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,9 @@ Makefile /archive_tmp /static2dll.* /*.zip -/*.tar.xz +/*.tar +/*.tar.* +/VERSION # Visual Studio Code /.vs From 874f64a0be93f15ca35bad21e462d79d832ff1ff Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 02:37:47 -0300 Subject: [PATCH 41/62] Install source tarball dependencies first --- .ci/build.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.ci/build.sh b/.ci/build.sh index a43ace764..4808af571 100644 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -59,6 +59,12 @@ try_make() { } make_tar() { + # Install dependencies. + if ! which tar xz > /dev/null 2>&1 + then + which apt-get > /dev/null 2>&1 && DEBIAN_FRONTEND=noninteractive sudo apt-get install -y tar xz-utils + fi + # Determine the best supported compression type. local compression_flag= local compression_ext= From 95c5a52856f1bd3604782120037310ff5cabd84a Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 13:48:00 -0300 Subject: [PATCH 42/62] Attempt Jenkins pipeline improvements including delegating builds --- .ci/Jenkinsfile | 38 +++++++++++++++++++++++++++++++++++--- .ci/build.sh | 2 ++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index bd2bd37b0..d88b823c7 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -17,8 +17,10 @@ def gitClone() { cleanWs() + if (env.GIT_COMMIT == null) + env.GIT_COMMIT = BRANCH def scmVars = git url: 'https://github.com/richardg867/86Box.git', - branch: 'cleanup30' + branch: env.GIT_COMMIT env.GIT_COMMIT = scmVars.GIT_COMMIT } @@ -38,9 +40,12 @@ pipeline { agent any parameters { - choice(name: 'BUILD_TYPE', - choices: ['beta', 'none', 'alpha', 'beta', 'release'], // duplicated on purpose, first is default + string(name: 'BUILD_TYPE', + defaultValue: 'beta', /* !!! CHANGE HERE !!! for build type */ description: 'Build type to pass on to CMake. This may affect the UI icon and feature set.') + string(name: 'BRANCH', + defaultValue: 'master', + description: 'Used internally to make sure all downstream builds use the same commit.') } stages { @@ -63,5 +68,32 @@ pipeline { } } } + + /* If we're on the main jobs, trigger each of the downstream jobs. */ + stage('Trigger downstream jobs') { + when { + expression { + return env.JOB_BASE_NAME == '86Box-TestBuildPleaseIgnore'; + } + } + + steps { + ["${env.JOB_BASE_NAME}2"].each { + /* Set next build number for this job. */ + def job = Jenkins.instance.getItem(it) + job.nextBuildNumber = env.BUILD_NUMBER + job.saveNextBuildNumber() + + /* Trigger this job. */ + build propagate: false, + wait: false, + job: it, + parameters: [ + string(name: 'BUILD_TYPE', value: BUILD_TYPE) + string(name: 'BRANCH', value: env.GIT_COMMIT) + ] + } + } + } } } diff --git a/.ci/build.sh b/.ci/build.sh index 4808af571..621369d08 100644 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -507,6 +507,8 @@ then fi # Run builds according to the Jenkins job name. +echo Temporarily disabled [$JOB_BASE_NAME] +exit 0 case $JOB_BASE_NAME in $project | $project-TestBuildPleaseIgnore) if is_windows From 5b634031952506b0976dd4fb9244caeb96d632bb Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 13:48:43 -0300 Subject: [PATCH 43/62] Fix Jenkins pipeline typo --- .ci/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index d88b823c7..4ab57bd29 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -89,7 +89,7 @@ pipeline { wait: false, job: it, parameters: [ - string(name: 'BUILD_TYPE', value: BUILD_TYPE) + string(name: 'BUILD_TYPE', value: BUILD_TYPE), string(name: 'BRANCH', value: env.GIT_COMMIT) ] } From 89fb9ca91299290379e3be1d0bdba81fe951b351 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 13:51:34 -0300 Subject: [PATCH 44/62] Fix pipeline delegation context --- .ci/Jenkinsfile | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 4ab57bd29..d0a2b7ba2 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -78,20 +78,22 @@ pipeline { } steps { - ["${env.JOB_BASE_NAME}2"].each { - /* Set next build number for this job. */ - def job = Jenkins.instance.getItem(it) - job.nextBuildNumber = env.BUILD_NUMBER - job.saveNextBuildNumber() + script { + ["${env.JOB_BASE_NAME}2"].each { + /* Set next build number for this job. */ + def job = Jenkins.instance.getItem(it) + job.nextBuildNumber = env.BUILD_NUMBER + job.saveNextBuildNumber() - /* Trigger this job. */ - build propagate: false, - wait: false, - job: it, - parameters: [ - string(name: 'BUILD_TYPE', value: BUILD_TYPE), - string(name: 'BRANCH', value: env.GIT_COMMIT) - ] + /* Trigger this job. */ + build propagate: false, + wait: false, + job: it, + parameters: [ + string(name: 'BUILD_TYPE', value: BUILD_TYPE), + string(name: 'BRANCH', value: env.GIT_COMMIT) + ] + } } } } From 630ea25922fb322dfaf23b3566ef8e2ff90b20c5 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 13:53:53 -0300 Subject: [PATCH 45/62] Some Jenkins troubleshooting in production... --- .ci/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index d0a2b7ba2..56e8140bd 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -17,6 +17,7 @@ def gitClone() { cleanWs() + println env.GIT_COMMIT if (env.GIT_COMMIT == null) env.GIT_COMMIT = BRANCH def scmVars = git url: 'https://github.com/richardg867/86Box.git', From 185c34e88521a713220dbab5b6954f871017e1fd Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 14:00:41 -0300 Subject: [PATCH 46/62] Some more Jenkins troubleshooting in production... --- .ci/Jenkinsfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 56e8140bd..5f5431639 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -17,11 +17,12 @@ def gitClone() { cleanWs() - println env.GIT_COMMIT if (env.GIT_COMMIT == null) env.GIT_COMMIT = BRANCH - def scmVars = git url: 'https://github.com/richardg867/86Box.git', - branch: env.GIT_COMMIT + println "[-] Building git tag [${env.GIT_COMMIT}]" + def scmVars = checkout scm: [$class: 'GitSCM', + branches: [[name: env.GIT_COMMIT]], + userRemoteConfigs: [[url: 'http://git-server/user/repository.git']]] env.GIT_COMMIT = scmVars.GIT_COMMIT } From e8881f6f25ce7a514b1383d3f900140419f546d7 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 14:02:17 -0300 Subject: [PATCH 47/62] Add per-stage failure to Jenkins pipeline --- .ci/Jenkinsfile | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 5f5431639..9a3f67472 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -53,20 +53,24 @@ pipeline { stages { stage('Build Windows') { steps { - node('windows') { - gitClone() - windowsBuild() - saveArtifacts() + catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { + node('windows') { + gitClone() + windowsBuild() + saveArtifacts() + } } } } stage('Build Linux') { steps { - node('debian') { - gitClone() - unixBuild() - saveArtifacts() + catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { + node('debian') { + gitClone() + unixBuild() + saveArtifacts() + } } } } From 941a1b20cf3623fb6c317fffab3e1182a987f6b9 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 14:06:49 -0300 Subject: [PATCH 48/62] Fix bad copypaste in Jenkins pipeline --- .ci/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 9a3f67472..be954259e 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -22,7 +22,7 @@ def gitClone() { println "[-] Building git tag [${env.GIT_COMMIT}]" def scmVars = checkout scm: [$class: 'GitSCM', branches: [[name: env.GIT_COMMIT]], - userRemoteConfigs: [[url: 'http://git-server/user/repository.git']]] + userRemoteConfigs: [[url: 'https://github.com/richardg867/86Box.git']]] env.GIT_COMMIT = scmVars.GIT_COMMIT } From ed4fd684fade970cd479cd44bd6df438921a82bf Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 14:40:38 -0300 Subject: [PATCH 49/62] Handle Jenkins script approvals for build number setting --- .ci/Jenkinsfile | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index be954259e..ee3c3eecd 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -15,6 +15,16 @@ * Copyright 2021 RichardG. */ +/* Run this on /script to get all the approvals necessary to sync build numbers across jobs: + +def approval = org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.get() +approval.approveSignature('staticMethod jenkins.model.Jenkins getInstance') +approval.approveSignature('method hudson.model.ItemGroup getItem java.lang.String') +approval.approveSignature('field hudson.model.Job nextBuildNumber') +approval.approveSignature('method hudson.model.Job saveNextBuildNumber') + +*/ + def gitClone() { cleanWs() if (env.GIT_COMMIT == null) @@ -86,10 +96,14 @@ pipeline { steps { script { ["${env.JOB_BASE_NAME}2"].each { - /* Set next build number for this job. */ - def job = Jenkins.instance.getItem(it) - job.nextBuildNumber = env.BUILD_NUMBER - job.saveNextBuildNumber() + try { + /* Set next build number for this job. */ + def job = Jenkins.instance.getItem(it) + job.nextBuildNumber = env.BUILD_NUMBER as Integer + job.saveNextBuildNumber() + } catch (Exception e) { + println "[!] Failed to set next build number for [$it], make sure the script approvals are in place" + } /* Trigger this job. */ build propagate: false, From ae4ec8d98a12a93c1ef7a25436eab29a9ede623f Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 14:42:30 -0300 Subject: [PATCH 50/62] Re-enable Jenkins builds as the pipeline is mostly figured out --- .ci/build.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/.ci/build.sh b/.ci/build.sh index 621369d08..4808af571 100644 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -507,8 +507,6 @@ then fi # Run builds according to the Jenkins job name. -echo Temporarily disabled [$JOB_BASE_NAME] -exit 0 case $JOB_BASE_NAME in $project | $project-TestBuildPleaseIgnore) if is_windows From b3972d11aa3d7d132d724490597b4640001ab81a Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 14:57:32 -0300 Subject: [PATCH 51/62] Fix small issue with the build chaining test --- .ci/Jenkinsfile | 2 +- .ci/build.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index ee3c3eecd..3209d4800 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -102,7 +102,7 @@ pipeline { job.nextBuildNumber = env.BUILD_NUMBER as Integer job.saveNextBuildNumber() } catch (Exception e) { - println "[!] Failed to set next build number for [$it], make sure the script approvals are in place" + println "[!] Could not set next build number for [$it], make sure all the script approvals are in place" } /* Trigger this job. */ diff --git a/.ci/build.sh b/.ci/build.sh index 4808af571..94f84706e 100644 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -508,7 +508,7 @@ fi # Run builds according to the Jenkins job name. case $JOB_BASE_NAME in - $project | $project-TestBuildPleaseIgnore) + $project | $project-TestBuildPleaseIgnore*) if is_windows then build 32 --preset=regular From d63461c712cf466b82cf97e2b0573c346839bae8 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 15:15:07 -0300 Subject: [PATCH 52/62] Add failure mode to Jenkins pipeline --- .ci/Jenkinsfile | 65 ++++++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 25 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 3209d4800..f7f7ca76e 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -48,6 +48,8 @@ def saveArtifacts() { archiveArtifacts artifacts: "${env.JOB_BASE_NAME}-*" } +def anySuccess = false + pipeline { agent any @@ -69,6 +71,10 @@ pipeline { windowsBuild() saveArtifacts() } + + script { + anySuccess = true + } } } } @@ -81,38 +87,47 @@ pipeline { unixBuild() saveArtifacts() } + + script { + anySuccess = true + } } } } - /* If we're on the main jobs, trigger each of the downstream jobs. */ - stage('Trigger downstream jobs') { - when { - expression { - return env.JOB_BASE_NAME == '86Box-TestBuildPleaseIgnore'; - } - } - + /* This stage has two tasks: + - Fail the build if all build stages failed + - Trigger downstream jobs if we're on the main job + This could be done with two stages and when{} blocks, but then they + would show up separately in the UI (unless JENKINS-44094 happens). */ + stage('Finish build') { steps { script { - ["${env.JOB_BASE_NAME}2"].each { - try { - /* Set next build number for this job. */ - def job = Jenkins.instance.getItem(it) - job.nextBuildNumber = env.BUILD_NUMBER as Integer - job.saveNextBuildNumber() - } catch (Exception e) { - println "[!] Could not set next build number for [$it], make sure all the script approvals are in place" - } + if (env.JOB_BASE_NAME == '86Box-TestBuildPleaseIgnore') { + ["${env.JOB_BASE_NAME}2"].each { + try { + /* Set next build number for this job. */ + def job = Jenkins.instance.getItem(it) + job.nextBuildNumber = env.BUILD_NUMBER as Integer + job.saveNextBuildNumber() + } catch (Exception e) { + println "[!] Could not set next build number for [$it], make sure all the script approvals are in place" + } - /* Trigger this job. */ - build propagate: false, - wait: false, - job: it, - parameters: [ - string(name: 'BUILD_TYPE', value: BUILD_TYPE), - string(name: 'BRANCH', value: env.GIT_COMMIT) - ] + /* Trigger this job. */ + build propagate: false, + wait: false, + job: it, + parameters: [ + string(name: 'BUILD_TYPE', value: BUILD_TYPE), + string(name: 'BRANCH', value: env.GIT_COMMIT) + ] + } + } + + if (!anySuccess) { + println "[!] Failing build because all build stages failed" + currentBuild.result = 'FAILURE' } } } From c7accb26fd9cd978d1df8b33404118a2a9d6b55c Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 15:32:02 -0300 Subject: [PATCH 53/62] Change description for Jenkins internal BRANCH parameter --- .ci/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index f7f7ca76e..8d7068a2d 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -59,7 +59,7 @@ pipeline { description: 'Build type to pass on to CMake. This may affect the UI icon and feature set.') string(name: 'BRANCH', defaultValue: 'master', - description: 'Used internally to make sure all downstream builds use the same commit.') + description: "Used internally to make sure all downstream builds use the same commit. Don't change this.") } stages { @@ -96,8 +96,8 @@ pipeline { } /* This stage has two tasks: - - Fail the build if all build stages failed - Trigger downstream jobs if we're on the main job + - Fail this build if all build stages failed This could be done with two stages and when{} blocks, but then they would show up separately in the UI (unless JENKINS-44094 happens). */ stage('Finish build') { From 94d9ec141408dabdd32642b39a5a55775eb32805 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 15:37:39 -0300 Subject: [PATCH 54/62] Another comment about Jenkins parameters for good measure --- .ci/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 8d7068a2d..e97830f05 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -56,7 +56,7 @@ pipeline { parameters { string(name: 'BUILD_TYPE', defaultValue: 'beta', /* !!! CHANGE HERE !!! for build type */ - description: 'Build type to pass on to CMake. This may affect the UI icon and feature set.') + description: "Build type to pass on to CMake. Don't change this, you should instead change the default value on .ci/Jenkinsfile") string(name: 'BRANCH', defaultValue: 'master', description: "Used internally to make sure all downstream builds use the same commit. Don't change this.") From 913b695073572869c941f81d1d7c8def9b7b62a6 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 15:59:22 -0300 Subject: [PATCH 55/62] Move Jenkins post-build tasks to a post{} block --- .ci/Jenkinsfile | 59 ++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index e97830f05..f6f0f11f1 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -51,7 +51,7 @@ def saveArtifacts() { def anySuccess = false pipeline { - agent any + agent none parameters { string(name: 'BUILD_TYPE', @@ -94,42 +94,37 @@ pipeline { } } } + } - /* This stage has two tasks: - - Trigger downstream jobs if we're on the main job - - Fail this build if all build stages failed - This could be done with two stages and when{} blocks, but then they - would show up separately in the UI (unless JENKINS-44094 happens). */ - stage('Finish build') { - steps { - script { - if (env.JOB_BASE_NAME == '86Box-TestBuildPleaseIgnore') { - ["${env.JOB_BASE_NAME}2"].each { - try { - /* Set next build number for this job. */ - def job = Jenkins.instance.getItem(it) - job.nextBuildNumber = env.BUILD_NUMBER as Integer - job.saveNextBuildNumber() - } catch (Exception e) { - println "[!] Could not set next build number for [$it], make sure all the script approvals are in place" - } - - /* Trigger this job. */ - build propagate: false, - wait: false, - job: it, - parameters: [ - string(name: 'BUILD_TYPE', value: BUILD_TYPE), - string(name: 'BRANCH', value: env.GIT_COMMIT) - ] + post { + always { + script { + if (env.JOB_BASE_NAME == '86Box-TestBuildPleaseIgnore') { + ["${env.JOB_BASE_NAME}2"].each { + try { + /* Set next build number for this job. */ + def job = Jenkins.instance.getItem(it) + job.nextBuildNumber = env.BUILD_NUMBER as Integer + job.saveNextBuildNumber() + } catch (Exception e) { + println "[!] Could not set next build number for [$it], make sure all the script approvals are in place" } - } - if (!anySuccess) { - println "[!] Failing build because all build stages failed" - currentBuild.result = 'FAILURE' + /* Trigger this job. */ + build propagate: false, + wait: false, + job: it, + parameters: [ + string(name: 'BUILD_TYPE', value: BUILD_TYPE), + string(name: 'BRANCH', value: env.GIT_COMMIT) + ] } } + + if (!anySuccess) { + println "[!] Failing build because all build stages failed" + currentBuild.result = 'FAILURE' + } } } } From 918dae0683b2713b464da93271e3864b01ef3d73 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 16:19:26 -0300 Subject: [PATCH 56/62] Dummy commit to test build chaining --- .ci/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index f6f0f11f1..f45bdbec5 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -31,8 +31,8 @@ def gitClone() { env.GIT_COMMIT = BRANCH println "[-] Building git tag [${env.GIT_COMMIT}]" def scmVars = checkout scm: [$class: 'GitSCM', - branches: [[name: env.GIT_COMMIT]], - userRemoteConfigs: [[url: 'https://github.com/richardg867/86Box.git']]] + branches: [[name: env.GIT_COMMIT]], + userRemoteConfigs: [[url: 'https://github.com/richardg867/86Box.git']]] env.GIT_COMMIT = scmVars.GIT_COMMIT } From c0fb42b75678abe591ebb5bc71b382be26d07b84 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 18:38:27 -0300 Subject: [PATCH 57/62] Disable VNC on Jenkins dev builds --- .ci/build.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.ci/build.sh b/.ci/build.sh index 94f84706e..e441d2242 100644 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -544,16 +544,16 @@ case $JOB_BASE_NAME in $project-Dev) if is_windows then - build 32 --preset=experimental - build 64 --preset=experimental + build 32 --preset=experimental -D VNC=OFF + build 64 --preset=experimental -D VNC=OFF elif is_mac then - build Universal --preset=experimental + build Universal --preset=experimental -D VNC=OFF else - build x86 --preset=experimental - build x86_64 --preset=experimental - build arm32 --preset=experimental - build arm64 --preset=experimental + build x86 --preset=experimental -D VNC=OFF + build x86_64 --preset=experimental -D VNC=OFF + build arm32 --preset=experimental -D VNC=OFF + build arm64 --preset=experimental -D VNC=OFF fi ;; From d7bc85478336b2904e6346189efd1ab0afce2bf3 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sun, 14 Nov 2021 03:06:20 -0300 Subject: [PATCH 58/62] Jenkins: make build chaining more elegant, and add Discord and IRC notifications --- .ci/Jenkinsfile | 55 +++++++++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index f45bdbec5..4dfca4eca 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -15,7 +15,7 @@ * Copyright 2021 RichardG. */ -/* Run this on /script to get all the approvals necessary to sync build numbers across jobs: +/* Run this on /script to get all approvals required to sync build numbers across jobs: def approval = org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.get() approval.approveSignature('staticMethod jenkins.model.Jenkins getInstance') @@ -41,7 +41,7 @@ def windowsBuild() { } def unixBuild() { - sh 'chmod u+x .ci/build.sh && .ci/build.sh' + sh 'chmod u+x .ci/build.sh && exec .ci/build.sh' } def saveArtifacts() { @@ -50,6 +50,12 @@ def saveArtifacts() { def anySuccess = false +def buildChain = { + '86Box': '86Box-Dev', + '86Box-Dev': '86Box-Debug', + '86Box-TestBuildPleaseIgnore': '86Box-TestBuildPleaseIgnore2' +} + pipeline { agent none @@ -62,6 +68,10 @@ pipeline { description: "Used internally to make sure all downstream builds use the same commit. Don't change this.") } + environment { + DISCORD_WEBHOOK_URL = credentials('discord-webhook-url') + } + stages { stage('Build Windows') { steps { @@ -99,32 +109,37 @@ pipeline { post { always { script { - if (env.JOB_BASE_NAME == '86Box-TestBuildPleaseIgnore') { - ["${env.JOB_BASE_NAME}2"].each { - try { - /* Set next build number for this job. */ - def job = Jenkins.instance.getItem(it) - job.nextBuildNumber = env.BUILD_NUMBER as Integer - job.saveNextBuildNumber() - } catch (Exception e) { - println "[!] Could not set next build number for [$it], make sure all the script approvals are in place" - } + if (buildChain[env.JOB_BASE_NAME]) { + def nextJob = buildChain[env.JOB_BASE_NAME] - /* Trigger this job. */ - build propagate: false, - wait: false, - job: it, - parameters: [ - string(name: 'BUILD_TYPE', value: BUILD_TYPE), - string(name: 'BRANCH', value: env.GIT_COMMIT) - ] + try { + /* Set next build number for this job. */ + def job = Jenkins.instance.getItem(nextJob) + job.nextBuildNumber = env.BUILD_NUMBER as Integer + job.saveNextBuildNumber() + } catch (Exception e) { + println "[!] Could not set next build number for [$nextJob], make sure all required script approvals are in place" } + + /* Trigger this job. */ + build propagate: false, + wait: false, + job: nextJob, + parameters: [ + string(name: 'BUILD_TYPE', value: BUILD_TYPE), + string(name: 'BRANCH', value: env.GIT_COMMIT) + ] } if (!anySuccess) { println "[!] Failing build because all build stages failed" currentBuild.result = 'FAILURE' } + + if (!env.JOB_BASE_NAME.contains("TestBuildPleaseIgnore")) { + discordSend webhookURL: DISCORD_WEBHOOK_URL + ircNotify() + } } } } From 2e9d57dcc830c7fcd566ac608f059b3fadf63cad Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sun, 14 Nov 2021 03:07:16 -0300 Subject: [PATCH 59/62] Fix typo in Jenkinsfile --- .ci/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 4dfca4eca..4118da758 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -50,11 +50,11 @@ def saveArtifacts() { def anySuccess = false -def buildChain = { +def buildChain = [ '86Box': '86Box-Dev', '86Box-Dev': '86Box-Debug', '86Box-TestBuildPleaseIgnore': '86Box-TestBuildPleaseIgnore2' -} +] pipeline { agent none From 3fa3541f109fee4b892d3f53ebcf4ceaf9253b9d Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sun, 14 Nov 2021 13:35:36 -0300 Subject: [PATCH 60/62] Add dev builds with old dynarec as requested --- .ci/Jenkinsfile | 3 ++- .ci/build.sh | 30 +++++++++++++++++++++++------- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 4118da758..5243d4d6b 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -52,7 +52,8 @@ def anySuccess = false def buildChain = [ '86Box': '86Box-Dev', - '86Box-Dev': '86Box-Debug', + '86Box-Dev': '86Box-DevODR', + '86Box-DevODR': '86Box-Debug', '86Box-TestBuildPleaseIgnore': '86Box-TestBuildPleaseIgnore2' ] diff --git a/.ci/build.sh b/.ci/build.sh index e441d2242..24738fbfb 100644 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -544,16 +544,32 @@ case $JOB_BASE_NAME in $project-Dev) if is_windows then - build 32 --preset=experimental -D VNC=OFF - build 64 --preset=experimental -D VNC=OFF + build 32 --preset=experimental -D NEW_DYNAREC=ON -D VNC=OFF + build 64 --preset=experimental -D NEW_DYNAREC=ON -D VNC=OFF elif is_mac then - build Universal --preset=experimental -D VNC=OFF + build Universal --preset=experimental -D NEW_DYNAREC=ON -D VNC=OFF else - build x86 --preset=experimental -D VNC=OFF - build x86_64 --preset=experimental -D VNC=OFF - build arm32 --preset=experimental -D VNC=OFF - build arm64 --preset=experimental -D VNC=OFF + build x86 --preset=experimental -D NEW_DYNAREC=ON -D VNC=OFF + build x86_64 --preset=experimental -D NEW_DYNAREC=ON -D VNC=OFF + build arm32 --preset=experimental -D NEW_DYNAREC=ON -D VNC=OFF + build arm64 --preset=experimental -D NEW_DYNAREC=ON -D VNC=OFF + fi + ;; + + $project-DevODR) + if is_windows + then + build 32 --preset=experimental -D NEW_DYNAREC=OFF -D VNC=OFF + build 64 --preset=experimental -D NEW_DYNAREC=OFF -D VNC=OFF + elif is_mac + then + build Universal --preset=experimental -D NEW_DYNAREC=OFF -D VNC=OFF + else + build x86 --preset=experimental -D NEW_DYNAREC=OFF -D VNC=OFF + build x86_64 --preset=experimental -D NEW_DYNAREC=OFF -D VNC=OFF + build arm32 --preset=experimental -D NEW_DYNAREC=OFF -D VNC=OFF + build arm64 --preset=experimental -D NEW_DYNAREC=OFF -D VNC=OFF fi ;; From 33e56c4dd9721185453fbed5e0a02bf37cd866df Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sun, 14 Nov 2021 14:28:22 -0300 Subject: [PATCH 61/62] Merge machine table changes from local branch --- src/include/86box/machine.h | 28 ++++++------ src/machine/m_at_slot1.c | 7 +++ src/machine/m_at_socket4.c | 8 ++-- src/machine/m_at_socket5.c | 34 --------------- src/machine/m_at_socket7.c | 12 ++--- src/machine/m_at_socket7_3v.c | 82 +++++++++++++++++++++++------------ src/machine/m_at_socket8.c | 2 +- src/machine/machine_table.c | 60 ++++++++++++------------- 8 files changed, 117 insertions(+), 116 deletions(-) diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 2767789b3..5f969aa44 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -408,7 +408,7 @@ extern void machine_at_award_common_init(const machine_t *); extern void machine_at_sp4_common_init(const machine_t *model); -extern int machine_at_excalibur_pci_init(const machine_t *); +extern int machine_at_excaliburpci_init(const machine_t *); extern int machine_at_p5mp3_init(const machine_t *); extern int machine_at_dellxp60_init(const machine_t *); extern int machine_at_opti560l_init(const machine_t *); @@ -422,7 +422,7 @@ extern int machine_at_excalibur_init(const machine_t *); extern int machine_at_p5vl_init(const machine_t *); -extern int machine_at_excalibur_pci_2_init(const machine_t *); +extern int machine_at_excaliburpci2_init(const machine_t *); extern int machine_at_p5sp4_init(const machine_t *); #ifdef EMU_DEVICE_H @@ -437,7 +437,6 @@ extern int machine_at_430nx_init(const machine_t *); extern int machine_at_acerv30_init(const machine_t *); extern int machine_at_apollo_init(const machine_t *); extern int machine_at_exp8551_init(const machine_t *); -extern int machine_at_vectra54_init(const machine_t *); extern int machine_at_zappa_init(const machine_t *); extern int machine_at_powermatev_init(const machine_t *); extern int machine_at_mb500n_init(const machine_t *); @@ -450,13 +449,10 @@ extern int machine_at_hot543_init(const machine_t *); extern int machine_at_p54sp4_init(const machine_t *); extern int machine_at_sq588_init(const machine_t *); -#ifdef EMU_DEVICE_H -#define at_vectra54_get_device at_endeavor_get_device -#endif /* m_at_socket7_3v.c */ extern int machine_at_p54tp4xe_init(const machine_t *); -extern int machine_at_mr586_init(const machine_t *); +extern int machine_at_p54tp4xe_mr_init(const machine_t *); extern int machine_at_gw2katx_init(const machine_t *); extern int machine_at_thor_init(const machine_t *); extern int machine_at_mrthor_init(const machine_t *); @@ -474,9 +470,11 @@ extern int machine_at_p5vxb_init(const machine_t *); extern int machine_at_gw2kte_init(const machine_t *); extern int machine_at_ap5s_init(const machine_t *); +extern int machine_at_vectra54_init(const machine_t *); #ifdef EMU_DEVICE_H extern const device_t *at_endeavor_get_device(void); +#define at_vectra54_get_device at_endeavor_get_device extern const device_t *at_thor_get_device(void); #define at_mrthor_get_device at_thor_get_device extern const device_t *at_pb640_get_device(void); @@ -488,7 +486,7 @@ extern int machine_at_p55t2p4_init(const machine_t *); extern int machine_at_m7shi_init(const machine_t *); extern int machine_at_tc430hx_init(const machine_t *); extern int machine_at_equium5200_init(const machine_t *); -extern int machine_at_pcv240_init(const machine_t *); +extern int machine_at_pcv90_init(const machine_t *); extern int machine_at_p65up5_cp55t2d_init(const machine_t *); extern int machine_at_ap5vm_init(const machine_t *); @@ -546,7 +544,7 @@ extern int machine_at_v60n_init(const machine_t *); extern int machine_at_vs440fx_init(const machine_t *); extern int machine_at_ap440fx_init(const machine_t *); extern int machine_at_mb600n_init(const machine_t *); -extern int machine_at_8500ttc_init(const machine_t *); +extern int machine_at_8600ttc_init(const machine_t *); extern int machine_at_m6mi_init(const machine_t *); #ifdef EMU_DEVICE_H extern void machine_at_p65up5_common_init(const machine_t *, const device_t *northbridge); @@ -570,7 +568,7 @@ extern int machine_at_bf6_init(const machine_t *); extern int machine_at_ax6bc_init(const machine_t *); extern int machine_at_atc6310bxii_init(const machine_t *); extern int machine_at_686bx_init(const machine_t *); -extern int machine_at_tsunamiatx_init(const machine_t *); +extern int machine_at_s1846_init(const machine_t *); extern int machine_at_p6sba_init(const machine_t *); extern int machine_at_ficka6130_init(const machine_t *); extern int machine_at_p3v133_init(const machine_t *); @@ -582,7 +580,11 @@ extern int machine_at_borapro_init(const machine_t *); extern int machine_at_ms6168_init(const machine_t *); #ifdef EMU_DEVICE_H -extern const device_t *at_tsunamiatx_get_device(void); +extern const device_t *at_s1846_get_device(void); +#define at_s1857_get_device at_s1846_get_device +#define at_gt694va_get_device at_s1846_get_device +extern const device_t *at_ms6168_get_device(void); +#define at_borapro_get_device at_ms6168_get_device #endif /* m_at_slot2.c */ @@ -597,13 +599,13 @@ extern int machine_at_cubx_init(const machine_t *); extern int machine_at_atc7020bxii_init(const machine_t *); extern int machine_at_ambx133_init(const machine_t *); extern int machine_at_awo671r_init(const machine_t *); -extern int machine_at_63a_init(const machine_t *); +extern int machine_at_63a1_init(const machine_t *); extern int machine_at_s370sba_init(const machine_t *); extern int machine_at_apas3_init(const machine_t *); extern int machine_at_gt694va_init(const machine_t *); extern int machine_at_cuv4xls_init(const machine_t *); extern int machine_at_6via90ap_init(const machine_t *); -extern int machine_at_trinity371_init(const machine_t *); +extern int machine_at_s1857_init(const machine_t *); extern int machine_at_p6bap_init(const machine_t *); /* m_at_misc.c */ diff --git a/src/machine/m_at_slot1.c b/src/machine/m_at_slot1.c index feb0a1081..9c286ec79 100644 --- a/src/machine/m_at_slot1.c +++ b/src/machine/m_at_slot1.c @@ -659,6 +659,13 @@ machine_at_ms6168_common_init(const machine_t *model) } +const device_t * +at_ms6168_get_device(void) +{ + return &voodoo_3_2000_agp_onboard_8m_device; +} + + int machine_at_borapro_init(const machine_t *model) { diff --git a/src/machine/m_at_socket4.c b/src/machine/m_at_socket4.c index 7e8dd9232..30b76cf7a 100644 --- a/src/machine/m_at_socket4.c +++ b/src/machine/m_at_socket4.c @@ -112,11 +112,11 @@ machine_at_sp4_common_init(const machine_t *model) int -machine_at_excalibur_pci_init(const machine_t *model) +machine_at_excaliburpci_init(const machine_t *model) { int ret; - ret = bios_load_linear_inverted("roms/machines/excalibur_pci/S701P.ROM", + ret = bios_load_linear_inverted("roms/machines/excaliburpci/S701P.ROM", 0x000e0000, 131072, 0); if (bios_only || !ret) @@ -423,11 +423,11 @@ machine_at_p5vl_init(const machine_t *model) int -machine_at_excalibur_pci_2_init(const machine_t *model) +machine_at_excaliburpci2_init(const machine_t *model) { int ret; - ret = bios_load_linear_inverted("roms/machines/excalibur_pci-2/S722P.ROM", + ret = bios_load_linear_inverted("roms/machines/excaliburpci2/S722P.ROM", 0x000e0000, 131072, 0); if (bios_only || !ret) diff --git a/src/machine/m_at_socket5.c b/src/machine/m_at_socket5.c index 2748210e0..f987bd7ab 100644 --- a/src/machine/m_at_socket5.c +++ b/src/machine/m_at_socket5.c @@ -194,40 +194,6 @@ machine_at_exp8551_init(const machine_t *model) } -int -machine_at_vectra54_init(const machine_t *model) -{ - int ret; - - ret = bios_load_linear("roms/machines/vectra54/GT0724.22", - 0x000e0000, 131072, 0); - - if (bios_only || !ret) - return ret; - - machine_at_common_init_ex(model, 2); - - pci_init(PCI_CONFIG_TYPE_1); - pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x0F, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x0D, PCI_CARD_VIDEO, 0, 0, 0, 0); - pci_register_slot(0x06, PCI_CARD_NORMAL, 1, 2, 3, 4); - pci_register_slot(0x07, PCI_CARD_NORMAL, 2, 3, 4, 1); - pci_register_slot(0x08, PCI_CARD_NORMAL, 3, 4, 1, 2); - - if (gfxcard == VID_INTERNAL) - device_add(&s3_phoenix_trio64_onboard_pci_device); - - device_add(&keyboard_ps2_ami_pci_device); - device_add(&i430fx_device); - device_add(&piix_device); - device_add(&fdc37c931apm_device); - device_add(&sst_flash_29ee010_device); - - return ret; -} - - int machine_at_zappa_init(const machine_t *model) { diff --git a/src/machine/m_at_socket7.c b/src/machine/m_at_socket7.c index d9e9b7cd1..70865044f 100644 --- a/src/machine/m_at_socket7.c +++ b/src/machine/m_at_socket7.c @@ -246,15 +246,15 @@ machine_at_equium5200_init(const machine_t *model) int -machine_at_pcv240_init(const machine_t *model) +machine_at_pcv90_init(const machine_t *model) { int ret; - ret = bios_load_linear_combined2("roms/machines/pcv240/1010DD04.BIO", - "roms/machines/pcv240/1010DD04.BI1", - "roms/machines/pcv240/1010DD04.BI2", - "roms/machines/pcv240/1010DD04.BI3", - "roms/machines/pcv240/1010DD04.RCV", + ret = bios_load_linear_combined2("roms/machines/pcv90/1010DD04.BIO", + "roms/machines/pcv90/1010DD04.BI1", + "roms/machines/pcv90/1010DD04.BI2", + "roms/machines/pcv90/1010DD04.BI3", + "roms/machines/pcv90/1010DD04.RCV", 0x3a000, 128); if (bios_only || !ret) diff --git a/src/machine/m_at_socket7_3v.c b/src/machine/m_at_socket7_3v.c index 5ee87fc44..87185ad53 100644 --- a/src/machine/m_at_socket7_3v.c +++ b/src/machine/m_at_socket7_3v.c @@ -72,20 +72,11 @@ machine_at_thor_common_init(const machine_t *model, int mr) } -int -machine_at_p54tp4xe_init(const machine_t *model) +static void +machine_at_p54tp4xe_common_init(const machine_t *model) { - int ret; - - ret = bios_load_linear("roms/machines/p54tp4xe/t15i0302.awd", - 0x000e0000, 131072, 0); - - if (bios_only || !ret) - return ret; - machine_at_common_init(model); - /* Award BIOS, SMC FDC37C665. */ pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4); @@ -98,37 +89,38 @@ machine_at_p54tp4xe_init(const machine_t *model) device_add(&piix_device); device_add(&fdc37c665_device); device_add(&intel_flash_bxt_device); +} + + +int +machine_at_p54tp4xe_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear("roms/machines/p54tp4xe/t15i0302.awd", + 0x000e0000, 131072, 0); + + if (bios_only || !ret) + return ret; + + machine_at_p54tp4xe_common_init(model); return ret; } int -machine_at_mr586_init(const machine_t *model) +machine_at_p54tp4xe_mr_init(const machine_t *model) { int ret; - ret = bios_load_linear("roms/machines/mr586/TRITON.BIO", + ret = bios_load_linear("roms/machines/p54tp4xe_mr/TRITON.BIO", 0x000e0000, 131072, 0); if (bios_only || !ret) return ret; - machine_at_common_init(model); - - pci_init(PCI_CONFIG_TYPE_1); - pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4); - pci_register_slot(0x0B, PCI_CARD_NORMAL, 2, 3, 4, 1); - pci_register_slot(0x0A, PCI_CARD_NORMAL, 3, 4, 1, 2); - pci_register_slot(0x09, PCI_CARD_NORMAL, 4, 1, 2, 3); - - device_add(&i430fx_device); - device_add(&piix_device); - device_add(&keyboard_ps2_ami_pci_device); - device_add(&fdc37c665_device); - device_add(&intel_flash_bxt_device); + machine_at_p54tp4xe_common_init(model); return ret; } @@ -552,3 +544,37 @@ machine_at_ap5s_init(const machine_t *model) return ret; } + + +int +machine_at_vectra54_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear("roms/machines/vectra54/GT0724.22", + 0x000e0000, 131072, 0); + + if (bios_only || !ret) + return ret; + + machine_at_common_init_ex(model, 2); + + pci_init(PCI_CONFIG_TYPE_1); + pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x0F, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x0D, PCI_CARD_VIDEO, 0, 0, 0, 0); + pci_register_slot(0x06, PCI_CARD_NORMAL, 1, 2, 3, 4); + pci_register_slot(0x07, PCI_CARD_NORMAL, 2, 3, 4, 1); + pci_register_slot(0x08, PCI_CARD_NORMAL, 3, 4, 1, 2); + + if (gfxcard == VID_INTERNAL) + device_add(&s3_phoenix_trio64_onboard_pci_device); + + device_add(&keyboard_ps2_ami_pci_device); + device_add(&i430fx_device); + device_add(&piix_device); + device_add(&fdc37c931apm_device); + device_add(&sst_flash_29ee010_device); + + return ret; +} diff --git a/src/machine/m_at_socket8.c b/src/machine/m_at_socket8.c index 52a2212cc..109a7926f 100644 --- a/src/machine/m_at_socket8.c +++ b/src/machine/m_at_socket8.c @@ -236,7 +236,7 @@ machine_at_8600ttc_init(const machine_t *model) { int ret; - ret = bios_load_linear("roms/machines/8500ttc/TTC0715B.ROM", + ret = bios_load_linear("roms/machines/8600ttc/TTC0715B.ROM", 0x000e0000, 131072, 0); if (bios_only || !ret) diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 5077b3ea3..250661934 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -451,18 +451,18 @@ const machine_t machines[] = { of type 'H'. */ { "[SiS 496] Zida Tomato 4DP", "4dps", MACHINE_TYPE_486_S3, CPU_PKG_SOCKET3, 0, 0, 0, 0, 0, 0, 0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 1024, 261120, 1024, 255, machine_at_4dps_init, NULL }, /* This has the UMC 88xx on-chip KBC. */ - { "[UMC 888x] A-Trend ATC-1415", "atc1415", MACHINE_TYPE_486_S3, CPU_PKG_SOCKET3, 0, 0, 0, 0, 0, 0, 0, MACHINE_PCI | MACHINE_IDE_DUAL, 1024, 65536, 1024, 255, machine_at_atc1415_init, NULL }, + { "[UMC 8881] A-Trend ATC-1415", "atc1415", MACHINE_TYPE_486_S3, CPU_PKG_SOCKET3, 0, 0, 0, 0, 0, 0, 0, MACHINE_PCI | MACHINE_IDE_DUAL, 1024, 65536, 1024, 255, machine_at_atc1415_init, NULL }, /* This has an AMIKey-2, which is an updated version of type 'H'. */ - { "[UMC 888x] ECS Elite UM8810PAIO", "ecs486", MACHINE_TYPE_486_S3, CPU_PKG_SOCKET3, 0, 0, 0, 0, 0, 0, 0, MACHINE_PCI | MACHINE_IDE_DUAL, 1024, 131072, 1024, 255, machine_at_ecs486_init, NULL }, + { "[UMC 8881] ECS Elite UM8810PAIO", "ecs486", MACHINE_TYPE_486_S3, CPU_PKG_SOCKET3, 0, 0, 0, 0, 0, 0, 0, MACHINE_PCI | MACHINE_IDE_DUAL, 1024, 131072, 1024, 255, machine_at_ecs486_init, NULL }, /* Has AMIKey Z(!) KBC firmware. */ - { "[UMC 888x] Epson Action PC 2600", "actionpc2600", MACHINE_TYPE_486_S3, CPU_PKG_SOCKET3, 0, 0, 0, 0, 0, 0, 0, MACHINE_PCI | MACHINE_IDE_DUAL, 1024, 262144, 1024, 255, machine_at_actionpc2600_init, NULL }, + { "[UMC 8881] Epson Action PC 2600", "actionpc2600", MACHINE_TYPE_486_S3, CPU_PKG_SOCKET3, 0, 0, 0, 0, 0, 0, 0, MACHINE_PCI | MACHINE_IDE_DUAL, 1024, 262144, 1024, 255, machine_at_actionpc2600_init, NULL }, /* This has the UMC 88xx on-chip KBC. All the copies of the BIOS string I can find, end in in -H, so the UMC on-chip KBC likely emulates the AMI 'H' KBC firmware. */ - { "[UMC 888x] PC Chips M919", "m919", MACHINE_TYPE_486_S3, CPU_PKG_SOCKET3, 0, 0, 0, 0, 0, 0, 0, MACHINE_PCI | MACHINE_VLB | MACHINE_IDE_DUAL, 1024, 131072, 1024, 255, machine_at_m919_init, NULL }, + { "[UMC 8881] PC Chips M919", "m919", MACHINE_TYPE_486_S3, CPU_PKG_SOCKET3, 0, 0, 0, 0, 0, 0, 0, MACHINE_PCI | MACHINE_VLB | MACHINE_IDE_DUAL, 1024, 131072, 1024, 255, machine_at_m919_init, NULL }, /* Has IBM PS/2 Type 1 KBC firmware. Uses a mysterious I/O port C05. */ - { "[UMC 888x] Samsung SPC7700P-LW", "spc7700p-lw", MACHINE_TYPE_486_S3, CPU_PKG_SOCKET3, 0, 0, 0, 0, 0, 0, 0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 1024, 131072, 1024, 255, machine_at_spc7700p_lw_init, NULL }, + { "[UMC 8881] Samsung SPC7700P-LW", "spc7700p-lw", MACHINE_TYPE_486_S3, CPU_PKG_SOCKET3, 0, 0, 0, 0, 0, 0, 0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 1024, 131072, 1024, 255, machine_at_spc7700p_lw_init, NULL }, /* This has a Holtek KBC. */ - { "[UMC 888x] Shuttle HOT-433A", "hot433", MACHINE_TYPE_486_S3, CPU_PKG_SOCKET3, 0, 0, 0, 0, 0, 0, 0, MACHINE_PCI | MACHINE_IDE_DUAL, 1024, 262144, 1024, 255, machine_at_hot433_init, NULL }, + { "[UMC 8881] Shuttle HOT-433A", "hot433", MACHINE_TYPE_486_S3, CPU_PKG_SOCKET3, 0, 0, 0, 0, 0, 0, 0, MACHINE_PCI | MACHINE_IDE_DUAL, 1024, 262144, 1024, 255, machine_at_hot433_init, NULL }, /* Has a VIA VT82C406 KBC+RTC that likely has identical commands to the VT82C42N. */ { "[VIA VT82C496G] DFI G486VPA", "g486vpa", MACHINE_TYPE_486_S3, CPU_PKG_SOCKET3, 0, 0, 0, 0, 0, 0, 0, MACHINE_PCIV | MACHINE_IDE_DUAL, 1024, 131072, 1024, 255, machine_at_g486vpa_init, NULL }, /* Has a VIA VT82C42N KBC. */ @@ -493,7 +493,7 @@ const machine_t machines[] = { connector. The boot block for BIOS recovery requires an unknown bit on port 805h to be clear. */ - { "[i430LX] AMI Excalibur PCI Pentium", "excalibur_pci", MACHINE_TYPE_SOCKET4, CPU_PKG_SOCKET4, 0, 60000000, 66666667, 5000, 5000, MACHINE_MULTIPLIER_FIXED, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 2048, 131072, 2048, 127, machine_at_excalibur_pci_init, NULL }, + { "[i430LX] AMI Excalibur PCI Pentium", "excaliburpci", MACHINE_TYPE_SOCKET4, CPU_PKG_SOCKET4, 0, 60000000, 66666667, 5000, 5000, MACHINE_MULTIPLIER_FIXED, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 2048, 131072, 2048, 127, machine_at_excaliburpci_init, NULL }, /* Has AMIKey F KBC firmware (AMIKey). */ { "[i430LX] ASUS P/I-P5MP3", "p5mp3", MACHINE_TYPE_SOCKET4, CPU_PKG_SOCKET4, 0, 60000000, 66666667, 5000, 5000, MACHINE_MULTIPLIER_FIXED, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE, 2048, 196608, 2048, 127, machine_at_p5mp3_init, NULL }, /* Has IBM PS/2 Type 1 KBC firmware. */ @@ -517,7 +517,7 @@ const machine_t machines[] = { /* This uses an AMI KBC firmware in PS/2 mode (it sends command A5 with the PS/2 "Load Security" meaning), most likely MegaKey as it sends command AF (Set Extended Controller RAM) just like the later Intel AMI BIOS'es. */ - { "[OPTi 597] AMI Excalibur VLB", "excalibur", MACHINE_TYPE_SOCKET4, CPU_PKG_SOCKET4, 0, 60000000, 66666667, 5000, 5000, MACHINE_MULTIPLIER_FIXED, MACHINE_VLB | MACHINE_BUS_PS2 | MACHINE_IDE, 2048, 65536, 2048, 127, machine_at_excalibur_init, NULL }, + { "[OPTi 597] AMI Excalibur VLB", "excalibur", MACHINE_TYPE_SOCKET4, CPU_PKG_SOCKET4, 0, 60000000, 60000000, 5000, 5000, MACHINE_MULTIPLIER_FIXED, MACHINE_VLB | MACHINE_BUS_PS2 | MACHINE_IDE, 2048, 65536, 2048, 127, machine_at_excalibur_init, NULL }, /* OPTi 596/597/822 */ /* This has AMIKey 'F' KBC firmware. */ @@ -525,9 +525,9 @@ const machine_t machines[] = { /* SiS 50x */ /* This has an unknown AMI KBC firmware, most likely AMIKey / type 'F'. */ - { "[SiS 50x] AMI Excalibur PCI-II Pentium ISA","excalibur_pci-2", MACHINE_TYPE_SOCKET4, CPU_PKG_SOCKET4, 0, 60000000, 66666667, 5000, 5000, MACHINE_MULTIPLIER_FIXED, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_excalibur_pci_2_init, NULL }, + { "[SiS 501] AMI Excalibur PCI-II Pentium ISA","excaliburpci2", MACHINE_TYPE_SOCKET4, CPU_PKG_SOCKET4, 0, 60000000, 66666667, 5000, 5000, MACHINE_MULTIPLIER_FIXED, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_excaliburpci2_init, NULL }, /* This has an AMIKey-2, which is an updated version of type 'H'. */ - { "[SiS 50x] ASUS PCI/I-P5SP4", "p5sp4", MACHINE_TYPE_SOCKET4, CPU_PKG_SOCKET4, 0, 60000000, 66666667, 5000, 5000, MACHINE_MULTIPLIER_FIXED, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_p5sp4_init, NULL }, + { "[SiS 501] ASUS PCI/I-P5SP4", "p5sp4", MACHINE_TYPE_SOCKET4, CPU_PKG_SOCKET4, 0, 60000000, 66666667, 5000, 5000, MACHINE_MULTIPLIER_FIXED, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_p5sp4_init, NULL }, /* Socket 5 machines */ /* 430NX */ @@ -546,9 +546,6 @@ const machine_t machines[] = { { "[i430FX] AMI Apollo", "apollo", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 2.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_apollo_init, NULL }, /* Has AMIKey H KBC firmware. */ { "[i430FX] Dataexpert EXP8551", "exp8551", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 2.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_exp8551_init, NULL }, - /* The BIOS does not send a single non-standard KBC command, but the board has a SMC Super I/O - chip with on-chip KBC and AMI MegaKey KBC firmware. */ - { "[i430FX] HP Vectra VL 5 Series 4", "vectra54", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 2.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 511, machine_at_vectra54_init, at_vectra54_get_device }, /* According to tests from real hardware: This has AMI MegaKey KBC firmware on the PC87306 Super I/O chip, command 0xA1 returns '5'. Command 0xA0 copyright string: (C)1994 AMI . */ @@ -567,24 +564,27 @@ const machine_t machines[] = { { "[OPTi 597] TMC PAT54PV", "pat54pv", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, CPU_BLOCK(CPU_K5, CPU_5K86), 50000000, 66666667, 3520, 3520, 1.5, 1.5, MACHINE_VLB, 2048, 65536, 2048, 127, machine_at_pat54pv_init, NULL }, /* OPTi 596/597/822 */ - { "[OPTi 597] Shuttle HOT-543", "hot543", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3520, 3520, 1.5, 1.5, MACHINE_PCI | MACHINE_VLB, 8192, 131072, 8192, 127, machine_at_hot543_init, NULL }, + { "[OPTi 597] Shuttle HOT-543", "hot543", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3520, 3520, 1.5, 2.0, MACHINE_PCI | MACHINE_VLB, 8192, 131072, 8192, 127, machine_at_hot543_init, NULL }, /* SiS 85C50x */ /* This has an AMIKey-2, which is an updated version of type 'H'. */ - { "[SiS 85C50x] ASUS PCI/I-P54SP4", "p54sp4", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, CPU_BLOCK(CPU_K5, CPU_5K86), 40000000, 66666667, 3380, 3520, 1.5, 1.5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_p54sp4_init, NULL }, + { "[SiS 501] ASUS PCI/I-P54SP4", "p54sp4", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, CPU_BLOCK(CPU_K5, CPU_5K86), 40000000, 66666667, 3380, 3520, 1.5, 1.5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_p54sp4_init, NULL }, /* This has an AMIKey-2, which is an updated version of type 'H'. */ - { "[SiS 85C50x] BCM SQ-588", "sq588", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, CPU_BLOCK(CPU_PENTIUMMMX), 50000000, 66666667, 3520, 3520, 1.5, 1.5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_sq588_init, NULL }, + { "[SiS 501] BCM SQ-588", "sq588", MACHINE_TYPE_SOCKET5, CPU_PKG_SOCKET5_7, CPU_BLOCK(CPU_PENTIUMMMX), 50000000, 66666667, 3520, 3520, 1.5, 1.5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_sq588_init, NULL }, /* Socket 7 (Single Voltage) machines */ /* 430FX */ /* This has an AMIKey-2, which is an updated version of type 'H'. */ { "[i430FX] ASUS P/I-P54TP4XE", "p54tp4xe", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3600, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_p54tp4xe_init, NULL }, /* This has an AMIKey-2, which is an updated version of type 'H'. */ - { "[i430FX] ASUS P/I-P54TP4XE (MR BIOS)", "mr586", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3600, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_mr586_init, NULL }, + { "[i430FX] ASUS P/I-P54TP4XE (MR BIOS)", "p54tp4xe_mr", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3600, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_p54tp4xe_mr_init, NULL }, /* According to tests from real hardware: This has AMI MegaKey KBC firmware on the PC87306 Super I/O chip, command 0xA1 returns '5'. Command 0xA0 copyright string: (C)1994 AMI . */ { "[i430FX] Gateway 2000 Thor", "gw2katx", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 131072, 8192, 127, machine_at_gw2katx_init, NULL }, + /* The BIOS does not send a single non-standard KBC command, but the board has a SMC Super I/O + chip with on-chip KBC and AMI MegaKey KBC firmware. */ + { "[i430FX] HP Vectra VL 5 Series 4", "vectra54", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 2.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO, 8192, 131072, 8192, 511, machine_at_vectra54_init, at_vectra54_get_device }, /* According to tests from real hardware: This has AMI MegaKey KBC firmware on the PC87306 Super I/O chip, command 0xA1 returns '5'. Command 0xA0 copyright string: (C)1994 AMI . */ @@ -616,7 +616,7 @@ const machine_t machines[] = { { "[i430HX] Biostar MB-8500TUC", "8500tuc", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3380, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 524288, 8192, 127, machine_at_8500tuc_init, NULL }, /* [TEST] Unable to determine what KBC this has. A list on a Danish site shows the BIOS as having a -0 string, indicating non-AMI KBC firmware. */ - { "[i430HX] SuperMicro Super P55T2S", "p55t2s", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3300, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 127, machine_at_p55t2s_init, NULL }, + { "[i430HX] Supermicro P55T2S", "p55t2s", MACHINE_TYPE_SOCKET7_3V, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 3300, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 127, machine_at_p55t2s_init, NULL }, /* 430VX */ /* Has AMIKey H KBC firmware (AMIKey-2). */ @@ -650,7 +650,7 @@ const machine_t machines[] = { PC87306 Super I/O chip, command 0xA1 returns '5'. Command 0xA0 copyright string: (C)1994 AMI . Yes, this is an Intel AMI BIOS with a fancy splash screen. */ - { "[i430HX] Sony Vaio PCV-240", "pcv240", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 2800, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 196608, 8192, 127, machine_at_pcv240_init, NULL }, + { "[i430HX] Sony Vaio PCV-90", "pcv90", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 2800, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 196608, 8192, 127, machine_at_pcv90_init, NULL }, /* The base board has AMIKey-2 (updated 'H') KBC firmware. */ { "[i430HX] ASUS P/I-P65UP5 (C-P55T2D)", "p65up5_cp55t2d", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 2500, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 524288, 8192, 127, machine_at_p65up5_cp55t2d_init, NULL }, @@ -698,7 +698,7 @@ const machine_t machines[] = { /* The BIOS sends KBC command BB and expects it to output a byte, which is AMI KBC behavior. */ { "[i430TX] PC Partner MB540N", "mb540n", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 60000000, 66666667, 2700, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 262144, 8192, 255, machine_at_mb540n_init, NULL }, /* [TEST] Has AMIKey 'H' KBC firmware. */ - { "[i430TX] SuperMicro Super P5MMS98", "p5mms98", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 2100, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 262144, 8192, 255, machine_at_p5mms98_init, NULL }, + { "[i430TX] Supermicro P5MMS98", "p5mms98", MACHINE_TYPE_SOCKET7, CPU_PKG_SOCKET5_7, 0, 50000000, 66666667, 2100, 3520, 1.5, 3.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 262144, 8192, 255, machine_at_p5mms98_init, NULL }, /* Apollo VPX */ /* Has the VIA VT82C586B southbridge with on-chip KBC identical to the VIA @@ -760,7 +760,7 @@ const machine_t machines[] = { { "[i440FX] ASUS P/I-P65UP5 (C-P6ND)", "p65up5_cp6nd", MACHINE_TYPE_SOCKET8, CPU_PKG_SOCKET8, 0, 60000000, 66666667, 2100, 3500, 1.5, 8.0, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1048576, 8192, 127, machine_at_p65up5_cp6nd_init, NULL }, /* The MB-8600TTX has an AMIKey 'F' KBC firmware, so I'm going to assume so does the MB-8600TTC until someone can actually identify it. */ - { "[i440FX] Biostar MB-8600TTC", "8600ttc", MACHINE_TYPE_SOCKET8, CPU_PKG_SOCKET8, 0, 50000000, 66666667, 2900, 3300, 2.0, 5.5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1048576, 8192, 127, machine_at_8500ttc_init, NULL }, + { "[i440FX] Biostar MB-8600TTC", "8600ttc", MACHINE_TYPE_SOCKET8, CPU_PKG_SOCKET8, 0, 50000000, 66666667, 2900, 3300, 2.0, 5.5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1048576, 8192, 127, machine_at_8600ttc_init, NULL }, { "[i440FX] Gigabyte GA-686NX", "686nx", MACHINE_TYPE_SOCKET8, CPU_PKG_SOCKET8, 0, 60000000, 66666667, 2100, 3500, 2.0, 5.5, MACHINE_PCI | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 524288, 8192, 127, machine_at_686nx_init, NULL }, /* According to tests from real hardware: This has AMI MegaKey KBC firmware on the PC87306 Super I/O chip, command 0xA1 returns '5'. @@ -823,18 +823,18 @@ const machine_t machines[] = { { "[i440BX] HP Vectra VEi 8", "vei8", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192,1048576, 8192, 255, machine_at_vei8_init, NULL }, /* Has a National Semiconductors PC87309 Super I/O chip with on-chip KBC with most likely AMIKey-2 KBC firmware. */ - { "[i440BX] Tyan Tsunami ATX", "tsunamiatx", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 112121212, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_SOUND, 8192,1048576, 8192, 255, machine_at_tsunamiatx_init, at_tsunamiatx_get_device }, + { "[i440BX] Tyan Tsunami ATX", "s1846", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 112121212, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_SOUND, 8192,1048576, 8192, 255, machine_at_s1846_init, at_s1846_get_device }, /* Has a Winbond W83977TF Super I/O chip with on-chip KBC with AMIKey-2 KBC firmware. */ - { "[i440BX] SuperMicro Super P6SBA", "p6sba", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_p6sba_init, NULL }, + { "[i440BX] Supermicro P6SBA", "p6sba", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_p6sba_init, NULL }, /* 440ZX */ /* Has a Winbond W83977EF Super I/O chip with on-chip KBC with AMIKey-2 KBC firmware. */ - { "[i440ZX] MSI MS-6168", "ms6168", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO | MACHINE_SOUND,8192, 524288, 8192, 255, machine_at_ms6168_init, NULL }, + { "[i440ZX] MSI MS-6168", "ms6168", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO | MACHINE_SOUND,8192, 524288, 8192, 255, machine_at_ms6168_init, at_ms6168_get_device }, /* Has a Winbond W83977EF Super I/O chip with on-chip KBC with AMIKey-2 KBC firmware. */ - { "[i440ZX] Packard Bell Bora Pro", "borapro", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 66666667, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO | MACHINE_SOUND,8192, 524288, 8192, 255, machine_at_borapro_init, NULL }, + { "[i440ZX] Packard Bell Bora Pro", "borapro", MACHINE_TYPE_SLOT1, CPU_PKG_SLOT1, 0, 66666667, 66666667, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL | MACHINE_VIDEO | MACHINE_SOUND,8192, 524288, 8192, 255, machine_at_borapro_init, at_borapro_get_device }, /* SMSC VictoryBX-66 */ /* Has a Winbond W83977EF Super I/O chip with on-chip KBC with AMIKey-2 KBC @@ -865,13 +865,13 @@ const machine_t machines[] = { { "[i440GX] Gigabyte GA-6GXU", "6gxu", MACHINE_TYPE_SLOT2, CPU_PKG_SLOT2, 0, 100000000, 133333333, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 16384,2097152,16384, 511, machine_at_6gxu_init, NULL }, /* Has a Winbond W83977TF Super I/O chip with on-chip KBC with AMIKey-2 KBC firmware. */ - { "[i440GX] SuperMicro Super S2DGE", "s2dge", MACHINE_TYPE_SLOT2, CPU_PKG_SLOT2, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 16384,2097152,16384, 511, machine_at_s2dge_init, NULL }, + { "[i440GX] Supermicro S2DGE", "s2dge", MACHINE_TYPE_SLOT2, CPU_PKG_SLOT2, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 16384,2097152,16384, 511, machine_at_s2dge_init, NULL }, /* PGA370 machines */ /* 440LX */ /* Has a Winbond W83977TF Super I/O chip with on-chip KBC with AMIKey-2 KBC firmware. */ - { "[i440LX] SuperMicro Super 370SLM", "s370slm", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 100000000, 1800, 3500, MACHINE_MULTIPLIER_FIXED, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_s370slm_init, NULL }, + { "[i440LX] Supermicro 370SLM", "s370slm", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 100000000, 1800, 3500, MACHINE_MULTIPLIER_FIXED, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_s370slm_init, NULL }, /* 440BX */ /* Has a Winbond W83977EF Super I/O chip with on-chip KBC with AMIKey-2 KBC @@ -885,12 +885,12 @@ const machine_t machines[] = { { "[i440BX] AmazePC AM-BX133", "ambx133", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, /* limits assumed */ MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_ambx133_init, NULL }, /* Has a Winbond W83977EF Super I/O chip with on-chip KBC with AMIKey-2 KBC firmware. */ - { "[i440BX] Tyan Trinity 371", "trinity371", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_trinity371_init, NULL }, + { "[i440BX] Tyan Trinity 371", "s1857", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 786432, 8192, 255, machine_at_s1857_init, at_s1857_get_device }, /* 440ZX */ /* Has a Winbond W83977TF Super I/O chip with on-chip KBC with AMIKey-2 KBC firmware. */ - { "[i440ZX] Soltek SL-63A1", "63a", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 524288, 8192, 255, machine_at_63a_init, NULL }, + { "[i440ZX] Soltek SL-63A1", "63a1", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 100000000, 1800, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 8192, 524288, 8192, 255, machine_at_63a1_init, NULL }, /* SMSC VictoryBX-66 */ /* Has a Winbond W83977EF Super I/O chip with on-chip KBC with AMIKey-2 KBC @@ -912,7 +912,7 @@ const machine_t machines[] = { { "[VIA Apollo Pro133A] ASUS CUV4X-LS", "cuv4xls", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 150000000, 1300, 3500, 1.5, 8.0, (MACHINE_AGP & ~MACHINE_AT) | MACHINE_BUS_PS2 | MACHINE_BUS_AC97 | MACHINE_IDE_DUAL,16384,4194304, 8192, 255, machine_at_cuv4xls_init, NULL }, /* Has a Winbond W83977EF Super I/O chip with on-chip KBC with AMIKey-2 KBC firmware. */ - { "[VIA Apollo Pro133A] BCM GT694VA", "gt694va", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 16384,3145728, 8192, 255, machine_at_gt694va_init, NULL }, + { "[VIA Apollo Pro133A] BCM GT694VA", "gt694va", MACHINE_TYPE_SOCKET370, CPU_PKG_SOCKET370, 0, 66666667, 133333333, 1300, 3500, 1.5, 8.0, MACHINE_AGP | MACHINE_BUS_PS2 | MACHINE_IDE_DUAL, 16384,3145728, 8192, 255, machine_at_gt694va_init, at_gt694va_get_device }, /* Miscellaneous/Fake/Hypervisor machines */ /* Has a Winbond W83977F Super I/O chip with on-chip KBC with AMIKey-2 KBC From dccd1627587b8f51cadaa8441a1d5760a6d7ab97 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sun, 14 Nov 2021 14:31:01 -0300 Subject: [PATCH 62/62] Add SL-63A1 config migration --- src/config.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/config.c b/src/config.c index c05036648..57bdf5508 100644 --- a/src/config.c +++ b/src/config.c @@ -639,6 +639,8 @@ load_machine(void) machine = machine_get_machine_from_internal_name("s1846"); else if (! strcmp(p, "trinity371")) machine = machine_get_machine_from_internal_name("s1857"); + else if (! strcmp(p, "63a")) + machine = machine_get_machine_from_internal_name("63a1"); else if (! strcmp(p, "award386dx")) /* ...merged machines... */ machine = machine_get_machine_from_internal_name("award495"); else if (! strcmp(p, "ami386dx"))