Call FatalError() instead of ErrorF() in case the amdmsr(4) is not

available or an ioctl returns an error.  This properly terminates and
the X server and restores the text console instead of hanging in an
undefined screen mode.
This commit is contained in:
mbalmer
2008-06-18 06:29:41 +00:00
parent 5cf4e1c7ef
commit 53a4a3bc02

View File

@@ -33,7 +33,8 @@ _msr_open(void)
msrfd = open(_PATH_MSRDEV, O_RDWR);
#endif
if (msrfd == -1)
ErrorF("Unable to open %s: %s\n", _PATH_MSRDEV, strerror(errno));
FatalError("Unable to open %s: %s\n", _PATH_MSRDEV,
strerror(errno));
}
return msrfd;
@@ -51,7 +52,8 @@ GeodeReadMSR(unsigned long addr, unsigned long *lo, unsigned long *hi)
req.addr = addr;
if (ioctl(fd, RDMSR, &req) == -1)
ErrorF("Unable to RDMSR %d\n", errno);
FatalError("Unable to read MSR at address %0x06x: %s\n", addr,
strerror(errno));
*hi = req.val >> 32;
*lo = req.val & 0xffffffff;
@@ -92,7 +94,8 @@ GeodeWriteMSR(unsigned long addr, unsigned long lo, unsigned long hi)
req.val = (u_int64_t)hi << 32 | (u_int64_t)lo;
if (ioctl(fd, WRMSR, &req) == -1)
ErrorF("Unable to WRMSR %d\n", errno);
FatalError("Unable to write MSR at address 0x%06x: %s\n", addr,
strerror(errno));
#else
unsigned int data[2];
int fd = _msr_open();