merge pciaccess into mips
This commit is contained in:
commit
6b6e0e05db
6 changed files with 43 additions and 16 deletions
22
ChangeLog.pciaccess
Normal file
22
ChangeLog.pciaccess
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
2009-12-02 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
libpciaccess support.
|
||||||
|
|
||||||
|
* Makefile.in (LIBPCIACCESS): New variable.
|
||||||
|
(enable_grub_emu_pci): Likewise.
|
||||||
|
* conf/any-emu.rmk (grub_emu_SOURCES) [enable_grub_emu_pci]: Add
|
||||||
|
util/pci.c and commands/lspci.c.
|
||||||
|
(grub_emu_LDFLAGS) [enable_grub_emu_pci]: Add $(LIBPCIACCESS).
|
||||||
|
* configure.ac (grub-emu-pci): New option.
|
||||||
|
* include/grub/i386/pci.h (grub_pci_device_map_range): New function.
|
||||||
|
(grub_pci_device_unmap_range): Likewise.
|
||||||
|
* include/grub/pci.h [GRUB_UTIL]: Include grub/pciutils.h.
|
||||||
|
(grub_pci_device) [!GRUB_UTIL]: New structure. All users updated.
|
||||||
|
(grub_pci_address_t) [!GRUB_UTIL]: New type.
|
||||||
|
(grub_pci_device_t) [!GRUB_UTIL]: Likewise.
|
||||||
|
(grub_pci_get_bus) [!GRUB_UTIL]: New function.
|
||||||
|
(grub_pci_get_device) [!GRUB_UTIL]: Likewise.
|
||||||
|
(grub_pci_get_function) [!GRUB_UTIL]: Likewise.
|
||||||
|
* include/grub/pciutils.h: New file.
|
||||||
|
* util/pci.c: Likewise.
|
||||||
|
|
|
@ -38,11 +38,11 @@ static struct grub_video_patch
|
||||||
};
|
};
|
||||||
|
|
||||||
static int NESTED_FUNC_ATTR
|
static int NESTED_FUNC_ATTR
|
||||||
scan_card (int bus, int dev, int func, grub_pci_id_t pciid)
|
scan_card (grub_pci_device_t dev, grub_pci_id_t pciid)
|
||||||
{
|
{
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
|
|
||||||
addr = grub_pci_make_address (bus, dev, func, 2);
|
addr = grub_pci_make_address (dev, 2);
|
||||||
if (grub_pci_read_byte (addr + 3) == 0x3)
|
if (grub_pci_read_byte (addr + 3) == 0x3)
|
||||||
{
|
{
|
||||||
struct grub_video_patch *p = video_patches;
|
struct grub_video_patch *p = video_patches;
|
||||||
|
|
|
@ -41,6 +41,7 @@ enable_rom_area (void)
|
||||||
{
|
{
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
grub_uint32_t *rom_ptr;
|
grub_uint32_t *rom_ptr;
|
||||||
|
grub_pci_device_t dev = { .bus = 0, .device = 0, .function = 0};
|
||||||
|
|
||||||
rom_ptr = (grub_uint32_t *) VBIOS_ADDR;
|
rom_ptr = (grub_uint32_t *) VBIOS_ADDR;
|
||||||
if (*rom_ptr != BLANK_MEM)
|
if (*rom_ptr != BLANK_MEM)
|
||||||
|
@ -49,7 +50,7 @@ enable_rom_area (void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
addr = grub_pci_make_address (0, 0, 0, 36);
|
addr = grub_pci_make_address (dev, 36);
|
||||||
grub_pci_write_byte (addr++, 0x30);
|
grub_pci_write_byte (addr++, 0x30);
|
||||||
grub_pci_write_byte (addr++, 0x33);
|
grub_pci_write_byte (addr++, 0x33);
|
||||||
grub_pci_write_byte (addr++, 0x33);
|
grub_pci_write_byte (addr++, 0x33);
|
||||||
|
@ -73,8 +74,9 @@ static void
|
||||||
lock_rom_area (void)
|
lock_rom_area (void)
|
||||||
{
|
{
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
|
grub_pci_device_t dev = { .bus = 0, .device = 0, .function = 0};
|
||||||
|
|
||||||
addr = grub_pci_make_address (0, 0, 0, 36);
|
addr = grub_pci_make_address (dev, 36);
|
||||||
grub_pci_write_byte (addr++, 0x10);
|
grub_pci_write_byte (addr++, 0x10);
|
||||||
grub_pci_write_byte (addr++, 0x11);
|
grub_pci_write_byte (addr++, 0x11);
|
||||||
grub_pci_write_byte (addr++, 0x11);
|
grub_pci_write_byte (addr++, 0x11);
|
||||||
|
|
|
@ -469,21 +469,22 @@ find_framebuf (grub_uint32_t *fb_base, grub_uint32_t *line_len)
|
||||||
{
|
{
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
auto int NESTED_FUNC_ATTR find_card (int bus, int dev, int func,
|
auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev,
|
||||||
grub_pci_id_t pciid);
|
grub_pci_id_t pciid);
|
||||||
|
|
||||||
int NESTED_FUNC_ATTR find_card (int bus, int dev, int func,
|
int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev,
|
||||||
grub_pci_id_t pciid)
|
grub_pci_id_t pciid)
|
||||||
{
|
{
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
|
|
||||||
addr = grub_pci_make_address (bus, dev, func, 2);
|
addr = grub_pci_make_address (dev, 2);
|
||||||
if (grub_pci_read (addr) >> 24 == 0x3)
|
if (grub_pci_read (addr) >> 24 == 0x3)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
grub_printf ("Display controller: %d:%d.%d\nDevice id: %x\n",
|
grub_printf ("Display controller: %d:%d.%d\nDevice id: %x\n",
|
||||||
bus, dev, func, pciid);
|
grub_pci_get_bus (dev), grub_pci_get_device (dev),
|
||||||
|
grub_pci_get_function (dev), pciid);
|
||||||
addr += 8;
|
addr += 8;
|
||||||
for (i = 0; i < 6; i++, addr += 4)
|
for (i = 0; i < 6; i++, addr += 4)
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,21 +71,22 @@ find_framebuf (grub_uint32_t *fb_base, grub_uint32_t *line_len)
|
||||||
{
|
{
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
auto int NESTED_FUNC_ATTR find_card (int bus, int dev, int func,
|
auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev,
|
||||||
grub_pci_id_t pciid);
|
grub_pci_id_t pciid);
|
||||||
|
|
||||||
int NESTED_FUNC_ATTR find_card (int bus, int dev, int func,
|
int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev,
|
||||||
grub_pci_id_t pciid)
|
grub_pci_id_t pciid)
|
||||||
{
|
{
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
|
|
||||||
addr = grub_pci_make_address (bus, dev, func, 2);
|
addr = grub_pci_make_address (dev, 2);
|
||||||
if (grub_pci_read (addr) >> 24 == 0x3)
|
if (grub_pci_read (addr) >> 24 == 0x3)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
grub_printf ("Display controller: %d:%d.%d\nDevice id: %x\n",
|
grub_printf ("Display controller: %d:%d.%d\nDevice id: %x\n",
|
||||||
bus, dev, func, pciid);
|
grub_pci_get_bus (dev), grub_pci_get_device (dev),
|
||||||
|
grub_pci_get_function (dev), pciid);
|
||||||
addr += 8;
|
addr += 8;
|
||||||
for (i = 0; i < 6; i++, addr += 4)
|
for (i = 0; i < 6; i++, addr += 4)
|
||||||
{
|
{
|
||||||
|
|
|
@ -84,21 +84,22 @@ find_framebuf (grub_uint32_t *fb_base, grub_uint32_t *line_len)
|
||||||
{
|
{
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
auto int NESTED_FUNC_ATTR find_card (int bus, int dev, int func,
|
auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev,
|
||||||
grub_pci_id_t pciid);
|
grub_pci_id_t pciid);
|
||||||
|
|
||||||
int NESTED_FUNC_ATTR find_card (int bus, int dev, int func,
|
int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev,
|
||||||
grub_pci_id_t pciid)
|
grub_pci_id_t pciid)
|
||||||
{
|
{
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
|
|
||||||
addr = grub_pci_make_address (bus, dev, func, 2);
|
addr = grub_pci_make_address (dev, 2);
|
||||||
if (grub_pci_read (addr) >> 24 == 0x3)
|
if (grub_pci_read (addr) >> 24 == 0x3)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
grub_dprintf ("fb", "Display controller: %d:%d.%d\nDevice id: %x\n",
|
grub_dprintf ("fb", "Display controller: %d:%d.%d\nDevice id: %x\n",
|
||||||
bus, dev, func, pciid);
|
grub_pci_get_bus (dev), grub_pci_get_device (dev),
|
||||||
|
grub_pci_get_function (dev), pciid);
|
||||||
addr += 8;
|
addr += 8;
|
||||||
for (i = 0; i < 6; i++, addr += 4)
|
for (i = 0; i < 6; i++, addr += 4)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue