1/* 2 * Copyright (c) 2025 The NetBSD Foundation, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#ifndef BOCHSFBVAR_H 27#define BOCHSFBVAR_H 28 29#include <dev/wscons/wsdisplayvar.h> 30#include <dev/wscons/wsconsio.h> 31#include <dev/wsfont/wsfont.h> 32#include <dev/rasops/rasops.h> 33#include <dev/wscons/wsdisplay_vconsvar.h> 34#include <dev/videomode/edidvar.h> 35 36#ifndef BOCHSFB_DEFAULT_WIDTH 37#define BOCHSFB_DEFAULT_WIDTH (1024) 38#endif 39 40#ifndef BOCHSFB_DEFAULT_HEIGHT 41#define BOCHSFB_DEFAULT_HEIGHT (768) 42#endif 43 44/* Structure for the Bochs FB driver */ 45struct bochsfb_softc { 46 device_t sc_dev; 47 48 /* PCI attachment */ 49 pci_chipset_tag_t sc_pc; 50 pcitag_t sc_pcitag; 51 52 /* Bus space tags and handles */ 53 bus_space_tag_t sc_iot; /* I/O space tag */ 54 bus_space_handle_t sc_ioh_vga; /* VGA I/O handle */ 55 bus_space_handle_t sc_ioh_dispi; /* DISPI I/O handle */ 56 57 bus_space_tag_t sc_mmiot; /* MMIO space tag */ 58 bus_space_handle_t sc_mmioh; /* MMIO handle for DISPI interface */ 59 60 bus_space_tag_t sc_memt; /* Memory space tag */ 61 bus_space_handle_t sc_fb_handle; /* Framebuffer handle */ 62 63 bus_addr_t sc_mmio_addr; /* MMIO base address */ 64 bus_size_t sc_mmio_size; /* MMIO size */ 65 66 bus_addr_t sc_fb_addr; /* Framebuffer physical address */ 67 bus_size_t sc_fb_size; /* Framebuffer size */ 68 69 bool sc_has_mmio; /* Whether MMIO is available */ 70 71 /* Device Info */ 72 uint16_t sc_id; /* Device ID */ 73 pcireg_t sc_pci_id; /* PCI ID */ 74 75 /* Video mode parameters */ 76 int sc_width, sc_height, sc_linebytes, sc_bpp; 77 const struct videomode *sc_videomode; 78 79 uint8_t edid_buf[0x400]; /* EDID data buffer */ 80 struct edid_info sc_ei; 81 82 /* WS Display data */ 83 int sc_blank; 84 int sc_mode; 85 struct vcons_screen sc_console_screen; 86 struct vcons_data vd; 87 struct wsscreen_descr sc_defaultscreen_descr; 88 const struct wsscreen_descr *sc_screens[1]; 89 struct wsscreen_list sc_screenlist; 90}; 91 92#endif /* BOCHSFBVAR_H */ 93