summaryrefslogtreecommitdiffstats
path: root/dwflpp.cxx
Commit message (Expand)AuthorAgeFilesLines
* Support building against elfutils < 0.142 again.Mark Wielaard2010-02-021-1/+3
* Make sure cfa_ops are always retrieved through dwfl global address.Mark Wielaard2010-02-021-10/+24
* PR11173 Markers get a bad address in prelinked libraries.Mark Wielaard2010-01-181-39/+0
* PR10467 cont'd: be tolerant of bad line numbersJosh Stone2010-01-141-5/+2
* Fix get_cfa_ops failure on shared libraries.Mark Wielaard2010-01-061-3/+3
* PR11015 Support shared library reloading (in different processes)Mark Wielaard2009-12-221-3/+3
* dwarf probes: skip inlined instances with null (buggy) entrypcFrank Ch. Eigler2009-12-201-0/+10
* Search other CUs of the module when resolving declarations.Mark Wielaard2009-11-171-10/+38
* Use DW_AT_MIPS_linkage_name when available in vardie_from_symtable.Mark Wielaard2009-11-171-1/+8
* Remove caching of emit_address for kernel modules and shared libraries.Mark Wielaard2009-11-171-4/+7
* PR10010 Support $globals in shared libraries.Mark Wielaard2009-11-161-6/+5
* PR10622 Search for extern $variables in symbol table.Mark Wielaard2009-11-161-14/+54
* PR10923 Handle AT_frame_base given by DW_OP_call_frame_cfa in .debug_frame.Mark Wielaard2009-11-081-2/+2
* Ensure that DWARF keeps loc2c to a reasonable stack depthJosh Stone2009-10-211-0/+7
* Report experssion stack slot use back from loc2c.Roland McGrath2009-10-141-1/+2
* Handle DW_AT_const_value as alternative to location description.Mark Wielaard2009-10-051-1/+10
* Cache Dwfl's for reuse between pass 2 and pass 3.Mark Wielaard2009-09-291-13/+12
* Factor out duplicated code to setup user/module Dwfl from dwflpp/translate.Mark Wielaard2009-09-291-46/+9
* Use dwlpp::setup_kernel for tracepoint modules.Mark Wielaard2009-09-281-4/+33
* Factor out duplicated code to setup kernel/module Dwfl from dwflpp/translate.Mark Wielaard2009-09-281-93/+4
* PR10574: remove comdat/duplicate functions with entrypc=0Frank Ch. Eigler2009-09-221-1/+12
* Fix build error with elfutils < 0.142.Roland McGrath2009-09-171-4/+4
* PR10417 Pass around attributes for supporting DW_OP_{implicit,stack}_value.Mark Wielaard2009-09-171-2/+2
* Fix compilation error of dwflpp.cxx on gcc 4.1Wenji Huang2009-09-171-2/+3
* PR10461: Match C++ scopes for namespaces and classesJosh Stone2009-09-161-0/+58
* Remove the unused function_name_final_matchJosh Stone2009-09-161-7/+0
* Clean up dwflpp::translate_location workaround for DW_AT_data_member_location.Mark Wielaard2009-09-161-12/+11
* Remove function comparison from label iterationJosh Stone2009-09-151-26/+16
* Add actual pc address to semantic error about inaccessible variables.Mark Wielaard2009-09-111-1/+2
* PR10594 cont'd: Use parent die cache for variable lookupJosh Stone2009-09-101-63/+118
* Simplify deleting all map valuesJosh Stone2009-09-101-19/+5
* PR10594: Provide a cached dwarf_getscopes_dieJosh Stone2009-09-101-5/+98
* Escape literal '.'s in regular expressionsJosh Stone2009-09-031-7/+7
* Use a regexp for matching blacklist sectionsJosh Stone2009-09-031-8/+15
* Fetch the blacklist section only when neededJosh Stone2009-09-031-13/+3
* PR10572: Allow duplicate function names in a CUJosh Stone2009-09-021-13/+17
* Delete stuff that dwflpp newedJosh Stone2009-09-021-0/+17
* Unify lex_cast* and avoid string copiesJosh Stone2009-09-021-15/+15
* Cache inline instance lookupsJosh Stone2009-08-281-11/+50
* Reorganize iterate_over_labelsJosh Stone2009-08-261-51/+42
* Compute cu_name dynamicallyJosh Stone2009-08-251-6/+11
* Avoid needless Dwarf_Die copyingJosh Stone2009-08-251-14/+11
* Index cu_inl_function_cache_t by function->addrJosh Stone2009-08-251-3/+2
* Index mod_cu_function_cache_t by cu->addrJosh Stone2009-08-251-11/+12
* PR2475: Filter filenames against the decl_fileJosh Stone2009-08-241-1/+1
* PR10461: Add support for C++ classes and referencesJosh Stone2009-08-211-13/+33
* PR10537 process().function().label() should select multiple inlined instances.Mark Wielaard2009-08-201-20/+9
* Give a more exact error for dereferencing void*Josh Stone2009-08-191-0/+6
* PR10538: Give a file:line hint for anonymous typesJosh Stone2009-08-191-2/+13
* Create a dwarf_attr_die idiomJosh Stone2009-08-191-10/+3
p;data->update_lock); if (time_after(jiffies, data->last_updated + HZ) || !data->valid) { /* Update local register data */ data->reg.vid = i2c_smbus_read_byte_data(client, ATXP1_VID); data->reg.cpu_vid = i2c_smbus_read_byte_data(client, ATXP1_CVID); data->reg.gpio1 = i2c_smbus_read_byte_data(client, ATXP1_GPIO1); data->reg.gpio2 = i2c_smbus_read_byte_data(client, ATXP1_GPIO2); data->valid = 1; } mutex_unlock(&data->update_lock); return(data); } /* sys file functions for cpu0_vid */ static ssize_t atxp1_showvcore(struct device *dev, struct device_attribute *attr, char *buf) { int size; struct atxp1_data *data; data = atxp1_update_device(dev); size = sprintf(buf, "%d\n", vid_from_reg(data->reg.vid & ATXP1_VIDMASK, data->vrm)); return size; } static ssize_t atxp1_storevcore(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct atxp1_data *data; struct i2c_client *client; int vid, cvid; unsigned int vcore; client = to_i2c_client(dev); data = atxp1_update_device(dev); vcore = simple_strtoul(buf, NULL, 10); vcore /= 25; vcore *= 25; /* Calculate VID */ vid = vid_to_reg(vcore, data->vrm); if (vid < 0) { dev_err(dev, "VID calculation failed.\n"); return -1; } /* If output enabled, use control register value. Otherwise original CPU VID */ if (data->reg.vid & ATXP1_VIDENA) cvid = data->reg.vid & ATXP1_VIDMASK; else cvid = data->reg.cpu_vid; /* Nothing changed, aborting */ if (vid == cvid) return count; dev_dbg(dev, "Setting VCore to %d mV (0x%02x)\n", vcore, vid); /* Write every 25 mV step to increase stability */ if (cvid > vid) { for (; cvid >= vid; cvid--) { i2c_smbus_write_byte_data(client, ATXP1_VID, cvid | ATXP1_VIDENA); } } else { for (; cvid <= vid; cvid++) { i2c_smbus_write_byte_data(client, ATXP1_VID, cvid | ATXP1_VIDENA); } } data->valid = 0; return count; } /* CPU core reference voltage unit: millivolt */ static DEVICE_ATTR(cpu0_vid, S_IRUGO | S_IWUSR, atxp1_showvcore, atxp1_storevcore); /* sys file functions for GPIO1 */ static ssize_t atxp1_showgpio1(struct device *dev, struct device_attribute *attr, char *buf) { int size; struct atxp1_data *data; data = atxp1_update_device(dev); size = sprintf(buf, "0x%02x\n", data->reg.gpio1 & ATXP1_GPIO1MASK); return size; } static ssize_t atxp1_storegpio1(struct device *dev, struct device_attribute *attr, const char*buf, size_t count) { struct atxp1_data *data; struct i2c_client *client; unsigned int value; client = to_i2c_client(dev); data = atxp1_update_device(dev); value = simple_strtoul(buf, NULL, 16); value &= ATXP1_GPIO1MASK; if (value != (data->reg.gpio1 & ATXP1_GPIO1MASK)) { dev_info(dev, "Writing 0x%x to GPIO1.\n", value); i2c_smbus_write_byte_data(client, ATXP1_GPIO1, value); data->valid = 0; } return count; } /* GPIO1 data register unit: Four bit as hex (e.g. 0x0f) */ static DEVICE_ATTR(gpio1, S_IRUGO | S_IWUSR, atxp1_showgpio1, atxp1_storegpio1); /* sys file functions for GPIO2 */ static ssize_t atxp1_showgpio2(struct device *dev, struct device_attribute *attr, char *buf) { int size; struct atxp1_data *data; data = atxp1_update_device(dev); size = sprintf(buf, "0x%02x\n", data->reg.gpio2); return size; } static ssize_t atxp1_storegpio2(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct atxp1_data *data; struct i2c_client *client; unsigned int value; client = to_i2c_client(dev); data = atxp1_update_device(dev); value = simple_strtoul(buf, NULL, 16) & 0xff; if (value != data->reg.gpio2) { dev_info(dev, "Writing 0x%x to GPIO1.\n", value); i2c_smbus_write_byte_data(client, ATXP1_GPIO2, value); data->valid = 0; } return count; } /* GPIO2 data register unit: Eight bit as hex (e.g. 0xff) */ static DEVICE_ATTR(gpio2, S_IRUGO | S_IWUSR, atxp1_showgpio2, atxp1_storegpio2); static struct attribute *atxp1_attributes[] = { &dev_attr_gpio1.attr, &dev_attr_gpio2.attr, &dev_attr_cpu0_vid.attr, NULL }; static const struct attribute_group atxp1_group = { .attrs = atxp1_attributes, }; static int atxp1_attach_adapter(struct i2c_adapter *adapter) { if (!(adapter->class & I2C_CLASS_HWMON)) return 0; return i2c_probe(adapter, &addr_data, &atxp1_detect); }; static int atxp1_detect(struct i2c_adapter *adapter, int address, int kind) { struct i2c_client * new_client; struct atxp1_data * data; int err = 0; u8 temp; if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) goto exit; if (!(data = kzalloc(sizeof(struct atxp1_data), GFP_KERNEL))) { err = -ENOMEM; goto exit; } new_client = &data->client; i2c_set_clientdata(new_client, data); new_client->addr = address; new_client->adapter = adapter; new_client->driver = &atxp1_driver; new_client->flags = 0; /* Detect ATXP1, checking if vendor ID registers are all zero */ if (!((i2c_smbus_read_byte_data(new_client, 0x3e) == 0) && (i2c_smbus_read_byte_data(new_client, 0x3f) == 0) && (i2c_smbus_read_byte_data(new_client, 0xfe) == 0) && (i2c_smbus_read_byte_data(new_client, 0xff) == 0) )) { /* No vendor ID, now checking if registers 0x10,0x11 (non-existent) * showing the same as register 0x00 */ temp = i2c_smbus_read_byte_data(new_client, 0x00); if (!((i2c_smbus_read_byte_data(new_client, 0x10) == temp) && (i2c_smbus_read_byte_data(new_client, 0x11) == temp) )) goto exit_free; } /* Get VRM */ data->vrm = vid_which_vrm(); if ((data->vrm != 90) && (data->vrm != 91)) { dev_err(&new_client->dev, "Not supporting VRM %d.%d\n", data->vrm / 10, data->vrm % 10); goto exit_free; } strncpy(new_client->name, "atxp1", I2C_NAME_SIZE); data->valid = 0; mutex_init(&data->update_lock); err = i2c_attach_client(new_client); if (err) { dev_err(&new_client->dev, "Attach client error.\n"); goto exit_free; } /* Register sysfs hooks */ if ((err = sysfs_create_group(&new_client->dev.kobj, &atxp1_group))) goto exit_detach; data->class_dev = hwmon_device_register(&new_client->dev); if (IS_ERR(data->class_dev)) { err = PTR_ERR(data->class_dev); goto exit_remove_files; } dev_info(&new_client->dev, "Using VRM: %d.%d\n", data->vrm / 10, data->vrm % 10); return 0; exit_remove_files: sysfs_remove_group(&new_client->dev.kobj, &atxp1_group); exit_detach: i2c_detach_client(new_client); exit_free: kfree(data); exit: return err; }; static int atxp1_detach_client(struct i2c_client * client) { struct atxp1_data * data = i2c_get_clientdata(client); int err; hwmon_device_unregister(data->class_dev); sysfs_remove_group(&client->dev.kobj, &atxp1_group); err = i2c_detach_client(client); if (err) dev_err(&client->dev, "Failed to detach client.\n"); else kfree(data); return err; }; static int __init atxp1_init(void) { return i2c_add_driver(&atxp1_driver); }; static void __exit atxp1_exit(void) { i2c_del_driver(&atxp1_driver); }; module_init(atxp1_init); module_exit(atxp1_exit);