Chameleon

Chameleon Commit Details

Date:2010-08-18 12:08:03 (10 years 3 months ago)
Author:Kabyl
Commit:383
Parents: 382
Message:Added Booter message Logging, dump tool to be added later
Changes:
M/trunk/i386/libsaio/console.c
M/trunk/i386/boot2/boot.c
M/trunk/i386/libsaio/cpu.c
M/trunk/CHANGES
M/trunk/i386/libsaio/saio_internal.h

File differences

trunk/CHANGES
1
12
23
34
- Added Booter message Logging (":/boot-log" ioreg property)
- Removed obsolete -f option, use -x instead
- Removed -x32 option, use arch=i386 instead
- Added automatic SMBusspeed detection for lga1156 core i5/7 cpus
trunk/i386/libsaio/console.c
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
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
55117
56118
57119
......
103165
104166
105167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
106185
107186
108187
......
111190
112191
113192
193
114194
115195
116
117196
118197
119198
120199
121
122200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
123219
124220
125221
bool gVerboseMode;
bool gErrors;
/* Kabyl: BooterLog */
#define BOOTER_LOG_SIZE(64 * 1024)
#define SAFE_LOG_SIZE80
char *msgbuf = 0;
char *cursor = 0;
struct putc_info {
char * str;
char * last_str;
};
static void sputc(int c, struct putc_info * pi)
{
if (pi->last_str)
if (pi->str == pi->last_str)
{
*(pi->str) = '\0';
return;
}
*(pi->str)++ = c;
}
void initBooterLog(void)
{
msgbuf = malloc(BOOTER_LOG_SIZE);
bzero(msgbuf, BOOTER_LOG_SIZE);
cursor = msgbuf;
}
void msglog(const char * fmt, ...)
{
va_list ap;
struct putc_info pi;
if (!msgbuf)
return;
if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE)))
return;
va_start(ap, fmt);
pi.str = cursor;
pi.last_str = 0;
prf(fmt, ap, sputc, &pi);
*pi.str = '\0';
va_end(ap);
cursor += (pi.str - cursor);
}
void setupBooterLog(void)
{
if (!msgbuf)
return;
Node *node = DT__FindNode("/", false);
if (node)
DT__AddProperty(node, "boot-log", strlen((char *)msgbuf) + 1, msgbuf);
}
/* Kabyl: !BooterLog */
/*
* write one character to console
*/
prf(fmt, ap, putchar, 0);
else
vprf(fmt, ap);
{
/* Kabyl: BooterLog */
struct putc_info pi;
if (!msgbuf)
return 0;
if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE)))
return 0;
pi.str = cursor;
pi.last_str = 0;
prf(fmt, ap, sputc, &pi);
*pi.str = '\0';
cursor += (pi.str - cursor);
}
va_end(ap);
return 0;
}
{
va_list ap;
va_start(ap, fmt);
if (gVerboseMode)
{
va_start(ap, fmt);
if (bootArgs->Video.v_display == VGA_TEXT_MODE)
prf(fmt, ap, putchar, 0);
else
vprf(fmt, ap);
va_end(ap);
}
{
/* Kabyl: BooterLog */
struct putc_info pi;
if (!msgbuf)
return 0;
if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE)))
return 0;
pi.str = cursor;
pi.last_str = 0;
prf(fmt, ap, sputc, &pi);
*pi.str = '\0';
cursor += (pi.str - cursor);
}
va_end(ap);
return(0);
}
trunk/i386/libsaio/cpu.c
1414
1515
1616
17
17
1818
1919
2020
......
297297
298298
299299
300
300
301301
302302
303303
......
307307
308308
309309
310
310311
311312
312313
#if DEBUG_CPU
#define DBG(x...)printf(x)
#else
#define DBG(x...)
#define DBG(x...)msglog(x)
#endif
/*
p->CPU.TSCFrequency = tscFrequency;
p->CPU.FSBFrequency = fsbFrequency;
p->CPU.CPUFrequency = cpuFrequency;
#if DEBUG_CPU
DBG("CPU: Vendor/Model/ExtModel: 0x%x/0x%x/0x%x\n", p->CPU.Vendor, p->CPU.Model, p->CPU.ExtModel);
DBG("CPU: Family/ExtFamily: 0x%x/0x%x\n", p->CPU.Family, p->CPU.ExtFamily);
DBG("CPU: MaxCoef/CurrCoef: 0x%x/0x%x\n", p->CPU.MaxCoef, p->CPU.CurrCoef);
DBG("CPU: CPUFreq: %dMHz\n", p->CPU.CPUFrequency / 1000000);
DBG("CPU: NoCores/NoThreads: %d/%d\n", p->CPU.NoCores, p->CPU.NoThreads);
DBG("CPU: Features: 0x%08x\n", p->CPU.Features);
#if DEBUG_CPU
pause();
#endif
}
trunk/i386/libsaio/saio_internal.h
8989
9090
9191
92
93
9294
9395
96
9497
9598
9699
/* console.c */
extern bool gVerboseMode;
extern bool gErrors;
extern void initBooterLog(void);
extern void setupBooterLog(void);
extern void putchar(int ch);
extern int getchar(void);
extern void msglog(const char * format, ...);
extern int printf(const char *format, ...);
extern int error(const char *format, ...);
extern int verbose(const char *format, ...);
trunk/i386/boot2/boot.c
193193
194194
195195
196
197
196198
197199
198200
......
249251
250252
251253
254
255
252256
253257
254258
else
drawBootGraphics();
setupBooterLog();
finalizeBootStruct();
// Jump to kernel's entry point. There's no going back now.
// Initialize boot info structure.
initKernBootStruct();
initBooterLog();
// Setup VGA text mode.
// Not sure if it is safe to call setVideoMode() before the
// config table has been loaded. Call video_mode() instead.

Archive Download the corresponding diff file

Revision: 383