New frame buffer detection algorithm and loadrom command for efi platform
PATCH 1/1 New frame buffer detection algorithm and loadrom command for efi platform
Hi,
This patch improves the frame buffer detection algorithm. It uses pci to find the video memory base, then scan it for frame buffer.
It also add a loadrom command which can be used to enable accel graphic driver. The idea is that you can grab the video bios dump, and optionally the IVT from pc mode, then load them in efi.
To grab bios dump:
sudo dd if=/dev/mem of=bios.bin bs=65536 skip=12 count=1
You can also include the system bios by changing the count to 4.
To grab IVT dump:
sudo dd if=/dev/mem of=ivt.bin bs=1024 count=1
Then, to load them in grub-efi (ivt.bin is optionally):
loadrom /bios.bin /ivt.bin
Here are some of the findings concerning different video cards:
Old 32-bit efi model, intel card:
Works with intel driver, no need to load vbios or ivt.
New 64-bit efi model, intel card:
Works with intel driver, needs to load vbios.
New 64-bit efi model, nvidia card:
Works with nvidia driver, no needs to load vbios or ivt. However, the backlight value is set too low so desktop is barely visible. You need to use a small tool to adjust backlight. The nv driver doesn't work.
New 64-bit efi model, ati radeon card:
Works with fglrx driver, needs to load vbios and ivt. The radeonhd driver doesn't work.
Signature · 1 line
Bean
include/grub/i386/pci.h +35 -0
@@ -32,4 +32,39 @@ grub_pci_read (grub_pci_address_t addr)return grub_inl (GRUB_PCI_DATA_REG ); } +static inline grub_uint16_t +grub_pci_read_word (grub_pci_address_t addr) +{ +grub_outl (addr & ~3 ,GRUB_PCI_ADDR_REG ); +return grub_inw (GRUB_PCI_DATA_REG + (addr &3 )); +} + +static inline grub_uint8_t +grub_pci_read_byte (grub_pci_address_t addr) +{ +grub_outl (addr & ~3 ,GRUB_PCI_ADDR_REG ); +return grub_inb (GRUB_PCI_DATA_REG + (addr &3 )); +} + +static inline void +grub_pci_write (grub_pci_address_t addr,grub_uint32_t data) +{ +grub_outl (addr,GRUB_PCI_ADDR_REG ); +grub_outl (data,GRUB_PCI_DATA_REG ); +} + +static inline void +grub_pci_write_word (grub_pci_address_t addr,grub_uint16_t data) +{ +grub_outl (addr & ~3 ,GRUB_PCI_ADDR_REG ); +grub_outw (data,GRUB_PCI_DATA_REG + (addr &3 )); +} + +static inline void +grub_pci_write_byte (grub_pci_address_t addr,grub_uint8_t data) +{ +grub_outl (addr & ~3 ,GRUB_PCI_ADDR_REG ); +grub_outb (data,GRUB_PCI_DATA_REG + (addr &3 )); +} +#endif /* GRUB_CPU_PCI_H */
include/grub/pci.h +2 -2
@@ -36,8 +36,8 @@#define GRUB_PCI_ADDR_IO_MASK ~0x03typedef grub_uint32_t grub_pci_id_t ; -typedef int (*grub_pci_iteratefunc_t ) (int bus,int device,int func, -grub_pci_id_t pciid); +typedef int NESTED_FUNC_ATTR (*grub_pci_iteratefunc_t) + (int bus,int device,int func,grub_pci_id_t pciid);typedef grub_uint32_t grub_pci_address_t ; grub_pci_address_t EXPORT_FUNC(grub_pci_make_address) (int bus, int device,
loader/i386/efi/linux.c +365 -117
611 lines not on this page · raw message
nice ... will try to test this asap.
2009/3/21 Bean <[email protected]>:
Quoted 46 lines
Hi,
This patch improves the frame buffer detection algorithm. It uses pci to find the video memory base, then scan it for frame buffer.
It also add a loadrom command which can be used to enable accel graphic driver. The idea is that you can grab the video bios dump, and optionally the IVT from pc mode, then load them in efi.
To grab bios dump:
sudo dd if=/dev/mem of=bios.bin bs=65536 skip=12 count=1You can also include the system bios by changing the count to 4.
To grab IVT dump:
sudo dd if=/dev/mem of=ivt.bin bs=1024 count=1Then, to load them in grub-efi (ivt.bin is optionally):
loadrom /bios.bin /ivt.binHere are some of the findings concerning different video cards:
Old 32-bit efi model, intel card:
Works with intel driver, no need to load vbios or ivt.New 64-bit efi model, intel card:
Works with intel driver, needs to load vbios.New 64-bit efi model, nvidia card:
Works with nvidia driver, no needs to load vbios or ivt. However, the backlight value is set too low so desktop is barely visible. You need to use a small tool to adjust backlight. The nv driver doesn't work.New 64-bit efi model, ati radeon card:
Works with fglrx driver, needs to load vbios and ivt. The radeonhd driver doesn't work.--
Bean_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 1 line · On Sat, Mar 21, 2009 at 11:49 PM, step21 <[email protected]> wrote:
nice ... will try to test this asap.
Hi,
Oh btw, there is still problem concerning the nvidia card, intel and ati cards should be all right.
Signature · 1 line
Bean
Quoted 4 lines · Bean
Hi,
This patch improves the frame buffer detection algorithm. It uses pci to find the video memory base, then scan it for frame buffer.
With this detection code getting increasingly more sophisticated, wouldn't this be a good time to make it a video backend? (i.e. video/efi.c)
Even if it won't be complete enough for gfxterm yet, it's much better than doing it in i386/efi/linux.c IMHO.
The code to obtain framebuffer address from video backends is pretty simple. It's already in i386/linux.c and could be easily integrated into i386/efi/linux.c.
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Hi,
svn rev 2043 patched loadrom.diff on imac81 with ati fglrx.
I find loadrom needs time when called in menuentry, otherwise linux load fails or loadrom fails. So I had to use sleep.
Then it works very nicely.
----------------------
insmod sleep
menuentry "loadrom hd0,4 sda4" {
search --set /ivt.bin
loadrom /bios.bin /ivt.bin
sleep 1
root=hd0,4
linux /vmlinuz root=/dev/sda4 video=vesafb
initrd /initrd.img
}
This is not apparent from command line with manual entry pauses.
---------------------------------
2009/3/21 Bean <[email protected]>
Quoted 46 lines
Hi,
This patch improves the frame buffer detection algorithm. It uses pci to find the video memory base, then scan it for frame buffer.
It also add a loadrom command which can be used to enable accel graphic driver. The idea is that you can grab the video bios dump, and optionally the IVT from pc mode, then load them in efi.
To grab bios dump:
sudo dd if=/dev/mem of=bios.bin bs=65536 skip=12 count=1You can also include the system bios by changing the count to 4.
To grab IVT dump:
sudo dd if=/dev/mem of=ivt.bin bs=1024 count=1Then, to load them in grub-efi (ivt.bin is optionally):
loadrom /bios.bin /ivt.binHere are some of the findings concerning different video cards:
Old 32-bit efi model, intel card:
Works with intel driver, no need to load vbios or ivt.New 64-bit efi model, intel card:
Works with intel driver, needs to load vbios.New 64-bit efi model, nvidia card:
Works with nvidia driver, no needs to load vbios or ivt. However, the backlight value is set too low so desktop is barely visible. You need to use a small tool to adjust backlight. The nv driver doesn't work.New 64-bit efi model, ati radeon card:
Works with fglrx driver, needs to load vbios and ivt. The radeonhd driver doesn't work.--
Bean_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 1 line
Cros (pxw)
Hi,
The new patch have some adjustment:
1, The loadbios code is moved out of linux.c, it's in a standalone module loadbios.mod, you could use:
fakebios
or
loadbios /VBIOS.bin
Both will fake acpi and dmi information, loadbios loads video bios rom from external file as well.
2, loadbios doesn't load ivt.bin anymore, you need to set INT13 with command write_dword in module memrw. First, use hexdump to get the INT13 vector from pc boot:
sudo hexdump /dev/mem -e '1/4 "0x%x\n"' -s 0x40 -n 4
Result is something like this:0xc0000014
The high word should always be 0xc000.
In grub2, use write_dword to change INT13:
write_dword 0x40 0xc0000014
Signature · 1 line
Bean
commands/memrw.c new file +101 -0
@@ -0,0 +1,101 @@ +/* memrw.c - command to read / write physical memory */ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2009 Free Software Foundation, Inc. +* +* GRUB is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GRUB is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GRUB. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <grub/dl.h> +#include <grub/misc.h> +#include <grub/command.h> + +static grub_command_t cmd_read_byte, cmd_read_word, cmd_read_dword; +static grub_command_t cmd_write_byte, cmd_write_word, cmd_write_dword; + +static grub_err_t +grub_cmd_read (grub_command_t cmd,int argc,char **argv) +{ +grub_target_addr_t addr; +grub_uint32_t value; + +if (argc !=1 ) +return grub_error (GRUB_ERR_BAD_ARGUMENT ,"Invalid number of arguments" ); + + addr =grub_strtoul (argv[0 ],0 ,0 ); +if (cmd->name[5 ] =='d' ) + value = *((grub_uint32_t *) addr); +else if (cmd->name[5 ] =='w' ) + value = *((grub_uint16_t *) addr); +else + value = *((grub_uint8_t *) addr); + +grub_printf ("0x%x\n" , value); + +return 0 ; +} + +static grub_err_t +grub_cmd_write (grub_command_t cmd,int argc,char **argv) +{ +grub_target_addr_t addr; +grub_uint32_t value; + +if (argc !=2 ) +return grub_error (GRUB_ERR_BAD_ARGUMENT ,"Invalid number of arguments" ); + + addr =grub_strtoul (argv[0 ],0 ,0 ); + value =grub_strtoul (argv[1 ],0 ,0 ); +if (cmd->name[6 ] =='d' ) + *((grub_uint32_t *) addr) = value; +else if (cmd->name[6 ] =='w' ) + *((grub_uint16_t *) addr) = (grub_uint16_t ) value; +else + *((grub_uint8_t *) addr) = (grub_uint8_t ) value; + +return 0 ; +} + +GRUB_MOD_INIT (memrw) +{ + (void ) mod;/* To stop warning. */ + cmd_read_byte = +grub_register_command ("read_byte" , grub_cmd_read, +"read_byte ADDR" ,"read byte." ); + cmd_read_word = +grub_register_command ("read_word" , grub_cmd_read, +"read_word ADDR" ,"read word." ); + cmd_read_dword = +grub_register_command ("read_dword" , grub_cmd_read, +"read_dword ADDR" ,"read dword." ); + cmd_write_byte = +grub_register_command ("write_byte" , grub_cmd_write, +"write_byte ADDR VALUE" ,"write byte." ); + cmd_write_word = +grub_register_command ("write_word" , grub_cmd_write, +"write_word ADDR VALUE" ,"write word." ); + cmd_write_dword = +grub_register_command ("write_dword" , grub_cmd_write, +"write_dword ADDR VALUE" ,"write dword." ); +} + +GRUB_MOD_FINI (memrw) +{ +grub_unregister_command (cmd_read_byte); +grub_unregister_command (cmd_read_word); +grub_unregister_command (cmd_read_dword); +grub_unregister_command (cmd_write_byte); +grub_unregister_command (cmd_write_word); +grub_unregister_command (cmd_write_dword); +}
conf/common.rmk +6 -1
@@ -335,7 +335,7 @@ pkglib_MODULES += minicmd.mod extcmd.mod hello.mod handler.mod \ ls.mod cmp.mod cat.mod help.mod search.mod \ loopback.mod fs_uuid.mod configfile.mod echo.mod \ terminfo.mod test.mod blocklist.mod hexdump.mod \ - read.mod sleep.mod loadenv.mod crc.mod + read.mod sleep.mod loadenv.mod crc.mod memrw.mod # For minicmd.mod. minicmd_mod_SOURCES = commands/minicmd.c
@@ -442,6 +442,11 @@ crc_mod_SOURCES = commands/crc.c lib/crc.c crc_mod_CFLAGS = $(COMMON_CFLAGS) crc_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For memrw.mod. +memrw_mod_SOURCES = commands/memrw.c +memrw_mod_CFLAGS = $(COMMON_CFLAGS) +memrw_mod_LDFLAGS = $(COMMON_LDFLAGS) + # Common Video Subsystem specific modules. pkglib_MODULES += video.mod videotest.mod bitmap.mod tga.mod jpeg.mod \ png.mod font.mod gfxterm.mod
conf/i386-efi.rmk +6 -1
@@ -79,7 +79,7 @@ grub_install_SOURCES = util/i386/efi/grub-install.in # Modules. pkglib_MODULES = kernel.mod normal.mod chain.mod appleldr.mod \ linux.mod halt.mod reboot.mod pci.mod lspci.mod \ - datetime.mod date.mod datehook.mod + datetime.mod date.mod datehook.mod loadbios.mod # For kernel.mod. kernel_mod_EXPORTS = no
@@ -182,5 +182,10 @@ datehook_mod_SOURCES = hook/datehook.c datehook_mod_CFLAGS = $(COMMON_CFLAGS) datehook_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For loadbios.mod +loadbios_mod_SOURCES = loader/i386/efi/loadbios.c +loadbios_mod_CFLAGS = $(COMMON_CFLAGS) +loadbios_mod_LDFLAGS = $(COMMON_LDFLAGS) + include $(srcdir)/conf/i386.mk include $(srcdir)/conf/common.mk
conf/x86_64-efi.rmk +6 -1
@@ -81,7 +81,7 @@ grub_install_SOURCES = util/i386/efi/grub-install.in # Modules. pkglib_MODULES = kernel.mod normal.mod chain.mod appleldr.mod \ halt.mod reboot.mod linux.mod pci.mod lspci.mod \ - datetime.mod date.mod datehook.mod + datetime.mod date.mod datehook.mod loadbios.mod # For kernel.mod. kernel_mod_EXPORTS = no
@@ -185,5 +185,10 @@ datehook_mod_SOURCES = hook/datehook.c datehook_mod_CFLAGS = $(COMMON_CFLAGS) datehook_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For loadbios.mod +loadbios_mod_SOURCES = loader/i386/efi/loadbios.c +loadbios_mod_CFLAGS = $(COMMON_CFLAGS) +loadbios_mod_LDFLAGS = $(COMMON_LDFLAGS) + include $(srcdir)/conf/i386.mk include $(srcdir)/conf/common.mk
include/grub/i386/pci.h +35 -0
@@ -32,4 +32,39 @@ grub_pci_read (grub_pci_address_t addr)return grub_inl (GRUB_PCI_DATA_REG ); } +static inline grub_uint16_t +grub_pci_read_word (grub_pci_address_t addr) +{ +grub_outl (addr & ~3 ,GRUB_PCI_ADDR_REG ); +return grub_inw (GRUB_PCI_DATA_REG + (addr &3 )); +} + +static inline grub_uint8_t +grub_pci_read_byte (grub_pci_address_t addr) +{ +grub_outl (addr & ~3 ,GRUB_PCI_ADDR_REG ); +return grub_inb (GRUB_PCI_DATA_REG + (addr &3 )); +} + +static inline void +grub_pci_write (grub_pci_address_t addr,grub_uint32_t data) +{ +grub_outl (addr,GRUB_PCI_ADDR_REG ); +grub_outl (data,GRUB_PCI_DATA_REG ); +} + +static inline void +grub_pci_write_word (grub_pci_address_t addr,grub_uint16_t data) +{ +grub_outl (addr & ~3 ,GRUB_PCI_ADDR_REG ); +grub_outw (data,GRUB_PCI_DATA_REG + (addr &3 )); +} + +static inline void +grub_pci_write_byte (grub_pci_address_t addr,grub_uint8_t data) +{ +grub_outl (addr & ~3 ,GRUB_PCI_ADDR_REG ); +grub_outb (data,GRUB_PCI_DATA_REG + (addr &3 )); +} +#endif /* GRUB_CPU_PCI_H */
include/grub/pci.h +2 -2
@@ -36,8 +36,8 @@#define GRUB_PCI_ADDR_IO_MASK ~0x03typedef grub_uint32_t grub_pci_id_t ; -typedef int (*grub_pci_iteratefunc_t ) (int bus,int device,int func, -grub_pci_id_t pciid); +typedef int NESTED_FUNC_ATTR (*grub_pci_iteratefunc_t) + (int bus,int device,int func,grub_pci_id_t pciid);typedef grub_uint32_t grub_pci_address_t ; grub_pci_address_t EXPORT_FUNC(grub_pci_make_address) (int bus, int device,
loader/i386/efi/linux.c +168 -157
414 lines not on this page · raw message
loader/i386/efi/loadbios.c new file +195 -0
195 lines not on this page · raw message
Hi,
This is another update, it contains the following changes with regards to the previous one:
1, Move loadbios command to commands/efi directory.
2, loadbios support an optional second parameter which is the int10 vector dump file.
3, The linux command enables frame buffer by default, so you don't need video= option anymore.
4. New command fix_video to fix video register issue with efi. With this, you can boot to console mode with agp enabled.
5, New shell script grub-dumpbios which can be used to generate the bios dump from pc mode.
As the commands usage have changed in the previous patches, here is a summary of what you should do with this latest patch:
1, Boot without bios dump.
This is the commands to use:
search --set /vmlinuzfix_video
fakebios
linux /vmlinuz root=/dev/sdb1
initrd /initrd.img
2, Boot with bios dump.
First, boot to pc mode, then use script grub-dumpbios to generate the dump files:
sudo grub-dumpbios -o /boot/
video bios dump is in vbios.bin, int10 vector is in int10.bin. /boot/ is the output directory.
Then, use the following commands in grub2:
search --set /vmlinuzfix_video
loadbios /boot/vbios.bin /boot/int10.bin
linux /vmlinuz root=/dev/sdb1
initrd /initrd.img
Moreover, if you're booting 2.6.27-28, amd64 kernel, you need to add noefi option.
Signature · 1 line
Bean
commands/efi/fixvideo.c new file +106 -0
@@ -0,0 +1,106 @@ +/* fixvideo.c - fix video problem in efi */ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2009 Free Software Foundation, Inc. +* +* GRUB is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GRUB is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GRUB. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <grub/dl.h> +#include <grub/misc.h> +#include <grub/file.h> +#include <grub/pci.h> +#include <grub/command.h> + +static struct grub_video_patch +{ +const char *name; +grub_uint32_t pci_id; +grub_uint32_t mmio_bar; +grub_uint32_t mmio_dispa; +grub_uint32_t mmio_dispb; +} video_patches[] = + { + {"Intel 965GM" ,0x2a028086 ,0 ,0x7019C ,0x7119C },/* DSPBSURF */ + {0 ,0 ,0 ,0 ,0 } + }; + +static int NESTED_FUNC_ATTR +scan_card (int bus, int dev, int func, grub_pci_id_t pciid) +{ +grub_pci_address_t addr; + + addr =grub_pci_make_address (bus, dev, func,2 ); +if (grub_pci_read_byte (addr +3 ) ==0x3 ) + { +struct grub_video_patch *p = video_patches; + +while (p->name) + { +if (p->pci_id == pciid) + { +grub_target_addr_t base; + +grub_printf ("Found graphic card: %s\n" , p->name); + addr +=8 + p->mmio_bar *4 ; + base =grub_pci_read (addr); +if ((! base) || (base &GRUB_PCI_ADDR_SPACE_IO ) || + (base &GRUB_PCI_ADDR_MEM_PREFETCH )) +grub_printf ("Invalid MMIO bar %d\n" , p->mmio_bar); +else + { +grub_uint32_t v; + + base &=GRUB_PCI_ADDR_MEM_MASK ; + v = *((volatile grub_uint32_t *) (base + p->mmio_dispa)); + *((volatile grub_uint32_t *) (base + p->mmio_dispb)) = v; +if (*((volatile grub_uint32_t *) (base + p->mmio_dispb)) + != v) +grub_printf ("Set MMIO fails\n" ); + } + +return 1 ; + } + p++; + } + +grub_printf ("Unknown graphic card: %x\n" , pciid); + } + +return 0 ; +} + +static grub_err_t +grub_cmd_fixvideo (grub_command_t cmd __attribute__ ((unused)), +int argc __attribute__ ((unused)), +char *argv[] __attribute__ ((unused))) +{ +grub_pci_iterate (scan_card); +return 0 ; +} + +static grub_command_t cmd_fixvideo; + +GRUB_MOD_INIT (fixvideo) +{ + (void ) mod;/* To stop warning. */ + cmd_fixvideo =grub_register_command ("fix_video" , grub_cmd_fixvideo, +0 ,"Fix video problem." ); + +} + +GRUB_MOD_FINI (fixvideo) +{ +grub_unregister_command (cmd_fixvideo); +}
commands/efi/loadbios.c new file +211 -0
211 lines not on this page · raw message
commands/memrw.c new file +101 -0
101 lines not on this page · raw message
conf/common.rmk +12 -1
@@ -155,6 +155,12 @@ CLEANFILES += $(grub-mkconfig_SCRIPTS) grub-mkconfig_DATA += util/grub.d/README +# For grub-dumpbios +grub-dumpbios: util/grub-dumpbios.in config.status + ./config.status --file=$@:$< + chmod +x $@ +sbin_SCRIPTS += grub-dumpbios +CLEANFILES += grub-dumpbios # Filing systems. pkglib_MODULES += fshelp.mod fat.mod ufs.mod ext2.mod ntfs.mod \
@@ -335,7 +341,7 @@ pkglib_MODULES += minicmd.mod extcmd.mod hello.mod handler.mod \ ls.mod cmp.mod cat.mod help.mod search.mod \ loopback.mod fs_uuid.mod configfile.mod echo.mod \ terminfo.mod test.mod blocklist.mod hexdump.mod \ - read.mod sleep.mod loadenv.mod crc.mod + read.mod sleep.mod loadenv.mod crc.mod memrw.mod # For minicmd.mod. minicmd_mod_SOURCES = commands/minicmd.c
@@ -442,6 +448,11 @@ crc_mod_SOURCES = commands/crc.c lib/crc.c crc_mod_CFLAGS = $(COMMON_CFLAGS) crc_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For memrw.mod. +memrw_mod_SOURCES = commands/memrw.c +memrw_mod_CFLAGS = $(COMMON_CFLAGS) +memrw_mod_LDFLAGS = $(COMMON_LDFLAGS) + # Common Video Subsystem specific modules. pkglib_MODULES += video.mod videotest.mod bitmap.mod tga.mod jpeg.mod \ png.mod font.mod gfxterm.mod
conf/i386-efi.rmk +11 -1
@@ -79,7 +79,7 @@ grub_install_SOURCES = util/i386/efi/grub-install.in # Modules. pkglib_MODULES = kernel.mod normal.mod chain.mod appleldr.mod \ linux.mod halt.mod reboot.mod pci.mod lspci.mod \ - datetime.mod date.mod datehook.mod + datetime.mod date.mod datehook.mod loadbios.mod fixvideo.mod # For kernel.mod. kernel_mod_EXPORTS = no
@@ -182,5 +182,15 @@ datehook_mod_SOURCES = hook/datehook.c datehook_mod_CFLAGS = $(COMMON_CFLAGS) datehook_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For loadbios.mod +loadbios_mod_SOURCES = commands/efi/loadbios.c +loadbios_mod_CFLAGS = $(COMMON_CFLAGS) +loadbios_mod_LDFLAGS = $(COMMON_LDFLAGS) + +# For fixvideo.mod +fixvideo_mod_SOURCES = commands/efi/fixvideo.c +fixvideo_mod_CFLAGS = $(COMMON_CFLAGS) +fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS) + include $(srcdir)/conf/i386.mk include $(srcdir)/conf/common.mk
conf/x86_64-efi.rmk +11 -1
@@ -81,7 +81,7 @@ grub_install_SOURCES = util/i386/efi/grub-install.in # Modules. pkglib_MODULES = kernel.mod normal.mod chain.mod appleldr.mod \ halt.mod reboot.mod linux.mod pci.mod lspci.mod \ - datetime.mod date.mod datehook.mod + datetime.mod date.mod datehook.mod loadbios.mod fixvideo.mod # For kernel.mod. kernel_mod_EXPORTS = no
@@ -185,5 +185,15 @@ datehook_mod_SOURCES = hook/datehook.c datehook_mod_CFLAGS = $(COMMON_CFLAGS) datehook_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For loadbios.mod +loadbios_mod_SOURCES = commands/efi/loadbios.c +loadbios_mod_CFLAGS = $(COMMON_CFLAGS) +loadbios_mod_LDFLAGS = $(COMMON_LDFLAGS) + +# For fixvideo.mod +fixvideo_mod_SOURCES = commands/efi/fixvideo.c +fixvideo_mod_CFLAGS = $(COMMON_CFLAGS) +fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS) + include $(srcdir)/conf/i386.mk include $(srcdir)/conf/common.mk
include/grub/i386/pci.h +35 -0
@@ -32,4 +32,39 @@ grub_pci_read (grub_pci_address_t addr)return grub_inl (GRUB_PCI_DATA_REG ); } +static inline grub_uint16_t +grub_pci_read_word (grub_pci_address_t addr) +{ +grub_outl (addr & ~3 ,GRUB_PCI_ADDR_REG ); +return grub_inw (GRUB_PCI_DATA_REG + (addr &3 )); +} + +static inline grub_uint8_t +grub_pci_read_byte (grub_pci_address_t addr) +{ +grub_outl (addr & ~3 ,GRUB_PCI_ADDR_REG ); +return grub_inb (GRUB_PCI_DATA_REG + (addr &3 )); +} + +static inline void +grub_pci_write (grub_pci_address_t addr,grub_uint32_t data) +{ +grub_outl (addr,GRUB_PCI_ADDR_REG ); +grub_outl (data,GRUB_PCI_DATA_REG ); +} + +static inline void +grub_pci_write_word (grub_pci_address_t addr,grub_uint16_t data) +{ +grub_outl (addr & ~3 ,GRUB_PCI_ADDR_REG ); +grub_outw (data,GRUB_PCI_DATA_REG + (addr &3 )); +} + +static inline void +grub_pci_write_byte (grub_pci_address_t addr,grub_uint8_t data) +{ +grub_outl (addr & ~3 ,GRUB_PCI_ADDR_REG ); +grub_outb (data,GRUB_PCI_DATA_REG + (addr &3 )); +} +#endif /* GRUB_CPU_PCI_H */
include/grub/pci.h +2 -2
@@ -36,8 +36,8 @@#define GRUB_PCI_ADDR_IO_MASK ~0x03typedef grub_uint32_t grub_pci_id_t ; -typedef int (*grub_pci_iteratefunc_t ) (int bus,int device,int func, -grub_pci_id_t pciid); +typedef int NESTED_FUNC_ATTR (*grub_pci_iteratefunc_t) + (int bus,int device,int func,grub_pci_id_t pciid);typedef grub_uint32_t grub_pci_address_t ; grub_pci_address_t EXPORT_FUNC(grub_pci_make_address) (int bus, int device,
loader/i386/efi/linux.c +172 -165
444 lines not on this page · raw message
util/grub-dumpbios.in new file +58 -0
58 lines not on this page · raw message
hi,
why did you scrap ivt.bin loading ... seems much more complicated now. I'm not sure if I remeber right, but I think ivt.bin worked best for me ...
2009/3/26 Bean <[email protected]>:
Quoted 57 lines
Hi,
This is another update, it contains the following changes with regards to the previous one:
1, Move loadbios command to commands/efi directory.
2, loadbios support an optional second parameter which is the int10 vector dump file.
3, The linux command enables frame buffer by default, so you don't need video= option anymore.
4. New commandfix_videoto fix video register issue with efi. With this, you can boot to console mode with agp enabled.
5, New shell script grub-dumpbios which can be used to generate the bios dump from pc mode.As the commands usage have changed in the previous patches, here is a summary of what you should do with this latest patch:
1, Boot without bios dump.
This is the commands to use:
search --set /vmlinuz
fix_video
fakebios
linux /vmlinuz root=/dev/sdb1
initrd /initrd.img2, Boot with bios dump.
First, boot to pc mode, then use script grub-dumpbios to generate the dump files:
sudo grub-dumpbios -o
/boot/video bios dump is in vbios.bin, int10 vector is in int10.bin.
/boot/is the output directory.Then, use the following commands in grub2:
search --set /vmlinuzfix_video
loadbios/boot/vbios.bin/boot/int10.bin
linux /vmlinuz root=/dev/sdb1
initrd /initrd.imgMoreover, if you're booting 2.6.27-28, amd64 kernel, you need to add noefi option.
--
Bean_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 3 lines · On Fri, Mar 27, 2009 at 12:09 AM, step21 <[email protected]> wrote:
hi,
why did you scrap ivt.bin loading ... seems much more complicated now. I'm not sure if I remeber right, but I think ivt.bin worked best for me ...
Hi,
The latest patch support loading file again, but only int10.bin, not the whole ivt. In fact, I add a shell script grub-dumpbios that does the job:
sudo grub-dumpbios -o /boot/
It would then save vbios.bin and int10.bin to /boot/ directory, in grub2:
loadbios /boot/vbios.bin /boot/int10.bin
Signature · 1 line
Bean
Quoted 11 lines · Bean
Quoted 3 lines · On Fri, Mar 27, 2009 at 12:09 AM, step21 <[email protected]> wrote:
hi,
why did you scrap ivt.bin loading ... seems much more complicated now. I'm not sure if I remeber right, but I think ivt.bin worked best for me ...Hi,
The latest patch support loading file again, but only int10.bin, not the whole ivt. In fact, I add a shell script grub-dumpbios that does the job:
Quoted 5 lines
sudo grub-dumpbios -o
/boot/It would then save vbios.bin and int10.bin to
/boot/directory, in grub2:loadbios
/boot/vbios.bin/boot/int10.bin
Committed.
Signature · 1 line
Bean