Kernel support for VESA Bios Extension
PATCH 1/1 Kernel support for VESA Bios Extension
Hi,
Here is attached a patch that adds VBE support to kernel and include file to make it easier to use it. There is diff for both i386-pc.rmk and
i386-pc.mk. Latter could be removed and let build process to generate
it again, but I think that .mk file is present in CVS so I left both there.
I will make separate patch for the frame buffer console after this is first committed. (And I need to make some cleanups there first)
I would like to hear comments about the patch. I tried to implement most commonly needed functions, so you can't do everything with this. As I didn't need to use every function in my frame buffer console test, some things might not work. But I tried to make my best to proof read every function.
Thanks,
Vesa Jääskeläinen
ChangeLog +18 -0
@@ -1,3 +1,21 @@ +2005-07-14 Vesa Jaaskelainen <[email protected]> + + * conf/i386-pc.rmk (kernel_img_HEADERS): Added machine/vbe.h. + * kern/i386/pc/startup.S: Updated Global Descriptor table's + descriptions. + (grub_vbe_get_controller_info): New function. + (grub_vbe_get_mode_info): Likewise. + (grub_vbe_set_mode): Likewise. + (grub_vbe_get_mode): Likewise. + (grub_vbe_set_memory_window): Likewise. + (grub_vbe_get_memory_window): Likewise. + (grub_vbe_set_scanline_length): Likewise. + (grub_vbe_get_scanline_length): Likewise. + (grub_vbe_set_display_start): Likewise. + (grub_vbe_get_display_start): Likewise. + (grub_vbe_set_palette_data): Likewise. + * include/grub/i386/pc/vbe.h: New file. + 2005-07-12 Hollis Blanchard <[email protected]> * disk/powerpc/ieee1275/ofdisk.c (grub_ofdisk_open): dprintf the
conf/i386-pc.mk +2 -1
@@ -253,7 +253,8 @@ file.h fs.h kernel.h loader.h misc.h mm.h net.h rescue.h symbol.h \ term.h types.h machine/biosdisk.h machine/boot.h \ machine/console.h machine/init.h machine/memory.h \ - machine/loader.h partition.h pc_partition.h machine/time.h machine/vga.h + machine/loader.h partition.h pc_partition.h machine/time.h machine/vga.h \ + machine/vbe.h kernel_img_CFLAGS = $(COMMON_CFLAGS) kernel_img_ASFLAGS = $(COMMON_ASFLAGS) kernel_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,8200
conf/i386-pc.rmk +2 -1
@@ -33,7 +33,8 @@ file.h fs.h kernel.h loader.h misc.h mm.h net.h rescue.h symbol.h \ term.h types.h machine/biosdisk.h machine/boot.h \ machine/console.h machine/init.h machine/memory.h \ - machine/loader.h partition.h pc_partition.h machine/time.h machine/vga.h + machine/loader.h partition.h pc_partition.h machine/time.h machine/vga.h \ + machine/vbe.h kernel_img_CFLAGS = $(COMMON_CFLAGS) kernel_img_ASFLAGS = $(COMMON_ASFLAGS) kernel_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,8200
Files grub2/core.img and grub2.vbe/core.img differ
device.map +1 -0
@@ -0,0 +1 @@ +(fd0) /dev/fd0
include/grub/i386/pc/vbe.h +161 -0
161 lines not on this page · raw message
kern/i386/pc/startup.S +422 -7
461 lines not on this page · raw message
Vesa Jääskeläinen <[email protected]> writes:
Hi,
Thanks a lot for your work. I am looking forwards to the VESA console!
Quoted 5 lines
Here is attached a patch that adds VBE support to kernel and include file to make it easier to use it. There is diff for both i386-pc.rmk and i386-pc.mk. Latter could be removed and let build process to generate it again, but I think that .mk file is present in CVS so I left both there.
Please always include the changed to *.rmk in the patches. You don't have to supply *.mk because those files are generated and make the patch just harder to read.
Quoted 2 lines
I will make separate patch for the frame buffer console after this is first committed. (And I need to make some cleanups there first)
Ok.
Quoted 5 lines
I would like to hear comments about the patch. I tried to implement most commonly needed functions, so you can't do everything with this. As I didn't need to use every function in my frame buffer console test, some things might not work. But I tried to make my best to proof read every function.
Can you please make sure you are using the GCS for coding style? Please have a look at the other sourcecode and the GCS (GNU Coding Standards) first:
http://www.gnu.org/prep/standards/
It is important for us to have a single and consistent coding style. If you have questions about either GRUB or the coding style you are of course free to ask.
Thanks,
Marco
Quoted 10 lines · Marco Gerards
Quoted 5 lines
I would like to hear comments about the patch. I tried to implement most commonly needed functions, so you can't do everything with this. As I didn't need to use every function in my frame buffer console test, some things might not work. But I tried to make my best to proof read every function.
Can you please make sure you are using the GCS for coding style? Please have a look at the other sourcecode and the GCS (GNU Coding Standards) first:
Quoted 5 lines
http://www.gnu.org/prep/standards/
It is important for us to have a single and consistent coding style. If you have questions about either GRUB or the coding style you are of course free to ask.
Perhaps this is a bit closer to requirement?
If there still are issues on formatting could you specify what issues you are thinking on.
Thanks,
Vesa Jääskeläinen
ChangeLog +18 -0
@@ -1,3 +1,21 @@ +2005-07-14 Vesa Jaaskelainen <[email protected]> + + * conf/i386-pc.rmk (kernel_img_HEADERS): Added machine/vbe.h. + * kern/i386/pc/startup.S: Updated Global Descriptor table's + descriptions. + (grub_vbe_get_controller_info): New function. + (grub_vbe_get_mode_info): Likewise. + (grub_vbe_set_mode): Likewise. + (grub_vbe_get_mode): Likewise. + (grub_vbe_set_memory_window): Likewise. + (grub_vbe_get_memory_window): Likewise. + (grub_vbe_set_scanline_length): Likewise. + (grub_vbe_get_scanline_length): Likewise. + (grub_vbe_set_display_start): Likewise. + (grub_vbe_get_display_start): Likewise. + (grub_vbe_set_palette_data): Likewise. + * include/grub/i386/pc/vbe.h: New file. + 2005-07-12 Hollis Blanchard <[email protected]> * disk/powerpc/ieee1275/ofdisk.c (grub_ofdisk_open): dprintf the
conf/i386-pc.rmk +2 -1
@@ -33,7 +33,8 @@ file.h fs.h kernel.h loader.h misc.h mm.h net.h rescue.h symbol.h \ term.h types.h machine/biosdisk.h machine/boot.h \ machine/console.h machine/init.h machine/memory.h \ - machine/loader.h partition.h pc_partition.h machine/time.h machine/vga.h + machine/loader.h partition.h pc_partition.h machine/time.h machine/vga.h \ + machine/vbe.h kernel_img_CFLAGS = $(COMMON_CFLAGS) kernel_img_ASFLAGS = $(COMMON_ASFLAGS) kernel_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,8200
include/grub/i386/pc/vbe.h +180 -0
180 lines not on this page · raw message
kern/i386/pc/startup.S +430 -7
469 lines not on this page · raw message
Quoted 13 lines · Vesa Jääskeläinen
Quoted 5 lines
Quoted 5 lines
I would like to hear comments about the patch. I tried to implement most commonly needed functions, so you can't do everything with this. As I didn't need to use every function in my frame buffer console test, some things might not work. But I tried to make my best to proof read every function.
Quoted 7 lines
Can you please make sure you are using the GCS for coding style? Please have a look at the other sourcecode and the GCS (GNU Coding Standards) first:
http://www.gnu.org/prep/standards/
It is important for us to have a single and consistent coding style. If you have questions about either GRUB or the coding style you are of course free to ask.
Quoted 1 line
Perhaps this is a bit closer to requirement?
It is, thanks.
Quoted 2 lines
If there still are issues on formatting could you specify what issues you are thinking on.
Of course.
include/grub/i386/pc/vbe.h line 38
Quoted 3 lines
include/grub/i386/pc/vbe.h +3
-0+typedef grub_uint32_t grub_vbe_farptr_t ; +typedef grub_uint32_t grub_vbe_physptr_t ; +typedef grub_uint32_t grub_vbe_status_t ;
Please use a single space before the type name.
include/grub/i386/pc/vbe.h line 62
Quoted 3 lines
include/grub/i386/pc/vbe.h +3
-0+struct grub_vbe_mode_info_block +{ +/* Mandory information for all VBE revisions */
After the comment add a `.' and two spaces instead of one. This is true for all comments.
include/grub/i386/pc/vbe.h line 121
Quoted 6 lines
include/grub/i386/pc/vbe.h +6
-0+/* +* Reserved field to make structure to be 256 bytes long, VESA BIOS +* Extension 3.0 Specification says to reserve 189 bytes here but +* that doesn't make structure to be 256 bytes. So additional one is +* added here. +*/
I personally prefer not using that many `*'s and believe it is not in the GCS. But I think Okuji uses this as well, but I don't. Perhaps we need our own guidelines for such things, I think consistency is important. Okuji, what you you think?
Quoted 1 line
+
grub_uint8_treserved4[189+1];
Please put spaces around operators. So this should be:
grub_uint8_t reserved4[189 + 1]
* 31 24 19 16 7 0
Quoted 10 lines
* ------------------------------------------------------------
* | | |B| |A| | | |1|0|E|W|A| | - * | BASE 31..24 |G|/|0|V| LIMIT |P|DPL| TYPE | BASE 23:16 | + * | BASE 31..24 |G|/|L|V| LIMIT |P|DPL| TYPE | BASE 23:16 | 4 * | | |D| |L| 19..16| | |1|1|C|R|A| | * ------------------------------------------------------------ * | | | - * | BASE 15..0 | LIMIT 15..0 | + * | BASE 15..0 | LIMIT 15..0 | 0 * | | |
Quoted 2 lines
* ------------------------------------------------------------ *
What is this? Is this copied from (copyrighted) documentation?
To me it seemed line some lines were too long. Please keep in mind it should be all readable on a 80 columns width terminal according to the GCS.
I will be gone this weekend. After the weekend I will try to understand the patch and proofread the assembler code. But my x86 assembly is *very* rusty, so I hope someone else can review this patch because I am afraid when it comes to assembler my opinion is not worth a bit. ;)
Thanks,
Marco
Quoted 4 lines · Marco Gerards
I personally prefer not using that many `*'s and believe it is not in the GCS. But I think Okuji uses this as well, but I don't. Perhaps we need our own guidelines for such things, I think consistency is important. Okuji, what you you think?
I don't need strict rules here. As far as I see, GNU does not define anything about this.
But I myself don't use aterisks except for the license term in C, do I?
Okuji
Quoted 5 lines · Marco Gerards
Review
Quoted 3 lines
(quoted diff) +3
-0+typedef grub_uint32_t grub_vbe_farptr_t; +typedef grub_uint32_t grub_vbe_physptr_t; +typedef grub_uint32_t grub_vbe_status_t;Please use a single space before the type name.
Done.
Quoted 6 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+struct grub_vbe_mode_info_block +{ + /* Mandory information for all VBE revisions */After the comment add a `.' and two spaces instead of one. This is true for all comments.
Odd... Especially that two spaces. But I don't want to start another "war" with this ;)... So I try to adapt.
Quoted 11 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ /* + * Reserved field to make structure to be 256 bytes long, VESA BIOS + * Extension 3.0 Specification says to reserve 189 bytes here but + * that doesn't make structure to be 256 bytes. So additional one is + * added here. + */I personally prefer not using that many `*'s and believe it is not in the GCS. But I think Okuji uses this as well, but I don't. Perhaps we need our own guidelines for such things, I think consistency is important. Okuji, what you you think?
Now it's modified a bit.
Quoted 5 lines
Quoted 1 line
+
grub_uint8_treserved4[189+1];Please put spaces around operators. So this should be:
grub_uint8_treserved4[189 + 1]
Done.
Quoted 15 lines
* 31 24 19 16 7 0
Quoted 9 lines
* ------------------------------------------------------------
* | | |B| |A| | | |1|0|E|W|A| | - * | BASE 31..24 |G|/|0|V| LIMIT |P|DPL| TYPE | BASE 23:16 | + * | BASE 31..24 |G|/|L|V| LIMIT |P|DPL| TYPE | BASE 23:16 | 4 * | | |D| |L| 19..16| | |1|1|C|R|A| | * ------------------------------------------------------------ * | | | - * | BASE 15..0 | LIMIT 15..0 | + * | BASE 15..0 | LIMIT 15..0 | 0Quoted 3 lines
* | | |
* ------------------------------------------------------------ *
Quoted 1 line
What is this? Is this copied from (copyrighted) documentation?
It was there already and I just added x86-64 specific flag there and some helpers (4 and 0) to make it easier to read records correctly. I am not sure what is it's origin as it was there already, but as you could guess, it looks similar as in Intel's software developers guide and I would assume that it looks similar also in AMD's.
It can of course be removed completely in the commit if required to be.
Quoted 3 lines
To me it seemed line some lines were too long. Please keep in mind it should be all readable on a 80 columns width terminal according to the GCS.
I can see if I can split them more nicely if they are too long. But the problem is how to split them so that they are conforming the GCS on that :). But let's see.
Quoted 5 lines
I will be gone this weekend. After the weekend I will try to understand the patch and proofread the assembler code. But my x86 assembly is *very* rusty, so I hope someone else can review this patch because I am afraid when it comes to assembler my opinion is not worth a bit. ;)
Ok.
I have attached yet another patch with some formatting changes.
Thanks,
Vesa Jääskeläinen
ChangeLog +18 -0
@@ -1,3 +1,21 @@ +2005-07-15 Vesa Jaaskelainen <[email protected]> + + * conf/i386-pc.rmk (kernel_img_HEADERS): Added machine/vbe.h. + * kern/i386/pc/startup.S: Updated Global Descriptor table's + descriptions. + (grub_vbe_get_controller_info): New function. + (grub_vbe_get_mode_info): Likewise. + (grub_vbe_set_mode): Likewise. + (grub_vbe_get_mode): Likewise. + (grub_vbe_set_memory_window): Likewise. + (grub_vbe_get_memory_window): Likewise. + (grub_vbe_set_scanline_length): Likewise. + (grub_vbe_get_scanline_length): Likewise. + (grub_vbe_set_display_start): Likewise. + (grub_vbe_get_display_start): Likewise. + (grub_vbe_set_palette_data): Likewise. + * include/grub/i386/pc/vbe.h: New file. + 2005-07-12 Hollis Blanchard <[email protected]> * disk/powerpc/ieee1275/ofdisk.c (grub_ofdisk_open): dprintf the
conf/i386-pc.rmk +2 -1
@@ -33,7 +33,8 @@ file.h fs.h kernel.h loader.h misc.h mm.h net.h rescue.h symbol.h \ term.h types.h machine/biosdisk.h machine/boot.h \ machine/console.h machine/init.h machine/memory.h \ - machine/loader.h partition.h pc_partition.h machine/time.h machine/vga.h + machine/loader.h partition.h pc_partition.h machine/time.h machine/vga.h \ + machine/vbe.h kernel_img_CFLAGS = $(COMMON_CFLAGS) kernel_img_ASFLAGS = $(COMMON_ASFLAGS) kernel_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,8200
include/grub/i386/pc/vbe.h +184 -0
184 lines not on this page · raw message
kern/i386/pc/startup.S +431 -7
470 lines not on this page · raw message
Quoted 5 lines · Vesa Jääskeläinen
Quoted 2 lines
After the comment add a `.' and two spaces instead of one. This is true for all comments.
Odd... Especially that two spaces. But I don't want to start another "war" with this ;)... So I try to adapt.
According to the GNU Coding Standards, two spaces are useful for Emacs to identify the end of a text. I myself do not see any problem without two spaces in Emacs, so I agree that it looks strange. But... this is what the GNU Coding Standards says, and I have no problem with this rule, so we follow it.
Quoted 1 line
It can of course be removed completely in the commit if required to be.
You don't have to remove it. As far as I know, copyright is not applied to this kind of information (at least in USA), because this is merely information but not a so-called "creative work". So, regardless of the origin, you can use this information.
Okuji
Quoted 4 lines · Yoshinori K. Okuji
Quoted 3 lines · Vesa Jääskeläinen
Quoted 2 lines
After the comment add a `.' and two spaces instead of one. This is true for all comments.
Quoted 8 lines
Quoted 2 lines
Odd... Especially that two spaces. But I don't want to start another "war" with this ;)... So I try to adapt.
According to the GNU Coding Standards, two spaces are useful for Emacs to identify the end of a text. I myself do not see any problem without two spaces in Emacs, so I agree that it looks strange. But... this is what the GNU Coding Standards says, and I have no problem with this rule, so we follow it.
I do remember having some problems in emacs if this is not used. But I don't remember what the exact problems are. To avoid further problems and because of the GCS I really prefer two spaces in both comments and changelog entries.
--
Marco