diff options
author | Erwan Velu <erwan@seanodes.com> | 2007-08-13 17:16:03 +0200 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-08-16 18:13:25 -0700 |
commit | 4e9956bf1b587df39590aa620be0940b30269a53 (patch) | |
tree | fe68ac6e95a455553e0c6caa11fca7e57ea8972e /com32/include/sys | |
parent | b85529420d2618222d9157866ab41a00e9f4fad9 (diff) | |
download | syslinux-4e9956bf1b587df39590aa620be0940b30269a53.tar.gz syslinux-4e9956bf1b587df39590aa620be0940b30269a53.tar.xz syslinux-4e9956bf1b587df39590aa620be0940b30269a53.zip |
Improving PCI collected informations
This patch
- add a new pci_dev_info structure :
It contains additional informations about the pci devices like
the product/vendor name and the associated linux kernel module
- add a get_name_from_pci_ids() function in pci/scan.c
This function reads a pci.ids file from the boot device.
Then it assign for each pci device, its vendor/product name.
You just have to put this file in the root directory of your
isolinux/pxelinux (i.e the root directory of your tfptboot server
if you are using pxelinux).
- add a get_module_name_from_pci_ids() function in pci/scan.c
This function reads a modules.pcimap file from the boot device.
Then it assign for each pci_device its linux kernel module.
You just have to put this file in the root directory of your
isolinux/pxelinux (i.e the root directory of your tfptboot server
if you are using pxelinux).
- Add a call to get_name_from_pci_ids() into the pcitest COM32 module
- Add a call to get_module_name_from_pci_ids() into the pcitest COM32 module
- Fixing typedef struct { ... } s_pci...; by struct pci... {};
- Improving comments
- Fixing the memory allocation to prevent leaks
With this patch, pcitest.c32 act like lspci plus a bonus by displaying
the linux kernel module assiocated to each pci device.
Signed-off-by:Erwan Velu <erwan.velu@free.fr>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32/include/sys')
-rw-r--r-- | com32/include/sys/pci.h | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/com32/include/sys/pci.h b/com32/include/sys/pci.h index b511477b..3f9b0d97 100644 --- a/com32/include/sys/pci.h +++ b/com32/include/sys/pci.h @@ -4,36 +4,43 @@ #include <inttypes.h> #include <sys/io.h> -#define MAX_VENDOR_NAME_SIZE 255 -#define MAX_PRODUCT_NAME_SIZE 255 #define MAX_PCI_DEVICES 32 #define MAX_PCI_BUSES 255 typedef uint32_t pciaddr_t; -typedef struct { +/* a structure for extended pci information */ +struct pci_dev_info { + char *vendor_name; + char *product_name; + char *linux_kernel_module; +}; + +/* a struct to represent a pci device */ +struct pci_device { uint16_t vendor; uint16_t product; uint16_t sub_vendor; uint16_t sub_product; uint8_t revision; -} s_pci_device; + struct pci_dev_info *pci_dev_info; +}; -typedef struct { +struct pci_bus { uint16_t id; - s_pci_device *pci_device[MAX_PCI_DEVICES]; + struct pci_device *pci_device[MAX_PCI_DEVICES]; uint8_t pci_device_count; -} s_pci_bus; +}; -typedef struct { - s_pci_device pci_device[MAX_PCI_DEVICES]; +struct pci_device_list { + struct pci_device pci_device[MAX_PCI_DEVICES]; uint8_t count; -} s_pci_device_list; +}; -typedef struct { - s_pci_bus pci_bus[MAX_PCI_BUSES]; +struct pci_bus_list { + struct pci_bus pci_bus[MAX_PCI_BUSES]; uint8_t count; -} s_pci_bus_list; +}; struct match { struct match *next; @@ -69,6 +76,8 @@ void pci_writeb(uint8_t, pciaddr_t); void pci_writew(uint16_t, pciaddr_t); void pci_writel(uint32_t, pciaddr_t); -extern int pci_scan(s_pci_bus_list *pci_bus_list, s_pci_device_list *pci_device_list); -extern struct match * find_pci_device(s_pci_device_list *pci_device_list, struct match *list); +extern int pci_scan(struct pci_bus_list *pci_bus_list, struct pci_device_list *pci_device_list); +extern struct match * find_pci_device(struct pci_device_list *pci_device_list, struct match *list); +extern void get_name_from_pci_ids(struct pci_device_list *pci_device_list); +extern void get_module_name_from_pci_ids(struct pci_device_list *pci_device_list); #endif /* _SYS_PCI_H */ |