$NetBSD: patch-az,v 1.2 2003/07/31 15:12:40 bencollver Exp $ --- src/r128.c.orig Wed May 30 01:02:14 2001 +++ src/r128.c @@ -313,7 +313,7 @@ static void R128RestoreMode(R128SavePtr OUTREG(R128_AMCGPIO_MASK, restore->amcgpio_mask); OUTREG(R128_AMCGPIO_EN_REG, restore->amcgpio_en_reg); OUTREG(R128_CLOCK_CNTL_INDEX, restore->clock_cntl_index); - OUTREG(R128_GEN_RESET_CNTL, restore->gen_reset_cntl); +// OUTREG(R128_GEN_RESET_CNTL, restore->gen_reset_cntl); OUTREG(R128_DP_DATATYPE, restore->dp_datatype); R128RestoreCommonRegisters( restore); @@ -443,6 +443,10 @@ static void R128InitCommonRegisters(R128 save->mem_vga_wp_sel = 0; save->mem_vga_rp_sel = 0; save->bus_cntl = BusCntl; + + save->config_cntl = INREG(R128_CONFIG_CNTL); + save->amcgpio_en_reg = INREG(R128_AMCGPIO_EN_REG); + save->amcgpio_mask = INREG(R128_AMCGPIO_MASK); /* * If bursts are enabled, turn on discards and aborts */ @@ -958,6 +962,15 @@ static int r128_test(void) { int found, id; unsigned long buf[64]; + int _ioperm=0; + + if (getenv("IOPERM") == NULL) { + _ioperm=1; + if (iopl(3) < 0) { + printf("svgalib: cannot get I/O permissions\n"); + exit(1); + } + } found=__svgalib_pci_find_vendor_vga(VENDOR_ID,buf,0); @@ -966,6 +979,8 @@ static int r128_test(void) if((id>=0x5350) || (id<=0x4fff)) return 0; r128_init(0,0,0); + if (_ioperm) iopl(0); + return 1; }