From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NVoMJ-0000Zv-DD for mharc-grub-devel@gnu.org; Fri, 15 Jan 2010 10:45:11 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NVoMF-0000Zq-Ju for grub-devel@gnu.org; Fri, 15 Jan 2010 10:45:07 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NVoMA-0000Zc-93 for grub-devel@gnu.org; Fri, 15 Jan 2010 10:45:06 -0500 Received: from [199.232.76.173] (port=52029 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NVoM9-0000ZZ-Ts for grub-devel@gnu.org; Fri, 15 Jan 2010 10:45:01 -0500 Received: from mail-bw0-f215.google.com ([209.85.218.215]:35498) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NVoM9-0007N8-CY for grub-devel@gnu.org; Fri, 15 Jan 2010 10:45:01 -0500 Received: by bwz7 with SMTP id 7so718569bwz.26 for ; Fri, 15 Jan 2010 07:44:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :x-enigmail-version:content-type; bh=9dRM/2Miq+yzpxhSQndCK9fmTuqbkU7x82b5t2HFp0E=; b=bE8iTq7LZGSrwRSkQWUYW/gE62aB0HmvanFede9qhetNzTNhmiQaWxhbbSU8q20fK0 bs5qyW3MhgIlaxWJiWZ26FgMRP8X980cXbpM+BmvUW1WVB2RkQBW7FLICZl9s6VLF5x0 KZysDmjF043snQlf/q+OOiQH/SEZGCDR1vUKA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type; b=EDnG9P4Pl8J+EhWeTS4M5Wyc6eoucwIw8jqWFnCbFNpMSKNz1p9gRt6A1BQpsiVnNw rGnAWsHry21q94Lzk4WapdhyNMKtLKMtabUw8w0Eo1PAtIU4+QkUe15TLjhyYASx7D4U Otrn9dcrn3HeT4O5i9uSt7dm5zm4a1q/bRcUE= Received: by 10.204.49.82 with SMTP id u18mr1396156bkf.47.1263570298987; Fri, 15 Jan 2010 07:44:58 -0800 (PST) Received: from debian.bg45.phnet (113-93.203-62.cust.bluewin.ch [62.203.93.113]) by mx.google.com with ESMTPS id 14sm952271bwz.5.2010.01.15.07.44.57 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 15 Jan 2010 07:44:57 -0800 (PST) Message-ID: <4B508D72.3050508@gmail.com> Date: Fri, 15 Jan 2010 16:44:50 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20091109) MIME-Version: 1.0 To: The development of GRUB 2 References: <4B4F305D.3080200@gmail.com> <4B5080BB.90204@gmail.com> In-Reply-To: <4B5080BB.90204@gmail.com> X-Enigmail-Version: 0.95.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enigBC84146EB3EC39BA4EBEDC3F" X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [PATCH] Multiboot video support X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jan 2010 15:45:08 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigBC84146EB3EC39BA4EBEDC3F Content-Type: multipart/mixed; boundary="------------060606070700080304060807" This is a multi-part message in MIME format. --------------060606070700080304060807 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Vladimir 'phi-coder/phcoder' Serbinenko wrote: > Added EGA text support > =20 Non-VBE parts reviewed and comitted. Resending VBE parts. > > =20 --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------060606070700080304060807 Content-Type: text/x-diff; name="mbivid.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="mbivid.diff" =3D=3D=3D added file 'ChangeLog.mbivid' --- ChangeLog.mbivid 1970-01-01 00:00:00 +0000 +++ ChangeLog.mbivid 2010-01-15 15:35:51 +0000 @@ -0,0 +1,9 @@ +2010-01-14 Vladimir Serbinenko + + VBE multiboot support. + + * loader/i386/multiboot_mbi.c (HAS_VBE): New constant. + (grub_multiboot_get_mbi_size) [HAS_VBE]: Account for VBE structures. + (grub_multiboot_make_mbi) [HAS_VBE]: Likewise. + (fill_vbe_info) [HAS_VBE]: New function. + (retrieve_video_parameters) [HAS_VBE]: Call fill_vbe_info. =3D=3D=3D modified file 'loader/i386/multiboot.c' --- loader/i386/multiboot.c 2010-01-15 15:30:57 +0000 +++ loader/i386/multiboot.c 2010-01-15 15:31:45 +0000 @@ -20,7 +20,6 @@ /* * FIXME: The following features from the Multiboot specification still= * need to be implemented: - * - VBE support * - symbol table * - drives table * - ROM configuration table =3D=3D=3D modified file 'loader/i386/multiboot_mbi.c' --- loader/i386/multiboot_mbi.c 2010-01-15 15:30:57 +0000 +++ loader/i386/multiboot_mbi.c 2010-01-15 15:32:50 +0000 @@ -35,9 +35,11 @@ #include #define DEFAULT_VIDEO_MODE "text" #define HAS_VGA_TEXT 1 +#define HAS_VBE 1 #else #define DEFAULT_VIDEO_MODE "auto" #define HAS_VGA_TEXT 0 +#define HAS_VBE 0 #endif =20 struct module @@ -91,6 +93,10 @@ return sizeof (struct multiboot_info) + ALIGN_UP (cmdline_size, 4) + modcnt * sizeof (struct multiboot_mod_list) + total_modcmd + ALIGN_UP (sizeof(PACKAGE_STRING), 4) + grub_get_multiboot_mmap_len= () +#if HAS_VBE + + sizeof (struct grub_vbe_info_block) + + sizeof (struct grub_vbe_mode_info_block) +#endif + 256 * sizeof (struct multiboot_color); } =20 @@ -153,6 +159,78 @@ return err; } =20 +#if HAS_VBE +static grub_err_t +fill_vbe_info (struct multiboot_info *mbi, grub_uint8_t *ptrorig, + grub_uint32_t ptrdest, int fill_generic) +{ + grub_vbe_status_t status; + grub_uint32_t vbe_mode; + void *scratch =3D (void *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR; + struct grub_vbe_mode_info_block *mode_info; + =20 + status =3D grub_vbe_bios_get_controller_info (scratch); + if (status !=3D GRUB_VBE_STATUS_OK) + return grub_error (GRUB_ERR_IO, "Can't get controller info."); + =20 + mbi->vbe_control_info =3D ptrdest; + grub_memcpy (ptrorig, scratch, sizeof (struct grub_vbe_info_block)); + ptrorig +=3D sizeof (struct grub_vbe_info_block); + ptrdest +=3D sizeof (struct grub_vbe_info_block); + =20 + status =3D grub_vbe_bios_get_mode (scratch); + vbe_mode =3D *(grub_uint32_t *) scratch; + if (status !=3D GRUB_VBE_STATUS_OK) + return grub_error (GRUB_ERR_IO, "can't get VBE mode"); + mbi->vbe_mode =3D vbe_mode; + + mode_info =3D (struct grub_vbe_mode_info_block *) ptrorig; + mbi->vbe_mode_info =3D ptrdest; + /* get_mode_info isn't available for mode 3. */ + if (vbe_mode =3D=3D 3) + { + grub_memset (mode_info, 0, sizeof (struct grub_vbe_mode_info_block= )); + mode_info->memory_model =3D GRUB_VBE_MEMORY_MODEL_TEXT; + mode_info->x_resolution =3D 80; + mode_info->y_resolution =3D 25; + } + else + { + status =3D grub_vbe_bios_get_mode_info (vbe_mode, scratch); + if (status !=3D GRUB_VBE_STATUS_OK) + return grub_error (GRUB_ERR_IO, "can't get mode info"); + grub_memcpy (mode_info, scratch, + sizeof (struct grub_vbe_mode_info_block)); + } + ptrorig +=3D sizeof (struct grub_vbe_mode_info_block); + ptrdest +=3D sizeof (struct grub_vbe_mode_info_block); + =20 + /* FIXME: retrieve those. */ + mbi->vbe_interface_seg =3D 0; + mbi->vbe_interface_off =3D 0; + mbi->vbe_interface_len =3D 0; + =20 + mbi->flags |=3D MULTIBOOT_INFO_VBE_INFO; + + if (fill_generic && mode_info->memory_model =3D=3D GRUB_VBE_MEMORY_MOD= EL_TEXT) + { + mbi->framebuffer_addr =3D 0xb8000; + + mbi->framebuffer_pitch =3D 2 * mode_info->x_resolution;=09 + mbi->framebuffer_width =3D mode_info->x_resolution; + mbi->framebuffer_height =3D mode_info->y_resolution; + + mbi->framebuffer_bpp =3D 16; + + mbi->framebuffer_type =3D MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT; + + mbi->flags |=3D MULTIBOOT_INFO_FRAMEBUFFER_INFO; + } + + return GRUB_ERR_NONE; +} +#endif + static grub_err_t retrieve_video_parameters (struct multiboot_info *mbi, grub_uint8_t *ptrorig, grub_uint32_t ptrdest) @@ -173,8 +251,13 @@ grub_video_get_palette (0, ARRAY_SIZE (palette), palette); =20 driv_id =3D grub_video_get_driver_id (); +#if HAS_VGA_TEXT + if (driv_id =3D=3D GRUB_VIDEO_DRIVER_NONE) + return fill_vbe_info (mbi, ptrorig, ptrdest, 1); +#else if (driv_id =3D=3D GRUB_VIDEO_DRIVER_NONE) return GRUB_ERR_NONE; +#endif =20 err =3D grub_video_get_info_and_fini (&mode_info, &framebuffer); if (err) @@ -222,6 +305,11 @@ =20 mbi->flags |=3D MULTIBOOT_INFO_FRAMEBUFFER_INFO; =20 +#if HAS_VBE + if (driv_id =3D=3D GRUB_VIDEO_DRIVER_VBE) + return fill_vbe_info (mbi, ptrorig, ptrdest, 0); +#endif + return GRUB_ERR_NONE; } =20 @@ -308,6 +396,12 @@ grub_print_error (); grub_errno =3D GRUB_ERR_NONE; } +#if HAS_VBE + ptrorig +=3D sizeof (struct grub_vbe_info_block); + ptrdest +=3D sizeof (struct grub_vbe_info_block); + ptrorig +=3D sizeof (struct grub_vbe_mode_info_block); + ptrdest +=3D sizeof (struct grub_vbe_mode_info_block); +#endif =20 return GRUB_ERR_NONE; } --------------060606070700080304060807-- --------------enigBC84146EB3EC39BA4EBEDC3F Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iF4EAREKAAYFAktQjXgACgkQNak7dOguQgkI8QEAosAXxxlPmEn5LnYix1rwMBiw 7XoaG4+qpClzVYjuHFIBAJManJGisbFpieDAKYjliQyKsMzRLxl7bWCMkLJnQQAE =5+7V -----END PGP SIGNATURE----- --------------enigBC84146EB3EC39BA4EBEDC3F--