Chameleon

Chameleon Commit Details

Date:2011-08-07 08:27:31 (9 years 3 months ago)
Author:Evan Lojewski
Commit:1323
Parents: 1322
Message:Cleanup i386 files
Changes:
D/branches/xZenu/src/arch/i386/libsaio/acpi.h
M/branches/xZenu/src/arch/i386/libsaio/console.c
M/branches/xZenu/src/arch/i386/libsaio/saio_types.h
M/branches/xZenu/src/arch/i386/boot2/boot.c
M/branches/xZenu/src/arch/i386/boot2/boot.h
M/branches/xZenu/src/arch/i386/libsaio/saio_internal.h

File differences

branches/xZenu/src/arch/i386/libsaio/acpi.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#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_tSCI_Interrupt;
uint32_tSMI_Command_Port;
uint8_tACPI_Enable;
uint8_tACPI_Disable;
uint8_tS4BIOS_Command;
uint8_tPState_Control;
uint32_tPM1A_Event_Block_Address;
uint32_tPM1B_Event_Block_Address;
uint32_tPM1A_Control_Block_Address;
uint32_tPM1B_Control_Block_Address;
uint32_tPM2_Control_Block_Address;
uint32_tPM_Timer_Block_Address;
uint32_tGPE0_Block_Address;
uint32_tGPE1_Block_Address;
uint8_tPM1_Event_Block_Length;
uint8_tPM1_Control_Block_Length;
uint8_tPM2_Control_Block_Length;
uint8_tPM_Timer_Block_Length;
uint8_tGPE0_Block_Length;
uint8_tGPE1_Block_Length;
uint8_tGPE1_Base_Offset;
uint8_tCST_Support;
uint16_tC2_Latency;
uint16_tC3_Latency;
uint16_tCPU_Cache_Size;
uint16_tCache_Flush_Stride;
uint8_tDuty_Cycle_Offset;
uint8_tDuty_Cycle_Width;
uint8_tRTC_Day_Alarm_Index;
uint8_tRTC_Month_Alarm_Index;
uint8_tRTC_Century_Index;
uint16_tBoot_Flags;
uint8_tReserved0;
/* 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_tnotimp2[96];
} __attribute__((packed));
#endif /* !__LIBSAIO_ACPI_H */
branches/xZenu/src/arch/i386/libsaio/console.c
4545
4646
4747
48
4849
49
5050
5151
5252
......
6868
6969
7070
71
71
72
73
74
7275
7376
74
77
7578
7679
7780
7881
7982
8083
81
82
83
84
85
86
87
88
89
90
91
92
93
94
9584
9685
9786
9887
99
88
10089
*/
#include "libsaio.h"
#include <stdio.h>
/*
* write one character to console
*/
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();
}
branches/xZenu/src/arch/i386/libsaio/saio_types.h
5252
5353
5454
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
8555
8656
8757
......
9868
9969
10070
101
102
103
104
105
106
10771
10872
10973
int totalDrives;
};
struct Tag {
longtype;
char *string;
longoffset;
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 */
#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 {
branches/xZenu/src/arch/i386/libsaio/saio_internal.h
3232
3333
3434
35
3635
3736
3837
......
7271
7372
7473
75
76
77
7874
7975
80
81
82
83
84
8576
8677
87
88
89
9078
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
14479
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);
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 */
branches/xZenu/src/arch/i386/boot2/boot.c
9494
9595
9696
97
98
99
100
101
102
103
104
105
106
10797
10898
10999
......
123113
124114
125115
116
117
118
119
120
121
122
123
124
125
}
//==========================================================================
// 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.
//
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);
}
branches/xZenu/src/arch/i386/boot2/boot.h
3131
3232
3333
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
6434
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
13535
#include <sys/types.h>
/*
* 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 */

Archive Download the corresponding diff file

Revision: 1323