From af1a266670d040d2f4083ff309d732d648afba2a Mon Sep 17 00:00:00 2001 From: Angelos Mouzakitis Date: Tue, 10 Oct 2023 14:33:42 +0000 Subject: Add submodule dependency files Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec --- .../QemuVGADriver/QemuVGADriver.mcp.xml | 1 + .../QemuVGADriver/src/DriverDoDriverIO.c | 605 ++++++++++++++++++++ .../QemuVGADriver/src/DriverGestaltHandler.c | 50 ++ .../QemuVGADriver/src/DriverQDCalls.c | 622 +++++++++++++++++++++ .../QemuVGADriver/src/DriverQDCalls.h | 42 ++ roms/QemuMacDrivers/QemuVGADriver/src/QemuEdid.c | 1 + roms/QemuMacDrivers/QemuVGADriver/src/QemuVga.c | 386 +++++++++++++ roms/QemuMacDrivers/QemuVGADriver/src/QemuVga.h | 89 +++ .../QemuVGADriver/src/VideoDriver.exp | 2 + .../QemuVGADriver/src/VideoDriverPrivate.h | 85 +++ .../QemuVGADriver/src/VideoDriverPrototypes.h | 100 ++++ 11 files changed, 1983 insertions(+) create mode 100644 roms/QemuMacDrivers/QemuVGADriver/QemuVGADriver.mcp.xml create mode 100755 roms/QemuMacDrivers/QemuVGADriver/src/DriverDoDriverIO.c create mode 100755 roms/QemuMacDrivers/QemuVGADriver/src/DriverGestaltHandler.c create mode 100644 roms/QemuMacDrivers/QemuVGADriver/src/DriverQDCalls.c create mode 100644 roms/QemuMacDrivers/QemuVGADriver/src/DriverQDCalls.h create mode 100644 roms/QemuMacDrivers/QemuVGADriver/src/QemuEdid.c create mode 100644 roms/QemuMacDrivers/QemuVGADriver/src/QemuVga.c create mode 100644 roms/QemuMacDrivers/QemuVGADriver/src/QemuVga.h create mode 100644 roms/QemuMacDrivers/QemuVGADriver/src/VideoDriver.exp create mode 100644 roms/QemuMacDrivers/QemuVGADriver/src/VideoDriverPrivate.h create mode 100755 roms/QemuMacDrivers/QemuVGADriver/src/VideoDriverPrototypes.h (limited to 'roms/QemuMacDrivers/QemuVGADriver') diff --git a/roms/QemuMacDrivers/QemuVGADriver/QemuVGADriver.mcp.xml b/roms/QemuMacDrivers/QemuVGADriver/QemuVGADriver.mcp.xml new file mode 100644 index 000000000..fda99e800 --- /dev/null +++ b/roms/QemuMacDrivers/QemuVGADriver/QemuVGADriver.mcp.xml @@ -0,0 +1 @@ + ]> QemuVGADriver_DebugOSI UserSourceTrees AlwaysSearchUserPathstrue InterpretDOSAndUnixPathsfalse RequireFrameworkStyleIncludesfalse SourceRelativeIncludesfalse UserSearchPaths SearchPath Path: PathFormatMacOS PathRootProject Recursivetrue FrameworkPathfalse HostFlagsAll SearchPath Path../shared PathFormatUnix PathRootProject Recursivetrue FrameworkPathfalse HostFlagsAll SystemSearchPaths SearchPath Path: PathFormatMacOS PathRootCodeWarrior Recursivetrue FrameworkPathfalse HostFlagsAll MWRuntimeSettings_WorkingDirectory MWRuntimeSettings_CommandLine MWRuntimeSettings_HostApplication Path PathFormatGeneric PathRootAbsolute MWRuntimeSettings_EnvVars LinkerMacOS PPC Linker PreLinker PostLinker TargetnameQemuVGADriver_DebugOSI OutputDirectory Path../builds PathFormatUnix PathRootProject SaveEntriesUsingRelativePathsfalse FileMappings FileTypeAPPL FileExtension Compiler EditLanguage Precompilefalse Launchabletrue ResourceFiletrue IgnoredByMakefalse FileTypeAppl FileExtension Compiler EditLanguage Precompilefalse Launchabletrue ResourceFiletrue IgnoredByMakefalse FileTypeMMLB FileExtension CompilerLib Import PPC EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeMPLF FileExtension CompilerLib Import PPC EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeMWCD FileExtension Compiler EditLanguage Precompilefalse Launchabletrue ResourceFiletrue IgnoredByMakefalse FileTypeRSRC FileExtension Compiler EditLanguage Precompilefalse Launchabletrue ResourceFiletrue IgnoredByMakefalse FileTypeTEXT FileExtension.arr Compiler EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.bh CompilerBalloon Help EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.c CompilerMW C/C++ PPC EditLanguageC/C++ Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.c++ CompilerMW C/C++ PPC EditLanguageC/C++ Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.cc CompilerMW C/C++ PPC EditLanguageC/C++ Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.cp CompilerMW C/C++ PPC EditLanguageC/C++ Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.cpp CompilerMW C/C++ PPC EditLanguageC/C++ Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.exp Compiler EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.h CompilerMW C/C++ PPC EditLanguageC/C++ Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMaketrue FileTypeTEXT FileExtension.pch CompilerMW C/C++ PPC EditLanguageC/C++ Precompiletrue Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.pch++ CompilerMW C/C++ PPC EditLanguageC/C++ Precompiletrue Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.plist Compiler EditLanguage Precompilefalse Launchabletrue ResourceFilefalse IgnoredByMaketrue FileTypeTEXT FileExtension.r CompilerRez EditLanguageRez Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.s CompilerPPCAsm EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeXCOF FileExtension CompilerXCOFF Import PPC EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypedocu FileExtension Compiler EditLanguage Precompilefalse Launchabletrue ResourceFiletrue IgnoredByMakefalse FileTypersrc FileExtension Compiler EditLanguage Precompilefalse Launchabletrue ResourceFiletrue IgnoredByMakefalse FileTypeshlb FileExtension CompilerPEF Import PPC EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypestub FileExtension CompilerPEF Import PPC EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileExtension.doc Compiler EditLanguage Precompilefalse Launchabletrue ResourceFilefalse IgnoredByMaketrue FileExtension.o CompilerXCOFF Import PPC EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileExtension.ppob Compiler EditLanguage Precompilefalse Launchabletrue ResourceFiletrue IgnoredByMakefalse FileExtension.rsrc Compiler EditLanguage Precompilefalse Launchabletrue ResourceFiletrue IgnoredByMakefalse CacheModDatestrue DumpBrowserInfofalse CacheSubprojectstrue UseThirdPartyDebuggerfalse BrowserGenerator0 DebuggerAppPath Path PathFormatGeneric PathRootAbsolute DebuggerCmdLineArgs DebuggerWorkingDir Path PathFormatGeneric PathRootAbsolute CodeCompletionPrefixFileName CodeCompletionMacroFileName ConsoleEncoding0 LogSystemMessagestrue AutoTargetDLLsPopUp0 StopAtWatchpointstrue PauseWhileRunningfalse PauseInterval5 PauseUIFlags0 AltExePath Path PathFormatGeneric PathRootAbsolute StopAtTempBPOnLaunchtrue CacheSymbolicstrue TempBPFunctionNamemain TempBPType0 Enabledfalse ConnectionName DownloadPath LaunchRemoteAppfalse RemoteAppPath CoreID0 JTAGClockSpeed8000 IsMultiCorefalse OSDownloadfalse UseGlobalOSDownloadfalse OSDownloadConnectionName OSDownloadPath AltDownloadfalse AltDownloadConnectionName OtherExecutables AnalyzerConnectionName CustomColor1 Red0 Green32767 Blue0 CustomColor2 Red0 Green32767 Blue0 CustomColor3 Red0 Green32767 Blue0 CustomColor4 Red0 Green32767 Blue0 MWFrontEnd_C_cplusplus0 MWFrontEnd_C_checkprotos1 MWFrontEnd_C_arm0 MWFrontEnd_C_trigraphs0 MWFrontEnd_C_onlystdkeywords0 MWFrontEnd_C_enumsalwaysint0 MWFrontEnd_C_ansistrict0 MWFrontEnd_C_wchar_type1 MWFrontEnd_C_enableexceptions0 MWFrontEnd_C_dontreusestrings0 MWFrontEnd_C_poolstrings0 MWFrontEnd_C_dontinline0 MWFrontEnd_C_useRTTI0 MWFrontEnd_C_unsignedchars0 MWFrontEnd_C_autoinline0 MWFrontEnd_C_booltruefalse0 MWFrontEnd_C_inlinelevel0 MWFrontEnd_C_ecplusplus0 MWFrontEnd_C_defer_codegen0 MWFrontEnd_C_templateparser0 MWFrontEnd_C_c990 MWFrontEnd_C_bottomupinline1 MWFrontEnd_C_gcc_extensions0 MWFrontEnd_C_instance_manager0 C_CPP_Preprocessor_EmitFiletrue C_CPP_Preprocessor_EmitLinefalse C_CPP_Preprocessor_EmitFullPathfalse C_CPP_Preprocessor_KeepCommentsfalse C_CPP_Preprocessor_PCHUsesPrefixTextfalse C_CPP_Preprocessor_EmitPragmastrue C_CPP_Preprocessor_KeepWhiteSpacefalse C_CPP_Preprocessor_MultiByteEncodingencAutoDetectMultibyte C_CPP_Preprocessor_PrefixText#define DEBUG_OSI MWWarning_C_warn_illpragma0 MWWarning_C_warn_emptydecl1 MWWarning_C_warn_possunwant1 MWWarning_C_warn_unusedvar1 MWWarning_C_warn_unusedarg0 MWWarning_C_warn_extracomma1 MWWarning_C_pedantic0 MWWarning_C_warningerrors0 MWWarning_C_warn_hidevirtual0 MWWarning_C_warn_implicitconv0 MWWarning_C_warn_notinlined0 MWWarning_C_warn_structclass0 MWWarning_C_warn_missingreturn0 MWWarning_C_warn_no_side_effect0 MWWarning_C_warn_resultnotused0 MWWarning_C_warn_padding0 MWWarning_C_warn_impl_i2f_conv0 MWWarning_C_warn_impl_f2i_conv0 MWWarning_C_warn_impl_s2u_conv0 MWWarning_C_warn_illtokenpasting0 MWWarning_C_warn_filenamecaps0 MWWarning_C_warn_filenamecapssystem0 MWWarning_C_warn_undefmacro0 MWWarning_C_warn_ptrintconv0 MWMerge_MacOS_projectTypeApplication MWMerge_MacOS_outputNameMerge Out MWMerge_MacOS_outputCreator???? MWMerge_MacOS_outputTypeAPPL MWMerge_MacOS_suppressWarning0 MWMerge_MacOS_copyFragments1 MWMerge_MacOS_copyResources1 MWMerge_MacOS_flattenResource0 MWMerge_MacOS_flatFileNamea.rsrc MWMerge_MacOS_flatFileOutputPath Path: PathFormatMacOS PathRootProject MWMerge_MacOS_skipResources DLGX ckid Proj WSPC FileLockedfalse ResourcesMapIsReadOnlyfalse PrinterDriverIsMultiFinderCompatiblefalse Invisiblefalse HasBundlefalse NameLockedfalse Stationeryfalse HasCustomIconfalse Sharedfalse HasBeenInitedfalse Label0 Comments HasCustomBadgefalse HasRoutingInfofalse MWCodeGen_PPC_structalignmentPPC_mw MWCodeGen_PPC_tracebacktablesNone MWCodeGen_PPC_processorGeneric MWCodeGen_PPC_function_align4 MWCodeGen_PPC_tocdata1 MWCodeGen_PPC_largetoc0 MWCodeGen_PPC_profiler0 MWCodeGen_PPC_vectortocdata1 MWCodeGen_PPC_poolconst0 MWCodeGen_PPC_peephole1 MWCodeGen_PPC_readonlystrings0 MWCodeGen_PPC_linkerpoolsstrings0 MWCodeGen_PPC_volatileasm0 MWCodeGen_PPC_schedule0 MWCodeGen_PPC_altivec0 MWCodeGen_PPC_altivec_move_block0 MWCodeGen_PPC_strictIEEEfp0 MWCodeGen_PPC_fpcontract1 MWCodeGen_PPC_genfsel0 MWCodeGen_PPC_orderedfpcmp0 MWCodeGen_MachO_structalignmentPPC_mw MWCodeGen_MachO_profiler_enumOff MWCodeGen_MachO_processorGeneric MWCodeGen_MachO_function_align4 MWCodeGen_MachO_common0 MWCodeGen_MachO_boolisint0 MWCodeGen_MachO_peephole1 MWCodeGen_MachO_readonlystrings0 MWCodeGen_MachO_linkerpoolsstrings1 MWCodeGen_MachO_volatileasm0 MWCodeGen_MachO_schedule0 MWCodeGen_MachO_altivec0 MWCodeGen_MachO_vecmove0 MWCodeGen_MachO_fp_ieee_strict0 MWCodeGen_MachO_fpcontract1 MWCodeGen_MachO_genfsel0 MWCodeGen_MachO_fp_cmps_ordered0 MWDisassembler_PPC_showcode1 MWDisassembler_PPC_extended1 MWDisassembler_PPC_mix0 MWDisassembler_PPC_nohex0 MWDisassembler_PPC_showdata1 MWDisassembler_PPC_showexceptions1 MWDisassembler_PPC_showsym0 MWDisassembler_PPC_shownames1 GlobalOptimizer_PPC_optimizationlevelLevel2 GlobalOptimizer_PPC_optforSize MWLinker_PPC_linksym0 MWLinker_PPC_symfullpath1 MWLinker_PPC_linkmap0 MWLinker_PPC_nolinkwarnings0 MWLinker_PPC_dontdeadstripinitcode0 MWLinker_PPC_permitmultdefs0 MWLinker_PPC_linkmodeFast MWLinker_PPC_code_foldingNone MWLinker_PPC_initname MWLinker_PPC_mainnameDoDriverIO MWLinker_PPC_termname MWLinker_MacOSX_linksym1 MWLinker_MacOSX_symfullpath0 MWLinker_MacOSX_nolinkwarnings0 MWLinker_MacOSX_linkmap0 MWLinker_MacOSX_dontdeadstripinitcode0 MWLinker_MacOSX_permitmultdefs0 MWLinker_MacOSX_use_objectivec_semantics0 MWLinker_MacOSX_strip_debug_symbols0 MWLinker_MacOSX_prebind_all_twolevel_modules0 MWLinker_MacOSX_data_before_text_segment0 MWLinker_MacOSX_report_msl_overloads0 MWLinker_MacOSX_objects_follow_linkorder0 MWLinker_MacOSX_linkmodeNormal MWLinker_MacOSX_exportsReferencedGlobals MWLinker_MacOSX_sortcodeNone MWLinker_MacOSX_mainname MWLinker_MacOSX_initname MWLinker_MacOSX_code_foldingNone MWLinker_MacOSX_stabsgenNone MWProject_MacOSX_typeSharedLibrary MWProject_MacOSX_outfilevideo.nw MWProject_MacOSX_filecreatorPSSD MWProject_MacOSX_filetypendrv MWProject_MacOSX_vmaddress4096 MWProject_MacOSX_usedefaultvmaddr1 MWProject_MacOSX_flatrsrc0 MWProject_MacOSX_flatrsrcfilename MWProject_MacOSX_flatrsrcoutputdir Path: PathFormatMacOS PathRootProject MWProject_MacOSX_installpath./ MWProject_MacOSX_dont_prebind0 MWProject_MacOSX_flat_namespace0 MWProject_MacOSX_frameworkversionA MWProject_MacOSX_currentversion0 MWProject_MacOSX_flat_oldimpversion0 MWProject_MacOSX_AddrMode0 MWProject_MacOSX_SingleModule1 MWPEF_exportsFile MWPEF_libfolder0 MWPEF_sortcodeNone MWPEF_expandbss1 MWPEF_sharedata0 MWPEF_olddefversion0 MWPEF_oldimpversion0 MWPEF_currentversion0 MWPEF_fragmentname MWPEF_collapsereloads0 MWProject_PPC_typeSharedLibrary MWProject_PPC_outfileqemu_vga_debugosi.ndrv MWProject_PPC_filecreatorPSSD MWProject_PPC_filetypendrv MWProject_PPC_size0 MWProject_PPC_minsize0 MWProject_PPC_stacksize0 MWProject_PPC_flags0 MWProject_PPC_symfilename MWProject_PPC_rsrcname MWProject_PPC_rsrcheaderNative MWProject_PPC_rsrctype???? MWProject_PPC_rsrcid0 MWProject_PPC_rsrcflags0 MWProject_PPC_rsrcstore0 MWProject_PPC_rsrcmerge0 MWProject_PPC_flatrsrc0 MWProject_PPC_flatrsrcoutputdir Path: PathFormatMacOS PathRootProject MWProject_PPC_flatrsrcfilename MWAssembler_PPC_auxheader0 MWAssembler_PPC_symmodeMac MWAssembler_PPC_dialectPPC MWAssembler_PPC_prefixfile MWAssembler_PPC_typecheck0 MWAssembler_PPC_warnings0 MWAssembler_PPC_casesensitive0 PList_OutputTypeFile PList_OutputEncodingUTF-8 PList_PListVersion1.0 PList_Prefix PList_FileFilenameInfo.plist PList_FileDirectory Path PathFormatUnix PathRootProject PList_ResourceTypeplst PList_ResourceID0 PList_ResourceName MWRez_Language_maxwidth80 MWRez_Language_scriptRoman MWRez_Language_alignmentAlign1 MWRez_Language_filtermodeFilterSkip MWRez_Language_suppresswarnings0 MWRez_Language_escapecontrolchars1 MWRez_Language_prefixname MWRez_Language_filteredtypes'CODE' 'DATA' 'PICT' MWWinRC_prefixname MWCodeGen_X86_processorGeneric MWCodeGen_X86_alignmentbytes8 MWCodeGen_X86_exceptionsZeroOverhead MWCodeGen_X86_name_manglingMWWin32 MWCodeGen_X86_use_extinst0 MWCodeGen_X86_extinst_mmx0 MWCodeGen_X86_extinst_3dnow0 MWCodeGen_X86_use_mmx_3dnow_convention0 MWCodeGen_X86_extinst_cmov0 MWCodeGen_X86_extinst_sse0 MWCodeGen_X86_extinst_sse20 MWCodeGen_X86_intrinsics0 MWCodeGen_X86_optimizeasm0 MWCodeGen_X86_disableopts0 MWCodeGen_X86_profile0 MWLinker_X86_runtimeCustom MWCodeGen_X86_readonlystrings1 MWCodeGen_X86_vectorize0 MWCodeGen_X86_relaxieee0 MWLinker_X86_subsysmajorid4 MWLinker_X86_subsysminorid0 MWCOFF_X86_opsysmajorid4 MWCOFF_X86_opsysminorid0 MWLinker_X86_usrmajorid0 MWLinker_X86_usrminorid0 MWProject_X86_maxstacksize1024 MWProject_X86_minstacksize4 MWProject_X86_size1024 MWProject_X86_minsize4 MWCOFF_X86_coff_flags0 MWCOFF_X86_dll_flags0 MWProject_X86_baseaddress4194304 MWCOFF_X86_filealign4096 MWCOFF_X86_sectionalign4096 PDisasmX86_showHeaderstrue PDisasmX86_showSectHeaderstrue PDisasmX86_showSymTabtrue PDisasmX86_showCodetrue PDisasmX86_showDatatrue PDisasmX86_showDebugfalse PDisasmX86_showExceptionsfalse PDisasmX86_showRawfalse PDisasmX86_showAllRawfalse PDisasmX86_showSourcetrue PDisasmX86_showRelocationfalse PDisasmX86_showHextrue PDisasmX86_showCommentsfalse PDisasmX86_showSymDefstrue PDisasmX86_unmanglefalse PDisasmX86_verbosefalse PDisasmX86_resolveRelocstrue PDisasmX86_resolveLocalsfalse MWDebugger_X86_Exceptions 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 GlobalOptimizer_X86_optimizationlevelLevel0 GlobalOptimizer_X86_optforSpeed MWLinker_X86_entrypointusageDefault MWLinker_X86_entrypoint MWLinker_X86_subsystemUnknown MWLinker_X86_commandfile MWLinker_X86_generatemap0 MWLinker_X86_linksym0 MWLinker_X86_linkCV1 MWLinker_X86_symfullpathfalse MWLinker_X86_linkdebugfalse MWLinker_X86_checksumfalse MWLinker_X86_zero_init_bssfalse MWLinker_X86_mergedatafalse MWLinker_X86_usedefaultlibstrue MWLinker_X86_adddefaultlibsfalse MWLinker_X86_nowarningsfalse MWLinker_X86_verbosefalse MWLinker_X86_linkformemfalse MWLinker_X86_codefoldingNone MWLinker_X86_debuginlinefalse MWProject_X86_typeApplication MWProject_X86_outfilenoname.exe MWProject_X86_importlib MWProject_X86_setimportlibdirfalse MWProject_X86_dontgenerateimportlibtrue MWProject_X86_oldformatlibfalse MWProject_X86_replaceobjextensionfalse MWProject_X86_copyallfilesfalse Name DriverServicesLib MacOS Library Debug Name DriverLoaderLib MacOS Library Debug Name NameRegistryLib MacOS Library Debug Name PCILib MacOS Library Debug Name vsprintf.c MacOS Text Name DriverDoDriverIO.c MacOS Text Name DriverGestaltHandler.c MacOS Text Name DriverQDCalls.c MacOS Text Name QemuEdid.c Unix Text Name QemuVga.c Unix Text Name VideoServicesLib MacOS Library Name LinuxOSI.s MacOS Text Name VideoDriver.exp MacOS Text Debug Name MacDriverUtils.c Unix Text Debug Name InterfaceLibForDriverServices Unix Library Debug Name MSL_ShLibRuntime_PPC.Lib Unix Library Debug Name DriverDoDriverIO.c MacOS Name DriverGestaltHandler.c MacOS Name DriverQDCalls.c MacOS Name QemuVga.c Unix Name MacDriverUtils.c Unix Name LinuxOSI.s MacOS Name vsprintf.c MacOS Name VideoDriver.exp MacOS Name PCILib MacOS Name NameRegistryLib MacOS Name DriverLoaderLib MacOS Name DriverServicesLib MacOS Name VideoServicesLib MacOS Name InterfaceLibForDriverServices Unix Name MSL_ShLibRuntime_PPC.Lib Unix QemuVGADriver UserSourceTrees AlwaysSearchUserPathstrue InterpretDOSAndUnixPathsfalse RequireFrameworkStyleIncludesfalse SourceRelativeIncludesfalse UserSearchPaths SearchPath Path: PathFormatMacOS PathRootProject Recursivetrue FrameworkPathfalse HostFlagsAll SearchPath Path../shared PathFormatUnix PathRootProject Recursivetrue FrameworkPathfalse HostFlagsAll SystemSearchPaths SearchPath Path: PathFormatMacOS PathRootCodeWarrior Recursivetrue FrameworkPathfalse HostFlagsAll MWRuntimeSettings_WorkingDirectory MWRuntimeSettings_CommandLine MWRuntimeSettings_HostApplication Path PathFormatGeneric PathRootAbsolute MWRuntimeSettings_EnvVars LinkerMacOS PPC Linker PreLinker PostLinker TargetnameQemuVGADriver OutputDirectory Path../builds PathFormatUnix PathRootProject SaveEntriesUsingRelativePathsfalse FileMappings FileTypeAPPL FileExtension Compiler EditLanguage Precompilefalse Launchabletrue ResourceFiletrue IgnoredByMakefalse FileTypeAppl FileExtension Compiler EditLanguage Precompilefalse Launchabletrue ResourceFiletrue IgnoredByMakefalse FileTypeMMLB FileExtension CompilerLib Import PPC EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeMPLF FileExtension CompilerLib Import PPC EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeMWCD FileExtension Compiler EditLanguage Precompilefalse Launchabletrue ResourceFiletrue IgnoredByMakefalse FileTypeRSRC FileExtension Compiler EditLanguage Precompilefalse Launchabletrue ResourceFiletrue IgnoredByMakefalse FileTypeTEXT FileExtension.arr Compiler EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.bh CompilerBalloon Help EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.c CompilerMW C/C++ PPC EditLanguageC/C++ Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.c++ CompilerMW C/C++ PPC EditLanguageC/C++ Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.cc CompilerMW C/C++ PPC EditLanguageC/C++ Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.cp CompilerMW C/C++ PPC EditLanguageC/C++ Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.cpp CompilerMW C/C++ PPC EditLanguageC/C++ Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.exp Compiler EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.h CompilerMW C/C++ PPC EditLanguageC/C++ Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMaketrue FileTypeTEXT FileExtension.pch CompilerMW C/C++ PPC EditLanguageC/C++ Precompiletrue Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.pch++ CompilerMW C/C++ PPC EditLanguageC/C++ Precompiletrue Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.plist Compiler EditLanguage Precompilefalse Launchabletrue ResourceFilefalse IgnoredByMaketrue FileTypeTEXT FileExtension.r CompilerRez EditLanguageRez Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeTEXT FileExtension.s CompilerPPCAsm EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypeXCOF FileExtension CompilerXCOFF Import PPC EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypedocu FileExtension Compiler EditLanguage Precompilefalse Launchabletrue ResourceFiletrue IgnoredByMakefalse FileTypersrc FileExtension Compiler EditLanguage Precompilefalse Launchabletrue ResourceFiletrue IgnoredByMakefalse FileTypeshlb FileExtension CompilerPEF Import PPC EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileTypestub FileExtension CompilerPEF Import PPC EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileExtension.doc Compiler EditLanguage Precompilefalse Launchabletrue ResourceFilefalse IgnoredByMaketrue FileExtension.o CompilerXCOFF Import PPC EditLanguage Precompilefalse Launchablefalse ResourceFilefalse IgnoredByMakefalse FileExtension.ppob Compiler EditLanguage Precompilefalse Launchabletrue ResourceFiletrue IgnoredByMakefalse FileExtension.rsrc Compiler EditLanguage Precompilefalse Launchabletrue ResourceFiletrue IgnoredByMakefalse CacheModDatestrue DumpBrowserInfofalse CacheSubprojectstrue UseThirdPartyDebuggerfalse BrowserGenerator0 DebuggerAppPath Path PathFormatGeneric PathRootAbsolute DebuggerCmdLineArgs DebuggerWorkingDir Path PathFormatGeneric PathRootAbsolute CodeCompletionPrefixFileName CodeCompletionMacroFileName ConsoleEncoding0 LogSystemMessagestrue AutoTargetDLLsPopUp0 StopAtWatchpointstrue PauseWhileRunningfalse PauseInterval5 PauseUIFlags0 AltExePath Path PathFormatGeneric PathRootAbsolute StopAtTempBPOnLaunchtrue CacheSymbolicstrue TempBPFunctionNamemain TempBPType0 Enabledfalse ConnectionName DownloadPath LaunchRemoteAppfalse RemoteAppPath CoreID0 JTAGClockSpeed8000 IsMultiCorefalse OSDownloadfalse UseGlobalOSDownloadfalse OSDownloadConnectionName OSDownloadPath AltDownloadfalse AltDownloadConnectionName OtherExecutables AnalyzerConnectionName CustomColor1 Red0 Green32767 Blue0 CustomColor2 Red0 Green32767 Blue0 CustomColor3 Red0 Green32767 Blue0 CustomColor4 Red0 Green32767 Blue0 MWFrontEnd_C_cplusplus0 MWFrontEnd_C_checkprotos1 MWFrontEnd_C_arm0 MWFrontEnd_C_trigraphs0 MWFrontEnd_C_onlystdkeywords0 MWFrontEnd_C_enumsalwaysint0 MWFrontEnd_C_ansistrict0 MWFrontEnd_C_wchar_type1 MWFrontEnd_C_enableexceptions0 MWFrontEnd_C_dontreusestrings0 MWFrontEnd_C_poolstrings0 MWFrontEnd_C_dontinline0 MWFrontEnd_C_useRTTI0 MWFrontEnd_C_unsignedchars0 MWFrontEnd_C_autoinline0 MWFrontEnd_C_booltruefalse0 MWFrontEnd_C_inlinelevel0 MWFrontEnd_C_ecplusplus0 MWFrontEnd_C_defer_codegen0 MWFrontEnd_C_templateparser0 MWFrontEnd_C_c990 MWFrontEnd_C_bottomupinline1 MWFrontEnd_C_gcc_extensions0 MWFrontEnd_C_instance_manager0 C_CPP_Preprocessor_EmitFiletrue C_CPP_Preprocessor_EmitLinefalse C_CPP_Preprocessor_EmitFullPathfalse C_CPP_Preprocessor_KeepCommentsfalse C_CPP_Preprocessor_PCHUsesPrefixTextfalse C_CPP_Preprocessor_EmitPragmastrue C_CPP_Preprocessor_KeepWhiteSpacefalse C_CPP_Preprocessor_MultiByteEncodingencAutoDetectMultibyte C_CPP_Preprocessor_PrefixText#define DEBUG_OSI MWWarning_C_warn_illpragma0 MWWarning_C_warn_emptydecl1 MWWarning_C_warn_possunwant1 MWWarning_C_warn_unusedvar1 MWWarning_C_warn_unusedarg0 MWWarning_C_warn_extracomma1 MWWarning_C_pedantic0 MWWarning_C_warningerrors0 MWWarning_C_warn_hidevirtual0 MWWarning_C_warn_implicitconv0 MWWarning_C_warn_notinlined0 MWWarning_C_warn_structclass0 MWWarning_C_warn_missingreturn0 MWWarning_C_warn_no_side_effect0 MWWarning_C_warn_resultnotused0 MWWarning_C_warn_padding0 MWWarning_C_warn_impl_i2f_conv0 MWWarning_C_warn_impl_f2i_conv0 MWWarning_C_warn_impl_s2u_conv0 MWWarning_C_warn_illtokenpasting0 MWWarning_C_warn_filenamecaps0 MWWarning_C_warn_filenamecapssystem0 MWWarning_C_warn_undefmacro0 MWWarning_C_warn_ptrintconv0 MWMerge_MacOS_projectTypeApplication MWMerge_MacOS_outputNameMerge Out MWMerge_MacOS_outputCreator???? MWMerge_MacOS_outputTypeAPPL MWMerge_MacOS_suppressWarning0 MWMerge_MacOS_copyFragments1 MWMerge_MacOS_copyResources1 MWMerge_MacOS_flattenResource0 MWMerge_MacOS_flatFileNamea.rsrc MWMerge_MacOS_flatFileOutputPath Path: PathFormatMacOS PathRootProject MWMerge_MacOS_skipResources DLGX ckid Proj WSPC FileLockedfalse ResourcesMapIsReadOnlyfalse PrinterDriverIsMultiFinderCompatiblefalse Invisiblefalse HasBundlefalse NameLockedfalse Stationeryfalse HasCustomIconfalse Sharedfalse HasBeenInitedfalse Label0 Comments HasCustomBadgefalse HasRoutingInfofalse MWCodeGen_PPC_structalignmentPPC_mw MWCodeGen_PPC_tracebacktablesNone MWCodeGen_PPC_processorGeneric MWCodeGen_PPC_function_align4 MWCodeGen_PPC_tocdata1 MWCodeGen_PPC_largetoc0 MWCodeGen_PPC_profiler0 MWCodeGen_PPC_vectortocdata1 MWCodeGen_PPC_poolconst0 MWCodeGen_PPC_peephole1 MWCodeGen_PPC_readonlystrings0 MWCodeGen_PPC_linkerpoolsstrings0 MWCodeGen_PPC_volatileasm0 MWCodeGen_PPC_schedule0 MWCodeGen_PPC_altivec0 MWCodeGen_PPC_altivec_move_block0 MWCodeGen_PPC_strictIEEEfp0 MWCodeGen_PPC_fpcontract0 MWCodeGen_PPC_genfsel0 MWCodeGen_PPC_orderedfpcmp0 MWCodeGen_MachO_structalignmentPPC_mw MWCodeGen_MachO_profiler_enumOff MWCodeGen_MachO_processorGeneric MWCodeGen_MachO_function_align4 MWCodeGen_MachO_common0 MWCodeGen_MachO_boolisint0 MWCodeGen_MachO_peephole1 MWCodeGen_MachO_readonlystrings0 MWCodeGen_MachO_linkerpoolsstrings1 MWCodeGen_MachO_volatileasm0 MWCodeGen_MachO_schedule0 MWCodeGen_MachO_altivec0 MWCodeGen_MachO_vecmove0 MWCodeGen_MachO_fp_ieee_strict0 MWCodeGen_MachO_fpcontract1 MWCodeGen_MachO_genfsel0 MWCodeGen_MachO_fp_cmps_ordered0 MWDisassembler_PPC_showcode1 MWDisassembler_PPC_extended1 MWDisassembler_PPC_mix0 MWDisassembler_PPC_nohex0 MWDisassembler_PPC_showdata1 MWDisassembler_PPC_showexceptions1 MWDisassembler_PPC_showsym0 MWDisassembler_PPC_shownames1 GlobalOptimizer_PPC_optimizationlevelLevel2 GlobalOptimizer_PPC_optforSize MWLinker_PPC_linksym0 MWLinker_PPC_symfullpath1 MWLinker_PPC_linkmap0 MWLinker_PPC_nolinkwarnings1 MWLinker_PPC_dontdeadstripinitcode0 MWLinker_PPC_permitmultdefs0 MWLinker_PPC_linkmodeFast MWLinker_PPC_code_foldingNone MWLinker_PPC_initname MWLinker_PPC_mainnameDoDriverIO MWLinker_PPC_termname MWLinker_MacOSX_linksym1 MWLinker_MacOSX_symfullpath0 MWLinker_MacOSX_nolinkwarnings0 MWLinker_MacOSX_linkmap0 MWLinker_MacOSX_dontdeadstripinitcode0 MWLinker_MacOSX_permitmultdefs0 MWLinker_MacOSX_use_objectivec_semantics0 MWLinker_MacOSX_strip_debug_symbols0 MWLinker_MacOSX_prebind_all_twolevel_modules0 MWLinker_MacOSX_data_before_text_segment0 MWLinker_MacOSX_report_msl_overloads0 MWLinker_MacOSX_objects_follow_linkorder0 MWLinker_MacOSX_linkmodeNormal MWLinker_MacOSX_exportsReferencedGlobals MWLinker_MacOSX_sortcodeNone MWLinker_MacOSX_mainname MWLinker_MacOSX_initname MWLinker_MacOSX_code_foldingNone MWLinker_MacOSX_stabsgenNone MWProject_MacOSX_typeSharedLibrary MWProject_MacOSX_outfilevideo.nw MWProject_MacOSX_filecreatorPSSD MWProject_MacOSX_filetypendrv MWProject_MacOSX_vmaddress4096 MWProject_MacOSX_usedefaultvmaddr1 MWProject_MacOSX_flatrsrc0 MWProject_MacOSX_flatrsrcfilename MWProject_MacOSX_flatrsrcoutputdir Path: PathFormatMacOS PathRootProject MWProject_MacOSX_installpath./ MWProject_MacOSX_dont_prebind0 MWProject_MacOSX_flat_namespace0 MWProject_MacOSX_frameworkversionA MWProject_MacOSX_currentversion0 MWProject_MacOSX_flat_oldimpversion0 MWProject_MacOSX_AddrMode0 MWProject_MacOSX_SingleModule1 MWPEF_exportsFile MWPEF_libfolder0 MWPEF_sortcodeNone MWPEF_expandbss1 MWPEF_sharedata0 MWPEF_olddefversion0 MWPEF_oldimpversion0 MWPEF_currentversion0 MWPEF_fragmentname MWPEF_collapsereloads0 MWProject_PPC_typeSharedLibrary MWProject_PPC_outfileqemu_vga.ndrv MWProject_PPC_filecreatorPSSD MWProject_PPC_filetypendrv MWProject_PPC_size0 MWProject_PPC_minsize0 MWProject_PPC_stacksize0 MWProject_PPC_flags0 MWProject_PPC_symfilename MWProject_PPC_rsrcname MWProject_PPC_rsrcheaderNative MWProject_PPC_rsrctype???? MWProject_PPC_rsrcid0 MWProject_PPC_rsrcflags0 MWProject_PPC_rsrcstore0 MWProject_PPC_rsrcmerge0 MWProject_PPC_flatrsrc0 MWProject_PPC_flatrsrcoutputdir Path: PathFormatMacOS PathRootProject MWProject_PPC_flatrsrcfilename MWAssembler_PPC_auxheader0 MWAssembler_PPC_symmodeMac MWAssembler_PPC_dialectPPC MWAssembler_PPC_prefixfile MWAssembler_PPC_typecheck0 MWAssembler_PPC_warnings0 MWAssembler_PPC_casesensitive0 PList_OutputTypeFile PList_OutputEncodingUTF-8 PList_PListVersion1.0 PList_Prefix PList_FileFilenameInfo.plist PList_FileDirectory Path PathFormatUnix PathRootProject PList_ResourceTypeplst PList_ResourceID0 PList_ResourceName MWRez_Language_maxwidth80 MWRez_Language_scriptRoman MWRez_Language_alignmentAlign1 MWRez_Language_filtermodeFilterSkip MWRez_Language_suppresswarnings0 MWRez_Language_escapecontrolchars1 MWRez_Language_prefixname MWRez_Language_filteredtypes'CODE' 'DATA' 'PICT' MWWinRC_prefixname MWCodeGen_X86_processorGeneric MWCodeGen_X86_alignmentbytes8 MWCodeGen_X86_exceptionsZeroOverhead MWCodeGen_X86_name_manglingMWWin32 MWCodeGen_X86_use_extinst0 MWCodeGen_X86_extinst_mmx0 MWCodeGen_X86_extinst_3dnow0 MWCodeGen_X86_use_mmx_3dnow_convention0 MWCodeGen_X86_extinst_cmov0 MWCodeGen_X86_extinst_sse0 MWCodeGen_X86_extinst_sse20 MWCodeGen_X86_intrinsics0 MWCodeGen_X86_optimizeasm0 MWCodeGen_X86_disableopts0 MWCodeGen_X86_profile0 MWLinker_X86_runtimeCustom MWCodeGen_X86_readonlystrings1 MWCodeGen_X86_vectorize0 MWCodeGen_X86_relaxieee0 MWLinker_X86_subsysmajorid4 MWLinker_X86_subsysminorid0 MWCOFF_X86_opsysmajorid4 MWCOFF_X86_opsysminorid0 MWLinker_X86_usrmajorid0 MWLinker_X86_usrminorid0 MWProject_X86_maxstacksize1024 MWProject_X86_minstacksize4 MWProject_X86_size1024 MWProject_X86_minsize4 MWCOFF_X86_coff_flags0 MWCOFF_X86_dll_flags0 MWProject_X86_baseaddress4194304 MWCOFF_X86_filealign4096 MWCOFF_X86_sectionalign4096 PDisasmX86_showHeaderstrue PDisasmX86_showSectHeaderstrue PDisasmX86_showSymTabtrue PDisasmX86_showCodetrue PDisasmX86_showDatatrue PDisasmX86_showDebugfalseO PDisasmX86_showExceptionsfalse PDisasmX86_showRawfalse PDisasmX86_showAllRawfalse PDisasmX86_showSourcetrue PDisasmX86_showRelocationfalse PDisasmX86_showHextrue PDisasmX86_showCommentsfalse PDisasmX86_showSymDefstrue PDisasmX86_unmanglefalse PDisasmX86_verbosefalse PDisasmX86_resolveRelocstrue PDisasmX86_resolveLocalsfalse MWDebugger_X86_Exceptions 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 GlobalOptimizer_X86_optimizationlevelLevel0 GlobalOptimizer_X86_optforSpeed MWLinker_X86_entrypointusageDefault MWLinker_X86_entrypoint MWLinker_X86_subsystemUnknown MWLinker_X86_commandfile MWLinker_X86_generatemap0 MWLinker_X86_linksym0 MWLinker_X86_linkCV1 MWLinker_X86_symfullpathfalse MWLinker_X86_linkdebugfalse MWLinker_X86_checksumfalse MWLinker_X86_zero_init_bssfalse MWLinker_X86_mergedatafalse MWLinker_X86_usedefaultlibstrue MWLinker_X86_adddefaultlibsfalse MWLinker_X86_nowarningsfalse MWLinker_X86_verbosefalse MWLinker_X86_linkformemfalse MWLinker_X86_codefoldingNone MWLinker_X86_debuginlinefalse MWProject_X86_typeApplication MWProject_X86_outfilenoname.exe MWProject_X86_importlib MWProject_X86_setimportlibdirfalse MWProject_X86_dontgenerateimportlibtrue MWProject_X86_oldformatlibfalse MWProject_X86_replaceobjextensionfalse MWProject_X86_copyallfilesfalse Name DriverServicesLib MacOS Library Debug Name DriverLoaderLib MacOS Library Debug Name NameRegistryLib MacOS Library Debug Name PCILib MacOS Library Debug Name DriverDoDriverIO.c MacOS Text Name DriverGestaltHandler.c MacOS Text Name DriverQDCalls.c MacOS Text Name QemuEdid.c Unix Text Name QemuVga.c Unix Text Name VideoServicesLib MacOS Library Name VideoDriver.exp MacOS Text Debug Name MacDriverUtils.c Unix Text Debug Name InterfaceLibForDriverServices Unix Library Debug Name MSL_ShLibRuntime_PPC.Lib Unix Library Debug Name DriverServicesLib MacOS Name DriverLoaderLib MacOS Name NameRegistryLib MacOS Name PCILib MacOS Name DriverDoDriverIO.c MacOS Name DriverGestaltHandler.c MacOS Name DriverQDCalls.c MacOS Name QemuVga.c Unix Name QemuEdid.c Unix Name VideoServicesLib MacOS Name VideoDriver.exp MacOS Name MacDriverUtils.c Unix Name InterfaceLibForDriverServices Unix Name MSL_ShLibRuntime_PPC.Lib Unix QemuVGADriver QemuVGADriver_DebugOSI Util QemuVGADriver_DebugOSI Name MacDriverUtils.c Unix Libs QemuVGADriver_DebugOSI Name DriverLoaderLib MacOS QemuVGADriver_DebugOSI Name DriverServicesLib MacOS QemuVGADriver_DebugOSI Name InterfaceLibForDriverServices Unix QemuVGADriver_DebugOSI Name NameRegistryLib MacOS QemuVGADriver_DebugOSI Name PCILib MacOS QemuVGADriver_DebugOSI Name VideoDriver.exp MacOS QemuVGADriver_DebugOSI Name VideoServicesLib MacOS QemuVGADriver_DebugOSI Name MSL_ShLibRuntime_PPC.Lib Unix Src QemuVGADriver_DebugOSI Name DriverGestaltHandler.c MacOS QemuVGADriver_DebugOSI Name DriverDoDriverIO.c MacOS QemuVGADriver_DebugOSI Name QemuVga.c Unix Name QemuEdid.c Unix QemuVGADriver_DebugOSI Name DriverQDCalls.c MacOS LinuxInterface QemuVGADriver_DebugOSI Name LinuxOSI.s MacOS QemuVGADriver_DebugOSI Name vsprintf.c MacOS a \ No newline at end of file diff --git a/roms/QemuMacDrivers/QemuVGADriver/src/DriverDoDriverIO.c b/roms/QemuMacDrivers/QemuVGADriver/src/DriverDoDriverIO.c new file mode 100755 index 000000000..d72fd9cdf --- /dev/null +++ b/roms/QemuMacDrivers/QemuVGADriver/src/DriverDoDriverIO.c @@ -0,0 +1,605 @@ +/* Simple PCI video driver for use with Mac-On-Linux emulator + * + * Basically, this driver forward Apple video driver calls to + * the emulator via a fake HW (and later, a "sc" based API). +*/ + +#include "VideoDriverPrivate.h" +#include "VideoDriverPrototypes.h" +#include "DriverQDCalls.h" +#include "QemuVga.h" + +DriverDescription TheDriverDescription = { + /* + * Signature info + */ + kTheDescriptionSignature, /* OSType driverDescSignature */ + kInitialDriverDescriptor, /* DriverDescVersion driverDescVersion */ + QEMU_PCI_VIDEO_NAME, + 0x01, 0x01, + 0, 0, + /* + * DriverOSRuntime driverOSRuntimeInfo + */ + 0 /* RuntimeOptions driverRuntime */ + | (0 * kDriverIsLoadedUponDiscovery) /* Loader runtime options */ + | (1 * kDriverIsOpenedUponLoad) /* Opened when loaded */ + | (1 * kDriverIsUnderExpertControl) /* I/O expert handles loads/opens */ + | (0 * kDriverIsConcurrent) /* concurrent */ + | (0 * kDriverQueuesIOPB), /* Internally queued */ + QEMU_PCI_VIDEO_PNAME, /* Str31 driverName (OpenDriver param) */ + 0, 0, 0, 0, 0, 0, 0, 0, /* UInt32 driverDescReserved[8] */ + /* + * DriverOSService Information. This section contains a vector count followed by + * a vector of structures, each defining a driver service. + */ + 1, /* ServiceCount nServices */ + /* + * DriverServiceInfo service[0] + */ + kServiceCategoryNdrvDriver, /* OSType serviceCategory */ + kNdrvTypeIsVideo, /* OSType serviceType */ + 1, 0, 0, 0 +}; + +/* + * All driver-global information is in a structure defined in NCRDriverPrivate. + * Note that "modern" drivers do not have access to their dce. In native Power PC + * environments, the global world is created by the Code Fragment Manager (hmm, + * perhaps it is created by CFMInitialize). + */ +DriverGlobal gDriverGlobal; + +/* + * DoDriverIO + * + * In the new driver environment, DoDriverIO performs all driver + * functions. It is called with the following parameters: + * IOCommandID A unique reference for this driver request. In + * the emulated environment, this will be the ParamBlkPtr + * passed in from the Device Manager. + * + * IOCommandContents A union structure that contains information for the + * specific request. For the emulated environment, this + * will contain the following: + * Initialize Driver RefNum and the name registry id for this driver. + * Finalize Driver RefNum and the name registry id for this driver. + * Others The ParamBlkPtr + * + * IOCommandCode A switch value that specifies the required function. + * + * IOCommandKind A bit-mask indicating Synchronous, Asynchronous, and Immediate + * + * For Synchronous and Immediate commands, DoDriverIO returns the final status to + * the Device Manager. For Asynchronous commands, DoDriverIO may return kIOBusyStatus. + * If it returns busy status, the driver promises to call IOCommandIsComplete when + * the transaction has completed. + */ +OSStatus +DoDriverIO( AddressSpaceID addressSpaceID, IOCommandID ioCommandID, IOCommandContents ioCommandContents, + IOCommandCode ioCommandCode, IOCommandKind ioCommandKind ) +{ + OSStatus status; + + /* + * Note: Initialize, Open, KillIO, Close, and Finalize are either synchronous + * or immediate. Read, Write, Control, and Status may be immediate, + * synchronous, or asynchronous. + */ + + lprintf("DoDriverIO cmdCode=%d\n", ioCommandCode); + + switch( ioCommandCode ) { + case kInitializeCommand: /* Always immediate */ + status = DriverInitializeCmd(addressSpaceID, ioCommandContents.initialInfo); + CheckStatus(status, "Initialize failed"); + break; + case kFinalizeCommand: /* Always immediate */ + status = DriverFinalizeCmd(ioCommandContents.finalInfo); + break; + case kSupersededCommand: + status = DriverSupersededCmd(ioCommandContents.supersededInfo, FALSE); + break; + case kReplaceCommand: /* replace an old driver */ + status = DriverReplaceCmd(addressSpaceID, ioCommandContents.replaceInfo); + break; + case kOpenCommand: /* Always immediate */ + status = DriverOpenCmd(addressSpaceID, ioCommandContents.pb); + break; + case kCloseCommand: /* Always immediate */ + status = DriverCloseCmd(ioCommandContents.pb); + break; + case kControlCommand: + /* lprintf("kControlCommand\n"); */ + status = DriverControlCmd( addressSpaceID, ioCommandID, ioCommandKind, + (CntrlParam*)ioCommandContents.pb ); + break; + case kStatusCommand: + status = DriverStatusCmd( ioCommandID, ioCommandKind, + (CntrlParam *)ioCommandContents.pb ); + break; + case kReadCommand: + status = DriverReadCmd( addressSpaceID, ioCommandID, ioCommandKind, + ioCommandContents.pb ); + break; + case kWriteCommand: + status = DriverWriteCmd( addressSpaceID, ioCommandID, ioCommandKind, + ioCommandContents.pb); + break; + case kKillIOCommand: /* Always immediate */ + status = DriverKillIOCmd(ioCommandContents.pb); + break; + default: + status = paramErr; + break; + } + lprintf("Completing with status=%d (kind: %x)\n", status, ioCommandKind); + + /* + * Force a valid result for immediate commands -- they must return a valid + * status to the Driver Manager: returning kIOBusyStatus would be a bug.. + * Non-immediate commands return a status from the lower-level routine. If the + * status is kIOBusyStatus, we just return -- an asynchronous I/O completion + * routine will eventually complete the request. If it's some other status, the + * lower-level routine has completed a non-immediate task, so we call + * IOCommandIsComplete and return its (presumably noErr) status. + */ + if( (ioCommandKind & kImmediateIOCommandKind) != 0 ) { + ; /* Immediate commands return the operation status */ + } + else if (status == ioInProgress) { + /* + * An asynchronous operation is in progress. The driver handler promises + * to call IOCommandIsComplete when the operation concludes. + */ + status = noErr; + } else { + /* + * Normal command that completed synchronously. Dequeue the user's + * parameter block. + */ + status = (OSStatus)IOCommandIsComplete(ioCommandID, (OSErr)status); + } + return status; +} + +/* + * DriverInitializeCmd + * + * The New Driver Manager calls this when the driver is first opened. + */ +OSStatus +DriverInitializeCmd( AddressSpaceID addressSpaceID, DriverInitInfoPtr driverInitInfoPtr ) +{ + OSStatus status; + + Trace(DriverInitializeCmd); + + lprintf("** First call:\n"); + lprintf(" DoDriverIO @ %p\n", DoDriverIO); + lprintf(" DriverStatusCmd @ %p\n", DriverStatusCmd); + lprintf(" DriverControlCmd @ %p\n", DriverControlCmd); + + GLOBAL.refNum = driverInitInfoPtr->refNum; + GLOBAL.openCount = 0; + GLOBAL.inInterrupt = false; + GLOBAL.hasTimer = false; + + RegistryEntryIDInit( &GLOBAL.deviceEntry ); + status = RegistryEntryIDCopy( &driverInitInfoPtr->deviceEntry, &GLOBAL.deviceEntry ); + if( status != noErr ) + return status; + + GLOBAL.isOpen = false; + GLOBAL.qdInterruptsEnable = false; + GLOBAL.qdVBLInterrupt = NULL; + + GLOBAL.boardFBAddress = GetDeviceBARAddress(&GLOBAL.deviceEntry, + QEMU_PCI_VIDEO_BASE_REG, + &GLOBAL.boardFBMappedSize, + NULL); + if (GLOBAL.boardFBAddress == NULL) { + status = paramErr; + goto bail; + } + lprintf("boardFBAddress %08lX boardFBMappedSize %08lX\n", + GLOBAL.boardFBAddress, GLOBAL.boardFBMappedSize); + + GLOBAL.boardRegAddress = GetDeviceBARAddress(&GLOBAL.deviceEntry, + QEMU_PCI_VIDEO_MMIO_REG, + &GLOBAL.boardRegMappedSize, + NULL); + if (GLOBAL.boardRegAddress == NULL) { + status = paramErr; + goto bail; + } + lprintf("boardRegAddress %08lX boardRegMappedSize %08lX\n", + GLOBAL.boardRegAddress, GLOBAL.boardRegMappedSize); + + + lprintf("Enabling memory space..\n"); + status = EnablePCIMemorySpace(&GLOBAL.deviceEntry); + if (status != noErr) { + lprintf("EnablePCIMemorySpace returned %d\n", status); + goto bail; + } + + status = QemuVga_Init(); + if (status != noErr) + goto bail; + +bail: + DBG(lprintf("Driver init result: %d\n", status)); + + return status; +} + +/* + * DriverReplaceCmd + * + * We are replacing an existing driver -- or are completing an initialization sequence. + * Retrieve any state information from the Name Registry (we have none), install + * our interrupt handlers, and activate the device. + * + * We don't use the calledFromInitialize parameter, but it's here so that a driver can + * distinguish between initialization (fetch only the NVRAM parameter) and replacement + * (fetch state information that may be left-over from the previous incantation). + */ +OSStatus +DriverReplaceCmd( AddressSpaceID addressSpaceID, DriverReplaceInfoPtr driverReplaceInfoPtr ) +{ + OSStatus status; + + Trace(DriverReplaceCmd); + + GLOBAL.refNum = driverReplaceInfoPtr->refNum; + GLOBAL.deviceEntry = driverReplaceInfoPtr->deviceEntry; + + status = DriverInitializeCmd(addressSpaceID, driverReplaceInfoPtr); + + return status; +} + +/* + * DriverFinalizeCmd + * + * Process a DoDriverIO finalize command. + */ +OSStatus +DriverFinalizeCmd( DriverFinalInfoPtr driverFinalInfoPtr ) +{ + Trace(DriverFinializeCmd); + (void) DriverSupersededCmd((DriverSupersededInfoPtr) driverFinalInfoPtr, TRUE); + return noErr; +} + +/* + * DriverSupersededCmd + * + * We are shutting down, or being replaced by a later driver. Wait for all I/O to + * complete and store volatile state in the Name Registry whree it will be retrieved + * by our replacement. + */ +OSStatus +DriverSupersededCmd( DriverSupersededInfoPtr driverSupersededInfoPtr, Boolean calledFromFinalize ) +{ + Trace(DriverSupersededCmd); + + /* + * This duplicates DriverKillIOCmd, the correct algorithm would wait for + * concurrent I/O to complete. Hmm, what about "infinite wait" I/O, such + * as would be posted by a modem server or socket listener? Note that + * this section needs to be extended to handle all pending requests. + * + * It's safe to call CompleteThisRequest, as that routine uses an atomic + * operation that allows it to be called when no request is pending without + * any possible problems. Since it's a secondary interrupt handler, we + * need to call it through the Driver Services Library. + * + * Warning: GLOBAL.perRequestDataPtr will be NULL if initialization fails + * and the Driver Manager tries to terminate us. When we permit concurrent + * requests, this will loop on all per-request records. + */ + + QemuVga_Exit(); + + RegistryEntryIDDispose( &GLOBAL.deviceEntry ); + + return noErr; +} + +/* + * DriverControlCmd + * + * Process a PBControl command. + */ +OSStatus +DriverControlCmd( AddressSpaceID addressSpaceID, IOCommandID ioCommandID, + IOCommandKind ioCommandKind, CntrlParam *pb ) +{ + OSStatus status; + void *genericPtr; + + /* The 'csParam' field of the 'CntrlParam' stucture is defined as 'short csParam[11]'. This is + * meant for 'operation defined parameters.' For the graphics driver, only the first 4 bytes are + * used. They are used as a pointer to another structure. + * To help code readability, the pointer will be extracted as a generic 'void *' and then cast as + * appropriate. + */ + + genericPtr = (void *) *((UInt32 *) &(pb->csParam[0])); + + Trace(DriverControlCmd); + + switch( pb->csCode ) { + case cscReset: // Old obsolete call..return a 'controlErr' + return controlErr; + break; + + case cscKillIO: // Old obsolete call..do nothing + return noErr; + + case cscSetMode: + status = GraphicsCoreSetMode((VDPageInfo *) genericPtr); + break; + + case cscSetEntries: + status = GraphicsCoreSetEntries((VDSetEntryRecord *) genericPtr); + // if ((status == noErr)&&(GLOBAL.qdDeskServiceCreated)&&(ioCommandKind == kSynchronousIOCommandKind)) + // VSLWaitOnInterruptService(GLOBAL.qdVBLInterrupt, 1000); + break; + + case cscSetGamma: + status = GraphicsCoreSetGamma((VDGammaRecord *) genericPtr); + break; + + case cscGrayPage: + status = GraphicsCoreGrayPage((VDPageInfo *) genericPtr); + break; + + case cscSetGray: + status = GraphicsCoreSetGray((VDGrayRecord *) genericPtr); + break; + + case cscSetInterrupt: + status = GraphicsCoreSetInterrupt((VDFlagRecord *) genericPtr); + break; + + case cscDirectSetEntries: + status = GraphicsCoreDirectSetEntries((VDSetEntryRecord *) genericPtr); + break; + + case cscSetDefaultMode: + return controlErr; + + case cscSwitchMode: + status = GraphicsCoreSwitchMode((VDSwitchInfoRec *) genericPtr); + break; + + case cscSetSync: + status = GraphicsCoreSetSync((VDSyncInfoRec *) genericPtr); + break; + + case cscSavePreferredConfiguration: + status = GraphicsCoreSetPreferredConfiguration((VDSwitchInfoRec *) genericPtr); + break; + + case cscSetHardwareCursor: + status = GraphicsCoreSetHardwareCursor((VDSetHardwareCursorRec *) genericPtr); + break; + + case cscDrawHardwareCursor: + status = GraphicsCoreDrawHardwareCursor((VDDrawHardwareCursorRec *) genericPtr); + break; + case cscSetPowerState: + status = GraphicsCoreSetPowerState((VDPowerStateRec *) genericPtr); + break; + default: + break; + } + if (status) + status = paramErr; + + return status; +} + +/* + * DriverStatusCmd + * + * Process a PBStatus command. We support the driver gestalt call and our private + * debugging commands. + */ +OSStatus +DriverStatusCmd( IOCommandID ioCommandID, IOCommandKind ioCommandKind, CntrlParam *pb ) +{ + OSStatus status; + void *genericPtr; + + /* The 'csParam' field of the 'CntrlParam' stucture is defined as 'short csParam[11]'. This is + * meant for 'operation defined parameters.' For the graphics driver, only the first 4 bytes are + * used. They are used as a pointer to another structure. + * To help code readability, the pointer will be extracted as a generic 'void *' and then cast as + * appropriate. + */ + + genericPtr = (void *) *((UInt32 *) &(pb->csParam[0])); + + Trace(DriverStatusCmd); + lprintf("csCode=%d\n", pb->csCode); + switch( pb->csCode ) { + case cscGetMode: + status = GraphicsCoreGetMode((VDPageInfo *) genericPtr); + break; + + case cscGetEntries: + status = GraphicsCoreGetEntries((VDSetEntryRecord *) genericPtr); + break; + + case cscGetPages: + status = GraphicsCoreGetPages((VDPageInfo *) genericPtr); + break; + + case cscGetBaseAddr: + status = GraphicsCoreGetBaseAddress((VDPageInfo *) genericPtr); + break; + + case cscGetGray: + status = GraphicsCoreGetGray((VDGrayRecord *) genericPtr); + break; + + case cscGetInterrupt: + status = GraphicsCoreGetInterrupt((VDFlagRecord *) genericPtr); + break; + + case cscGetGamma: + status = GraphicsCoreGetGamma((VDGammaRecord *) genericPtr); + break; + + case cscGetDefaultMode: + status = statusErr; + break; + + case cscGetCurMode: + status = GraphicsCoreGetCurrentMode((VDSwitchInfoRec *) genericPtr); + break; + + case cscGetSync: + status = GraphicsCoreGetSync((VDSyncInfoRec *) genericPtr); + break; + + case cscGetConnection: + status = GraphicsCoreGetConnection((VDDisplayConnectInfoRec *) genericPtr); + break; + + case cscGetModeTiming: + status = GraphicsCoreGetModeTiming((VDTimingInfoRec *) genericPtr); + break; + + case cscGetPreferredConfiguration: + status = GraphicsCoreGetPreferredConfiguration((VDSwitchInfoRec *) genericPtr); + break; + + case cscGetNextResolution: + status = GraphicsCoreGetNextResolution((VDResolutionInfoRec *) genericPtr); + break; + + case cscGetVideoParameters: + status = GraphicsCoreGetVideoParams((VDVideoParametersInfoRec *) genericPtr); + break; + + case cscGetGammaInfoList: + status = GraphicsCoreGetGammaInfoList((VDGetGammaListRec *) genericPtr); + break; + + case cscRetrieveGammaTable: + status = GraphicsCoreRetrieveGammaTable((VDRetrieveGammaRec *) genericPtr); + break; + + case cscSupportsHardwareCursor: + status = GraphicsCoreSupportsHardwareCursor((VDSupportsHardwareCursorRec *) genericPtr); + break; + + case cscGetHardwareCursorDrawState: + status = GraphicsCoreGetHardwareCursorDrawState((VDHardwareCursorDrawStateRec *) genericPtr); + break; + + case kDriverGestaltCode: + status = DriverGestaltHandler(pb); + break; + + case cscGetPowerState: + status = GraphicsCoreGetPowerState((VDPowerStateRec *) genericPtr); + break; + case cscGetClutBehavior: + *(VDClutBehaviorPtr)genericPtr = kSetClutAtSetEntries; + status = noErr; + break; + default: + return statusErr; + } + if (status) + status = paramErr; + + return status; +} + +/* + * DriverKillIOCmd stops all I/O for this chip. It's a big hammer, use it wisely. + * This will need revision when we support concurrent I/O as we must stop all + * pending requests. + */ +OSStatus +DriverKillIOCmd( ParmBlkPtr pb ) +{ +#define REQUEST (GLOBAL.perRequestData) + + Trace(DriverKillIOCmd); + return noErr; +#undef REQUEST +} + +/* + * DriverReadCmd + * + * The caller passes the data buffer and buffer length in the IOParam record and + * a pointer to a SCSI NCRSCSIParam in the ioMisc field. + */ +OSStatus +DriverReadCmd( AddressSpaceID addressSpaceID, IOCommandID ioCommandID, + IOCommandKind ioCommandKind, ParmBlkPtr pb ) +{ + Trace(DriverReadCmd); + return paramErr; +} + + +/* + * DriverWriteCmd + * + * The caller passes the data buffer and buffer length in the IOParam record and + * a pointer to a SCSI NCRSCSIParam in the ioMisc field. + */ +OSStatus +DriverWriteCmd( AddressSpaceID addressSpaceID, IOCommandID ioCommandID, + IOCommandKind ioCommandKind, ParmBlkPtr pb ) +{ + Trace(DriverWriteCmd); + return paramErr; +} + +/* + * DriverCloseCmd does nothing.. + */ +OSStatus +DriverCloseCmd( ParmBlkPtr pb ) +{ + Trace(DriverCloseCmd); + + if( !GLOBAL.openCount ) + return notOpenErr; + + GLOBAL.openCount--; + + if (!GLOBAL.openCount) + QemuVga_Close(); + + return noErr; +} + +/* + * DriverOpenCmd does nothing: remember that many applications will open a device, but + * never close it.. + */ +OSStatus +DriverOpenCmd( AddressSpaceID addressSpaceID, ParmBlkPtr pb ) +{ + Trace(DriverOpenCmd); + + GLOBAL.openCount++; + if (GLOBAL.openCount == 1) + QemuVga_Open(); + + return noErr; +} + + diff --git a/roms/QemuMacDrivers/QemuVGADriver/src/DriverGestaltHandler.c b/roms/QemuMacDrivers/QemuVGADriver/src/DriverGestaltHandler.c new file mode 100755 index 000000000..84189e0f0 --- /dev/null +++ b/roms/QemuMacDrivers/QemuVGADriver/src/DriverGestaltHandler.c @@ -0,0 +1,50 @@ +#include "VideoDriverPrivate.h" +#include "VideoDriverPrototypes.h" + +/* + * Called on PBStatus, csCode = 43 + */ +OSStatus +DriverGestaltHandler( CntrlParam *pb ) +{ +#define PB (*((DriverGestaltParam *) pb)) +#define OPTIONS (TheDriverDescription.driverOSRuntimeInfo) + + OSStatus status; + Trace(DriverGestaltHandler); + + PB.driverGestaltResponse = 0; + status = noErr; + + lprintf("DriverGestalt, selector=%c%c%c%c\n", + PB.driverGestaltSelector >> 24, + (PB.driverGestaltSelector >> 16) & 0xff, + (PB.driverGestaltSelector >> 8) & 0xff, + (PB.driverGestaltSelector ) & 0xff); + switch( PB.driverGestaltSelector ) { + case kdgSync: + PB.driverGestaltResponse = FALSE; /* We handle asynchronous I/O */ + break; + case kdgVersion: + PB.driverGestaltResponse = + *((UInt32 *) &TheDriverDescription.driverType.version); + break; + case kdgDeviceType: + PB.driverGestaltResponse = 'QEMU'; + break; + case kdgInterface: + PB.driverGestaltResponse = 'pci '; + break; + case kdgSupportsSwitching: /* Support Power up/down switching? */ + PB.driverGestaltResponse = FALSE; /* Not supported yet */ + break; + case kdgSupportsPowerCtl: /* TRUE if in high-power mode */ + PB.driverGestaltResponse = FALSE; /* Power-switching is not supported */ + break; + default: + status = statusErr; + break; + } + return status; +#undef PB +} diff --git a/roms/QemuMacDrivers/QemuVGADriver/src/DriverQDCalls.c b/roms/QemuMacDrivers/QemuVGADriver/src/DriverQDCalls.c new file mode 100644 index 000000000..fdfc043ec --- /dev/null +++ b/roms/QemuMacDrivers/QemuVGADriver/src/DriverQDCalls.c @@ -0,0 +1,622 @@ +#include "VideoDriverPrivate.h" +#include "VideoDriverPrototypes.h" +#include "DriverQDCalls.h" +#include "QemuVga.h" + +#define MAX_DEPTH_MODE kDepthMode3 + +static UInt8 DepthToDepthMode(UInt8 depth) +{ + switch (depth) { + case 8: + return kDepthMode1; + case 15: + case 16: + return kDepthMode2; + case 24: + case 32: + return kDepthMode3; + default: + return kDepthMode1; + } +} + +static UInt8 DepthModeToDepth(UInt8 mode) +{ + switch (mode) { + case kDepthMode1: + return 8; + case kDepthMode2: + return 15; + case kDepthMode3: + return 32; + default: + return 8; + } +} + +/************************ Color Table Stuff ****************************/ + +static OSStatus +GraphicsCoreDoSetEntries(VDSetEntryRecord *entryRecord, Boolean directDevice, UInt32 start, UInt32 stop, Boolean useValue) +{ + UInt32 i; + + CHECK_OPEN( controlErr ); + if (GLOBAL.depth != 8) + return controlErr; + if (NULL == entryRecord->csTable) + return controlErr; + + /* Note that stop value is included in the range */ + for(i=start;i<=stop;i++) { + UInt32 colorIndex = useValue ? entryRecord->csTable[i].value : i; + QemuVga_SetColorEntry(colorIndex, &entryRecord->csTable[i].rgb); + } + + return noErr; +} + +OSStatus +GraphicsCoreSetEntries(VDSetEntryRecord *entryRecord) +{ + Boolean useValue = (entryRecord->csStart < 0); + UInt32 start = useValue ? 0UL : (UInt32)entryRecord->csStart; + UInt32 stop = start + entryRecord->csCount; + + Trace(GraphicsCoreSetEntries); + + return GraphicsCoreDoSetEntries(entryRecord, false, start, stop, useValue); +} + +OSStatus +GraphicsCoreDirectSetEntries(VDSetEntryRecord *entryRecord) +{ + Boolean useValue = (entryRecord->csStart < 0); + UInt32 start = useValue ? 0 : entryRecord->csStart; + UInt32 stop = start + entryRecord->csCount; + + Trace(GraphicsCoreDirectSetEntries); + + return GraphicsCoreDoSetEntries(entryRecord, true, start, stop, useValue); +} + +OSStatus +GraphicsCoreGetEntries(VDSetEntryRecord *entryRecord) +{ + Boolean useValue = (entryRecord->csStart < 0); + UInt32 start = useValue ? 0UL : (UInt32)entryRecord->csStart; + UInt32 stop = start + entryRecord->csCount; + UInt32 i; + + Trace(GraphicsCoreGetEntries); + + if (GLOBAL.depth != 8) + return controlErr; + for(i=start;i<=stop;i++) { + UInt32 colorIndex = useValue ? entryRecord->csTable[i].value : i; + QemuVga_GetColorEntry(colorIndex, &entryRecord->csTable[i].rgb); + } + + return noErr; +} + +/************************ Gamma ****************************/ + +OSStatus +GraphicsCoreSetGamma(VDGammaRecord *gammaRec) +{ + CHECK_OPEN( controlErr ); + + return noErr; +} + +OSStatus +GraphicsCoreGetGammaInfoList(VDGetGammaListRec *gammaList) +{ + Trace(GraphicsCoreGammaInfoList); + + return statusErr; +} + +OSStatus +GraphicsCoreRetrieveGammaTable(VDRetrieveGammaRec *gammaRec) +{ + Trace(GraphicsCoreRetrieveGammaTable); + + return statusErr; +} + +OSStatus +GraphicsCoreGetGamma(VDGammaRecord *gammaRecord) +{ + CHECK_OPEN( statusErr ); + + Trace(GraphicsCoreGetGamma); + + gammaRecord->csGTable = NULL; + + return noErr; +} + + +/************************ Gray pages ****************************/ + +OSStatus +GraphicsCoreGrayPage(VDPageInfo *pageInfo) +{ + UInt32 pageCount; + + CHECK_OPEN( controlErr ); + + Trace(GraphicsCoreGrayPage); + + QemuVga_GetModePages(GLOBAL.curMode, GLOBAL.depth, NULL, &pageCount); + if (pageInfo->csPage >= pageCount) + return paramErr; + + /* XXX Make it gray ! */ + return noErr; +} + +OSStatus +GraphicsCoreSetGray(VDGrayRecord *grayRecord) +{ + CHECK_OPEN( controlErr ); + + Trace(GraphicsCoreSetGray); + + GLOBAL.qdLuminanceMapping = grayRecord->csMode; + return noErr; +} + + +OSStatus +GraphicsCoreGetPages(VDPageInfo *pageInfo) +{ + UInt32 pageCount, depth; + + CHECK_OPEN( statusErr ); + + Trace(GraphicsCoreGetPages); + + depth = DepthModeToDepth(pageInfo->csMode); + QemuVga_GetModePages(GLOBAL.curMode, depth, NULL, &pageCount); + pageInfo->csPage = pageCount; + + return noErr; +} + + +OSStatus +GraphicsCoreGetGray(VDGrayRecord *grayRecord) +{ + CHECK_OPEN( statusErr ); + + Trace(GraphicsCoreGetGray); + + grayRecord->csMode = (GLOBAL.qdLuminanceMapping); + + return noErr; +} + +/************************ Hardware Cursor ****************************/ + +OSStatus +GraphicsCoreSupportsHardwareCursor(VDSupportsHardwareCursorRec *hwCursRec) +{ + CHECK_OPEN( statusErr ); + + Trace(GraphicsCoreSupportsHardwareCursor); + + hwCursRec->csReserved1 = 0; + hwCursRec->csReserved2 = 0; + + hwCursRec->csSupportsHardwareCursor = false; + + return noErr; +} + +OSStatus +GraphicsCoreSetHardwareCursor(VDSetHardwareCursorRec *setHwCursRec) +{ + Trace(GraphicsCoreSetHardwareCursor); + + return controlErr; +} + +OSStatus +GraphicsCoreDrawHardwareCursor(VDDrawHardwareCursorRec *drawHwCursRec) +{ + Trace(GraphicsCoreDrawHardwareCursor); + + return controlErr; +} + +OSStatus +GraphicsCoreGetHardwareCursorDrawState(VDHardwareCursorDrawStateRec *hwCursDStateRec) +{ + Trace(GraphicsCoreGetHardwareCursorDrawState); + + return statusErr; +} + +/************************ Misc ****************************/ + +OSStatus +GraphicsCoreSetInterrupt(VDFlagRecord *flagRecord) +{ + CHECK_OPEN( controlErr ); + + Trace(GraphicsCoreSetInterrupt); + + if (!flagRecord->csMode) + QemuVga_EnableInterrupts(); + else + QemuVga_DisableInterrupts(); + + return noErr; +} + +OSStatus +GraphicsCoreGetInterrupt(VDFlagRecord *flagRecord) +{ + Trace(GraphicsCoreGetInterrupt); + + CHECK_OPEN( statusErr ); + + flagRecord->csMode = !GLOBAL.qdInterruptsEnable; + return noErr; +} + +OSStatus +GraphicsCoreSetSync(VDSyncInfoRec *syncInfo) +{ + UInt8 sync, mask; + + Trace(GraphicsCoreSetSync); + + CHECK_OPEN( controlErr ); + + sync = syncInfo->csMode; + mask = syncInfo->csFlags; + + /* Unblank shortcut */ + if (sync == 0 && mask == 0) { + sync = 0; + mask = kDPMSSyncMask; + } + /* Blank shortcut */ + if (sync == 0xff && mask == 0xff) { + sync = 0x7; + mask = kDPMSSyncMask; + } + + lprintf("SetSync req: sync=%x mask=%x\n", sync, mask); + + /* Only care about the DPMS mode */ + if ((mask & kDPMSSyncMask) == 0) + return noErr; + + /* If any sync is disabled, blank */ + if (sync & kDPMSSyncMask) + QemuVga_Blank(true); + else + QemuVga_Blank(false); + + return noErr; +} + +OSStatus +GraphicsCoreGetSync(VDSyncInfoRec *syncInfo) +{ + Trace(GraphicsCoreGetSync); + + if (syncInfo->csMode == 0xff) { + /* Return HW caps */ + syncInfo->csMode = (1 << kDisableHorizontalSyncBit) | + (1 << kDisableVerticalSyncBit) | + (1 << kDisableCompositeSyncBit) | + (1 << kNoSeparateSyncControlBit); + } else if (syncInfo->csMode == 0x00){ + syncInfo->csMode = GLOBAL.blanked ? kDPMSSyncMask : 0; + } else + return statusErr; + + syncInfo->csFlags = 0; + + return noErr; +} + +OSStatus +GraphicsCoreSetPowerState(VDPowerStateRec *powerStateRec) +{ + Trace(GraphicsCoreSetPowerState); + + return paramErr; +} + +OSStatus +GraphicsCoreGetPowerState(VDPowerStateRec *powerStateRec) +{ + Trace(GraphicsCoreGetPowerState); + + return paramErr; +} + +OSStatus +GraphicsCoreSetPreferredConfiguration(VDSwitchInfoRec *switchInfo) +{ + Trace(GraphicsCoreSetPreferredConfiguration); + + CHECK_OPEN( controlErr ); + + return noErr; +} + + +OSStatus +GraphicsCoreGetPreferredConfiguration(VDSwitchInfoRec *switchInfo) +{ + Trace(GraphicsCoreGetPreferredConfiguration); + + CHECK_OPEN( statusErr ); + + switchInfo->csMode = DepthToDepthMode(GLOBAL.bootDepth); + switchInfo->csData = GLOBAL.bootMode + 1; /* Modes are 1 based */ + switchInfo->csPage = 0; + switchInfo->csBaseAddr = FB_START; + + return noErr; +} + +// €***************** Misc status calls *********************/ + +OSStatus +GraphicsCoreGetBaseAddress(VDPageInfo *pageInfo) +{ + UInt32 pageCount, pageSize; + + Trace(GraphicsCoreGetBaseAddress); + + CHECK_OPEN( statusErr ); + + QemuVga_GetModePages(GLOBAL.curMode, GLOBAL.depth, &pageSize, &pageCount); + if (pageInfo->csPage >= pageCount) + return paramErr; + + pageInfo->csBaseAddr = FB_START + pageInfo->csPage * pageSize; + + return noErr; +} + +OSStatus +GraphicsCoreGetConnection(VDDisplayConnectInfoRec *connectInfo) +{ + Trace(GraphicsCoreGetConnection); + + CHECK_OPEN( statusErr ); + + connectInfo->csDisplayType = kVGAConnect; + connectInfo->csConnectTaggedType = 0; + connectInfo->csConnectTaggedData = 0; + + connectInfo->csConnectFlags = + (1 << kTaggingInfoNonStandard) | (1 << kUncertainConnection); + + connectInfo->csDisplayComponent = 0; + + return noErr; +} + +OSStatus +GraphicsCoreGetMode(VDPageInfo *pageInfo) +{ + Trace(GraphicsCoreGetMode); + + CHECK_OPEN( statusErr ); + + pageInfo->csMode = DepthToDepthMode(GLOBAL.depth); + pageInfo->csPage = GLOBAL.curPage; + pageInfo->csBaseAddr = GLOBAL.curBaseAddress; + + return noErr; +} + +OSStatus +GraphicsCoreGetCurrentMode(VDSwitchInfoRec *switchInfo) +{ + Trace(GraphicsCoreGetCurrentMode); + + CHECK_OPEN( statusErr ); + + //lprintf("GetCurrentMode\n"); + switchInfo->csMode = DepthToDepthMode(GLOBAL.depth); + switchInfo->csData = GLOBAL.curMode + 1; + switchInfo->csPage = GLOBAL.curPage; + switchInfo->csBaseAddr = GLOBAL.curBaseAddress; + + return noErr; +} + +/********************** Video mode *****************************/ + +OSStatus +GraphicsCoreGetModeTiming(VDTimingInfoRec *timingInfo) +{ + Trace(GraphicsCoreGetModeTiming); + + CHECK_OPEN( statusErr ); + + if (timingInfo->csTimingMode < 1 || timingInfo->csTimingMode > GLOBAL.numModes ) + return paramErr; + + timingInfo->csTimingFlags = + (1 << kModeValid) | (1 << kModeDefault) | (1 <csTimingFormat = kDeclROMtables; + timingInfo->csTimingData = timingVESA_640x480_60hz; + + return noErr; +} + + +OSStatus +GraphicsCoreSetMode(VDPageInfo *pageInfo) +{ + UInt32 newDepth, newPage, pageCount; + + Trace(GraphicsCoreSetMode); + + CHECK_OPEN(controlErr); + + newDepth = DepthModeToDepth(pageInfo->csMode); + newPage = pageInfo->csPage; + QemuVga_GetModePages(GLOBAL.curMode, newDepth, NULL, &pageCount); + + lprintf("Requested depth=%d page=%d\n", newDepth, newPage); + if (pageInfo->csPage >= pageCount) + return paramErr; + + if (newDepth != GLOBAL.depth || newPage != GLOBAL.curPage) + QemuVga_SetMode(GLOBAL.curMode, newDepth, newPage); + + pageInfo->csBaseAddr = GLOBAL.curBaseAddress; + lprintf("Returning BA: %lx\n", pageInfo->csBaseAddr); + + return noErr; +} + + +OSStatus +GraphicsCoreSwitchMode(VDSwitchInfoRec *switchInfo) +{ + UInt32 newMode, newDepth, newPage, pageCount; + + Trace(GraphicsCoreSwitchMode); + + CHECK_OPEN(controlErr); + + newMode = switchInfo->csData - 1; + newDepth = DepthModeToDepth(switchInfo->csMode); + newPage = switchInfo->csPage; + QemuVga_GetModePages(GLOBAL.curMode, newDepth, NULL, &pageCount); + + if (newPage >= pageCount) + return paramErr; + + if (newMode != GLOBAL.curMode || newDepth != GLOBAL.depth || + newPage != GLOBAL.curPage) { + if (QemuVga_SetMode(newMode, newDepth, newPage)) + return controlErr; + } + switchInfo->csBaseAddr = GLOBAL.curBaseAddress; + + return noErr; +} + +OSStatus +GraphicsCoreGetNextResolution(VDResolutionInfoRec *resInfo) +{ + UInt32 width, height; + int id = resInfo->csPreviousDisplayModeID; + + Trace(GraphicsCoreGetNextResolution); + + CHECK_OPEN(statusErr); + + if (id == kDisplayModeIDFindFirstResolution) + id = 0; + else if (id == kDisplayModeIDCurrent) + id = GLOBAL.curMode; + id++; + + if (id == GLOBAL.numModes + 1) { + resInfo->csDisplayModeID = kDisplayModeIDNoMoreResolutions; + return noErr; + } + if (id < 1 || id > GLOBAL.numModes) + return paramErr; + + if (QemuVga_GetModeInfo(id - 1, &width, &height)) + return paramErr; + + resInfo->csDisplayModeID = id; + resInfo->csHorizontalPixels = width; + resInfo->csVerticalLines = height; + resInfo->csRefreshRate = 60; + resInfo->csMaxDepthMode = MAX_DEPTH_MODE; /* XXX Calculate if it fits ! */ + + return noErr; +} + +// Looks quite a bit hard-coded, isn't it ? +OSStatus +GraphicsCoreGetVideoParams(VDVideoParametersInfoRec *videoParams) +{ + UInt32 width, height, depth, rowBytes, pageCount; + OSStatus err = noErr; + + Trace(GraphicsCoreGetVideoParams); + + CHECK_OPEN(statusErr); + + if (videoParams->csDisplayModeID < 1 || videoParams->csDisplayModeID > GLOBAL.numModes) + return paramErr; + if (videoParams->csDepthMode > MAX_DEPTH_MODE) + return paramErr; + if (QemuVga_GetModeInfo(videoParams->csDisplayModeID - 1, &width, &height)) + return paramErr; + + depth = DepthModeToDepth(videoParams->csDepthMode); + QemuVga_GetModePages(videoParams->csDisplayModeID - 1, depth, NULL, &pageCount); + videoParams->csPageCount = pageCount; + lprintf("Video Params says %d pages\n", pageCount); + + rowBytes = width * ((depth + 7) / 8); + (videoParams->csVPBlockPtr)->vpBaseOffset = 0; // For us, it's always 0 + (videoParams->csVPBlockPtr)->vpBounds.top = 0; // Always 0 + (videoParams->csVPBlockPtr)->vpBounds.left = 0; // Always 0 + (videoParams->csVPBlockPtr)->vpVersion = 0; // Always 0 + (videoParams->csVPBlockPtr)->vpPackType = 0; // Always 0 + (videoParams->csVPBlockPtr)->vpPackSize = 0; // Always 0 + (videoParams->csVPBlockPtr)->vpHRes = 0x00480000; // Hard coded to 72 dpi + (videoParams->csVPBlockPtr)->vpVRes = 0x00480000; // Hard coded to 72 dpi + (videoParams->csVPBlockPtr)->vpPlaneBytes = 0; // Always 0 + (videoParams->csVPBlockPtr)->vpBounds.bottom = height; + (videoParams->csVPBlockPtr)->vpBounds.right = width; + (videoParams->csVPBlockPtr)->vpRowBytes = rowBytes; + + switch (depth) { + case 8: + videoParams->csDeviceType = clutType; + (videoParams->csVPBlockPtr)->vpPixelType = 0; + (videoParams->csVPBlockPtr)->vpPixelSize = 8; + (videoParams->csVPBlockPtr)->vpCmpCount = 1; + (videoParams->csVPBlockPtr)->vpCmpSize = 8; + (videoParams->csVPBlockPtr)->vpPlaneBytes = 0; + break; + case 15: + case 16: + videoParams->csDeviceType = directType; + (videoParams->csVPBlockPtr)->vpPixelType = 16; + (videoParams->csVPBlockPtr)->vpPixelSize = 16; + (videoParams->csVPBlockPtr)->vpCmpCount = 3; + (videoParams->csVPBlockPtr)->vpCmpSize = 5; + (videoParams->csVPBlockPtr)->vpPlaneBytes = 0; + break; + case 32: + videoParams->csDeviceType = directType; + (videoParams->csVPBlockPtr)->vpPixelType = 16; + (videoParams->csVPBlockPtr)->vpPixelSize = 32; + (videoParams->csVPBlockPtr)->vpCmpCount = 3; + (videoParams->csVPBlockPtr)->vpCmpSize = 8; + (videoParams->csVPBlockPtr)->vpPlaneBytes = 0; + break; + default: + err = paramErr; + break; + } + + return err; +} diff --git a/roms/QemuMacDrivers/QemuVGADriver/src/DriverQDCalls.h b/roms/QemuMacDrivers/QemuVGADriver/src/DriverQDCalls.h new file mode 100644 index 000000000..cca4d28e6 --- /dev/null +++ b/roms/QemuMacDrivers/QemuVGADriver/src/DriverQDCalls.h @@ -0,0 +1,42 @@ +#ifndef _DRIVER_QD_CALLS_H__ +#define _DRIVER_QD_CALLS_H__ + +// ###ĘCONTROL ROUTINES ### + +OSStatus GraphicsCoreSetMode(VDPageInfo *pageInfo); +OSStatus GraphicsCoreSetEntries(VDSetEntryRecord *entryRecord); +OSStatus GraphicsCoreSetGamma(VDGammaRecord *gammaRec); +OSStatus GraphicsCoreGrayPage(VDPageInfo *pageInfo); +OSStatus GraphicsCoreSetGray(VDGrayRecord *grayRecord); +OSStatus GraphicsCoreSetInterrupt(VDFlagRecord *flagRecord); +OSStatus GraphicsCoreDirectSetEntries(VDSetEntryRecord *entryRecord); +OSStatus GraphicsCoreSwitchMode(VDSwitchInfoRec *switchInfo); +OSStatus GraphicsCoreSetSync(VDSyncInfoRec *syncInfo); +OSStatus GraphicsCoreSetPreferredConfiguration(VDSwitchInfoRec *switchInfo); +OSStatus GraphicsCoreSetHardwareCursor(VDSetHardwareCursorRec *setHwCursRec); +OSStatus GraphicsCoreDrawHardwareCursor(VDDrawHardwareCursorRec *drawHwCursRec); +OSStatus GraphicsCoreSetPowerState(VDPowerStateRec * powerStateRec); + +// ### STATUS ROUTINES ### + +OSStatus GraphicsCoreGetMode(VDPageInfo *pageInfo); +OSStatus GraphicsCoreGetEntries(VDSetEntryRecord *entryRecord); +OSStatus GraphicsCoreGetPages(VDPageInfo *pageInfo); +OSStatus GraphicsCoreGetBaseAddress(VDPageInfo *pageInfo); +OSStatus GraphicsCoreGetGray(VDGrayRecord *grayRecord); +OSStatus GraphicsCoreGetInterrupt(VDFlagRecord *flagRecord); +OSStatus GraphicsCoreGetGamma(VDGammaRecord *gammaRecord); +OSStatus GraphicsCoreGetCurrentMode(VDSwitchInfoRec *switchInfo); +OSStatus GraphicsCoreGetSync(VDSyncInfoRec *syncInfo); +OSStatus GraphicsCoreGetConnection(VDDisplayConnectInfoRec *connectInfo); +OSStatus GraphicsCoreGetModeTiming(VDTimingInfoRec *timingInfo); +OSStatus GraphicsCoreGetPreferredConfiguration(VDSwitchInfoRec *switchInfo); +OSStatus GraphicsCoreGetNextResolution(VDResolutionInfoRec *resInfo); +OSStatus GraphicsCoreGetVideoParams(VDVideoParametersInfoRec *videoParams); +OSStatus GraphicsCoreGetGammaInfoList(VDGetGammaListRec *gammaList); +OSStatus GraphicsCoreRetrieveGammaTable(VDRetrieveGammaRec *gammaRec); +OSStatus GraphicsCoreSupportsHardwareCursor(VDSupportsHardwareCursorRec *hwCursRec); +OSStatus GraphicsCoreGetHardwareCursorDrawState(VDHardwareCursorDrawStateRec *hwCursDStateRec); +OSStatus GraphicsCoreGetPowerState(VDPowerStateRec * powerStateRec); + +#endif /* DRIVER_QD_CALLS */ diff --git a/roms/QemuMacDrivers/QemuVGADriver/src/QemuEdid.c b/roms/QemuMacDrivers/QemuVGADriver/src/QemuEdid.c new file mode 100644 index 000000000..57de244a3 --- /dev/null +++ b/roms/QemuMacDrivers/QemuVGADriver/src/QemuEdid.c @@ -0,0 +1 @@ +#include #include "VideoDriverPrivate.h" #include "logger.h" #include "QemuVga.h" /* List of video modes */ struct vMode *vModes; /* Default modes if no EDID (must be 0 terminated) */ static struct _vMode defaultVModes[] = { { 640, 480 }, { 800, 600 }, { 1024, 768 }, { 1280, 1024 }, { 1600, 1200 }, { 1920, 1080 }, { 1920, 1200 }, }; /* EDID standard timings */ static struct _vMode edidStdVModes[] = { { 800, 600 }, /* 800x600 @ 60Hz */ { 800, 600 }, /* 800x600 @ 56Hz */ { 640, 480 }, /* 640x480 @ 75Hz */ { 640, 480 }, /* 640x480 @ 72Hz */ { 640, 480 }, /* 640x480 @ 67Hz */ { 640, 480 }, /* 640x480 @ 60Hz */ { 720, 400 }, /* 720x400 @ 88Hz */ { 720, 400 }, /* 720x400 @ 70Hz */ { 1280, 1024 }, /* 1280x1024 @ 75Hz */ { 1024, 768 }, /* 1024x768 @ 75Hz */ { 1024, 768 }, /* 1024x768 @ 72Hz */ { 1024, 768 }, /* 1024x768 @ 60Hz */ { 1024, 768 }, /* 1024x768 @ 87Hz */ { 832, 624 }, /* 832x624 @ 75Hz */ { 800, 600 }, /* 800x600 @ 75Hz */ { 800, 600 }, /* 800x600 @ 72Hz */ { 0, 0 }, /* Reserved */ { 0, 0 }, /* Reserved */ { 0, 0 }, /* Reserved */ { 0, 0 }, /* Reserved */ { 0, 0 }, /* Reserved */ { 0, 0 }, /* Reserved */ { 0, 0 }, /* Reserved */ { 1152, 870 }, /* 1152x870 @ 75Hz */ }; /* EDID extended standard timings */ static struct _vMode edidExtStdVModes[] = { { 1152, 864 }, /* 1152x864 @ 85Hz */ { 1024, 768 }, /* 1024x768 @ 75Hz */ { 800, 600 }, /* 800x600 @ 85Hz */ { 848, 480 }, /* 848x480 @ 60Hz */ { 640, 480 }, /* 640x480 @ 85Hz */ { 720, 400 }, /* 720x400 @ 85Hz */ { 640, 400 }, /* 640x400 @ 85Hz */ { 640, 350 }, /* 640x350 @ 85Hz */ { 1280, 1024 }, /* 1280x1024 @ 85Hz */ { 1280, 1024 }, /* 1280x1024 @ 60Hz */ { 1280, 960 }, /* 1280x960 @ 85Hz */ { 1280, 960 }, /* 1280x960 @ 60Hz */ { 1280, 768 }, /* 1280x768 @ 85Hz */ { 1280, 768 }, /* 1280x768 @ 75Hz */ { 1280, 768 }, /* 1280x768 @ 60Hz */ { 1280, 768 }, /* 1280x768 @ 60Hz (CVT-RB) */ { 1440, 1050 }, /* 1440x1050 @ 75Hz */ { 1440, 1050 }, /* 1440x1050 @ 60Hz */ { 1440, 1050 }, /* 1440x1050 @ 60Hz (CVT-RB) */ { 1440, 900 }, /* 1440x900 @ 85Hz */ { 1440, 900 }, /* 1440x900 @ 75Hz */ { 1440, 900 }, /* 1440x900 @ 60Hz (CVT-RB) */ { 1360, 768 }, /* 1360x768 @ 60Hz */ { 1360, 768 }, /* 1360x768 @ 60Hz (CVT-RB) */ { 1600, 1200 }, /* 1600x1200 @ 70Hz */ { 1600, 1200 }, /* 1600x1200 @ 65Hz */ { 1600, 1200 }, /* 1600x1200 @ 60Hz */ { 1680, 1050 }, /* 1680x1050 @ 85Hz */ { 1680, 1050 }, /* 1680x1050 @ 75Hz */ { 1680, 1050 }, /* 1680x1050 @ 60Hz */ { 1680, 1050 }, /* 1680x1050 @ 60Hz (CVT-RB) */ { 1440, 1050 }, /* 1440x1050 @ 85Hz */ { 1920, 1200 }, /* 1920x1200 @ 60Hz */ { 1920, 1200 }, /* 1920x1200 @ 60Hz (CVT-RB) */ { 1856, 1392 }, /* 1856x1392 @ 75Hz */ { 1856, 1392 }, /* 1856x1392 @ 60Hz */ { 1792, 1344 }, /* 1792x1344 @ 75Hz */ { 1792, 1344 }, /* 1792x1344 @ 60Hz */ { 1600, 1200 }, /* 1600x1200 @ 85Hz */ { 1600, 1200 }, /* 1600x1200 @ 75Hz */ { 0, 0 }, /* Reserved */ { 0, 0 }, /* Reserved */ { 0, 0 }, /* Reserved */ { 0, 0 }, /* Reserved */ { 1920, 1440 }, /* 1920x1440 @ 75Hz */ { 1920, 1440 }, /* 1920x1440 @ 60Hz */ { 1920, 1200 }, /* 1920x1200 @ 75Hz */ { 1920, 1200 }, /* 1920x1200 @ 60Hz */ }; /* EDID timing extension modes */ static struct _vMode edidTimingExtensionVModes[] = { { 640, 480 }, /* DMT0659 */ { 720, 480 }, /* 480p */ { 720, 480 }, /* 480pH */ { 1280, 720 }, /* 720p */ { 1920, 540 }, /* 1080i */ { 1440, 240 }, /* 480i */ { 1440, 240 }, /* 480iH */ { 1440, 240 }, /* 240p */ { 1440, 240 }, /* 240pH */ { 2880, 240 }, /* 480i4x */ { 2880, 240 }, /* 480i4xH */ { 2880, 240 }, /* 240p4x */ { 2880, 240 }, /* 240p4xH */ { 1440, 480 }, /* 480p2x */ { 1440, 480 }, /* 480p2xH */ { 1920, 1080 }, /* 1080p */ { 720, 576 }, /* 576p */ { 720, 576 }, /* 576pH */ { 1280, 720 }, /* 720p50 */ { 1920, 540 }, /* 1080i25 */ { 1440, 288 }, /* 576i */ { 1440, 288 }, /* 576iH */ { 1440, 288 }, /* 288p */ { 1440, 288 }, /* 288pH */ { 2880, 288 }, /* 576i4x */ { 2880, 288 }, /* 576i4xH */ { 2880, 288 }, /* 288p4x */ { 2880, 288 }, /* 288p4xH */ { 1440, 576 }, /* 576p2x */ { 1440, 576 }, /* 576p2xH */ { 1920, 1080 }, /* 1080p50 */ { 1920, 1080 }, /* 1080p24 */ { 1920, 1080 }, /* 1080p25 */ { 1920, 1080 }, /* 1080p30 */ { 2880, 240 }, /* 480p4x */ { 2880, 240 }, /* 480p4xH */ { 2880, 576 }, /* 576p4x */ { 2880, 576 }, /* 576p4xH */ { 1920, 540 }, /* 1080i25 */ { 1920, 540 }, /* 1080i50 */ { 1280, 720 }, /* 720p100 */ { 720, 576 }, /* 576p100 */ { 720, 576 }, /* 576p100H */ { 1440, 576 }, /* 576i50 */ { 1440, 576 }, /* 576i50H */ { 1920, 540 }, /* 1080i60 */ { 1280, 720 }, /* 720p120 */ { 720, 576 }, /* 480p119 */ { 720, 576 }, /* 480p119H */ { 1440, 576 }, /* 480i59 */ { 1440, 576 }, /* 480i59H */ { 720, 576 }, /* 576p200 */ { 720, 576 }, /* 576p200H */ { 1440, 288 }, /* 576i100 */ { 1440, 288 }, /* 576i100H */ { 720, 480 }, /* 480p239 */ { 720, 480 }, /* 480p239H */ { 1440, 240 }, /* 480i119 */ { 1440, 240 }, /* 480i119H */ { 1280, 720 }, /* 720p24 */ { 1280, 720 }, /* 720p25 */ { 1280, 720 }, /* 720p30 */ { 1920, 1080 }, /* 1080p120 */ { 1920, 1080 }, /* 1080p100 */ { 1280, 720 }, /* 720p24 */ { 1280, 720 }, /* 720p25 */ { 1280, 720 }, /* 720p30 */ { 1280, 720 }, /* 720p50 */ { 1650, 750 }, /* 720p */ { 1280, 720 }, /* 720p100 */ { 1280, 720 }, /* 720p120 */ { 1920, 1080 }, /* 1080p24 */ { 1920, 1280 }, /* 1080p25 */ { 1920, 1280 }, /* 1080p30 */ { 1920, 1280 }, /* 1080p50 */ { 1920, 1280 }, /* 1080p */ { 1920, 1280 }, /* 1080p100 */ { 1920, 1280 }, /* 1080p120 */ { 1680, 720 }, /* 720p2x24 */ { 1680, 720 }, /* 720p2x25 */ { 1680, 720 }, /* 720p2x30 */ { 1680, 720 }, /* 720p2x50 */ { 1680, 720 }, /* 720p2x */ { 1680, 720 }, /* 720p2x100 */ { 1680, 720 }, /* 720p2x120 */ { 2560, 1080 }, /* 1080p2x24 */ { 2560, 1080 }, /* 1080p2x25 */ { 2560, 1080 }, /* 1080p2x30 */ { 2560, 1080 }, /* 1080p2x50 */ { 2560, 1080 }, /* 1080p2x */ { 2560, 1080 }, /* 1080p2x100 */ { 2560, 1080 }, /* 1080p2x120 */ { 3840, 2160 }, /* 2160p24 */ { 3840, 2160 }, /* 2160p25 */ { 3840, 2160 }, /* 2160p30 */ { 3840, 2160 }, /* 2160p50 */ { 3840, 2160 }, /* 2160p */ { 4096, 2160 }, /* 2160p24 */ { 4096, 2160 }, /* 2160p25 */ { 4096, 2160 }, /* 2160p30 */ { 4096, 2160 }, /* 2160p50 */ { 4096, 2160 }, /* 2160p */ { 3840, 2160 }, /* 2160p24 */ { 3840, 2160 }, /* 2160p25 */ { 3840, 2160 }, /* 2160p30 */ { 3840, 2160 }, /* 2160p50 */ { 3840, 2160 }, /* 2160p */ { 1280, 720 }, /* 720p48 */ { 1280, 720 }, /* 720p48 */ { 1680, 720 }, /* 720p2x48 */ { 1920, 1280 }, /* 1080p48 */ { 1920, 1280 }, /* 1080p48 */ { 2560, 1080 }, /* 1080p2x48 */ { 3840, 2160 }, /* 2160p48 */ { 4096, 2160 }, /* 2160p48 */ { 3840, 2160 }, /* 2160p48 */ { 3840, 2160 }, /* 2160p100 */ { 3840, 2160 }, /* 2160p120 */ { 3840, 2160 }, /* 2160p100 */ { 3840, 2160 }, /* 2160p120 */ { 5120, 2160 }, /* 2160p2x24 */ { 5120, 2160 }, /* 2160p2x25 */ { 5120, 2160 }, /* 2160p2x30 */ { 5120, 2160 }, /* 2160p2x48 */ { 5120, 2160 }, /* 2160p2x50 */ { 5120, 2160 }, /* 2160p2x */ { 5120, 2160 }, /* 2160p2x100 */ { 0, 0 }, /* Reserved */ }; struct _vMode *getVMode(UInt16 idx) { struct vMode *v = vModes; UInt16 i = 0; while (v != NULL) { if (i == idx) { return v->mode; } v = v->next; i++; } return NULL; } static void dumpVModeList(void) { struct vMode *v = vModes; while (v != NULL) { lprintf(" %d, %d\n", v->mode->width, v->mode->height); v = v->next; } } static UInt16 getVModeListSize(void) { struct vMode *v = vModes; UInt16 i = 0; while (v != NULL) { v = v->next; i++; } return i; } static void addVModeToList(struct _vMode *vMode) { /* Add mode to list */ struct vMode **v = &vModes; struct vMode *n; while (*v != NULL) { /* Don't add mode if resulting framebuffer is too large for PCI MMIO space */ if (vMode->width * vMode->height * 4 > GLOBAL.boardFBMappedSize) { return; } /* Don't add duplicate mode if it already exists */ if ((*v)->mode->width == vMode->width && (*v)->mode->height == vMode->height) { return; } /* Add mode in order */ if (((*v)->mode->width == vMode->width && (*v)->mode->height > vMode->height) || ((*v)->mode->width > vMode->width)) { n = PoolAllocateResident(sizeof(struct vMode), true); n->next = *v; n->mode = vMode; *v = n; return; } v = &(*v)->next; } n = PoolAllocateResident(sizeof(struct vMode), true); n->next = NULL; n->mode = vMode; *v = n; } static UInt8 EdidReadB(UInt16 port) { UInt8 *ptr, val; ptr = (UInt8 *)((UInt32)GLOBAL.boardRegAddress + port); val = *ptr; SynchronizeIO(); return val; } static UInt16 GetEdidSize() { return 0x80 * ((UInt16)EdidReadB(0x7e) + 1); } static void ParseEdid(UInt8 *edid) { int i, j, d, idx; /* Standard modes */ lprintf("Standard modes: \n"); for (i = 35; i <= 37; i++) { for (j = 0; j <= 7; j++) { if (edid[i] & (1 << j)) { idx = ((i - 35) << 3) + j; lprintf(" %d, %d\n", edidStdVModes[idx].width, edidStdVModes[idx].height); addVModeToList(&edidStdVModes[idx]); } } } /* Extended standard modes */ lprintf("Extended standard modes: \n"); d = i = 54; while (d < 126) { /* Search for descriptor */ if (edid[d] == 0x0 && edid[d + 1] == 0x0 && edid[d + 2] == 0x0 && edid[d + 3] == 0xf7 && edid[d + 4] == 0x0) { for (i = d + 6; i <= d + 11; i++) { for (j = 0; j <= 7; j++) { if (edid[i] & (1 << j)) { idx = ((i - d - 6) << 3) + j; lprintf(" %d, %d\n", edidExtStdVModes[idx].width, edidExtStdVModes[idx].height); addVModeToList(&edidExtStdVModes[idx]); } } } break; } d += 18; } /* Extension block modes */ lprintf("Extension block modes: \n"); if (edid[126] > 0) { /* Search for descriptor */ i = 128; if (edid[i] == 0x2 && edid[i + 1] == 0x3) { /* Data present: check for video block */ d = edid[i + 2]; if (d > 0x4 && (edid[i + 4] & 0xf0) == (2 << 5)) { for (j = 0; j < (edid[i + 4] & 0x1f); j++) { idx = edid[(i + 5 + j)]; lprintf(" %d, %d\n", edidTimingExtensionVModes[idx].width, edidTimingExtensionVModes[idx].height); addVModeToList(&edidTimingExtensionVModes[idx]); } } } } } static void ParseDefaultVModes() { UInt8 defaultVModeCount; int i; defaultVModeCount = sizeof(defaultVModes) / sizeof(struct _vMode); lprintf("Default modes:\n"); for (i = 0; i < defaultVModeCount; i++) { lprintf(" %d, %d\n", defaultVModes[i].width, defaultVModes[i].height); addVModeToList(&defaultVModes[i]); } } UInt16 QemuVga_ReadEdidModes(void) { UInt16 edidSize = GetEdidSize(); UInt8 *edid; int i; if (EdidReadB(0x0) != 0x0 || EdidReadB(0x1) != 0xff) { lprintf("No valid EDID detected, using default modes\n"); ParseDefaultVModes(); return getVModeListSize(); } lprintf("EDID size: %d bytes, reading modes from EDID...\n", edidSize); edid = (UInt8 *)PoolAllocateResident(edidSize, true); if (!edid) return; for (i = 0; i < edidSize; i++) { edid[i] = EdidReadB(i); } ParseEdid(edid); PoolDeallocate(edid); lprintf("Final mode list:\n"); dumpVModeList(); return getVModeListSize(); } \ No newline at end of file diff --git a/roms/QemuMacDrivers/QemuVGADriver/src/QemuVga.c b/roms/QemuMacDrivers/QemuVGADriver/src/QemuVga.c new file mode 100644 index 000000000..7b6dd2303 --- /dev/null +++ b/roms/QemuMacDrivers/QemuVGADriver/src/QemuVga.c @@ -0,0 +1,386 @@ +#include "VideoDriverPrivate.h" +#include "VideoDriverPrototypes.h" +#include "DriverQDCalls.h" +#include "QemuVga.h" +#include + +/* +static struct _vMode defaultVModes[] = { + { 640, 480 }, + { 800, 600 }, + { 1024, 768 }, + { 1280, 1024 }, + { 1600, 1200 }, + { 1920, 1080 }, + { 1920, 1200 }, + { 0, 0 } +}; +*/ +static void VgaWriteB(UInt16 port, UInt8 val) +{ + UInt8 *ptr; + + ptr = (UInt8 *)((UInt32)GLOBAL.boardRegAddress + port + 0x400 - 0x3c0); + *ptr = val; + SynchronizeIO(); +} + +static UInt8 VgaReadB(UInt16 port) +{ + UInt8 *ptr, val; + + ptr = (UInt8 *)((UInt32)GLOBAL.boardRegAddress + port + 0x400 - 0x3c0); + val = *ptr; + SynchronizeIO(); + return val; +} + +static void DispiWriteW(UInt16 reg, UInt16 val) +{ + UInt16 *ptr; + + ptr = (UInt16 *)((UInt32)GLOBAL.boardRegAddress + (reg << 1) + 0x500); + *ptr = EndianSwap16Bit(val); + SynchronizeIO(); +} + +static UInt16 DispiReadW(UInt16 reg) +{ + UInt16 *ptr, val; + + ptr = (UInt16 *)((UInt32)GLOBAL.boardRegAddress + (reg << 1) + 0x500); + val = EndianSwap16Bit(*ptr); + SynchronizeIO(); + return val; +} + +static void ExtWriteL(UInt16 reg, UInt32 val) +{ + UInt32 *ptr; + + ptr = (UInt32 *)((UInt32)GLOBAL.boardRegAddress + (reg << 2) + 0x600); + *ptr = EndianSwap32Bit(val); + SynchronizeIO(); +} + +static UInt32 ExtReadL(UInt32 reg) +{ + UInt32 *ptr, val; + + ptr = (UInt32 *)((UInt32)GLOBAL.boardRegAddress + (reg << 2) + 0x600); + val = EndianSwap32Bit(*ptr); + SynchronizeIO(); + return val; +} + +static OSStatus VBLTimerProc(void *p1, void *p2); + +#ifndef USE_DSL_TIMER +static TMTask gLegacyTimer; + +static pascal void legacyTimerCB(TMTaskPtr *inTask) +{ + VBLTimerProc(NULL, NULL); +} + +static const RoutineDescriptor gLegacyTimerDesc = BUILD_ROUTINE_DESCRIPTOR(uppTimerProcInfo, legacyTimerCB); +static const TimerUPP gLegacyTimerProc = (TimerUPP) &gLegacyTimerDesc; +static int gTimerInstalled; + +static OSStatus ScheduleVBLTimer(void) +{ + if (!gTimerInstalled) { + BlockZero(&gLegacyTimer, sizeof(gLegacyTimer)); + gLegacyTimer.tmAddr = gLegacyTimerProc; + gLegacyTimer.qLink = (QElemPtr)'eada'; + InsXTime((QElemPtr)&gLegacyTimer); + gTimerInstalled = true; + } + PrimeTime((QElemPtr)&gLegacyTimer, TIMER_DURATION); + return noErr; +} + +#else + +static OSStatus ScheduleVBLTimer(void) +{ + AbsoluteTime target = AddDurationToAbsolute(TIMER_DURATION, UpTime()); + return SetInterruptTimer(&target, VBLTimerProc, NULL, &GLOBAL.VBLTimerID); +} + +#endif + +static OSStatus VBLTimerProc(void *p1, void *p2) +{ + static UInt32 VBcnt; + + GLOBAL.inInterrupt = 1; + + /* This can be called before the service is ready */ + if (GLOBAL.qdVBLInterrupt && GLOBAL.qdInterruptsEnable) + VSLDoInterruptService(GLOBAL.qdVBLInterrupt); + + /* Reschedule */ + ScheduleVBLTimer(); + + GLOBAL.inInterrupt = 0; +} + +#ifdef USE_PCI_IRQ +static InterruptMemberNumber PCIInterruptHandler(InterruptSetMember ISTmember, + void *refCon, UInt32 theIntCount) +{ + UInt32 reg; + + reg = ExtReadL(2); + if (!(reg & 1)) + return kIsrIsNotComplete; + if (GLOBAL.qdVBLInterrupt && GLOBAL.qdInterruptsEnable) + VSLDoInterruptService(GLOBAL.qdVBLInterrupt); + ExtWriteL(2, 3); + return kIsrIsComplete; +} +#endif + + +OSStatus QemuVga_Init(void) +{ + UInt16 id, i; + UInt32 mem, width, height, depth; + Boolean modeFound = false; + struct vMode *v; + + lprintf("First MMIO read...\n"); + id = DispiReadW(VBE_DISPI_INDEX_ID); + mem = DispiReadW(VBE_DISPI_INDEX_VIDEO_MEMORY_64K); + mem <<= 16; + lprintf("DISPI_ID=%04x VMEM=%d Mb\n", id, mem >> 20); + if ((id & 0xfff0) != VBE_DISPI_ID0) { + lprintf("Unsupported ID !\n"); + return controlErr; + } + if (mem > GLOBAL.boardFBMappedSize) + mem = GLOBAL.boardFBMappedSize; + GLOBAL.vramSize = mem; + + // XXX Add endian control regs + + width = DispiReadW(VBE_DISPI_INDEX_XRES); + height = DispiReadW(VBE_DISPI_INDEX_YRES); + depth = DispiReadW(VBE_DISPI_INDEX_BPP); + lprintf("Current setting: %dx%dx%d\n", width, height, depth); + + GLOBAL.depth = GLOBAL.bootDepth = depth; + GLOBAL.numModes = QemuVga_ReadEdidModes(); + lprintf("Number of modes: %d\n", GLOBAL.numModes); + + for (i = 0, v = vModes; v != NULL; v = v->next, i++) { + if (width == v->mode->width && height == v->mode->height) { + modeFound = true; + break; + } + } + + if (!modeFound) { + lprintf("Not found in list ! using default.\n"); + i = 0; + } else { + lprintf("Using mode: %d\n", i); + } + GLOBAL.bootMode = i; + + QemuVga_SetMode(GLOBAL.bootMode, depth, 0); + +#ifdef USE_PCI_IRQ + if (SetupPCIInterrupt(&GLOBAL.deviceEntry, &GLOBAL.irqInfo, + PCIInterruptHandler, NULL) == noErr) + GLOBAL.hasPCIInterrupt = true; + else +#else + GLOBAL.hasPCIInterrupt = false; +#endif + return noErr; +} + +OSStatus QemuVga_Open(void) +{ + lprintf("QemuVga v1.00\n"); + + GLOBAL.isOpen = true; + + if (GLOBAL.hasPCIInterrupt) { + QemuVga_EnableInterrupts(); + lprintf("VBL registered using PCI interrupts\n"); + } else { + /* Schedule the timer now if timers are supported. They aren't on OS X + * in which case we must not create the VSL service, otherwise OS X will expect + * a VBL and fail to update the cursor when not getting one. + */ + lprintf("Testing using timer to simulate VBL..\n"); + GLOBAL.hasTimer = (ScheduleVBLTimer() == noErr); + GLOBAL.qdInterruptsEnable = GLOBAL.hasTimer; + + if (GLOBAL.hasTimer) + lprintf("Using timer to simulate VBL.\n"); + else + lprintf("No timer service (OS X ?), VBL not registered.\n"); + + } + + /* Create VBL if we have a PCI interrupt or timer works */ + if (GLOBAL.hasPCIInterrupt || GLOBAL.hasTimer) + VSLNewInterruptService(&GLOBAL.deviceEntry, kVBLInterruptServiceType, &GLOBAL.qdVBLInterrupt); + + return noErr; +} + +OSStatus QemuVga_Close(void) +{ + lprintf("Closing Driver...\n"); + + GLOBAL.isOpen = false; + + QemuVga_DisableInterrupts(); + if (GLOBAL.qdVBLInterrupt) + VSLDisposeInterruptService( GLOBAL.qdVBLInterrupt ); + GLOBAL.qdVBLInterrupt = NULL; + + return noErr; +} + +OSStatus QemuVga_Exit(void) +{ + QemuVga_Close(); + + return noErr; +} + +void QemuVga_EnableInterrupts(void) +{ + GLOBAL.qdInterruptsEnable = true; + if (GLOBAL.hasTimer) + ScheduleVBLTimer(); + else if (GLOBAL.hasPCIInterrupt) { + GLOBAL.irqInfo.enableFunction(GLOBAL.irqInfo.interruptSetMember, GLOBAL.irqInfo.refCon); + ExtWriteL(2, 3); + } +} + +void QemuVga_DisableInterrupts(void) +{ + AbsoluteTime remaining; + + GLOBAL.qdInterruptsEnable = false; + if (GLOBAL.hasTimer) + CancelTimer(GLOBAL.VBLTimerID, &remaining); + else if (GLOBAL.hasPCIInterrupt) { + ExtWriteL(2, 1); + GLOBAL.irqInfo.disableFunction(GLOBAL.irqInfo.interruptSetMember, GLOBAL.irqInfo.refCon); + } +} + +OSStatus QemuVga_SetColorEntry(UInt32 index, RGBColor *color) +{ + //lprintf("SetColorEntry %d, %x %x %x\n", index, color->red, color->green, color->blue); + VgaWriteB(0x3c8, index); + VgaWriteB(0x3c9, color->red >> 8); + VgaWriteB(0x3c9, color->green >> 8); + VgaWriteB(0x3c9, color->blue >> 8); + return noErr; +} + +OSStatus QemuVga_GetColorEntry(UInt32 index, RGBColor *color) +{ + UInt32 r,g,b; + + VgaWriteB(0x3c7, index); + r = VgaReadB(0x3c9); + g = VgaReadB(0x3c9); + b = VgaReadB(0x3c9); + color->red = (r << 8) | r; + color->green = (g << 8) | g; + color->blue = (b << 8) | b; + + return noErr; +} + +OSStatus QemuVga_GetModeInfo(UInt32 index, UInt32 *width, UInt32 *height) +{ + if (index >= GLOBAL.numModes) + return paramErr; + if (width) + *width = getVMode(index)->width; + if (height) + *height = getVMode(index)->height; + return noErr; +} + +OSStatus QemuVga_GetModePages(UInt32 index, UInt32 depth, + UInt32 *pageSize, UInt32 *pageCount) +{ + UInt32 width, height, pBytes; + + if (index >= GLOBAL.numModes) + return paramErr; + width = getVMode(index)->width; + height = getVMode(index)->height; + pBytes = width * ((depth + 7) / 8) * height; + if (pageSize) + *pageSize = pBytes; + if (pageCount) { + if (pBytes <= (GLOBAL.boardFBMappedSize / 2)) + *pageCount = 2; + else + *pageCount = 1; + } + return noErr; +} + +OSStatus QemuVga_SetMode(UInt32 mode, UInt32 depth, UInt32 page) +{ + UInt32 width, height; + UInt32 pageSize, numPages; + + if (mode >= GLOBAL.numModes) + return paramErr; + + width = getVMode(mode)->width; + height = getVMode(mode)->height; + QemuVga_GetModePages(mode, depth, &pageSize, &numPages); + lprintf("Set Mode: %dx%dx%d has %d pages\n", width, height, depth, numPages); + if (page >= numPages) + return paramErr; + + DispiWriteW(VBE_DISPI_INDEX_ENABLE, 0); + DispiWriteW(VBE_DISPI_INDEX_BPP, depth); + DispiWriteW(VBE_DISPI_INDEX_XRES, width); + DispiWriteW(VBE_DISPI_INDEX_YRES, height); + DispiWriteW(VBE_DISPI_INDEX_BANK, 0); + DispiWriteW(VBE_DISPI_INDEX_VIRT_WIDTH, width); + DispiWriteW(VBE_DISPI_INDEX_VIRT_HEIGHT, height * numPages); + DispiWriteW(VBE_DISPI_INDEX_X_OFFSET, 0); + DispiWriteW(VBE_DISPI_INDEX_Y_OFFSET, height * page); + DispiWriteW(VBE_DISPI_INDEX_ENABLE, VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED | VBE_DISPI_8BIT_DAC); + GLOBAL.curMode = mode; + GLOBAL.depth = depth; + GLOBAL.curPage = page; + GLOBAL.curBaseAddress = FB_START + page * pageSize; + + return noErr; +} + +OSStatus QemuVga_Blank(Boolean blank) +{ + /* We use the AR Index VGA register which is a flip flop + * so we need to ensure we write twice. We use a non-existing + * index so that the second write is dropped. + */ + if (blank) { + VgaWriteB(0x3c0, 0x1f); + VgaWriteB(0x3c0, 0x1f); + } else { + VgaWriteB(0x3c0, 0x3f); + VgaWriteB(0x3c0, 0x3f); + } + GLOBAL.blanked = blank; +} diff --git a/roms/QemuMacDrivers/QemuVGADriver/src/QemuVga.h b/roms/QemuMacDrivers/QemuVGADriver/src/QemuVga.h new file mode 100644 index 000000000..f070bb72a --- /dev/null +++ b/roms/QemuMacDrivers/QemuVGADriver/src/QemuVga.h @@ -0,0 +1,89 @@ +#ifndef __QEMU_VGA_H__ +#define __QEMU_VGA_H__ + +/* This must be enabled for the MacOS X version of the timer otherwise + * we don't know if the call failed and don't back off to non-VBL ops + */ +#define USE_DSL_TIMER + +/* Pseudo VBL timer duration in ms */ +#define TIMER_DURATION 30 + +/* Enable use of the PCI IRQ as VBL using non-upstream QEMU VGA + * extensions + */ +#undef USE_PCI_IRQ + +/* --- Qemu/Bochs special registers --- */ + +#define VBE_DISPI_IOPORT_INDEX 0x01CE +#define VBE_DISPI_IOPORT_DATA 0x01CF + +#define VBE_DISPI_INDEX_ID 0x0 +#define VBE_DISPI_INDEX_XRES 0x1 +#define VBE_DISPI_INDEX_YRES 0x2 +#define VBE_DISPI_INDEX_BPP 0x3 +#define VBE_DISPI_INDEX_ENABLE 0x4 +#define VBE_DISPI_INDEX_BANK 0x5 +#define VBE_DISPI_INDEX_VIRT_WIDTH 0x6 +#define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7 +#define VBE_DISPI_INDEX_X_OFFSET 0x8 +#define VBE_DISPI_INDEX_Y_OFFSET 0x9 +#define VBE_DISPI_INDEX_VIDEO_MEMORY_64K 0xa + +#define VBE_DISPI_ID0 0xB0C0 +#define VBE_DISPI_ID1 0xB0C1 +#define VBE_DISPI_ID2 0xB0C2 +#define VBE_DISPI_ID3 0xB0C3 +#define VBE_DISPI_ID4 0xB0C4 +#define VBE_DISPI_ID5 0xB0C5 + +#define VBE_DISPI_DISABLED 0x00 +#define VBE_DISPI_ENABLED 0x01 +#define VBE_DISPI_GETCAPS 0x02 +#define VBE_DISPI_8BIT_DAC 0x20 +#define VBE_DISPI_LFB_ENABLED 0x40 +#define VBE_DISPI_NOCLEARMEM 0x80 + +/* --- VModes */ + +struct _vMode { + UInt32 width; + UInt32 height; +}; + +struct vMode { + struct vMode *next; + struct _vMode *mode; +}; + +extern struct vMode *vModes; +extern struct _vMode defaultVModes[]; +extern struct _vMode *getVMode(UInt16 idx); + +/* --- Internal APIs */ + +extern OSStatus QemuVga_Init(); +extern OSStatus QemuVga_Exit(); + +extern OSStatus QemuVga_Open(); +extern OSStatus QemuVga_Close(); + +extern void QemuVga_EnableInterrupts(void); +extern void QemuVga_DisableInterrupts(void); + +extern UInt16 QemuVga_ReadEdidModes(void); + +extern OSStatus QemuVga_SetDepth(UInt32 bpp); + +extern OSStatus QemuVga_SetColorEntry(UInt32 index, RGBColor *color); +extern OSStatus QemuVga_GetColorEntry(UInt32 index, RGBColor *color); + +extern OSStatus QemuVga_GetModePages(UInt32 index, UInt32 depth, + UInt32 *pageSize, UInt32 *pageCount); +extern OSStatus QemuVga_GetModeInfo(UInt32 index, UInt32 *width, UInt32 *height); +extern OSStatus QemuVga_SetMode(UInt32 modeIndex, UInt32 depth, UInt32 page); + +extern OSStatus QemuVga_Blank(Boolean blank); + +#endif diff --git a/roms/QemuMacDrivers/QemuVGADriver/src/VideoDriver.exp b/roms/QemuMacDrivers/QemuVGADriver/src/VideoDriver.exp new file mode 100644 index 000000000..0a102ee95 --- /dev/null +++ b/roms/QemuMacDrivers/QemuVGADriver/src/VideoDriver.exp @@ -0,0 +1,2 @@ +TheDriverDescription +DoDriverIO diff --git a/roms/QemuMacDrivers/QemuVGADriver/src/VideoDriverPrivate.h b/roms/QemuMacDrivers/QemuVGADriver/src/VideoDriverPrivate.h new file mode 100644 index 000000000..47a95a641 --- /dev/null +++ b/roms/QemuMacDrivers/QemuVGADriver/src/VideoDriverPrivate.h @@ -0,0 +1,85 @@ +#ifndef __VideoDriverPrivate_H__ +#define __VideoDriverPrivate_H__ + +#pragma internal off + +#include +#include +#include +#include +#include +#include + +#include "MacDriverUtils.h" + +#ifndef FALSE +#define TRUE 1 +#define FALSE 0 +#endif + +#define QEMU_PCI_VIDEO_VENDOR_ID 0x1234 +#define QEMU_PCI_VIDEO_DEVICE_ID 0x1111 +#define QEMU_PCI_VIDEO_NAME "\pQEMU,VGA" +#define QEMU_PCI_VIDEO_PNAME "\p.Display_Video_QemuVGA" + +#define QEMU_PCI_VIDEO_BASE_REG 0x10 +#define QEMU_PCI_VIDEO_MMIO_REG 0x18 + +#define kDriverGlobalsPropertyName "GLOBALS" +#define kDriverFailTextPropertyName "FAILURE" +#define kDriverFailCodePropertyName "FAIL-CODE" + + +/* + * Our global storage is defined by this structure. This is not a requirement of the + * driver environment, but it collects globals into a coherent structure for debugging. + */ +struct DriverGlobal { + DriverRefNum refNum; /* Driver refNum for PB... */ + RegEntryID deviceEntry; /* Name Registry Entry ID */ + LogicalAddress boardFBAddress; + ByteCount boardFBMappedSize; + LogicalAddress boardRegAddress; + ByteCount boardRegMappedSize; + + volatile Boolean inInterrupt; + + /* Common globals */ + UInt32 openCount; + + /* Frame buffer configuration */ + Boolean qdInterruptsEnable; /* Enable VBLs for qd */ + Boolean qdLuminanceMapping; + + Boolean hasPCIInterrupt; + IRQInfo irqInfo; + + Boolean hasTimer; + InterruptServiceIDType qdVBLInterrupt; + TimerID VBLTimerID; + + Boolean isOpen; + + UInt32 vramSize; + UInt32 depth; + UInt32 bootDepth; + UInt32 bootMode; + UInt32 curMode; + UInt32 numModes; + UInt32 curPage; + LogicalAddress curBaseAddress; + Boolean blanked; +}; +typedef struct DriverGlobal DriverGlobal, *DriverGlobalPtr; + +/* + * Globals and functions + */ +extern DriverGlobal gDriverGlobal; /* All interesting globals */ +#define GLOBAL (gDriverGlobal) /* GLOBAL.field for references */ +extern DriverDescription TheDriverDescription; /* Exported to the universe */ + +#define FB_START ((char*)GLOBAL.boardFBAddress) +#define CHECK_OPEN( error ) if( !GLOBAL.isOpen ) return (error) + +#endif diff --git a/roms/QemuMacDrivers/QemuVGADriver/src/VideoDriverPrototypes.h b/roms/QemuMacDrivers/QemuVGADriver/src/VideoDriverPrototypes.h new file mode 100755 index 000000000..682671a0c --- /dev/null +++ b/roms/QemuMacDrivers/QemuVGADriver/src/VideoDriverPrototypes.h @@ -0,0 +1,100 @@ +#ifndef __VideoDriverPrototypes_H__ +#define __VideoDriverPrototypes_H__ + +#include +#include "logger.h" + +/* + * The Driver Manager calls DoDriverIO to perform I/O. + */ + +OSStatus +DoDriverIO( AddressSpaceID addressSpaceID, + IOCommandID ioCommandID, + IOCommandContents ioCommandContents, + IOCommandCode ioCommandCode, + IOCommandKind ioCommandKind); + +#include "MacDriverUtils.h" + +/* + * Prototypes for the specific driver handlers. These do real work. + */ +OSStatus +DriverInitializeCmd( AddressSpaceID addressSpaceID, + DriverInitInfoPtr driverInitInfoPtr); + +OSStatus +DriverFinalizeCmd( DriverFinalInfoPtr driverFinalInfoPtr); + +OSStatus +DriverSupersededCmd( DriverSupersededInfoPtr driverSupersededInfoPtr, + Boolean calledFromFinalize); + +OSStatus +DriverReplaceCmd( AddressSpaceID addressSpaceID, + DriverReplaceInfoPtr driverReplaceInfoPtr); + +OSStatus +DriverOpenCmd( AddressSpaceID addressSpaceID, + ParmBlkPtr pb); + +OSStatus +DriverCloseCmd( ParmBlkPtr pb); + +OSStatus +DriverControlCmd( AddressSpaceID addressSpaceID, + IOCommandID ioCommandID, + IOCommandKind ioCommandKind, + CntrlParam *pb); + +OSStatus +DriverStatusCmd( IOCommandID ioCommandID, + IOCommandKind ioCommandKind, + CntrlParam *pb); + +OSStatus +DriverKillIOCmd( ParmBlkPtr pb); + +OSStatus +DriverReadCmd( + AddressSpaceID addressSpaceID, + IOCommandID ioCommandID, + IOCommandKind ioCommandKind, + ParmBlkPtr pb); + +OSStatus +DriverWriteCmd( AddressSpaceID addressSpaceID, + IOCommandID ioCommandID, + IOCommandKind ioCommandKind, + ParmBlkPtr pb); + +/* .___________________________________________________________________________________. + | Driver Gestalt handler -- called from the PBStatus handler. | + .___________________________________________________________________________________. + */ +OSStatus +DriverGestaltHandler( CntrlParam* pb); + + +/* .___________________________________________________________________________________. + | Utitlity function to clear a block of memory. | + .___________________________________________________________________________________. + */ +#ifndef CLEAR +#define CLEAR(what) BlockZero((char*)&what, sizeof what) +#endif + +/* + * This uses the ANSI-C string concatenate and "stringize" operations. + */ +#define Trace(what) lprintf("Trace: %s\n", #what) + +#if 0 +static void +CheckStatus( OSStatus value, + char* message) +{} +#endif + +#endif \ No newline at end of file -- cgit 1.2.3-korg