Specifications

216 AMD Geode™ GeodeROM Functional Specification
System Management Mode Software
32087C
Sample VSM Message Handler
unsigned char temp;
unsigned short Msg;
unsigned long Param[MAX_MSG_PARAM];
unsigned short VirtualRegs[10];
unsigned char Index;
do {
Msg = GET_NEXT_MSG(&Param);
switch (Msg) {
case MSG_INITIALIZE:
// Register as handler of Power Management virtual registers
SYS_REGISTER_EVENT(EVENT_VIRTUAL_REGISTER, VRC_PM, 0, 0);
break;
case MSG_EVENT:
switch (Param[0]) {
case EVENT_VIRTUAL_REGISTER:
Index = (unsigned char) Param[1];
if (Param[2] = = 0) { // I/O read
SET_AX(VirtualRegs[Index]);
} else { // I/O write
if (Index!= 0 && Index < 10)// Version register is Read-Only
VirtualRegs[Index] = (unsigned short) Param[3];
}
break;
} // end switch(Param[0])
break;
} // end switch(Msg)
} while (1);
15.8.1 Memory Model
VSMs run in real mode using the “tiny” mode (i.e., CS = DS = SS). There are descriptor fields in the VSM header, but these
are for use by the System Manager and should not be modified by the VSM. VSMs written in C must comply with the follow-
ing rules:
Must not have a main() routine
Must not use ‘C’ library functions (e.g. malloc, printf)
15.8.2 Initialization
VSA2 software initialization code scans the binary image on paragraph (16-byte) boundaries for the signature “VSM”. Each
signature marks the beginning of a VSM header. The VSA2 initialization code calls each VSM entry point with a
MSG_INITIALIZE message in the VSM’s message queue. In response to this message, the VSM performs its own module
specific initialization, including, but not limited to:
Data initialization
Registering events with the System Manager