Hello community, here is the log from the commit of package hwinfo checked in at Mon Feb 19 21:37:38 CET 2007. -------- --- hwinfo/hwinfo.changes 2007-02-09 15:46:26.000000000 +0100 +++ hwinfo/hwinfo.changes 2007-02-19 17:44:52.000000000 +0100 @@ -1,0 +2,7 @@ +Mon Feb 19 17:44:44 CET 2007 - snwint@suse.de + +- provide a bit more xen device info (#241564) +- sysfs: 'bus' is now called 'subsystem' +- support ehea devices (#243710) + +------------------------------------------------------------------- Old: ---- hwinfo-13.21.tar.bz2 New: ---- hwinfo-13.22.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hwinfo.spec ++++++ --- /var/tmp/diff_new_pack.w29855/_old 2007-02-19 21:36:25.000000000 +0100 +++ /var/tmp/diff_new_pack.w29855/_new 2007-02-19 21:36:25.000000000 +0100 @@ -1,5 +1,5 @@ # -# spec file for package hwinfo (Version 13.21) +# spec file for package hwinfo (Version 13.22) # # Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -20,9 +20,9 @@ PreReq: /sbin/ldconfig %insserv_prereq %fillup_prereq Autoreqprov: on Summary: Hardware Library -Version: 13.21 +Version: 13.22 Release: 1 -Source: hwinfo-13.21.tar.bz2 +Source: hwinfo-13.22.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -88,7 +88,11 @@ /usr/include/hd.h %doc doc/libhd/html -%changelog -n hwinfo +%changelog +* Mon Feb 19 2007 - snwint@suse.de +- provide a bit more xen device info (#241564) +- sysfs: 'bus' is now called 'subsystem' +- support ehea devices (#243710) * Fri Feb 09 2007 - snwint@suse.de - use dpt_i2o, not i2o (#176735) * Fri Feb 09 2007 - snwint@suse.de ++++++ hwinfo-13.21.tar.bz2 -> hwinfo-13.22.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/hwinfo-13.21/Changelog new/hwinfo-13.22/Changelog --- old/hwinfo-13.21/Changelog 2007-02-09 15:45:52.000000000 +0100 +++ new/hwinfo-13.22/Changelog 2007-02-19 17:34:19.000000000 +0100 @@ -1,3 +1,8 @@ +19/2/2007: v13.22 + - provide a bit more xen device info (#241564) + - sysfs: 'bus' is now called 'subsystem' + - support ehea devices (#243710) + 9/2/2007: v13.21 - use dpt_i2o, not i2o (#176735) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/hwinfo-13.21/VERSION new/hwinfo-13.22/VERSION --- old/hwinfo-13.21/VERSION 2007-02-09 15:45:29.000000000 +0100 +++ new/hwinfo-13.22/VERSION 2007-02-12 17:48:31.000000000 +0100 @@ -1 +1 @@ -13.21 +13.22 diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/hwinfo-13.21/hwinfo.c new/hwinfo-13.22/hwinfo.c --- old/hwinfo-13.21/hwinfo.c 2007-02-08 16:19:53.000000000 +0100 +++ new/hwinfo-13.22/hwinfo.c 2007-02-16 16:06:22.000000000 +0100 @@ -48,7 +48,7 @@ void do_chroot(hd_data_t *hd_data, char *dir); void ask_db(hd_data_t *hd_data, char *query); void get_mapping(hd_data_t *hd_data); -void get_mapping2(hd_data_t *hd_data); +int get_mapping2(void); void write_udi(hd_data_t *hd_data, char *udi); void do_saveconfig(hd_data_t *hd_data, hd_t *hd, FILE *f); @@ -56,6 +56,7 @@ struct { unsigned db_idx; unsigned separate:1; + unsigned verbose:1; char *root; } opt; @@ -66,6 +67,7 @@ { "version", 0, NULL, 400 }, { "log", 1, NULL, 'l' }, { "packages", 0, NULL, 'p' }, + { "verbose", 0, NULL, 'v' }, { "test", 0, NULL, 300 }, { "format", 1, NULL, 301 }, { "show-config", 1, NULL, 302 }, @@ -85,6 +87,7 @@ { "hddb-dir", 1, NULL, 316 }, { "nowpa", 0, NULL, 317 }, { "map2", 0, NULL, 318 }, + { "hddb-dir-new", 1, NULL, 319 }, { "cdrom", 0, NULL, 1000 + hw_cdrom }, { "floppy", 0, NULL, 1000 + hw_floppy }, { "disk", 0, NULL, 1000 + hw_disk }, @@ -177,7 +180,7 @@ opterr = 0; - while((i = getopt_long(argc, argv, "hd:l:p", options, NULL)) != -1) { + while((i = getopt_long(argc, argv, "hd:l:pv", options, NULL)) != -1) { switch(i) { case 1: if(!strcmp(optarg, "braille")) { @@ -207,6 +210,10 @@ dump_packages(hd_data); break; + case 'v': + opt.verbose = 1; + break; + case 300: do_test(hd_data); break; @@ -283,7 +290,11 @@ break; case 318: - get_mapping2(hd_data); + return get_mapping2(); + break; + + case 319: + if(*optarg) setenv("LIBHD_HDDB_DIR_NEW", optarg, 1); break; case 400: @@ -1566,20 +1577,135 @@ } -void get_mapping2(hd_data_t *hd_data) +int get_mapping2() { - hd_t *hd_manual, *hd; - hd_hw_item_t hw_items[] = { hw_disk, 0 }; - - hd_data->progress = NULL; + hd_data_t *hd_data, *hd_data_new; + hd_t *hd_manual, *hd, *hd_ctrl; + hd_hw_item_t hw_items[] = { hw_disk, hw_cdrom, hw_storage_ctrl, 0 }; + hd_hw_item_t type; + struct { + hd_hw_item_t type; + char *dev; + char *dev_new; + char *id; + char *p_id; + } *map; + unsigned i, cnt, unassigned = 0; + int err = 0; + char *s; + hd_data = calloc(1, sizeof *hd_data); hd_data->flags.list_all = 1; + hd_data->debug = -1; + + hd_data_new = calloc(1, sizeof *hd_data_new); + hd_data_new->flags.list_all = 1; + + hd_list(hd_data, hw_manual, 1, NULL); + hd_manual = hd_list2(hd_data, hw_items, 0); + + for(cnt = 0, hd = hd_manual; hd; hd = hd->next) { + cnt++; + if(opt.verbose) { + hd_dump_entry(hd_data, hd, stderr); + fprintf(stderr, "\n"); + } + } + + if(!cnt) return 0; + + map = calloc(cnt, sizeof *map); + + cnt = 0; + + for(hd = hd_manual; hd; hd = hd->next) { + type = hw_none; + if(hd_is_hw_class(hd, hw_cdrom)) type = hw_cdrom; + if(hd_is_hw_class(hd, hw_disk)) type = hw_disk; + + if(type == hw_none || !hd->unix_dev_name) continue; + + // printf("%s: %s\n %s\n %s\n", hd->unix_dev_name, hd->model, hd->unique_id, hd->udi); + hd_ctrl = hd_get_device_by_idx(hd_data, hd->attached_to); + map[cnt].type = type; + map[cnt].dev = hd->unix_dev_name; + map[cnt].id = hd->unique_id; + if(hd_ctrl) { + map[cnt].p_id = hd_ctrl->unique_id; + // printf(" %s\n %s\n", hd_ctrl->unique_id, hd_ctrl->udi); + } + + cnt++; + } + + if(!cnt) { + free(map); + return 0; + } + + s = getenv("LIBHD_HDDB_DIR_NEW"); + if(s) { + setenv("LIBHD_HDDB_DIR", s, 1); + + hd_list(hd_data_new, hw_manual, 1, NULL); + hd_manual = hd_list2(hd_data_new, hw_items, 0); + } + else { + hd_data_new->flags.list_all = 0; + hd_manual = hd_list2(hd_data_new, hw_items, 1); + } - hd_manual = hd_list2(hd_data, hw_items, 1); for(hd = hd_manual; hd; hd = hd->next) { - hd_dump_entry(hd_data, hd, stdout); + type = hw_none; + if(hd_is_hw_class(hd, hw_cdrom)) type = hw_cdrom; + if(hd_is_hw_class(hd, hw_disk)) type = hw_disk; + + if(type == hw_none || !hd->unix_dev_name) continue; + + hd_ctrl = hd_get_device_by_idx(hd_data_new, hd->attached_to); + + if(hd_ctrl) { + for(i = 0; i < cnt; i++) { + if( + map[i].type == type && + !map[i].dev_new && + map[i].p_id && + !strcmp(map[i].p_id, hd_ctrl->unique_id) + ) { + map[i].dev_new = hd->unix_dev_name; + break; + } + } + if(i == cnt) unassigned++; + } } + for(i = 0; i < cnt; i++) { + if(!map[i].dev_new) { + unassigned++; + continue; + } + if(strcmp(map[i].dev_new, map[i].dev)) printf("%s\t%s\n", map[i].dev_new, map[i].dev); + if(opt.verbose) { + fprintf(stderr, + "%d: %s = %s (%s @ %s)\n", + map[i].type, map[i].dev_new, map[i].dev, map[i].id, map[i].p_id + ); + } + } + if(opt.verbose) fprintf(stderr, "unassigned = %d\n", unassigned); + + if(unassigned) err = 1; + + free(map); + + hd_free_hd_data(hd_data_new); + free(hd_data_new); + + hd_free_hd_data(hd_data); + free(hd_data); + + return err; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/hwinfo-13.21/src/hd/block.c new/hwinfo-13.22/src/hd/block.c --- old/hwinfo-13.21/src/hd/block.c 2006-09-11 12:25:40.000000000 +0200 +++ new/hwinfo-13.22/src/hd/block.c 2007-02-14 15:01:58.000000000 +0100 @@ -162,7 +162,10 @@ if(bus_id) bus_id++; bus_name = NULL; - if((s = hd_read_sysfs_link(sf_dev, "bus"))) { + if( + (s = hd_read_sysfs_link(sf_dev, "subsystem")) || + (s = hd_read_sysfs_link(sf_dev, "bus")) + ) { bus_name = strrchr(s, '/'); if(bus_name) bus_name++; bus_name = new_str(bus_name); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/hwinfo-13.21/src/hd/net.c new/hwinfo-13.22/src/hd/net.c --- old/hwinfo-13.21/src/hd/net.c 2006-11-24 12:31:54.000000000 +0100 +++ new/hwinfo-13.22/src/hd/net.c 2007-02-19 17:33:25.000000000 +0100 @@ -127,8 +127,6 @@ add_res_entry(&hd->res, res1); } - hw_addr = free_mem(hw_addr); - hd->unix_dev_name = new_str(sf_class_e->str); hd->sysfs_id = new_str(hd_sysfs_id(sf_cdev)); @@ -139,6 +137,8 @@ get_driverinfo(hd_data, hd); } + hd_card = NULL; + if(sf_dev) { hd->sysfs_device_link = new_str(hd_sysfs_id(sf_dev)); @@ -173,6 +173,29 @@ } } + if(!hd_card && hw_addr) { + /* try to find card based on hwaddr (for prom-based cards) */ + + for(hd_card = hd_data->hd; hd_card; hd_card = hd_card->next) { + if( + hd_card->base_class.id != bc_network || + hd_card->sub_class.id != 0 + ) continue; + for(res = hd_card->res; res; res = res->next) { + if( + res->any.type == res_hwaddr && + !strcmp(hw_addr, res->hwaddr.addr) + ) break; + } + if(res) { + hd->attached_to = hd_card->idx; + break; + } + } + } + + hw_addr = free_mem(hw_addr); + #if 0 "ctc" sc_nif_ctc "iucv" sc_nif_iucv diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/hwinfo-13.21/src/hd/pci.c new/hwinfo-13.22/src/hd/pci.c --- old/hwinfo-13.21/src/hd/pci.c 2006-11-24 12:33:36.000000000 +0100 +++ new/hwinfo-13.22/src/hd/pci.c 2007-02-12 15:47:53.000000000 +0100 @@ -727,15 +727,16 @@ /* - * Get xen (network) data from sysfs. + * Get xen (network & storage) data from sysfs. */ void hd_read_xen(hd_data_t *hd_data) { char *s, *xen_type, *xen_node; - int eth_cnt = 0; + int eth_cnt = 0, blk_cnt = 0; hd_t *hd; str_list_t *sf_bus, *sf_bus_e; - char *sf_dev; + char *sf_dev, *drv, *module; + unsigned u; sf_bus = reverse_str_list(read_dir("/sys/bus/xen/devices", 'l')); @@ -765,19 +766,51 @@ ADD2LOG(" node = \"%s\"\n", xen_node); } + drv = new_str(hd_read_sysfs_link(sf_dev, "driver")); + + s = new_str(hd_read_sysfs_link(drv, "module")); + module = new_str(s ? strrchr(s, '/') + 1 : NULL); + free_mem(s); + + ADD2LOG(" module = \"%s\"\n", module); + if( xen_type && - !strcmp(xen_type, "vif") + ( + !strcmp(xen_type, "vif") || + !strcmp(xen_type, "vbd") + ) ) { hd = add_hd_entry(hd_data, __LINE__, 0); - hd->bus.id = bus_none; - hd->base_class.id = bc_network; - hd->sub_class.id = 0; /* ethernet */ - hd->slot = eth_cnt++; + hd->vendor.id = MAKE_ID(TAG_SPECIAL, 0x6011); /* xen */ - hd->device.id = MAKE_ID(TAG_SPECIAL, 0x0001); - str_printf(&hd->device.name, 0, "Virtual Ethernet card %d", hd->slot); + + if(!strcmp(xen_type, "vif")) { /* network */ + hd->base_class.id = bc_network; + hd->sub_class.id = 0; /* ethernet */ + hd->slot = eth_cnt++; + u = 3; + if(module) { + if(!strcmp(module, "xennet")) u = 1; + if(!strcmp(module, "xen_vnif")) u = 2; + } + hd->device.id = MAKE_ID(TAG_SPECIAL, u); + str_printf(&hd->device.name, 0, "Virtual Ethernet card %d", hd->slot); + } + else { /* storage */ + hd->base_class.id = bc_storage; + hd->sub_class.id = sc_sto_other; + hd->slot = blk_cnt++; + u = 3; + if(module) { + if(!strcmp(module, "xenblk")) u = 1; + if(!strcmp(module, "xen_vbd")) u = 2; + } + hd->device.id = MAKE_ID(TAG_SPECIAL, 0x1000 + u); + str_printf(&hd->device.name, 0, "Virtual Storage %d", hd->slot); + } + hd->rom_id = new_str(xen_node); hd->sysfs_id = new_str(hd_sysfs_id(sf_dev)); @@ -787,6 +820,8 @@ } free_mem(sf_dev); + free_mem(drv); + free_mem(module); } free_str_list(sf_bus); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/hwinfo-13.21/src/hd/prom.c new/hwinfo-13.22/src/hd/prom.c --- old/hwinfo-13.21/src/hd/prom.c 2006-08-29 16:15:38.000000000 +0200 +++ new/hwinfo-13.22/src/hd/prom.c 2007-02-19 17:31:38.000000000 +0100 @@ -31,6 +31,7 @@ static void add_pci_prom_devices(hd_data_t *hd_data, hd_t *hd_parent, devtree_t *parent); static void add_legacy_prom_devices(hd_data_t *hd_data, devtree_t *dt); static int add_prom_display(hd_data_t *hd_data, devtree_t *dt); +static void add_prom_ehea(hd_data_t *hd_data, devtree_t *dt); static void add_devices(hd_data_t *hd_data); static void dump_devtree_data(hd_data_t *hd_data); @@ -459,6 +460,8 @@ { if(dt->pci) return; + add_prom_ehea(hd_data, dt); + if(add_prom_display(hd_data, dt)) return; } @@ -508,6 +511,64 @@ return 0; } +void add_prom_ehea(hd_data_t *hd_data, devtree_t *dt) +{ + hd_t *hd; + hd_res_t *res; + char *path = NULL; + unsigned char *hw_addr_bin = NULL; + char *hw_addr = NULL; + int slot; + + if( + dt->device_type && + dt->compatible && + !strcmp(dt->device_type, "network") && + !strcmp(dt->compatible, "IBM,lhea-ethernet") + ) { + str_printf(&path, 0, PROC_PROM "/%s", dt->path); + + ADD2LOG(" ehea: %s\n", path); + + hd = add_hd_entry(hd_data, __LINE__, 0); + hd->bus.id = bus_none; + hd->base_class.id = bc_network; + hd->sub_class.id = 0; /* ethernet */ + + hd->vendor.id = MAKE_ID(TAG_SPECIAL, 0x6001); + hd->device.id = MAKE_ID(TAG_SPECIAL, 0x1003); + hd->rom_id = new_str(dt->path); + + read_int(path, "ibm,hea-port-no", &slot); + hd->slot = slot; + + read_str(path, "ibm,fw-adapter-name", &hd->device.name); + if(!hd->device.name) { + hd->device.name = new_str("IBM Host Ethernet Adapter"); + } + + // "mac-address" or "local-mac-address" ? + read_mem(path, "local-mac-address", &hw_addr_bin, 6); + + if(hw_addr_bin) { + str_printf( + &hw_addr, 0, "%02x:%02x:%02x:%02x:%02x:%02x", + hw_addr_bin[0], hw_addr_bin[1], + hw_addr_bin[2], hw_addr_bin[3], + hw_addr_bin[4], hw_addr_bin[5] + ); + res = new_mem(sizeof *res); + res->hwaddr.type = res_hwaddr; + res->hwaddr.addr = new_str(hw_addr); + add_res_entry(&hd->res, res); + } + } + + free_mem(hw_addr_bin); + free_mem(hw_addr); + free_mem(path); +} + void add_devices(hd_data_t *hd_data) { hd_t *hd; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/hwinfo-13.21/src/ids/src/class new/hwinfo-13.22/src/ids/src/class --- old/hwinfo-13.21/src/ids/src/class 2004-10-12 16:31:45.000000000 +0200 +++ new/hwinfo-13.22/src/ids/src/class 2007-02-12 15:48:05.000000000 +0100 @@ -40,7 +40,7 @@ baseclass.id 0x001 &subclass.id 0x80 -+subclass.name Unknown mass storage controller ++subclass.name Storage controller baseclass.id 0x002 +baseclass.name Network controller diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/hwinfo-13.21/src/ids/src/special new/hwinfo-13.22/src/ids/src/special --- old/hwinfo-13.21/src/ids/src/special 2005-12-09 11:11:59.000000000 +0100 +++ new/hwinfo-13.22/src/ids/src/special 2007-02-19 17:31:38.000000000 +0100 @@ -641,15 +641,36 @@ +driver.module.modprobe ibmveth +# IBM ehea + vendor.id special 0x6001 +&device.id special 0x1003 ++driver.module.modprobe ehea + + # UML veth vendor.id special 0x6010 +vendor.name UML -# Xen veth +# Xen network & storage vendor.id special 0x6011 +vendor.name Xen + vendor.id special 0x6011 +&device.id special 0x0001 ++driver.module.modprobe xennet + + vendor.id special 0x6011 +&device.id special 0x0002 ++driver.module.modprobe xen-vnif + + vendor.id special 0x6011 +&device.id special 0x1001 ++driver.module.modprobe xenblk + + vendor.id special 0x6011 +&device.id special 0x1002 ++driver.module.modprobe xen-vbd # VirtualIron vendor.id special 0x6012 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org