Index: branches/xZenu/src/arch/i386/libsaio/acpi.h =================================================================== --- branches/xZenu/src/arch/i386/libsaio/acpi.h (revision 1322) +++ branches/xZenu/src/arch/i386/libsaio/acpi.h (revision 1323) @@ -1,153 +0,0 @@ -#ifndef __LIBSAIO_ACPI_H -#define __LIBSAIO_ACPI_H - -#define ACPI_RANGE_START (0x0E0000) -#define ACPI_RANGE_END (0x0FFFFF) - -#define UINT64_LE_FROM_CHARS(a,b,c,d,e,f,g,h) \ -( ((uint64_t)h << 56) \ -| ((uint64_t)g << 48) \ -| ((uint64_t)f << 40) \ -| ((uint64_t)e << 32) \ -| ((uint64_t)d << 24) \ -| ((uint64_t)c << 16) \ -| ((uint64_t)b << 8) \ -| ((uint64_t)a << 0) \ -) - -#define ACPI_SIGNATURE_UINT64_LE UINT64_LE_FROM_CHARS('R','S','D',' ','P','T','R',' ') - -/* Per ACPI 3.0a spec */ - -// TODO Migrate -struct acpi_2_rsdp { - char Signature[8]; - uint8_t Checksum; - char OEMID[6]; - uint8_t Revision; - uint32_t RsdtAddress; - uint32_t Length; - uint64_t XsdtAddress; - uint8_t ExtendedChecksum; - char Reserved[3]; -} __attribute__((packed)); - -// TODO Migrate -struct acpi_2_rsdt { - char Signature[4]; - uint32_t Length; - uint8_t Revision; - uint8_t Checksum; - char OEMID[6]; - char OEMTableId[8]; - uint32_t OEMRevision; - uint32_t CreatorId; - uint32_t CreatorRevision; -} __attribute__((packed)); - -// TODO Migrate -struct acpi_2_xsdt { - char Signature[4]; - uint32_t Length; - uint8_t Revision; - uint8_t Checksum; - char OEMID[6]; - char OEMTableId[8]; - uint32_t OEMRevision; - uint32_t CreatorId; - uint32_t CreatorRevision; -} __attribute__((packed)); - -// TODO Migrate -struct acpi_2_ssdt { - char Signature[4]; - uint32_t Length; - uint8_t Revision; - uint8_t Checksum; - char OEMID[6]; - char OEMTableId[8]; - uint32_t OEMRevision; - uint32_t CreatorId; - uint32_t CreatorRevision; -} __attribute__((packed)); - -// TODO Migrate -struct acpi_2_dsdt { - char Signature[4]; - uint32_t Length; - uint8_t Revision; - uint8_t Checksum; - char OEMID[6]; - char OEMTableId[8]; - uint32_t OEMRevision; - uint32_t CreatorId; - uint32_t CreatorRevision; -} __attribute__((packed)); - -// TODO Migrate -struct acpi_2_fadt { - char Signature[4]; - uint32_t Length; - uint8_t Revision; - uint8_t Checksum; - char OEMID[6]; - char OEMTableId[8]; - uint32_t OEMRevision; - uint32_t CreatorId; - uint32_t CreatorRevision; - uint32_t FIRMWARE_CTRL; - uint32_t DSDT; - uint8_t Model; // JrCs - uint8_t PM_Profile; // JrCs - uint16_t SCI_Interrupt; - uint32_t SMI_Command_Port; - uint8_t ACPI_Enable; - uint8_t ACPI_Disable; - uint8_t S4BIOS_Command; - uint8_t PState_Control; - uint32_t PM1A_Event_Block_Address; - uint32_t PM1B_Event_Block_Address; - uint32_t PM1A_Control_Block_Address; - uint32_t PM1B_Control_Block_Address; - uint32_t PM2_Control_Block_Address; - uint32_t PM_Timer_Block_Address; - uint32_t GPE0_Block_Address; - uint32_t GPE1_Block_Address; - uint8_t PM1_Event_Block_Length; - uint8_t PM1_Control_Block_Length; - uint8_t PM2_Control_Block_Length; - uint8_t PM_Timer_Block_Length; - uint8_t GPE0_Block_Length; - uint8_t GPE1_Block_Length; - uint8_t GPE1_Base_Offset; - uint8_t CST_Support; - uint16_t C2_Latency; - uint16_t C3_Latency; - uint16_t CPU_Cache_Size; - uint16_t Cache_Flush_Stride; - uint8_t Duty_Cycle_Offset; - uint8_t Duty_Cycle_Width; - uint8_t RTC_Day_Alarm_Index; - uint8_t RTC_Month_Alarm_Index; - uint8_t RTC_Century_Index; - uint16_t Boot_Flags; - uint8_t Reserved0; -/* Begin Asere */ - //Reset Fix - uint32_t Flags; - uint8_t Reset_SpaceID; - uint8_t Reset_BitWidth; - uint8_t Reset_BitOffset; - uint8_t Reset_AccessWidth; - uint64_t Reset_Address; - uint8_t Reset_Value; - uint8_t Reserved[3]; - - uint64_t X_FIRMWARE_CTRL; - uint64_t X_DSDT; -/* End Asere */ - /*We absolutely don't care about theese fields*/ - uint8_t notimp2[96]; -} __attribute__((packed)); - -#endif /* !__LIBSAIO_ACPI_H */ Index: branches/xZenu/src/arch/i386/libsaio/console.c =================================================================== --- branches/xZenu/src/arch/i386/libsaio/console.c (revision 1322) +++ branches/xZenu/src/arch/i386/libsaio/console.c (revision 1323) @@ -45,8 +45,8 @@ */ #include "libsaio.h" +#include - /* * write one character to console */ @@ -68,33 +68,22 @@ return c; } -int getc() +// Read and echo a character from console. This doesn't echo backspace +// since that screws up higher level handling + +int getchar() { int c = bgetc(); - + if ((c & 0xff) == 0) return c; else return (c & 0xff); } -// Read and echo a character from console. This doesn't echo backspace -// since that screws up higher level handling - -int getchar() -{ - register int c = getc(); - -// if ( c == '\r' ) c = '\n'; - -// if ( c >= ' ' && c < 0x7f) putchar(c); - - return (c); -} - /** Print a "Press a key to continue..." message and wait for a key press. */ void pause() { printf("Press a key to continue...\n"); - getchar(); // replace getchar() by pause() ?? were useful...? + getchar(); } Index: branches/xZenu/src/arch/i386/libsaio/saio_types.h =================================================================== --- branches/xZenu/src/arch/i386/libsaio/saio_types.h (revision 1322) +++ branches/xZenu/src/arch/i386/libsaio/saio_types.h (revision 1323) @@ -52,36 +52,6 @@ int totalDrives; }; -struct Tag { - long type; - char *string; - long offset; - struct Tag *tag; - struct Tag *tagNext; -}; -typedef struct Tag Tag, *TagPtr; - - -typedef struct FinderInfo { - unsigned char data[16]; -} FinderInfo; - -struct BootVolume; -typedef struct BootVolume * BVRef; -typedef struct BootVolume * CICell; - -typedef long (*FSInit)(CICell ih); -typedef long (*FSLoadFile)(CICell ih, char * filePath); -typedef long (*FSReadFile)(CICell ih, char *filePath, void *base, uint64_t offset, uint64_t length); -typedef long (*FSGetFileBlock)(CICell ih, char *filePath, unsigned long long *firstBlock); -typedef long (*FSGetDirEntry)(CICell ih, char * dirPath, long long * dirIndex, - char ** name, long * flags, long * time, - FinderInfo * finderInfo, long * infoValid); -typedef long (*FSGetUUID)(CICell ih, char *uuidStr); -typedef void (*BVGetDescription)(CICell ih, char * str, long strMaxLen); -// Can be just pointed to free or a special free function -typedef void (*BVFree)(CICell ih); - struct iob { unsigned int i_flgs; /* see F_* below */ unsigned int i_offset; /* seek byte offset in file */ @@ -98,12 +68,6 @@ #define F_SSI 0x40 /* set skip sector inhibit */ #define F_MEM 0x80 /* memory instead of file or device */ -struct dirstuff { - char * dir_path; /* directory path */ - long long dir_index; /* directory entry index */ - BVRef dir_bvr; /* volume reference */ -}; - #define BVSTRLEN 32 enum { Index: branches/xZenu/src/arch/i386/libsaio/saio_internal.h =================================================================== --- branches/xZenu/src/arch/i386/libsaio/saio_internal.h (revision 1322) +++ branches/xZenu/src/arch/i386/libsaio/saio_internal.h (revision 1323) @@ -32,7 +32,6 @@ extern void prot_to_real(void); extern void halt(void); extern void startprog(unsigned int address, void *arg); -//extern void loader(UInt32 code, UInt32 cmdptr); /* bios.s */ extern void bios(biosBuf_t *bb); @@ -72,73 +71,9 @@ extern void sleep(int n); /* console.c */ -extern void initBooterLog(void); -extern void msglog(const char * format, ...); -extern void setupBooterLog(void); extern int putchar(int ch); extern int getchar(void); -extern int printf(const char *format, ...); -extern int error(const char *format, ...); -extern int verbose(const char *format, ...); -extern void stop(const char *format, ...); -//Azi: replace getc/getchar with ? console.c extern void pause(); -/* load.c */ -extern long ThinFatFile(void **binary, unsigned long *length); -extern long DecodeMachO(void *binary, entry_t *rentry, char **raddr, int *rsize); -/* memory.c */ -long AllocateKernelMemory( long inSize ); -long AllocateMemoryRange(char * rangeName, long start, long length, long type); - -/* sys.c */ -extern BVRef getBootVolumeRef( const char * path, const char ** outPath ); -extern long LoadVolumeFile(BVRef bvr, const char *fileSpec); -extern long LoadFile(const char *fileSpec); -extern long ReadFileAtOffset(const char * fileSpec, void *buffer, uint64_t offset, uint64_t length); -extern long LoadThinFatFile(const char *fileSpec, void **binary); -extern long GetDirEntry(const char *dirSpec, long long *dirIndex, const char **name, - long *flags, long *time); -extern long GetFileInfo(const char *dirSpec, const char *name, - long *flags, long *time); -extern long GetFileBlock(const char *fileSpec, unsigned long long *firstBlock); -extern long GetFSUUID(char *spec, char *uuidStr); -extern long CreateUUIDString(uint8_t uubytes[], int nbytes, char *uuidStr); -extern int openmem(char *buf, int len); -extern int open(const char *str, int how); -extern int open_bvdev(const char *bvd, const char *path, int flags); -extern int close(int fdesc); -extern int file_size(int fdesc); -extern int read(int fdesc, char *buf, int count); -extern int write(int fdesc, const char *buf, int count); -extern int writebyte(int fdesc, char value); -extern int writeint(int fdesc, int value); -extern int b_lseek(int fdesc, int addr, int ptr); -extern int tell(int fdesc); -extern const char * systemConfigDir(void); -extern struct dirstuff * opendir(const char *path); -extern struct dirstuff * vol_opendir(BVRef bvr, const char *path); -extern int closedir(struct dirstuff *dirp); -extern int readdir(struct dirstuff *dirp, const char **name, long *flags, long *time); -extern int readdir_ext(struct dirstuff * dirp, const char ** name, long * flags, - long * time, FinderInfo *finderInfo, long *infoValid); -extern void flushdev(void); -extern void scanBootVolumes(int biosdev, int *count); -extern void scanDisks(int biosdev, int *count); -extern BVRef selectBootVolume(BVRef chain); -extern void setRootVolume(BVRef volume); -extern void setBootGlobals(BVRef chain); -extern int getDeviceDescription(BVRef volume, char *str); - -extern int gBIOSDev; -extern int gBootFileType; -extern BVRef gBootVolume; -extern BVRef gBIOSBootVolume; - -// Function pointer to be filled in if ramdisks are available -extern int (*p_ramdiskReadBytes)( int biosdev, unsigned int blkno, - unsigned int byteoff, - unsigned int byteCount, void * buffer ); - #endif /* !__LIBSAIO_SAIO_INTERNAL_H */ Index: branches/xZenu/src/arch/i386/boot2/boot.c =================================================================== --- branches/xZenu/src/arch/i386/boot2/boot.c (revision 1322) +++ branches/xZenu/src/arch/i386/boot2/boot.c (revision 1323) @@ -94,16 +94,6 @@ } //========================================================================== -// This is the entrypoint from real. -void boot(int biosdev) -{ - initialize_runtime(); - // Enable A20 gate before accessing memory above 1Mb. - enableA20(); - common_boot(biosdev); -} - -//========================================================================== // The 'main' function for the booter. Called by boot0 when booting // from a block device, or by the network booter. // @@ -123,3 +113,13 @@ execute_hook("WorkLoop", (void*)loopCount++, 0, 0, 0); // Main work loop } } + +//========================================================================== +// This is the entrypoint from real. +void boot(int biosdev) +{ + initialize_runtime(); + // Enable A20 gate before accessing memory above 1Mb. + enableA20(); + common_boot(biosdev); +} Index: branches/xZenu/src/arch/i386/boot2/boot.h =================================================================== --- branches/xZenu/src/arch/i386/boot2/boot.h (revision 1322) +++ branches/xZenu/src/arch/i386/boot2/boot.h (revision 1323) @@ -31,105 +31,5 @@ #include -/* - * Keys used in system Boot.plist - */ -#define kGraphicsModeKey "Graphics Mode" -#define kTextModeKey "Text Mode" -#define kQuietBootKey "Quiet Boot" -#define kKernelFlagsKey "Kernel Flags" -#define karch "arch" /* boot.c */ -#define kProductVersion "ProductVersion" /* boot.c */ -#define kMKextCacheKey "MKext Cache" -#define kKernelNameKey "Kernel" -#define kKernelCacheKey "Kernel Cache" -#define kUseKernelCache "UseKernelCache" /* boot.c */ -#define kBootDeviceKey "Boot Device" -#define kTimeoutKey "Timeout" -#define kRootDeviceKey "rd" -#define kBootUUIDKey "boot-uuid" -#define kHelperRootUUIDKey "Root UUID" -#define kPlatformKey "platform" -#define kACPIKey "acpi" -#define kCDROMPromptKey "CD-ROM Prompt" -#define kCDROMOptionKey "CD-ROM Option Key" -#define kRescanPromptKey "Rescan Prompt" -#define kRescanKey "Rescan" -#define kScanSingleDriveKey "Scan Single Drive" -#define kInsantMenuKey "Instant Menu" -#define kDefaultKernel "mach_kernel" -#define kGUIKey "GUI" -#define kBootBannerKey "Boot Banner" -#define kWaitForKeypressKey "Wait" -#define kDSDT "DSDT" /* acpi_patcher.c */ -#define kDropSSDT "DropSSDT" /* acpi_patcher.c */ -#define kRestartFix "RestartFix" /* acpi_patcher.c */ -#define kGeneratePStates "GeneratePStates" /* acpi_patcher.c */ -#define kGenerateCStates "GenerateCStates" /* acpi_patcher.c */ -#define kEnableC2States "EnableC2State" /* acpi_patcher.c */ -#define kEnableC3States "EnableC3State" /* acpi_patcher.c */ -#define kEnableC4States "EnableC4State" /* acpi_patcher.c */ - -#define kWake "Wake" /* boot.c */ -#define kForceWake "ForceWake" /* boot.c */ -#define kWakeImage "WakeImage" /* boot.c */ - -#define kbusratio "busratio" /* cpu.c */ - -#define kDeviceProperties "device-properties" /* device_inject.c */ - -#define kHidePartition "Hide Partition" /* disk.c */ -#define kRenamePartition "Rename Partition" /* disk.c */ -#define kDefaultPartition "Default Partition" /* sys.c */ - -#define kSMBIOSKey "SMBIOS" /* fake_efi.c */ -#define kSMBIOSdefaults "SMBIOSdefaults" /* smbios_patcher.c */ -#define kSystemID "SystemId" /* fake_efi.c */ -#define kSystemType "SystemType" /* fake_efi.c */ - -#define kUseMemDetect "UseMemDetect" /* platform.c */ - -#define kPCIRootUID "PCIRootUID" /* pci_root.c */ - -#define kUseAtiROM "UseAtiROM" /* ati.c */ -#define kAtiConfig "AtiConfig" /* ati.c */ -#define kATYbinimage "ATYbinimage" /* ati.c */ - -#define kUseNvidiaROM "UseNvidiaROM" /* nvidia.c */ -#define kVBIOS "VBIOS" /* nvidia.c */ -#define kdcfg0 "display_0" /* nvidia.c */ -#define kdcfg1 "display_1" /* nvidia.c */ - -#define kEthernetBuiltIn "EthernetBuiltIn" /* pci_setup.c */ -#define kGraphicsEnabler "GraphicsEnabler" /* pci_setup.c */ -#define kForceHPET "ForceHPET" /* pci_setup.c */ - -#define kMD0Image "md0" /* ramdisk.h */ - -#define kUSBBusFix "USBBusFix" /* usb.c */ -#define kEHCIacquire "EHCIacquire" /* usb.c */ -#define kUHCIreset "UHCIreset" /* usb.c */ -#define kLegacyOff "USBLegacyOff" /* usb.c */ -#define kEHCIhard "EHCIhard" /* usb.c */ - -/* - * Flags to the booter or kernel - */ -#define kVerboseModeFlag "-v" -#define kSafeModeFlag "-x" -#define kIgnoreCachesFlag "-f" -#define kIgnoreBootFileFlag "-F" -#define kSingleUserModeFlag "-s" - -/* - * Booter behavior control - */ -#define kBootTimeout -1 -#define kCDBootTimeout 8 - -extern void initialize_runtime(); -extern void common_boot(int biosdev); - - #endif /* !__BOOT2_BOOT_H */