Thread: [Etherboot-developers] PCI IDs in 5.1 drivers
Brought to you by:
marty_connor,
stefanhajnoczi
|
From: <ke...@us...> - 2003-02-08 13:47:27
|
Eric,
How about this scheme?
Define a macro with a distinctive name, say PCI_ID_ENTRY like this.
#define PCI_ID_ENTRY(a,b,c) {a,b,c}
Then use this macro in all the drivers like this:
PCI_ID_ENTRY(PCI_VENDOR_ID_INTEL,PCI_DEVICE_ID,INTEL_82557,"Intel EtherExpressPro100"),
PCI_ID_ENTRY(...),
...
Or just use the bare numbers. This allows grep or a perl script to
extract all the IDs to create the file NIC. If the symbolic names are
used, then preprocess the output against pci.h using cpp.
|
|
From: <ebi...@ln...> - 2003-02-09 01:36:35
|
ke...@us... writes:
> Eric,
>
> How about this scheme?
>
> Define a macro with a distinctive name, say PCI_ID_ENTRY like this.
>
> #define PCI_ID_ENTRY(a,b,c) {a,b,c}
>
> Then use this macro in all the drivers like this:
>
> PCI_ID_ENTRY(PCI_VENDOR_ID_INTEL,PCI_DEVICE_ID,INTEL_82557,"Intel
> EtherExpressPro100"),
>
> PCI_ID_ENTRY(...),
> ...
>
> Or just use the bare numbers. This allows grep or a perl script to
> extract all the IDs to create the file NIC. If the symbolic names are
> used, then preprocess the output against pci.h using cpp.
That sounds reasonable.
A couple of things. I believe the NIC file still needs
to contain the list of drivers.
The filename for the driver with a particular compile option
needs to be in the table entry. We can replace the long
text string we currently have in the table, with the filename,
as we do not use the long string, and it just takes up space.
Unless I am mistaken the existing tables in the code should
be distinctive enough that a small perl script can parse them
out without the use of a special macro.
Additionally we should be able to get the list of isa drivers,
from a driver file as well.
Eric
|
|
From: <ebi...@ln...> - 2003-02-14 01:12:03
|
ke...@us... writes:
> Eric,
>
> How about this scheme?
>
> Define a macro with a distinctive name, say PCI_ID_ENTRY like this.
>
> #define PCI_ID_ENTRY(a,b,c) {a,b,c}
>
> Then use this macro in all the drivers like this:
>
> PCI_ID_ENTRY(PCI_VENDOR_ID_INTEL,PCI_DEVICE_ID,INTEL_82557,"Intel
> EtherExpressPro100"),
>
> PCI_ID_ENTRY(...),
> ...
>
> Or just use the bare numbers. This allows grep or a perl script to
> extract all the IDs to create the file NIC. If the symbolic names are
> used, then preprocess the output against pci.h using cpp.
O.k. thinking about this some more I think I have a working proposal.
The guiding principles.
- Keep it simple.
- Allow driver code to be isolated to drivers.
So the proposal goes:
- Don't use pci_ids.h use hex numbers. pci_ids.h doesn't seem to add any real value.
- Use macros (PCI_ROM, ISA_ROM) because they are easy to find.
- Do the work in genrules.pl when we build the Rom file.
- For the weird cases, and for identifying the drivers keep the NIC file.
Here is an initial implementation of the idea.
If no one objects I will commit this and start looking at other drivers
besides the eepro100.
Eric
diff -uNr --exclude=bin --exclude=CVS --exclude=*~ ../etherboot-checkin/etherboot/etherboot-5.1/src/NIC etherboot/src/NIC
--- ../etherboot-checkin/etherboot/etherboot-5.1/src/NIC Tue Jan 7 19:54:12 2003
+++ etherboot/src/NIC Thu Feb 13 18:03:35 2003
@@ -73,16 +73,8 @@
3c9805 0x10b7,0x9805
3csoho100-tx 0x10b7,0x7646
-family drivers/net/eepro100
# Intel Etherexpress Pro/100
-eepro100 0x8086,0x1229
-82559er 0x8086,0x1209
-id1029 0x8086,0x1029
-id1030 0x8086,0x1030
-82801cam 0x8086,0x1031 82801CAM (ICH3) Chipset Ethernet Controller
-id1038 0x8086,0x1038
-82562et 0x8086,0x1039
-82562em 0x8086,0x2449
+family drivers/net/eepro100
family drivers/net/e1000
#Intel Etherexpress Pro/1000
@@ -227,4 +219,3 @@
ide_disk 0x0000,0x0000 Generic IDE disk support
family drivers/disk/pc_floppy
-pc_floppy - Generic PC floppy support
diff -uNr --exclude=bin --exclude=CVS --exclude=*~ ../etherboot-checkin/etherboot/etherboot-5.1/src/drivers/disk/pc_floppy.c etherboot/src/drivers/disk/pc_floppy.c
--- ../etherboot-checkin/etherboot/etherboot-5.1/src/drivers/disk/pc_floppy.c Fri Jan 17 10:48:32 2003
+++ etherboot/src/drivers/disk/pc_floppy.c Thu Feb 13 18:01:17 2003
@@ -1141,10 +1141,11 @@
{
0x3F0, 0x370, 0
};
+ISA_ROM("pc_floppy", "Generic PC Floppy support")
+
static struct isa_driver floppy_isa_driver __isa_driver = {
.type = FLOPPY_DRIVER,
.name = "PC flopyy",
.probe = floppy_probe,
.ioaddrs = floppy_ioaddrs,
-
};
diff -uNr --exclude=bin --exclude=CVS --exclude=*~ ../etherboot-checkin/etherboot/etherboot-5.1/src/drivers/net/eepro100.c etherboot/src/drivers/net/eepro100.c
--- ../etherboot-checkin/etherboot/etherboot-5.1/src/drivers/net/eepro100.c Thu Jan 2 17:00:16 2003
+++ etherboot/src/drivers/net/eepro100.c Thu Feb 13 18:01:10 2003
@@ -659,26 +659,15 @@
#endif
static struct pci_id eepro100_nics[] = {
- { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82557,
- "Intel EtherExpressPro100" },
- { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82559ER,
- "Intel EtherExpressPro100 82559ER" },
- { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ID1029,
- "Intel EtherExpressPro100 ID1029" },
- { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ID1030,
- "Intel Corporation 82559 InBusiness 10/100" },
- { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ID1031,
- "Intel 82801CAM Chipset Ethernet Controller" },
- { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ID1039,
- "Intel Corporation 82559 InBusiness 10/100" },
- { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ID103A,
- "Intel Corporation 82559 InBusiness 10/100" },
- { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82562,
- "Intel EtherExpressPro100 82562EM" },
- { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ID1038,
- "Intel(R) PRO/100 VM Network Connection" },
- { PCI_VENDOR_ID_INTEL, 0x1039,
- "Intel PRO100 VE 82562ET" },
+PCI_ROM(0x8086, 0x1229, "eepro100", "Intel EtherExpressPro100"),
+PCI_ROM(0x8086, 0x1209, "82559er", "Intel EtherExpressPro100 82559ER"),
+PCI_ROM(0x8086, 0x1029, "id1029", "Intel EtherExpressPro100 ID1029"),
+PCI_ROM(0x8086, 0x1030, "id1030", "Intel EtherExpressPro100 ID1030"),
+PCI_ROM(0x8086, 0x1031, "82801cam", "Intel 82801CAM (ICH3) Chipset Ethernet Controller"),
+PCI_ROM(0x8086, 0x1038, "id1038", "Intel(R) PRO/100 VM Network Connection"),
+PCI_ROM(0x8086, 0x1039, "82562et", "Intel PRO100 VE 82562ET"),
+PCI_ROM(0x8086, 0x2449, "82562em", "Intel EtherExpressPro100 82562EM"),
+PCI_ROM(0x8086, 0x103A, "id103a", "Intel Corporation 82559 InBusiness 10/100"),
};
static struct pci_driver eepro100_driver __pci_driver = {
diff -uNr --exclude=bin --exclude=CVS --exclude=*~ ../etherboot-checkin/etherboot/etherboot-5.1/src/genrules.pl etherboot/src/genrules.pl
--- ../etherboot-checkin/etherboot/etherboot-5.1/src/genrules.pl Thu Jan 16 09:12:16 2003
+++ etherboot/src/genrules.pl Thu Feb 13 18:01:48 2003
@@ -59,6 +59,32 @@
return sort values %driver_dep
}
+sub genroms($) {
+ my ($driver) = @_;
+
+ # Automatically discover the ROMS this driver can produce.
+ unless (open(INFILE, "$driver")) {
+ print STDERR "$driver: %! (shouldn't happen)\n";
+ next;
+ };
+ while (<INFILE>) {
+ chomp($_);
+ if ($_ =~ m/^\s*PCI_ROM\(\s*0x([0-9A-Fa-f]*)\s*,\s*0x([0-9A-Fa-f]*)\s*,\s*"([^"]*)"\s*,\s*"([^"]*)"\)/) {
+
+ # We store a list of PCI IDs and comments for each PC target
+ my ($vendor_id, $device_id, $rom, $comment) = (hex($1), hex($2), $3, $4);
+ my $ids = sprintf("0x%04x,0x%04x", $vendor_id, $device_id);
+ push(@{$pcient{$curfam}}, [$rom, $ids, $comment]);
+ }
+ elsif($_ =~ m/^\s*ISA_ROM\(\s*"([^"]*)"\s*,\s*"([^"]*)"\)/) {
+ my ($rom, $comment) = ($1, $2);
+ # We store the base driver file for each ISA target
+ $isaent{$rom} = $curfam;
+ $buildent{$rom} = 1;
+ }
+ }
+}
+
sub addfam ($) {
my ($family) = @_;
@@ -66,6 +92,7 @@
my @deps = &gendep("$family.c");
$drivers{$family} = join(' ', @deps);
$pcient{$family} = [];
+ genroms("$family.c");
}
sub addrom ($) {
diff -uNr --exclude=bin --exclude=CVS --exclude=*~ ../etherboot-checkin/etherboot/etherboot-5.1/src/include/isa.h etherboot/src/include/isa.h
--- ../etherboot-checkin/etherboot/etherboot-5.1/src/include/isa.h Thu Dec 12 18:35:10 2002
+++ etherboot/src/include/isa.h Thu Feb 13 17:59:06 2003
@@ -21,5 +21,7 @@
extern const struct isa_driver isa_drivers[];
extern const struct isa_driver isa_drivers_end[];
+#define ISA_ROM(IMAGE, DESCRIPTION)
+
#endif /* ISA_H */
diff -uNr --exclude=bin --exclude=CVS --exclude=*~ ../etherboot-checkin/etherboot/etherboot-5.1/src/include/pci.h etherboot/src/include/pci.h
--- ../etherboot-checkin/etherboot/etherboot-5.1/src/include/pci.h Thu Dec 12 18:35:53 2002
+++ etherboot/src/include/pci.h Thu Feb 13 17:59:00 2003
@@ -231,5 +231,7 @@
extern const struct pci_driver pci_drivers[];
extern const struct pci_driver pci_drivers_end[];
+#define PCI_ROM(VENDOR_ID, DEVICE_ID, IMAGE, DESCRIPTION) \
+ { VENDOR_ID, DEVICE_ID, IMAGE, }
#endif /* PCI_H */
|