From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Fg7HY-0000QU-0O for mharc-grub-devel@gnu.org; Tue, 16 May 2006 17:40:44 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Fg7HW-0000P6-CG for grub-devel@gnu.org; Tue, 16 May 2006 17:40:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Fg7HV-0000OY-SI for grub-devel@gnu.org; Tue, 16 May 2006 17:40:42 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fg7HV-0000ON-Mj for grub-devel@gnu.org; Tue, 16 May 2006 17:40:41 -0400 Received: from [155.198.117.152] (helo=crumpet.cpn.ee.ic.ac.uk) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1Fg7KE-00066w-6w for grub-devel@gnu.org; Tue, 16 May 2006 17:43:30 -0400 Received: from localhost ([127.0.0.1]) by crumpet.cpn.ee.ic.ac.uk with esmtp (Exim 4.44) id 1Fg7HT-0001cY-Ag for grub-devel@gnu.org; Tue, 16 May 2006 22:40:39 +0100 Message-ID: <446A46D5.7040704@imperial.ac.uk> Date: Tue, 16 May 2006 22:40:37 +0100 From: vincent guffens User-Agent: Mozilla Thunderbird 1.0.8 (X11/20060502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: grub-devel@gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [patch 3/3] PCI support (simple test driver) X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 May 2006 21:40:42 -0000 And here comes the last part, this test driver detects the ne2000 card in qemu. 2006-05-16 Vincent Guffens * drivers/net/: New directory. * conf/i386-pc.rmk (pkgdata_MODULES): Added test_driver.mod to the list of modules. (test_driver_mod_SOURCES): Added. (test_driver_mod_CFLAGS): Likewise. (test_driver_mod_LDFLAGS): Likewise. * driver/net/test_driver.c: New file. diff -rNu grub2-pci_etherboot/ChangeLog grub2-pci_test_driver/ChangeLog --- grub2-pci_etherboot/ChangeLog 2006-05-16 21:51:44.000000000 +0100 +++ grub2-pci_test_driver/ChangeLog 2006-05-16 21:52:08.000000000 +0100 @@ -1,5 +1,17 @@ 2006-05-16 Vincent Guffens + * drivers/net/: New directory. + + * conf/i386-pc.rmk (pkgdata_MODULES): Added test_driver.mod + to the list of modules. + (test_driver_mod_SOURCES): Added. + (test_driver_mod_CFLAGS): Likewise. + (test_driver_mod_LDFLAGS): Likewise. + + * driver/net/test_driver.c: New file. + +2006-05-16 Vincent Guffens + * drivers/include/etherboot/: New directory. * drivers/pci/i386/: Likewise. diff -rNu grub2-pci_etherboot/conf/i386-pc.rmk grub2-pci_test_driver/conf/i386-pc.rmk --- grub2-pci_etherboot/conf/i386-pc.rmk 2006-05-16 21:27:03.000000000 +0100 +++ grub2-pci_test_driver/conf/i386-pc.rmk 2006-05-16 21:39:54.000000000 +0100 @@ -117,7 +117,8 @@ pkgdata_MODULES = _chain.mod _linux.mod linux.mod normal.mod \ _multiboot.mod chain.mod multiboot.mod reboot.mod halt.mod \ vbe.mod vbetest.mod vbeinfo.mod video.mod gfxterm.mod \ - videotest.mod play.mod pci.mod pci_etherboot.mod + videotest.mod play.mod pci.mod pci_etherboot.mod \ + test_driver.mod # For _chain.mod. _chain_mod_SOURCES = loader/i386/pc/chainloader.c @@ -220,4 +221,9 @@ pci_etherboot_mod_CFLAGS = $(COMMON_CFLAGS) $(DRIVERS_CFLAGS) pci_etherboot_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For test_driver.mod +test_driver_mod_SOURCES = drivers/net/test_driver.c +test_driver_mod_CFLAGS = $(COMMON_CFLAGS) $(DRIVERS_CFLAGS) +test_driver_mod_LDFLAGS = $(COMMON_LDFLAGS) + include $(srcdir)/conf/common.mk diff -rNu grub2-pci_etherboot/drivers/net/test_driver.c grub2-pci_test_driver/drivers/net/test_driver.c --- grub2-pci_etherboot/drivers/net/test_driver.c 1970-01-01 01:00:00.000000000 +0100 +++ grub2-pci_test_driver/drivers/net/test_driver.c 2006-05-16 21:40:07.000000000 +0100 @@ -0,0 +1,40 @@ +#include +#include +#include +#include +#include + +static grub_err_t +test_driver_probe (grub_pci_device_t pdev __attribute__((unused))) +{ + /* Whah! if it was always so simple. */ + return GRUB_ERR_NONE; +} + +static struct grub_pci_ids test_driver_ids[] = +{ + {0x10ec, 0x8029, "realtek 8029 test"}, + {0x1186, 0x0300, "dlink-528"}, +}; + +static struct grub_pci_driver test_driver = +{ + .next = 0, + .type = GRUB_NET_ETHERNET, + .name = "Test driver", + .probe = test_driver_probe, + .ids = test_driver_ids, + .id_count = sizeof(test_driver_ids)/sizeof(test_driver_ids[0]), + .class = 0, /* could be PCI_CLASS_NETWORK_ETHERNET + for generic drivers */ +}; + +GRUB_MOD_INIT(test_driver) +{ + grub_register_pci_driver (&test_driver); +} + +GRUB_MOD_FINI(test_driver) +{ + grub_unregister_pci_driver (&test_driver); +}