plan 9 kernel history: overview | file list | diff list

2000/1018/pc/apm.c (diff list | history)

2000/1018/sys/src/9/pc/apm.c:1,52000/1019/sys/src/9/pc/apm.c:1,12 (short | long | prev | next)
Bug fix: work around NEC Versa SX hardware issue. Comment edits.
rsc Fri Mar 4 12:44:25 2005
2000/1018    
/* 
 * Advanced Power Management 1.2 driver 
2000/1019    
 * Interface to Advanced Power Management 1.2 BIOS 
 * 
 * This is, in many ways, a giant hack, and when things settle down  
 * a bit and standardize, hopefully we can write a driver that deals 
 * more directly with the hardware and thus might be a bit cleaner. 
 *  
 * ACPI might be the answer, but at the moment this is simpler 
 * and more widespread. 
2000/1018    
 */ 
 
#include	"u.h" 
2000/1018/sys/src/9/pc/apm.c:39,442000/1019/sys/src/9/pc/apm.c:46,54
2000/1018    
 * type is 0 for system segment, 1 for code/data. 
 * 
 * clearly we know way too much about the memory unit. 
2000/1019    
 * however, knowing this much about the memory unit 
 * means that the memory unit need not know anything 
 * about us. 
2000/1018    
 * 
 * what a crock. 
 */ 
2000/1018/sys/src/9/pc/apm.c:67,792000/1019/sys/src/9/pc/apm.c:77,82
2000/1018    
	lgdt(ptr); 
} 
 
/* 
 * Must run before mmuinit, since we modify the GDT that 
 * we want the processor to inherit.  I think (but am not sure) 
 * that we could run after mmuinit on processor 0 and just 
 * modify m->gdt and then call lgdt() as mmuinit() does, 
 * but this is a bit simpler and safer. 
 */ 
static	ulong ax, cx, dx, di, ebx, esi; 
static Ureg apmu; 
static long 
2000/1018/sys/src/9/pc/apm.c:139,1442000/1019/sys/src/9/pc/apm.c:142,154
2000/1018    
		print("apm: missing register %s\n", s); 
		return; 
	} 
2000/1019    
 
	/* 
	 * The NEC Versa SX bios does not report the correct 16-bit code 
	 * segment length when loaded directly from mbr -> 9load (as compared 
	 * with going through ld.com).  We'll make both code segments 64k-1 bytes. 
	 */ 
	esi = 0xFFFFFFFF; 
2000/1018    
 
	/* 
	 * We are required by the BIOS to set up three consecutive segments, 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)