}
};
+#undef DEBUG_IOPERM
+
/* routine to process the /proc/cpuinfo information into the fields */
/* that are required for correctly determining the platform parameters */
fclose (fp);
-#if 1
+#ifdef DEBUG_IOPERM
fprintf(stderr, "system type: %s\n", systype);
fprintf(stderr, "system vari: %s\n", sysvari);
fprintf(stderr, "cpu model: %s\n", cpumodel);
/* systype is not a know platform name... */
__set_errno (EINVAL);
-#if 1
+#ifdef DEBUG_IOPERM
fprintf(stderr, "init_iosys: platform not recognized\n");
#endif
return -1;
int prot, err;
if (!io.swp && init_iosys() < 0) {
-#if 1
+#ifdef DEBUG_IOPERM
fprintf(stderr, "ioperm: init_iosys() failed\n");
#endif
return -1;
if (from >= MAX_PORT || from + num > MAX_PORT)
{
__set_errno (EINVAL);
-#if 1
+#ifdef DEBUG_IOPERM
fprintf(stderr, "ioperm: from/num out of range\n");
#endif
return -1;
}
-#if 1
+#ifdef DEBUG_IOPERM
fprintf(stderr, "ioperm: turn_on %d io.base %ld\n", turn_on, io.base);
#endif
fd = open ("/dev/mem", O_RDWR);
if (fd < 0) {
-#if 1
+#ifdef DEBUG_IOPERM
fprintf(stderr, "ioperm: /dev/mem open failed\n");
#endif
return -1;
(unsigned long int) __mmap (0, len, PROT_NONE, MAP_SHARED,
fd, io.io_base);
close (fd);
-#if 1
+#ifdef DEBUG_IOPERM
fprintf(stderr, "ioperm: mmap of len 0x%lx returned 0x%lx\n",
len, io.base);
#endif
addr &= PAGE_MASK;
len = port_to_cpu_addr (from + num, io.swiz, 1) - addr;
err = mprotect ((void *) addr, len, prot);
-#if 1
+#ifdef DEBUG_IOPERM
fprintf(stderr, "ioperm: mprotect returned %d\n", err);
#endif
return err;