1 /* $NetBSD: biosvbe.S,v 1.3 2011/02/20 22:03:13 jakllsch Exp $ */
4 * Copyright (c) 2009 Jared D. McNeill <jmcneill@invisible.ca>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
29 #include <machine/asm.h>
34 * VESA BIOS Extensions routines
38 * Function 00h - Return VBE Controller Information
40 * int biosvbe_info(struct vbeinfoblock *)
41 * return: VBE call status
52 movl 8(%ebp), %edi /* vbe info block address*/
54 call _C_LABEL(prot_to_real)
65 and $0xf, %di /* mode info block address now in es:di */
67 movw $0x4f00, %ax /* get vbe info block */
72 calll _C_LABEL(real_to_prot)
86 * Function 01h - Return VBE Mode Information
88 * int biosvbe_get_mode_info(int mode, struct modeinfoblock *mi)
89 * return: VBE call status
91 ENTRY(biosvbe_get_mode_info)
100 movl 8(%ebp), %ecx /* mode number */
101 movl 12(%ebp), %edi /* mode info block address */
103 call _C_LABEL(prot_to_real)
114 and $0xf, %di /* mode info block address now in es:di */
116 movw $0x4f01, %ax /* get mode info block */
121 calll _C_LABEL(real_to_prot)
135 * Function 02h - Set VBE Mode
137 * int biosvbe_set_mode(int mode)
138 * return: VBE call status
140 ENTRY(biosvbe_set_mode)
149 movl 8(%ebp), %ebx /* mode number */
152 call _C_LABEL(prot_to_real)
155 movw $0x4f02, %ax /* set mode */
158 calll _C_LABEL(real_to_prot)
172 * Function 08h - Set/Get DAC Palette Format
174 * int biosvbe_palette_format(int format)
175 * return: VBE call status
177 ENTRY(biosvbe_palette_format)
186 movl 8(%ebp), %ebx /* mode number */
188 call _C_LABEL(prot_to_real)
191 movw $0x4f08, %ax /* get/set palette format */
194 calll _C_LABEL(real_to_prot)
208 * Function 09h - Set/Get Palette Data
210 * int biosvbe_palette_data(int mode, int reg, struct paletteentry *)
211 * return: VBE call status
213 ENTRY(biosvbe_palette_data)
222 movl 8(%ebp), %ebx /* mode number */
223 movl 12(%ebp), %edx /* register */
224 movl 16(%ebp), %edi /* palette entry address */
225 movl $1, %ecx /* # palette entries to update */
227 call _C_LABEL(prot_to_real)
238 and $0xf, %di /* palette entry address now in es:di */
240 movw $0x4f09, %ax /* get/set palette entry */
245 calll _C_LABEL(real_to_prot)
259 * Function 15h BL=00h - Report VBE/DDC Capabilities
261 * int biosvbe_ddc_caps(void)
262 * return: VBE/DDC capabilities
264 ENTRY(biosvbe_ddc_caps)
273 call _C_LABEL(prot_to_real)
279 movw %di, %es /* es:di == 0:0 */
281 movw $0x4f15, %ax /* display identification extensions */
282 mov $0x00, %bx /* report DDC capabilities */
283 mov $0x00, %cx /* controller unit number (00h = primary) */
288 calll _C_LABEL(real_to_prot)
309 * Function 15h BL=01h - Read EDID
311 * int biosvbe_ddc_read_edid(int blockno, void *buf)
312 * return: VBE call status
314 ENTRY(biosvbe_ddc_read_edid)
323 movl 8(%ebp), %edx /* EDID block number */
324 movl 12(%ebp), %edi /* EDID block address */
326 call _C_LABEL(prot_to_real)
337 and $0xf, %di /* EDID block address now in es:di */
339 movw $0x4f15, %ax /* display identification extensions */
340 mov $0x01, %bx /* read EDID */
341 mov $0x00, %cx /* controller unit number (00h = primary) */
346 calll _C_LABEL(real_to_prot)