FreeBSD/sys/dev/fb/vga.c
/*
 * diag():
 * Print some information about the video adapter and video modes,
 * with requested level of details.
 *
 * all adapters
 */
Print some information about the video adapter and video modes,
with requested level of details.

all adapters
Print some information about the video adapter and video modes with requested level of details . all adapters
static int
vga_diag(video_adapter_t *adp, int level)
{
    u_char *mp;
#if FB_DEBUG > 1
    video_info_t info;
    int i;
#endif
    if (!vga_init_done)
	return ENXIO;
#if FB_DEBUG > 1
#ifndef VGA_NO_BIOS
    printf("vga: RTC equip. code:0x%02x, DCC code:0x%02x\n",
	   rtcin(RTC_EQUIPMENT), readb(BIOS_PADDRTOVADDR(0x488)));
    printf("vga: CRTC:0x%x, video option:0x%02x, ",
	   readw(BIOS_PADDRTOVADDR(0x463)),
	   readb(BIOS_PADDRTOVADDR(0x487)));
    printf("rows:%d, cols:%d, font height:%d\n",
	   readb(BIOS_PADDRTOVADDR(0x44a)),
	   readb(BIOS_PADDRTOVADDR(0x484)) + 1,
	   readb(BIOS_PADDRTOVADDR(0x485)));
#endif 
#if !defined(VGA_NO_BIOS) && !defined(VGA_NO_MODE_CHANGE)
    printf("vga: param table EGA/VGA:%p", video_mode_ptr);
    printf(", CGA/MDA:%p\n", video_mode_ptr2);
    printf("vga: rows_offset:%d\n", rows_offset);
#endif
#endif 
    fb_dump_adp_info(VGA_DRIVER_NAME, adp, level);
#if FB_DEBUG > 1
    if (adp->va_flags & V_ADP_MODECHANGE) {
	for (i = 0; bios_vmode[i].vi_mode != EOT; ++i) {
	    if (bios_vmode[i].vi_mode == NA)
		continue;
	    if (get_mode_param(bios_vmode[i].vi_mode) == NULL)
		continue;
	    fb_dump_mode_info(VGA_DRIVER_NAME, adp, &bios_vmode[i], level);
	}
    } else {
	vga_get_info(adp, adp->va_initial_mode, &info);	
	fb_dump_mode_info(VGA_DRIVER_NAME, adp, &info, level);
    }
#endif 
    if ((adp->va_type != KD_EGA) && (adp->va_type != KD_VGA))
	return 0;
#if !defined(VGA_NO_BIOS) && !defined(VGA_NO_MODE_CHANGE)
    if (video_mode_ptr == NULL)
	printf("vga%d: %s: WARNING: video mode switching is not "
	       "fully supported on this adapter\n",
	       adp->va_unit, adp->va_name);
#endif
    if (level <= 0)
	return 0;
    if (adp->va_type == KD_VGA) {
	printf("VGA parameters upon power-up\n");
	dump_buffer(adpstate.regs, sizeof(adpstate.regs));
	printf("VGA parameters in BIOS for mode %d\n", adp->va_initial_mode);
	dump_buffer(adpstate2.regs, sizeof(adpstate2.regs));
    }
    mp = get_mode_param(adp->va_initial_mode);
    if (mp == NULL)	
	return 0;
    printf("EGA/VGA parameters to be used for mode %d\n", adp->va_initial_mode);
    dump_buffer(mp, V_MODE_PARAM_SIZE);
    return 0;
}
static int vga_diag ( video_adapter_t * adp , int level ) { u_char * mp ; #if FB_DEBUG > 1 video_info_t info ; int i ; #endif if ( ! vga_init_done ) return ENXIO ; #if FB_DEBUG > 1 #ifndef VGA_NO_BIOS printf ( " \n " , rtcin ( RTC_EQUIPMENT ) , readb ( BIOS_PADDRTOVADDR ( 0x488 ) ) ) ; printf ( " " , readw ( BIOS_PADDRTOVADDR ( 0x463 ) ) , readb ( BIOS_PADDRTOVADDR ( 0x487 ) ) ) ; printf ( " \n " , readb ( BIOS_PADDRTOVADDR ( 0x44a ) ) , readb ( BIOS_PADDRTOVADDR ( 0x484 ) ) + 1 , readb ( BIOS_PADDRTOVADDR ( 0x485 ) ) ) ; #endif #if ! defined ( VGA_NO_BIOS ) && ! defined ( VGA_NO_MODE_CHANGE ) printf ( " " , video_mode_ptr ) ; printf ( " \n " , video_mode_ptr2 ) ; printf ( " \n " , rows_offset ) ; #endif #endif fb_dump_adp_info ( VGA_DRIVER_NAME , adp , level ) ; #if FB_DEBUG > 1 if ( adp -> va_flags & V_ADP_MODECHANGE ) { for ( i = 0 ; bios_vmode [ i ] . vi_mode != EOT ; ++ i ) { if ( bios_vmode [ i ] . vi_mode == NA ) continue ; if ( get_mode_param ( bios_vmode [ i ] . vi_mode ) == NULL ) continue ; fb_dump_mode_info ( VGA_DRIVER_NAME , adp , & bios_vmode [ i ] , level ) ; } } else { vga_get_info ( adp , adp -> va_initial_mode , & info ) ; fb_dump_mode_info ( VGA_DRIVER_NAME , adp , & info , level ) ; } #endif if ( ( adp -> va_type != KD_EGA ) && ( adp -> va_type != KD_VGA ) ) return 0 ; #if ! defined ( VGA_NO_BIOS ) && ! defined ( VGA_NO_MODE_CHANGE ) if ( video_mode_ptr == NULL ) printf ( " " " \n " , adp -> va_unit , adp -> va_name ) ; #endif if ( level <= 0 ) return 0 ; if ( adp -> va_type == KD_VGA ) { printf ( " \n " ) ; dump_buffer ( adpstate . regs , sizeof ( adpstate . regs ) ) ; printf ( " \n " , adp -> va_initial_mode ) ; dump_buffer ( adpstate2 . regs , sizeof ( adpstate2 . regs ) ) ; } mp = get_mode_param ( adp -> va_initial_mode ) ; if ( mp == NULL ) return 0 ; printf ( " \n " , adp -> va_initial_mode ) ; dump_buffer ( mp , V_MODE_PARAM_SIZE ) ; return 0 ; }
diag():
 Print some information about the video adapter and video modes,
 with requested level of details.
diag () : Print some information about the video adapter and video modes with requested level of details .
/* VGA_NO_BIOS */ /* FB_DEBUG > 1 */ /* shouldn't fail */ /* FB_DEBUG > 1 */ /* this shouldn't be happening */