From ef4592db095d94bf82ed5f76be310b82dffb9aaf Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 24 Mar 2008 16:42:10 +0000 Subject: [PATCH] Drop the trailing .pl from all perl script names. git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5162 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + eeprom/Module.mk | 8 +- eeprom/README | 15 +- eeprom/ddcmon | 2 +- eeprom/decode-dimms | 1402 ++++++++++++++++++++++++++++++++++++++++++++++++ eeprom/decode-dimms.pl | 1402 ------------------------------------------------ eeprom/decode-edid | 224 ++++++++ eeprom/decode-edid.pl | 224 -------- eeprom/decode-vaio | 272 ++++++++++ eeprom/decode-vaio.pl | 272 ---------- eeprom/decode-xeon | 197 +++++++ eeprom/decode-xeon.pl | 197 ------- 12 files changed, 2109 insertions(+), 2107 deletions(-) create mode 100755 eeprom/decode-dimms delete mode 100755 eeprom/decode-dimms.pl create mode 100755 eeprom/decode-edid delete mode 100755 eeprom/decode-edid.pl create mode 100755 eeprom/decode-vaio delete mode 100755 eeprom/decode-vaio.pl create mode 100755 eeprom/decode-xeon delete mode 100755 eeprom/decode-xeon.pl diff --git a/CHANGES b/CHANGES index d103e91..6d33408 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,7 @@ i2c-tools CHANGES ----------------- SVN + Drop the trailing .pl from all perl script names decode-dimms: Fix DDR2 SDRAM module speed decoding Update manufacturer IDs Don't print anything by default if checksum fails diff --git a/eeprom/Module.mk b/eeprom/Module.mk index d783956..950bee5 100644 --- a/eeprom/Module.mk +++ b/eeprom/Module.mk @@ -1,16 +1,16 @@ # EEPROM decoding scripts for the Linux eeprom driver # -# Copyright (C) 2007 Jean Delvare +# Copyright (C) 2007-2008 Jean Delvare # # Licensed under the GNU General Public License. EEPROM_DIR := eeprom -EEPROM_TARGETS := decode-dimms.pl decode-vaio.pl ddcmon decode-edid.pl +EEPROM_TARGETS := decode-dimms decode-vaio ddcmon decode-edid -# decode-xeon.pl was not yet ported to the Linux 2.6 sysfs interface +# decode-xeon was not yet ported to the Linux 2.6 sysfs interface ifeq (,$(findstring /2.6., /$(KERNELVERSION))) -EEPROM_TARGETS += decode-xeon.pl +EEPROM_TARGETS += decode-xeon endif # diff --git a/eeprom/README b/eeprom/README index 962ff46..efca1d0 100644 --- a/eeprom/README +++ b/eeprom/README @@ -1,21 +1,22 @@ This directory contains scripts to decode the data exposed by the eeprom Linux kernel driver. -* decode-dimms.pl (perl script) - Decode the information found in memory module SPD EEPROMs. +* decode-dimms (perl script) + Decode the information found in memory module SPD EEPROMs. The SPD + data is read either from the running system or from dump files. -* decode-vaio.pl (perl script) +* decode-vaio (perl script) Decode the information found in Sony Vaio laptop identification EEPROMs. * ddcmon (perl script) - decode-edid.pl (perl script) + decode-edid (perl script) Decode the information found in monitor EEPROMs. Both scripts require an access to the DDC channel of the monitor. This is typically provided - by framebuffer drivers. decode-edid.pl additionally requires parse-edid, + by framebuffer drivers. decode-edid additionally requires parse-edid, which is part of the read-edid package. ddcmon prints general - information, while decode-edid.pl prints timing information for + information, while decode-edid prints timing information for inclusion into your X11 configuration file. -* decode-xeon.pl (perl script) +* decode-xeon (perl script) ID ROM data decoding for Xeon processors. Support for sysfs is still missing, so this script doesn't work with 2.6 kernels yet. diff --git a/eeprom/ddcmon b/eeprom/ddcmon index 990e0b0..664d9be 100755 --- a/eeprom/ddcmon +++ b/eeprom/ddcmon @@ -2,7 +2,7 @@ # # Copyright (C) 2004-2005 Jean Delvare # -# Parts inspired from decode-edid.pl. +# Parts inspired from decode-edid. # Copyright (C) 2003-2004 Jean Delvare # # Parts inspired from the ddcmon driver and sensors' print_ddcmon function. diff --git a/eeprom/decode-dimms b/eeprom/decode-dimms new file mode 100755 index 0000000..39ea3cd --- /dev/null +++ b/eeprom/decode-dimms @@ -0,0 +1,1402 @@ +#!/usr/bin/perl -w +# +# EEPROM data decoder for SDRAM DIMM modules +# +# Copyright 1998, 1999 Philip Edelbrock +# modified by Christian Zuckschwerdt +# modified by Burkart Lingner +# Copyright (C) 2005-2008 Jean Delvare +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# +# The eeprom driver must be loaded (unless option -x is used). For kernels +# older than 2.6.0, the eeprom driver can be found in the lm-sensors package. +# +# References: +# PC SDRAM Serial Presence +# Detect (SPD) Specification, Intel, +# 1997,1999, Rev 1.2B +# +# Jedec Standards 4.1.x & 4.5.x +# http://www.jedec.org +# + +require 5.004; + +use strict; +use POSIX; +use Fcntl qw(:DEFAULT :seek); +use vars qw($opt_html $opt_bodyonly $opt_igncheck $use_sysfs $use_hexdump + @vendors %decode_callback $revision @dimm_list %hexdump_cache); + +$revision = '$Revision$ ($Date$)'; +$revision =~ s/\$\w+: (.*?) \$/$1/g; +$revision =~ s/ \([^()]*\)//; + +@vendors = ( +["AMD", "AMI", "Fairchild", "Fujitsu", + "GTE", "Harris", "Hitachi", "Inmos", + "Intel", "I.T.T.", "Intersil", "Monolithic Memories", + "Mostek", "Freescale (former Motorola)", "National", "NEC", + "RCA", "Raytheon", "Conexant (Rockwell)", "Seeq", + "NXP (former Signetics, Philips Semi.)", "Synertek", "Texas Instruments", "Toshiba", + "Xicor", "Zilog", "Eurotechnique", "Mitsubishi", + "Lucent (AT&T)", "Exel", "Atmel", "SGS/Thomson", + "Lattice Semi.", "NCR", "Wafer Scale Integration", "IBM", + "Tristar", "Visic", "Intl. CMOS Technology", "SSSI", + "MicrochipTechnology", "Ricoh Ltd.", "VLSI", "Micron Technology", + "Hyundai Electronics", "OKI Semiconductor", "ACTEL", "Sharp", + "Catalyst", "Panasonic", "IDT", "Cypress", + "DEC", "LSI Logic", "Zarlink (former Plessey)", "UTMC", + "Thinking Machine", "Thomson CSF", "Integrated CMOS (Vertex)", "Honeywell", + "Tektronix", "Sun Microsystems", "SST", "ProMos/Mosel Vitelic", + "Infineon (former Siemens)", "Macronix", "Xerox", "Plus Logic", + "SunDisk", "Elan Circuit Tech.", "European Silicon Str.", "Apple Computer", + "Xilinx", "Compaq", "Protocol Engines", "SCI", + "Seiko Instruments", "Samsung", "I3 Design System", "Klic", + "Crosspoint Solutions", "Alliance Semiconductor", "Tandem", "Hewlett-Packard", + "Intg. Silicon Solutions", "Brooktree", "New Media", "MHS Electronic", + "Performance Semi.", "Winbond Electronic", "Kawasaki Steel", "Bright Micro", + "TECMAR", "Exar", "PCMCIA", "LG Semi (former Goldstar)", + "Northern Telecom", "Sanyo", "Array Microsystems", "Crystal Semiconductor", + "Analog Devices", "PMC-Sierra", "Asparix", "Convex Computer", + "Quality Semiconductor", "Nimbus Technology", "Transwitch", "Micronas (ITT Intermetall)", + "Cannon", "Altera", "NEXCOM", "QUALCOMM", + "Sony", "Cray Research", "AMS(Austria Micro)", "Vitesse", + "Aster Electronics", "Bay Networks (Synoptic)", "Zentrum or ZMD", "TRW", + "Thesys", "Solbourne Computer", "Allied-Signal", "Dialog", + "Media Vision", "Level One Communication"], +["Cirrus Logic", "National Instruments", "ILC Data Device", "Alcatel Mietec", + "Micro Linear", "Univ. of NC", "JTAG Technologies", "BAE Systems", + "Nchip", "Galileo Tech", "Bestlink Systems", "Graychip", + "GENNUM", "VideoLogic", "Robert Bosch", "Chip Express", + "DATARAM", "United Microelec Corp.", "TCSI", "Smart Modular", + "Hughes Aircraft", "Lanstar Semiconductor", "Qlogic", "Kingston", + "Music Semi", "Ericsson Components", "SpaSE", "Eon Silicon Devices", + "Programmable Micro Corp", "DoD", "Integ. Memories Tech.", "Corollary Inc.", + "Dallas Semiconductor", "Omnivision", "EIV(Switzerland)", "Novatel Wireless", + "Zarlink (former Mitel)", "Clearpoint", "Cabletron", "STEC (former Silicon Technology)", + "Vanguard", "Hagiwara Sys-Com", "Vantis", "Celestica", + "Century", "Hal Computers", "Rohm Company Ltd.", "Juniper Networks", + "Libit Signal Processing", "Mushkin Enhanced Memory", "Tundra Semiconductor", "Adaptec Inc.", + "LightSpeed Semi.", "ZSP Corp.", "AMIC Technology", "Adobe Systems", + "Dynachip", "PNY Electronics", "Newport Digital", "MMC Networks", + "T Square", "Seiko Epson", "Broadcom", "Viking Components", + "V3 Semiconductor", "Flextronics (former Orbit)", "Suwa Electronics", "Transmeta", + "Micron CMS", "American Computer & Digital Components Inc", "Enhance 3000 Inc", "Tower Semiconductor", + "CPU Design", "Price Point", "Maxim Integrated Product", "Tellabs", + "Centaur Technology", "Unigen Corporation", "Transcend Information", "Memory Card Technology", + "CKD Corporation Ltd.", "Capital Instruments, Inc.", "Aica Kogyo, Ltd.", "Linvex Technology", + "MSC Vertriebs GmbH", "AKM Company, Ltd.", "Dynamem, Inc.", "NERA ASA", + "GSI Technology", "Dane-Elec (C Memory)", "Acorn Computers", "Lara Technology", + "Oak Technology, Inc.", "Itec Memory", "Tanisys Technology", "Truevision", + "Wintec Industries", "Super PC Memory", "MGV Memory", "Galvantech", + "Gadzoox Nteworks", "Multi Dimensional Cons.", "GateField", "Integrated Memory System", + "Triscend", "XaQti", "Goldenram", "Clear Logic", + "Cimaron Communications", "Nippon Steel Semi. Corp.", "Advantage Memory", "AMCC", + "LeCroy", "Yamaha Corporation", "Digital Microwave", "NetLogic Microsystems", + "MIMOS Semiconductor", "Advanced Fibre", "BF Goodrich Data.", "Epigram", + "Acbel Polytech Inc.", "Apacer Technology", "Admor Memory", "FOXCONN", + "Quadratics Superconductor", "3COM"], +["Camintonn Corporation", "ISOA Incorporated", "Agate Semiconductor", "ADMtek Incorporated", + "HYPERTEC", "Adhoc Technologies", "MOSAID Technologies", "Ardent Technologies", + "Switchcore", "Cisco Systems, Inc.", "Allayer Technologies", "WorkX AG", + "Oasis Semiconductor", "Novanet Semiconductor", "E-M Solutions", "Power General", + "Advanced Hardware Arch.", "Inova Semiconductors GmbH", "Telocity", "Delkin Devices", + "Symagery Microsystems", "C-Port Corporation", "SiberCore Technologies", "Southland Microsystems", + "Malleable Technologies", "Kendin Communications", "Great Technology Microcomputer", "Sanmina Corporation", + "HADCO Corporation", "Corsair", "Actrans System Inc.", "ALPHA Technologies", + "Silicon Laboratories, Inc. (Cygnal)", "Artesyn Technologies", "Align Manufacturing", "Peregrine Semiconductor", + "Chameleon Systems", "Aplus Flash Technology", "MIPS Technologies", "Chrysalis ITS", + "ADTEC Corporation", "Kentron Technologies", "Win Technologies", "Tachyon Semiconductor (former ASIC Designs Inc.)", + "Extreme Packet Devices", "RF Micro Devices", "Siemens AG", "Sarnoff Corporation", + "Itautec Philco SA", "Radiata Inc.", "Benchmark Elect. (AVEX)", "Legend", + "SpecTek Incorporated", "Hi/fn", "Enikia Incorporated", "SwitchOn Networks", + "AANetcom Incorporated", "Micro Memory Bank", "ESS Technology", "Virata Corporation", + "Excess Bandwidth", "West Bay Semiconductor", "DSP Group", "Newport Communications", + "Chip2Chip Incorporated", "Phobos Corporation", "Intellitech Corporation", "Nordic VLSI ASA", + "Ishoni Networks", "Silicon Spice", "Alchemy Semiconductor", "Agilent Technologies", + "Centillium Communications", "W.L. Gore", "HanBit Electronics", "GlobeSpan", + "Element 14", "Pycon", "Saifun Semiconductors", "Sibyte, Incorporated", + "MetaLink Technologies", "Feiya Technology", "I & C Technology", "Shikatronics", + "Elektrobit", "Megic", "Com-Tier", "Malaysia Micro Solutions", + "Hyperchip", "Gemstone Communications", "Anadigm (former Anadyne)", "3ParData", + "Mellanox Technologies", "Tenx Technologies", "Helix AG", "Domosys", + "Skyup Technology", "HiNT Corporation", "Chiaro", "MDT Technologies GmbH (former MCI Computer GMBH)", + "Exbit Technology A/S", "Integrated Technology Express", "AVED Memory", "Legerity", + "Jasmine Networks", "Caspian Networks", "nCUBE", "Silicon Access Networks", + "FDK Corporation", "High Bandwidth Access", "MultiLink Technology", "BRECIS", + "World Wide Packets", "APW", "Chicory Systems", "Xstream Logic", + "Fast-Chip", "Zucotto Wireless", "Realchip", "Galaxy Power", + "eSilicon", "Morphics Technology", "Accelerant Networks", "Silicon Wave", + "SandCraft", "Elpida"], +["Solectron", "Optosys Technologies", "Buffalo (former Melco)", "TriMedia Technologies", + "Cyan Technologies", "Global Locate", "Optillion", "Terago Communications", + "Ikanos Communications", "Princeton Technology", "Nanya Technology", "Elite Flash Storage", + "Mysticom", "LightSand Communications", "ATI Technologies", "Agere Systems", + "NeoMagic", "AuroraNetics", "Golden Empire", "Mushkin", + "Tioga Technologies", "Netlist", "TeraLogic", "Cicada Semiconductor", + "Centon Electronics", "Tyco Electronics", "Magis Works", "Zettacom", + "Cogency Semiconductor", "Chipcon AS", "Aspex Technology", "F5 Networks", + "Programmable Silicon Solutions", "ChipWrights", "Acorn Networks", "Quicklogic", + "Kingmax Semiconductor", "BOPS", "Flasys", "BitBlitz Communications", + "eMemory Technology", "Procket Networks", "Purple Ray", "Trebia Networks", + "Delta Electronics", "Onex Communications", "Ample Communications", "Memory Experts Intl", + "Astute Networks", "Azanda Network Devices", "Dibcom", "Tekmos", + "API NetWorks", "Bay Microsystems", "Firecron Ltd", "Resonext Communications", + "Tachys Technologies", "Equator Technology", "Concept Computer", "SILCOM", + "3Dlabs", "c't Magazine", "Sanera Systems", "Silicon Packets", + "Viasystems Group", "Simtek", "Semicon Devices Singapore", "Satron Handelsges", + "Improv Systems", "INDUSYS GmbH", "Corrent", "Infrant Technologies", + "Ritek Corp", "empowerTel Networks", "Hypertec", "Cavium Networks", + "PLX Technology", "Massana Design", "Intrinsity", "Valence Semiconductor", + "Terawave Communications", "IceFyre Semiconductor", "Primarion", "Picochip Designs Ltd", + "Silverback Systems", "Jade Star Technologies", "Pijnenburg Securealink", + "TakeMS International AG", "Cambridge Silicon Radio", + "Swissbit", "Nazomi Communications", "eWave System", + "Rockwell Collins", "Picocel Co., Ltd.", "Alphamosaic Ltd", "Sandburst", + "SiCon Video", "NanoAmp Solutions", "Ericsson Technology", "PrairieComm", + "Mitac International", "Layer N Networks", "MtekVision", "Allegro Networks", + "Marvell Semiconductors", "Netergy Microelectronic", "NVIDIA", "Internet Machines", + "Peak Electronics", "Litchfield Communication", "Accton Technology", "Teradiant Networks", + "Europe Technologies", "Cortina Systems", "RAM Components", "Raqia Networks", + "ClearSpeed", "Matsushita Battery", "Xelerated", "SimpleTech", + "Utron Technology", "Astec International", "AVM gmbH", "Redux Communications", + "Dot Hill Systems", "TeraChip"], +["T-RAM Incorporated", "Innovics Wireless", "Teknovus", "KeyEye Communications", + "Runcom Technologies", "RedSwitch", "Dotcast", "Silicon Mountain Memory", + "Signia Technologies", "Pixim", "Galazar Networks", "White Electronic Designs", + "Patriot Scientific", "Neoaxiom Corporation", "3Y Power Technology", "Europe Technologies", + "Potentia Power Systems", "C-guys Incorporated", "Digital Communications Technology Incorporated", "Silicon-Based Technology", + "Fulcrum Microsystems", "Positivo Informatica Ltd", "XIOtech Corporation", "PortalPlayer", + "Zhiying Software", "Direct2Data", "Phonex Broadband", "Skyworks Solutions", + "Entropic Communications", "Pacific Force Technology", "Zensys A/S", "Legend Silicon Corp.", + "sci-worx GmbH", "SMSC (former Oasis Silicon Systems)", "Renesas Technology", "Raza Microelectronics", + "Phyworks", "MediaTek", "Non-cents Productions", "US Modular", + "Wintegra Ltd", "Mathstar", "StarCore", "Oplus Technologies", + "Mindspeed", "Just Young Computer", "Radia Communications", "OCZ", + "Emuzed", "LOGIC Devices", "Inphi Corporation", "Quake Technologies", + "Vixel", "SolusTek", "Kongsberg Maritime", "Faraday Technology", + "Altium Ltd.", "Insyte", "ARM Ltd.", "DigiVision", + "Vativ Technologies", "Endicott Interconnect Technologies", "Pericom", "Bandspeed", + "LeWiz Communications", "CPU Technology", "Ramaxel Technology", "DSP Group", + "Axis Communications", "Legacy Electronics", "Chrontel", "Powerchip Semiconductor", + "MobilEye Technologies", "Excel Semiconductor", "A-DATA Technology", "VirtualDigm", + "G Skill Intl", "Quanta Computer", "Yield Microelectronics", "Afa Technologies", + "KINGBOX Technology Co. Ltd.", "Ceva", "iStor Networks", "Advance Modules", + "Microsoft", "Open-Silicon", "Goal Semiconductor", "ARC International", + "Simmtec", "Metanoia", "Key Stream", "Lowrance Electronics", + "Adimos", "SiGe Semiconductor", "Fodus Communications", "Credence Systems Corp.", + "Genesis Microchip Inc.", "Vihana, Inc.", "WIS Technologies", "GateChange Technologies", + "High Density Devices AS", "Synopsys", "Gigaram", "Enigma Semiconductor Inc.", + "Century Micro Inc.", "Icera Semiconductor", "Mediaworks Integrated Systems", "O'Neil Product Development", + "Supreme Top Technology Ltd.", "MicroDisplay Corporation", "Team Group Inc.", "Sinett Corporation", + "Toshiba Corporation", "Tensilica", "SiRF Technology", "Bacoc Inc.", + "SMaL Camera Technologies", "Thomson SC", "Airgo Networks", "Wisair Ltd.", + "SigmaTel", "Arkados", "Compete IT gmbH Co. KG", "Eudar Technology Inc.", + "Focus Enhancements", "Xyratex"], +["Specular Networks", "Patriot Memory", "U-Chip Technology Corp.", "Silicon Optix", + "Greenfield Networks", "CompuRAM GmbH", "Stargen, Inc.", "NetCell Corporation", + "Excalibrus Technologies Ltd", "SCM Microsystems", "Xsigo Systems, Inc.", "CHIPS & Systems Inc", + "Tier 1 Multichip Solutions", "CWRL Labs", "Teradici", "Gigaram, Inc.", + "g2 Microsystems", "PowerFlash Semiconductor", "P.A. Semi, Inc.", "NovaTech Solutions, S.A.", + "c2 Microsystems, Inc.", "Level5 Networks", "COS Memory AG", "Innovasic Semiconductor", + "02IC Co. Ltd", "Tabula, Inc.", "Crucial Technology", "Chelsio Communications", + "Solarflare Communications", "Xambala Inc.", "EADS Astrium", "ATO Semicon Co. Ltd.", + "Imaging Works, Inc.", "Astute Networks, Inc.", "Tzero", "Emulex", + "Power-One", "Pulse~LINK Inc.", "Hon Hai Precision Industry", "White Rock Networks Inc.", + "Telegent Systems USA, Inc.", "Atrua Technologies, Inc.", "Acbel Polytech Inc.", + "eRide Inc.","ULi Electronics Inc.", "Magnum Semiconductor Inc.", "neoOne Technology, Inc.", + "Connex Technology, Inc.", "Stream Processors, Inc.", "Focus Enhancements", "Telecis Wireless, Inc.", + "uNav Microelectronics", "Tarari, Inc.", "Ambric, Inc.", "Newport Media, Inc.", "VMTS", + "Enuclia Semiconductor, Inc.", "Virtium Technology Inc.", "Solid State System Co., Ltd.", "Kian Tech LLC", + "Artimi", "Power Quotient International", "Avago Technologies", "ADTechnology", "Sigma Designs", + "SiCortex, Inc.", "Ventura Technology Group", "eASIC", "M.H.S. SAS", "Micro Star International", + "Rapport Inc.", "Makway International", "Broad Reach Engineering Co.", + "Semiconductor Mfg Intl Corp", "SiConnect", "FCI USA Inc.", "Validity Sensors", + "Coney Technology Co. Ltd.", "Spans Logic", "Neterion Inc.", "Qimonda", + "New Japan Radio Co. Ltd.", "Velogix", "Montalvo Systems", "iVivity Inc.", "Walton Chaintech", + "AENEON", "Lorom Industrial Co. Ltd.", "Radiospire Networks", "Sensio Technologies, Inc.", + "Nethra Imaging", "Hexon Technology Pte Ltd", "CompuStocx (CSX)", "Methode Electronics, Inc.", + "Connect One Ltd.", "Opulan Technologies", "Septentrio NV", "Goldenmars Technology Inc.", + "Kreton Corporation", "Cochlear Ltd.", "Altair Semiconductor", "NetEffect, Inc.", + "Spansion, Inc.", "Taiwan Semiconductor Mfg", "Emphany Systems Inc.", + "ApaceWave Technologies", "Mobilygen Corporation", "Tego", "Cswitch Corporation", + "Haier (Beijing) IC Design Co.", "MetaRAM", "Axel Electronics Co. Ltd.", "Tilera Corporation", + "Aquantia", "Vivace Semiconductor", "Redpine Signals", "Octalica", "InterDigital Communications", + "Avant Technology", "Asrock, Inc.", "Availink", "Quartics, Inc.", "Element CXI", + "Innovaciones Microelectronicas", "VeriSilicon Microelectronics", "W5 Networks"], +["MOVEKING", "Mavrix Technology, Inc.", "CellGuide Ltd.", "Faraday Technology", + "Diablo Technologies, Inc.", "Jennic", "Octasic", "Molex Incorporated", "3Leaf Networks", + "Bright Micron Technology", "Netxen", "NextWave Broadband Inc.", "DisplayLink", "ZMOS Technology", + "Tec-Hill", "Multigig, Inc.", "Amimon", "Euphonic Technologies, Inc.", "BRN Phoenix", + "InSilica", "Ember Corporation", "Avexir Technologies Corporation", "Echelon Corporation", + "Edgewater Computer Systems", "XMOS Semiconductor Ltd.", "GENUSION, Inc.", "Memory Corp NV", + "SiliconBlue Technologies", "Rambus Inc."]); + +$use_sysfs = -d '/sys/bus'; + +# We consider that no data was written to this area of the SPD EEPROM if +# all bytes read 0x00 or all bytes read 0xff +sub spd_written(@) +{ + my $all_00 = 1; + my $all_ff = 1; + + foreach my $b (@_) { + $all_00 = 0 unless $b == 0x00; + $all_ff = 0 unless $b == 0xff; + return 1 unless $all_00 or $all_ff; + } + + return 0; +} + +sub parity($) +{ + my $n = shift; + my $parity = 0; + + while ($n) { + $parity++ if ($n & 1); + $n >>= 1; + } + + return ($parity & 1); +} + +sub manufacturer(@) +{ + my @bytes = @_; + my $ai = 0; + my $first; + + return ("Undefined", []) unless spd_written(@bytes); + + while (defined($first = shift(@bytes)) && $first == 0x7F) { + $ai++; + } + + return ("Invalid", []) unless defined $first; + return ("Invalid", [$first, @bytes]) if parity($first) != 1; + return ("Unknown", \@bytes) unless (($first & 0x7F) - 1 <= $vendors[$ai]); + + return ($vendors[$ai][($first & 0x7F) - 1], \@bytes); +} + +sub manufacturer_data(@) +{ + my $hex = ""; + my $asc = ""; + + return unless spd_written(@_); + + foreach my $byte (@_) { + $hex .= sprintf("\%02X ", $byte); + $asc .= ($byte >= 32 && $byte < 127) ? chr($byte) : '?'; + } + + return "$hex(\"$asc\")"; +} + +sub part_number(@) +{ + my $asc = ""; + my $byte; + + while (defined ($byte = shift) && $byte >= 32 && $byte < 127) { + $asc .= chr($byte); + } + + return ($asc eq "") ? "Undefined" : $asc; +} + +sub cas_latencies(@) +{ + return "None" unless @_; + return join ', ', map("${_}T", sort { $b <=> $a } @_); +} + +sub printl($$) # print a line w/ label and value +{ + my ($label, $value) = @_; + if ($opt_html) { + $label =~ s//\>/sg; + $label =~ s/\n/
\n/sg; + $value =~ s//\>/sg; + $value =~ s/\n/
\n/sg; + print "$label$value\n"; + } else { + my @values = split /\n/, $value; + printf "%-47s %s\n", $label, shift @values; + printf "%-47s %s\n", "", $_ foreach (@values); + } +} + +sub printl2($$) # print a line w/ label and value (outside a table) +{ + my ($label, $value) = @_; + if ($opt_html) { + $label =~ s//\>/sg; + $label =~ s/\n/
\n/sg; + $value =~ s//\>/sg; + $value =~ s/\n/
\n/sg; + } + print "$label: $value\n"; +} + +sub prints($) # print seperator w/ given text +{ + my ($label) = @_; + if ($opt_html) { + $label =~ s//\>/sg; + $label =~ s/\n/
\n/sg; + print "$label\n"; + } else { + print "\n---=== $label ===---\n"; + } +} + +sub printh($$) # print header w/ given text +{ + my ($header, $sub) = @_; + if ($opt_html) { + $header =~ s//\>/sg; + $header =~ s/\n/
\n/sg; + $sub =~ s//\>/sg; + $sub =~ s/\n/
\n/sg; + print "

$header

\n"; + print "

$sub

\n"; + } else { + print "\n$header\n$sub\n"; + } +} + +sub printc($) # print comment +{ + my ($comment) = @_; + if ($opt_html) { + $comment =~ s//\>/sg; + $comment =~ s/\n/
\n/sg; + print "\n"; + } else { + print "# $comment\n"; + } +} + +sub tns($) # print a time in ns +{ + return sprintf("%3.2f ns", $_[0]); +} + +# Parameter: bytes 0-63 +sub decode_sdr_sdram($) +{ + my $bytes = shift; + my ($l, $temp); + +# SPD revision + printl "SPD Revision", $bytes->[62]; + +#size computation + + prints "Memory Characteristics"; + + my $k = 0; + my $ii = 0; + + $ii = ($bytes->[3] & 0x0f) + ($bytes->[4] & 0x0f) - 17; + if (($bytes->[5] <= 8) && ($bytes->[17] <= 8)) { + $k = $bytes->[5] * $bytes->[17]; + } + + if ($ii > 0 && $ii <= 12 && $k > 0) { + printl "Size", ((1 << $ii) * $k) . " MB"; + } else { + printl "INVALID SIZE", $bytes->[3] . "," . $bytes->[4] . "," . + $bytes->[5] . "," . $bytes->[17]; + } + + my @cas; + for ($ii = 0; $ii < 7; $ii++) { + push(@cas, $ii + 1) if ($bytes->[18] & (1 << $ii)); + } + + my $trcd; + my $trp; + my $tras; + my $ctime = ($bytes->[9] >> 4) + ($bytes->[9] & 0xf) * 0.1; + + $trcd = $bytes->[29]; + $trp = $bytes->[27];; + $tras = $bytes->[30]; + + printl "tCL-tRCD-tRP-tRAS", + $cas[$#cas] . "-" . + ceil($trcd/$ctime) . "-" . + ceil($trp/$ctime) . "-" . + ceil($tras/$ctime); + + $l = "Number of Row Address Bits"; + if ($bytes->[3] == 0) { printl $l, "Undefined!"; } + elsif ($bytes->[3] == 1) { printl $l, "1/16"; } + elsif ($bytes->[3] == 2) { printl $l, "2/17"; } + elsif ($bytes->[3] == 3) { printl $l, "3/18"; } + else { printl $l, $bytes->[3]; } + + $l = "Number of Col Address Bits"; + if ($bytes->[4] == 0) { printl $l, "Undefined!"; } + elsif ($bytes->[4] == 1) { printl $l, "1/16"; } + elsif ($bytes->[4] == 2) { printl $l, "2/17"; } + elsif ($bytes->[4] == 3) { printl $l, "3/18"; } + else { printl $l, $bytes->[4]; } + + $l = "Number of Module Rows"; + if ($bytes->[5] == 0 ) { printl $l, "Undefined!"; } + else { printl $l, $bytes->[5]; } + + $l = "Data Width"; + if ($bytes->[7] > 1) { + printl $l, "Undefined!" + } else { + $temp = ($bytes->[7] * 256) + $bytes->[6]; + printl $l, $temp; + } + + $l = "Module Interface Signal Levels"; + if ($bytes->[8] == 0) { printl $l, "5.0 Volt/TTL"; } + elsif ($bytes->[8] == 1) { printl $l, "LVTTL"; } + elsif ($bytes->[8] == 2) { printl $l, "HSTL 1.5"; } + elsif ($bytes->[8] == 3) { printl $l, "SSTL 3.3"; } + elsif ($bytes->[8] == 4) { printl $l, "SSTL 2.5"; } + elsif ($bytes->[8] == 255) { printl $l, "New Table"; } + else { printl $l, "Undefined!"; } + + $l = "Module Configuration Type"; + if ($bytes->[11] == 0) { printl $l, "No Parity"; } + elsif ($bytes->[11] == 1) { printl $l, "Parity"; } + elsif ($bytes->[11] == 2) { printl $l, "ECC"; } + else { printl $l, "Undefined!"; } + + $l = "Refresh Type"; + if ($bytes->[12] > 126) { printl $l, "Self Refreshing"; } + else { printl $l, "Not Self Refreshing"; } + + $l = "Refresh Rate"; + $temp = $bytes->[12] & 0x7f; + if ($temp == 0) { printl $l, "Normal (15.625 us)"; } + elsif ($temp == 1) { printl $l, "Reduced (3.9 us)"; } + elsif ($temp == 2) { printl $l, "Reduced (7.8 us)"; } + elsif ($temp == 3) { printl $l, "Extended (31.3 us)"; } + elsif ($temp == 4) { printl $l, "Extended (62.5 us)"; } + elsif ($temp == 5) { printl $l, "Extended (125 us)"; } + else { printl $l, "Undefined!"; } + + $l = "Primary SDRAM Component Bank Config"; + if ($bytes->[13] > 126) { printl $l, "Bank2 = 2 x Bank1"; } + else { printl $l, "No Bank2 OR Bank2 = Bank1 width"; } + + $l = "Primary SDRAM Component Widths"; + $temp = $bytes->[13] & 0x7f; + if ($temp == 0) { printl $l, "Undefined!\n"; } + else { printl $l, $temp; } + + $l = "Error Checking SDRAM Component Bank Config"; + if ($bytes->[14] > 126) { printl $l, "Bank2 = 2 x Bank1"; } + else { printl $l, "No Bank2 OR Bank2 = Bank1 width"; } + + $l = "Error Checking SDRAM Component Widths"; + $temp = $bytes->[14] & 0x7f; + if ($temp == 0) { printl $l, "Undefined!"; } + else { printl $l, $temp; } + + $l = "Min Clock Delay for Back to Back Random Access"; + if ($bytes->[15] == 0) { printl $l, "Undefined!"; } + else { printl $l, $bytes->[15]; } + + $l = "Supported Burst Lengths"; + my @array; + for ($ii = 0; $ii < 4; $ii++) { + push(@array, 1 << $ii) if ($bytes->[16] & (1 << $ii)); + } + push(@array, "Page") if ($bytes->[16] & 128); + if (@array) { $temp = join ', ', @array; } + else { $temp = "None"; } + printl $l, $temp; + + $l = "Number of Device Banks"; + if ($bytes->[17] == 0) { printl $l, "Undefined/Reserved!"; } + else { printl $l, $bytes->[17]; } + + $l = "Supported CAS Latencies"; + printl $l, cas_latencies(@cas); + + $l = "Supported CS Latencies"; + @array = (); + for ($ii = 0; $ii < 7; $ii++) { + push(@array, $ii) if ($bytes->[19] & (1 << $ii)); + } + if (@array) { $temp = join ', ', @array; } + else { $temp = "None"; } + printl $l, $temp; + + $l = "Supported WE Latencies"; + @array = (); + for ($ii = 0; $ii < 7; $ii++) { + push(@array, $ii) if ($bytes->[20] & (1 << $ii)); + } + if (@array) { $temp = join ', ', @array; } + else { $temp = "None"; } + printl $l, $temp; + + if (@cas >= 1) { + $l = "Cycle Time at CAS ".$cas[$#cas]; + printl $l, "$ctime ns"; + + $l = "Access Time at CAS ".$cas[$#cas]; + $temp = ($bytes->[10] >> 4) + ($bytes->[10] & 0xf) * 0.1; + printl $l, "$temp ns"; + } + + if (@cas >= 2 && spd_written(@$bytes[23..24])) { + $l = "Cycle Time at CAS ".$cas[$#cas-1]; + $temp = $bytes->[23] >> 4; + if ($temp == 0) { printl $l, "Undefined!"; } + else { + if ($temp < 4 ) { $temp += 15; } + printl $l, $temp + (($bytes->[23] & 0xf) * 0.1) . " ns"; + } + + $l = "Access Time at CAS ".$cas[$#cas-1]; + $temp = $bytes->[24] >> 4; + if ($temp == 0) { printl $l, "Undefined!"; } + else { + if ($temp < 4 ) { $temp += 15; } + printl $l, $temp + (($bytes->[24] & 0xf) * 0.1) . " ns"; + } + } + + if (@cas >= 3 && spd_written(@$bytes[25..26])) { + $l = "Cycle Time at CAS ".$cas[$#cas-2]; + $temp = $bytes->[25] >> 2; + if ($temp == 0) { printl $l, "Undefined!"; } + else { printl $l, $temp + ($bytes->[25] & 0x3) * 0.25 . " ns"; } + + $l = "Access Time at CAS ".$cas[$#cas-2]; + $temp = $bytes->[26] >> 2; + if ($temp == 0) { printl $l, "Undefined!"; } + else { printl $l, $temp + ($bytes->[26] & 0x3) * 0.25 . " ns"; } + } + + $l = "SDRAM Module Attributes"; + $temp = ""; + if ($bytes->[21] & 1) { $temp .= "Buffered Address/Control Inputs\n"; } + if ($bytes->[21] & 2) { $temp .= "Registered Address/Control Inputs\n"; } + if ($bytes->[21] & 4) { $temp .= "On card PLL (clock)\n"; } + if ($bytes->[21] & 8) { $temp .= "Buffered DQMB Inputs\n"; } + if ($bytes->[21] & 16) { $temp .= "Registered DQMB Inputs\n"; } + if ($bytes->[21] & 32) { $temp .= "Differential Clock Input\n"; } + if ($bytes->[21] & 64) { $temp .= "Redundant Row Address\n"; } + if ($bytes->[21] & 128) { $temp .= "Undefined (bit 7)\n"; } + if ($bytes->[21] == 0) { $temp .= "(None Reported)\n"; } + printl $l, $temp; + + $l = "SDRAM Device Attributes (General)"; + $temp = ""; + if ($bytes->[22] & 1) { $temp .= "Supports Early RAS# Recharge\n"; } + if ($bytes->[22] & 2) { $temp .= "Supports Auto-Precharge\n"; } + if ($bytes->[22] & 4) { $temp .= "Supports Precharge All\n"; } + if ($bytes->[22] & 8) { $temp .= "Supports Write1/Read Burst\n"; } + if ($bytes->[22] & 16) { $temp .= "Lower VCC Tolerance: 5%\n"; } + else { $temp .= "Lower VCC Tolerance: 10%\n"; } + if ($bytes->[22] & 32) { $temp .= "Upper VCC Tolerance: 5%\n"; } + else { $temp .= "Upper VCC Tolerance: 10%\n"; } + if ($bytes->[22] & 64) { $temp .= "Undefined (bit 6)\n"; } + if ($bytes->[22] & 128) { $temp .= "Undefined (bit 7)\n"; } + printl $l, $temp; + + $l = "Minimum Row Precharge Time"; + if ($bytes->[27] == 0) { printl $l, "Undefined!"; } + else { printl $l, "$bytes->[27] ns"; } + + $l = "Row Active to Row Active Min"; + if ($bytes->[28] == 0) { printl $l, "Undefined!"; } + else { printl $l, "$bytes->[28] ns"; } + + $l = "RAS to CAS Delay"; + if ($bytes->[29] == 0) { printl $l, "Undefined!"; } + else { printl $l, "$bytes->[29] ns"; } + + $l = "Min RAS Pulse Width"; + if ($bytes->[30] == 0) { printl $l, "Undefined!"; } + else { printl $l, "$bytes->[30] ns"; } + + $l = "Row Densities"; + $temp = ""; + if ($bytes->[31] & 1) { $temp .= "4 MByte\n"; } + if ($bytes->[31] & 2) { $temp .= "8 MByte\n"; } + if ($bytes->[31] & 4) { $temp .= "16 MByte\n"; } + if ($bytes->[31] & 8) { $temp .= "32 MByte\n"; } + if ($bytes->[31] & 16) { $temp .= "64 MByte\n"; } + if ($bytes->[31] & 32) { $temp .= "128 MByte\n"; } + if ($bytes->[31] & 64) { $temp .= "256 MByte\n"; } + if ($bytes->[31] & 128) { $temp .= "512 MByte\n"; } + if ($bytes->[31] == 0) { $temp .= "(Undefined! -- None Reported!)\n"; } + printl $l, $temp; + + if (($bytes->[32] & 0xf) <= 9) { + $l = "Command and Address Signal Setup Time"; + $temp = (($bytes->[32] & 0x7f) >> 4) + ($bytes->[32] & 0xf) * 0.1; + printl $l, (($bytes->[32] >> 7) ? -$temp : $temp) . " ns"; + } + + if (($bytes->[33] & 0xf) <= 9) { + $l = "Command and Address Signal Hold Time"; + $temp = (($bytes->[33] & 0x7f) >> 4) + ($bytes->[33] & 0xf) * 0.1; + printl $l, (($bytes->[33] >> 7) ? -$temp : $temp) . " ns"; + } + + if (($bytes->[34] & 0xf) <= 9) { + $l = "Data Signal Setup Time"; + $temp = (($bytes->[34] & 0x7f) >> 4) + ($bytes->[34] & 0xf) * 0.1; + printl $l, (($bytes->[34] >> 7) ? -$temp : $temp) . " ns"; + } + + if (($bytes->[35] & 0xf) <= 9) { + $l = "Data Signal Hold Time"; + $temp = (($bytes->[35] & 0x7f) >> 4) + ($bytes->[35] & 0xf) * 0.1; + printl $l, (($bytes->[35] >> 7) ? -$temp : $temp) . " ns"; + } +} + +# Parameter: bytes 0-63 +sub decode_ddr_sdram($) +{ + my $bytes = shift; + my ($l, $temp); + +# SPD revision + if ($bytes->[62] != 0xff) { + printl "SPD Revision", ($bytes->[62] >> 4) . "." . + ($bytes->[62] & 0xf); + } + +# speed + prints "Memory Characteristics"; + + $l = "Maximum module speed"; + $temp = ($bytes->[9] >> 4) + ($bytes->[9] & 0xf) * 0.1; + my $ddrclk = 2 * (1000 / $temp); + my $tbits = ($bytes->[7] * 256) + $bytes->[6]; + if (($bytes->[11] == 2) || ($bytes->[11] == 1)) { $tbits = $tbits - 8; } + my $pcclk = int ($ddrclk * $tbits / 8); + $pcclk += 100 if ($pcclk % 100) >= 50; # Round properly + $pcclk = $pcclk - ($pcclk % 100); + $ddrclk = int ($ddrclk); + printl $l, "${ddrclk}MHz (PC${pcclk})"; + +#size computation + my $k = 0; + my $ii = 0; + + $ii = ($bytes->[3] & 0x0f) + ($bytes->[4] & 0x0f) - 17; + if (($bytes->[5] <= 8) && ($bytes->[17] <= 8)) { + $k = $bytes->[5] * $bytes->[17]; + } + + if ($ii > 0 && $ii <= 12 && $k > 0) { + printl "Size", ((1 << $ii) * $k) . " MB"; + } else { + printl "INVALID SIZE", $bytes->[3] . ", " . $bytes->[4] . ", " . + $bytes->[5] . ", " . $bytes->[17]; + } + + my $highestCAS = 0; + my %cas; + for ($ii = 0; $ii < 7; $ii++) { + if ($bytes->[18] & (1 << $ii)) { + $highestCAS = 1+$ii*0.5; + $cas{$highestCAS}++; + } + } + + my $trcd; + my $trp; + my $tras; + my $ctime = ($bytes->[9] >> 4) + ($bytes->[9] & 0xf) * 0.1; + + $trcd = ($bytes->[29] >> 2) + (($bytes->[29] & 3) * 0.25); + $trp = ($bytes->[27] >> 2) + (($bytes->[27] & 3) * 0.25); + $tras = $bytes->[30]; + + printl "tCL-tRCD-tRP-tRAS", + $highestCAS . "-" . + ceil($trcd/$ctime) . "-" . + ceil($trp/$ctime) . "-" . + ceil($tras/$ctime); + +# latencies + printl "Supported CAS Latencies", cas_latencies(keys %cas); + + my @array; + for ($ii = 0; $ii < 7; $ii++) { + push(@array, $ii) if ($bytes->[19] & (1 << $ii)); + } + if (@array) { $temp = join ', ', @array; } + else { $temp = "None"; } + printl "Supported CS Latencies", $temp; + + @array = (); + for ($ii = 0; $ii < 7; $ii++) { + push(@array, $ii) if ($bytes->[20] & (1 << $ii)); + } + if (@array) { $temp = join ', ', @array; } + else { $temp = "None"; } + printl "Supported WE Latencies", $temp; + +# timings + if (exists $cas{$highestCAS}) { + printl "Minimum Cycle Time at CAS $highestCAS", + "$ctime ns"; + + printl "Maximum Access Time at CAS $highestCAS", + (($bytes->[10] >> 4) * 0.1 + ($bytes->[10] & 0xf) * 0.01) . " ns"; + } + + if (exists $cas{$highestCAS-0.5} && spd_written(@$bytes[23..24])) { + printl "Minimum Cycle Time at CAS ".($highestCAS-0.5), + (($bytes->[23] >> 4) + ($bytes->[23] & 0xf) * 0.1) . " ns"; + + printl "Maximum Access Time at CAS ".($highestCAS-0.5), + (($bytes->[24] >> 4) * 0.1 + ($bytes->[24] & 0xf) * 0.01) . " ns"; + } + + if (exists $cas{$highestCAS-1} && spd_written(@$bytes[25..26])) { + printl "Minimum Cycle Time at CAS ".($highestCAS-1), + (($bytes->[25] >> 4) + ($bytes->[25] & 0xf) * 0.1) . " ns"; + + printl "Maximum Access Time at CAS ".($highestCAS-1), + (($bytes->[26] >> 4) * 0.1 + ($bytes->[26] & 0xf) * 0.01) . " ns"; + } + +# module attributes + if ($bytes->[47] & 0x03) { + if (($bytes->[47] & 0x03) == 0x01) { $temp = "1.125\" to 1.25\""; } + elsif (($bytes->[47] & 0x03) == 0x02) { $temp = "1.7\""; } + elsif (($bytes->[47] & 0x03) == 0x03) { $temp = "Other"; } + printl "Module Height", $temp; + } +} + +sub ddr2_sdram_ctime($) +{ + my $byte = shift; + my $ctime; + + $ctime = $byte >> 4; + if (($byte & 0xf) <= 9) { $ctime += ($byte & 0xf) * 0.1; } + elsif (($byte & 0xf) == 10) { $ctime += 0.25; } + elsif (($byte & 0xf) == 11) { $ctime += 0.33; } + elsif (($byte & 0xf) == 12) { $ctime += 0.66; } + elsif (($byte & 0xf) == 13) { $ctime += 0.75; } + + return $ctime; +} + +sub ddr2_sdram_atime($) +{ + my $byte = shift; + my $atime; + + $atime = ($byte >> 4) * 0.1 + ($byte & 0xf) * 0.01; + + return $atime; +} + +# Base, high-bit, 3-bit fraction code +sub ddr2_sdram_rtime($$$) +{ + my ($rtime, $msb, $ext) = @_; + my @table = (0, .25, .33, .50, .66, .75); + + return $rtime + $msb * 256 + $table[$ext]; +} + +sub ddr2_module_types($) +{ + my $byte = shift; + my @types = qw(RDIMM UDIMM SO-DIMM Micro-DIMM Mini-RDIMM Mini-UDIMM); + my @widths = (133.35, 133.25, 67.6, 45.5, 82.0, 82.0); + my @suptypes; + local $_; + + foreach (0..5) { + push @suptypes, "$types[$_] ($widths[$_] mm)" + if ($byte & (1 << $_)); + } + + return @suptypes; +} + +sub ddr2_refresh_rate($) +{ + my $byte = shift; + my @refresh = qw(Normal Reduced Reduced Extended Extended Extended); + my @refresht = (15.625, 3.9, 7.8, 31.3, 62.5, 125); + + return "$refresh[$byte & 0x7f] ($refresht[$byte & 0x7f] us)". + ($byte & 0x80 ? " - Self Refresh" : ""); +} + +# Parameter: bytes 0-63 +sub decode_ddr2_sdram($) +{ + my $bytes = shift; + my ($l, $temp); + my $ctime; + +# SPD revision + if ($bytes->[62] != 0xff) { + printl "SPD Revision", ($bytes->[62] >> 4) . "." . + ($bytes->[62] & 0xf); + } + +# speed + prints "Memory Characteristics"; + + $l = "Maximum module speed"; + $ctime = ddr2_sdram_ctime($bytes->[9]); + my $ddrclk = 2 * (1000 / $ctime); + my $tbits = ($bytes->[7] * 256) + $bytes->[6]; + if ($bytes->[11] & 0x03) { $tbits = $tbits - 8; } + my $pcclk = int ($ddrclk * $tbits / 8); + # Round down to comply with Jedec + $pcclk = $pcclk - ($pcclk % 100); + $ddrclk = int ($ddrclk); + printl $l, "${ddrclk}MHz (PC2-${pcclk})"; + +#size computation + my $k = 0; + my $ii = 0; + + $ii = ($bytes->[3] & 0x0f) + ($bytes->[4] & 0x0f) - 17; + $k = (($bytes->[5] & 0x7) + 1) * $bytes->[17]; + + if($ii > 0 && $ii <= 12 && $k > 0) { + printl "Size", ((1 << $ii) * $k) . " MB"; + } else { + printl "INVALID SIZE", $bytes->[3] . "," . $bytes->[4] . "," . + $bytes->[5] . "," . $bytes->[17]; + } + + printl "Banks x Rows x Columns x Bits", + join(' x ', $bytes->[17], $bytes->[3], $bytes->[4], $bytes->[6]); + printl "Ranks", ($bytes->[5] & 7) + 1; + + printl "SDRAM Device Width", $bytes->[13]." bits"; + + my @heights = ('< 25.4', '25.4', '25.4 - 30.0', '30.0', '30.5', '> 30.5'); + printl "Module Height", $heights[$bytes->[5] >> 5]." mm"; + + my @suptypes = ddr2_module_types($bytes->[20]); + printl "Module Type".(@suptypes > 1 ? 's' : ''), join(', ', @suptypes); + + printl "DRAM Package", $bytes->[5] & 0x10 ? "Stack" : "Planar"; + + my @volts = ("TTL (5V Tolerant)", "LVTTL", "HSTL 1.5V", + "SSTL 3.3V", "SSTL 2.5V", "SSTL 1.8V", "TBD"); + printl "Voltage Interface Level", $volts[$bytes->[8]]; + + printl "Refresh Rate", ddr2_refresh_rate($bytes->[12]); + + my @burst; + push @burst, 4 if ($bytes->[16] & 4); + push @burst, 8 if ($bytes->[16] & 8); + $burst[0] = 'None' if !@burst; + printl "Supported Burst Lengths", join(', ', @burst); + + my $highestCAS = 0; + my %cas; + for ($ii = 2; $ii < 7; $ii++) { + if ($bytes->[18] & (1 << $ii)) { + $highestCAS = $ii; + $cas{$highestCAS}++; + } + } + + my $trcd; + my $trp; + my $tras; + + $trcd = ($bytes->[29] >> 2) + (($bytes->[29] & 3) * 0.25); + $trp = ($bytes->[27] >> 2) + (($bytes->[27] & 3) * 0.25); + $tras = $bytes->[30]; + + printl "tCL-tRCD-tRP-tRAS", + $highestCAS . "-" . + ceil($trcd/$ctime) . "-" . + ceil($trp/$ctime) . "-" . + ceil($tras/$ctime); + +# latencies + printl "Supported CAS Latencies (tCL)", cas_latencies(keys %cas); + +# timings + if (exists $cas{$highestCAS}) { + printl "Minimum Cycle Time at CAS $highestCAS (tCK min)", + tns($ctime); + printl "Maximum Access Time at CAS $highestCAS (tAC)", + tns(ddr2_sdram_atime($bytes->[10])); + } + + if (exists $cas{$highestCAS-1} && spd_written(@$bytes[23..24])) { + printl "Minimum Cycle Time at CAS ".($highestCAS-1), + tns(ddr2_sdram_ctime($bytes->[23])); + printl "Maximum Access Time at CAS ".($highestCAS-1), + tns(ddr2_sdram_atime($bytes->[24])); + } + + if (exists $cas{$highestCAS-2} && spd_written(@$bytes[25..26])) { + printl "Minimum Cycle Time at CAS ".($highestCAS-2), + tns(ddr2_sdram_ctime($bytes->[25])); + printl "Maximum Access Time at CAS ".($highestCAS-2), + tns(ddr2_sdram_atime($bytes->[26])); + } + printl "Maximum Cycle Time (tCK max)", + tns(ddr2_sdram_ctime($bytes->[43])); + +# more timing information + prints("Timing Parameters"); + printl "Address/Command Setup Time Before Clock (tIS)", + tns(ddr2_sdram_atime($bytes->[32])); + printl "Address/Command Hold Time After Clock (tIH)", + tns(ddr2_sdram_atime($bytes->[33])); + printl "Data Input Setup Time Before Strobe (tDS)", + tns(ddr2_sdram_atime($bytes->[34])); + printl "Data Input Hold Time After Strobe (tDH)", + tns(ddr2_sdram_atime($bytes->[35])); + printl "Minimum Row Precharge Delay (tRP)", tns($trp); + printl "Minimum Row Active to Row Active Delay (tRRD)", + tns($bytes->[28]/4); + printl "Minimum RAS# to CAS# Delay (tRCD)", tns($trcd); + printl "Minimum RAS# Pulse Width (tRAS)", tns($tras); + printl "Write Recovery Time (tWR)", tns($bytes->[36]/4); + printl "Minimum Write to Read CMD Delay (tWTR)", tns($bytes->[37]/4); + printl "Minimum Read to Pre-charge CMD Delay (tRTP)", tns($bytes->[38]/4); + printl "Minimum Active to Auto-refresh Delay (tRC)", + tns(ddr2_sdram_rtime($bytes->[41], 0, ($bytes->[40] >> 4) & 7)); + printl "Minimum Recovery Delay (tRFC)", + tns(ddr2_sdram_rtime($bytes->[42], $bytes->[40] & 1, + ($bytes->[40] >> 1) & 7)); + printl "Maximum DQS to DQ Skew (tDQSQ)", tns($bytes->[44]/100); + printl "Maximum Read Data Hold Skew (tQHS)", tns($bytes->[45]/100); + printl "PLL Relock Time", $bytes->[46] . " us" if ($bytes->[46]); +} + +# Parameter: bytes 0-63 +sub decode_direct_rambus($) +{ + my $bytes = shift; + +#size computation + prints "Memory Characteristics"; + + my $ii; + + $ii = ($bytes->[4] & 0x0f) + ($bytes->[4] >> 4) + ($bytes->[5] & 0x07) - 13; + + if ($ii > 0 && $ii < 16) { + printl "Size", (1 << $ii) . " MB"; + } else { + printl "INVALID SIZE", sprintf("0x%02x, 0x%02x", + $bytes->[4], $bytes->[5]); + } +} + +# Parameter: bytes 0-63 +sub decode_rambus($) +{ + my $bytes = shift; + +#size computation + prints "Memory Characteristics"; + + my $ii; + + $ii = ($bytes->[3] & 0x0f) + ($bytes->[3] >> 4) + ($bytes->[5] & 0x07) - 13; + + if ($ii > 0 && $ii < 16) { + printl "Size", (1 << $ii) . " MB"; + } else { + printl "INVALID SIZE", sprintf("0x%02x, 0x%02x", + $bytes->[3], $bytes->[5]); + } +} + +%decode_callback = ( + "SDR SDRAM" => \&decode_sdr_sdram, + "DDR SDRAM" => \&decode_ddr_sdram, + "DDR2 SDRAM" => \&decode_ddr2_sdram, + "Direct Rambus" => \&decode_direct_rambus, + "Rambus" => \&decode_rambus, +); + +# Parameter: bytes 64-127 +sub decode_intel_spec_freq($) +{ + my $bytes = shift; + my ($l, $temp); + + prints "Intel Specification"; + + $l = "Frequency"; + if ($bytes->[62] == 0x66) { $temp = "66MHz\n"; } + elsif ($bytes->[62] == 100) { $temp = "100MHz or 133MHz\n"; } + elsif ($bytes->[62] == 133) { $temp = "133MHz\n"; } + else { $temp = "Undefined!\n"; } + printl $l, $temp; + + $l = "Details for 100MHz Support"; + $temp = ""; + if ($bytes->[63] & 1) { $temp .= "Intel Concurrent Auto-precharge\n"; } + if ($bytes->[63] & 2) { $temp .= "CAS Latency = 2\n"; } + if ($bytes->[63] & 4) { $temp .= "CAS Latency = 3\n"; } + if ($bytes->[63] & 8) { $temp .= "Junction Temp A (100 degrees C)\n"; } + else { $temp .= "Junction Temp B (90 degrees C)\n"; } + if ($bytes->[63] & 16) { $temp .= "CLK 3 Connected\n"; } + if ($bytes->[63] & 32) { $temp .= "CLK 2 Connected\n"; } + if ($bytes->[63] & 64) { $temp .= "CLK 1 Connected\n"; } + if ($bytes->[63] & 128) { $temp .= "CLK 0 Connected\n"; } + if (($bytes->[63] & 192) == 192) { $temp .= "Double-sided DIMM\n"; } + elsif (($bytes->[63] & 192) != 0) { $temp .= "Single-sided DIMM\n"; } + printl $l, $temp; +} + +# Read various hex dump style formats: hexdump, hexdump -C, i2cdump, eeprog +# note that normal 'hexdump' format on a little-endian system byte-swaps +# words, using hexdump -C is better. +sub read_hexdump($) +{ + my $addr = 0; + my $repstart = 0; + my @bytes; + my $header = 1; + my $word = 0; + + # Look in the cache first + return @{$hexdump_cache{$_[0]}} if exists $hexdump_cache{$_[0]}; + + open F, '<', $_[0] or die "Unable to open: $_[0]"; + while () { + chomp; + if (/^\*$/) { + $repstart = $addr; + next; + } + /^(?:0000 )?([a-f\d]{2,8}):?\s+((:?[a-f\d]{4}\s*){8}|(:?[a-f\d]{2}\s*){16})/i || + /^(?:0000 )?([a-f\d]{2,8}):?\s*$/i; + next if (!defined $1 && $header); # skip leading unparsed lines + + defined $1 or die "Unable to parse input"; + $header = 0; + + $addr = hex $1; + if ($repstart) { + @bytes[$repstart .. ($addr-1)] = + (@bytes[($repstart-16)..($repstart-1)]) x (($addr-$repstart)/16); + $repstart = 0; + } + last unless defined $2; + foreach (split(/\s+/, $2)) { + if (/^(..)(..)$/) { + $word |= 1; + $bytes[$addr++] = hex($1); + $bytes[$addr++] = hex($2); + } else { + $bytes[$addr++] = hex($_); + } + } + } + close F; + $header and die "Unable to parse any data from hexdump '$_[0]'"; + $word and printc "Warning: Assuming big-endian order 16-bit hex dump"; + + # Cache the data for later use + $hexdump_cache{$_[0]} = \@bytes; + return @bytes; +} + +sub readspd64($$) # reads 64 bytes from SPD-EEPROM +{ + my ($offset, $dimm_i) = @_; + my @bytes; + if ($use_hexdump) { + @bytes = read_hexdump($dimm_i); + return @bytes[$offset..($offset+63)]; + } elsif ($use_sysfs) { + # Kernel 2.6 with sysfs + sysopen(HANDLE, "/sys/bus/i2c/drivers/eeprom/$dimm_i/eeprom", O_RDONLY) + or die "Cannot open /sys/bus/i2c/drivers/eeprom/$dimm_i/eeprom"; + binmode HANDLE; + sysseek(HANDLE, $offset, SEEK_SET); + sysread(HANDLE, my $eeprom, 64); + close HANDLE; + @bytes = unpack("C64", $eeprom); + } else { + # Kernel 2.4 with procfs + for my $i (0 .. 3) { + my $hexoff = sprintf('%02x', $offset + $i * 16); + push @bytes, split(" ", `cat /proc/sys/dev/sensors/$dimm_i/$hexoff`); + } + } + return @bytes; +} + +# Parse command-line +foreach (@ARGV) { + if ($_ eq '-h' || $_ eq '--help') { + print "Usage: $0 [-c] [-f [-b]] [-x file [files..]]\n", + " $0 -h\n\n", + " -f, --format Print nice html output\n", + " -b, --bodyonly Don't print html header\n", + " (useful for postprocessing the output)\n", + " -c, --checksum Decode completely even if checksum fails\n", + " -x, Read data from hexdump files\n", + " -h, --help Display this usage summary\n"; + print <<"EOF"; + +Hexdumps can be the output from hexdump, hexdump -C, i2cdump, eeprog and +likely many other progams producing hex dumps of one kind or another. Note +that the default output of "hexdump" will be byte-swapped on little-endian +systems and will therefore not be parsed correctly. It is better to use +"hexdump -C", which is not ambiguous. +EOF + exit; + } + + if ($_ eq '-f' || $_ eq '--format') { + $opt_html = 1; + next; + } + if ($_ eq '-b' || $_ eq '--bodyonly') { + $opt_bodyonly = 1; + next; + } + if ($_ eq '-c' || $_ eq '--checksum') { + $opt_igncheck = 1; + next; + } + if ($_ eq '-x') { + $use_hexdump = 1; + next; + } + + if (m/^-/) { + print STDERR "Unrecognized option $_\n"; + exit; + } + + push @dimm_list, $_ if $use_hexdump; +} + +if ($opt_html && !$opt_bodyonly) { + print "\n", + "\n", + "\t\n", + "\tPC DIMM Serial Presence Detect Tester/Decoder Output\n", + "\n"; +} + +printc "decode-dimms version $revision"; +printh 'Memory Serial Presence Detect Decoder', +'By Philip Edelbrock, Christian Zuckschwerdt, Burkart Lingner, +Jean Delvare, Trent Piepho and others'; + + +my $dimm_count = 0; +my $dir; +if (!$use_hexdump) { + if ($use_sysfs) { $dir = '/sys/bus/i2c/drivers/eeprom'; } + else { $dir = '/proc/sys/dev/sensors'; } + if (-d $dir) { + @dimm_list = split(/\s+/, `ls $dir`); + } elsif (! -d '/sys/module/eeprom') { + print "No EEPROM found, are you sure the eeprom module is loaded?\n"; + exit; + } +} + +for my $i ( 0 .. $#dimm_list ) { + $_ = $dimm_list[$i]; + if (($use_sysfs && /^\d+-\d+$/) + || (!$use_sysfs && /^eeprom-/) + || $use_hexdump) { + my @bytes = readspd64(0, $dimm_list[$i]); + my $dimm_checksum = 0; + $dimm_checksum += $bytes[$_] foreach (0 .. 62); + $dimm_checksum &= 0xff; + + next unless $bytes[63] == $dimm_checksum || $opt_igncheck; + $dimm_count++; + + print "" if $opt_html; + printl2 "\n\nDecoding EEPROM", + $use_hexdump ? $dimm_list[$i] : ($use_sysfs ? + "/sys/bus/i2c/drivers/eeprom/$dimm_list[$i]" : + "/proc/sys/dev/sensors/$dimm_list[$i]"); + print "" if $opt_html; + print "\n" if $opt_html; + if (!$use_hexdump) { + if (($use_sysfs && /^[^-]+-([^-]+)$/) + || (!$use_sysfs && /^[^-]+-[^-]+-[^-]+-([^-]+)$/)) { + my $dimm_num = $1 - 49; + printl "Guessing DIMM is in", "bank $dimm_num"; + } + } + +# Decode first 3 bytes (0-2) + prints "SPD EEPROM Information"; + + my $l = "EEPROM Checksum of bytes 0-62"; + printl $l, ($bytes[63] == $dimm_checksum ? + sprintf("OK (0x%.2X)", $bytes[63]): + sprintf("Bad\n(found 0x%.2X, calculated 0x%.2X)\n", + $bytes[63], $dimm_checksum)); + + # Simple heuristic to detect Rambus + my $is_rambus = $bytes[0] < 4; + my $temp; + if ($is_rambus) { + if ($bytes[0] == 1) { $temp = "0.7"; } + elsif ($bytes[0] == 2) { $temp = "1.0"; } + elsif ($bytes[0] == 0 || $bytes[0] == 255) { $temp = "Invalid"; } + else { $temp = "Reserved"; } + printl "SPD Revision", $temp; + } else { + printl "# of bytes written to SDRAM EEPROM", + $bytes[0]; + } + + $l = "Total number of bytes in EEPROM"; + if ($bytes[1] <= 14) { + printl $l, 2**$bytes[1]; + } elsif ($bytes[1] == 0) { + printl $l, "RFU"; + } else { printl $l, "ERROR!"; } + + $l = "Fundamental Memory type"; + my $type = "Unknown"; + if ($is_rambus) { + if ($bytes[2] == 1) { $type = "Direct Rambus"; } + elsif ($bytes[2] == 17) { $type = "Rambus"; } + } else { + if ($bytes[2] == 1) { $type = "FPM DRAM"; } + elsif ($bytes[2] == 2) { $type = "EDO"; } + elsif ($bytes[2] == 3) { $type = "Pipelined Nibble"; } + elsif ($bytes[2] == 4) { $type = "SDR SDRAM"; } + elsif ($bytes[2] == 5) { $type = "Multiplexed ROM"; } + elsif ($bytes[2] == 6) { $type = "DDR SGRAM"; } + elsif ($bytes[2] == 7) { $type = "DDR SDRAM"; } + elsif ($bytes[2] == 8) { $type = "DDR2 SDRAM"; } + } + printl $l, $type; + +# Decode next 61 bytes (3-63, depend on memory type) + $decode_callback{$type}->(\@bytes) + if exists $decode_callback{$type}; + +# Decode next 35 bytes (64-98, common to all memory types) + prints "Manufacturing Information"; + + @bytes = readspd64(64, $dimm_list[$i]); + + $l = "Manufacturer"; + # $extra is a reference to an array containing up to + # 7 extra bytes from the Manufacturer field. Sometimes + # these bytes are filled with interesting data. + ($temp, my $extra) = manufacturer(@bytes[0..7]); + printl $l, $temp; + $l = "Custom Manufacturer Data"; + $temp = manufacturer_data(@{$extra}); + printl $l, $temp if defined $temp; + + if (spd_written($bytes[8])) { + # Try the location code as ASCII first, as earlier specifications + # suggested this. As newer specifications don't mention it anymore, + # we still fall back to binary. + $l = "Manufacturing Location Code"; + $temp = (chr($bytes[8]) =~ m/^[\w\d]$/) ? chr($bytes[8]) + : sprintf("0x%.2X", $bytes[8]); + printl $l, $temp; + } + + $l = "Part Number"; + $temp = part_number(@bytes[9..26]); + printl $l, $temp; + + if (spd_written(@bytes[27..28])) { + $l = "Revision Code"; + $temp = sprintf("0x%02X%02X\n", @bytes[27..28]); + printl $l, $temp; + } + + if (spd_written(@bytes[29..30])) { + $l = "Manufacturing Date"; + # In theory the year and week are in BCD format, but + # this is not always true in practice :( + if (($bytes[29] & 0xf0) <= 0x90 + && ($bytes[29] & 0x0f) <= 0x09 + && ($bytes[30] & 0xf0) <= 0x90 + && ($bytes[30] & 0x0f) <= 0x09) { + # Note that this heuristic will break in year 2080 + $temp = sprintf("%d%02X-W%02X\n", + $bytes[29] >= 0x80 ? 19 : 20, + @bytes[29..30]); + } else { + $temp = sprintf("0x%02X%02X\n", + @bytes[29..30]); + } + printl $l, $temp; + } + + if (spd_written(@bytes[31..34])) { + $l = "Assembly Serial Number"; + $temp = sprintf("0x%02X%02X%02X%02X\n", + @bytes[31..34]); + printl $l, $temp; + } + +# Next 27 bytes (99-125) are manufacturer specific, can't decode + +# Last 2 bytes (126-127) are reserved, Intel used them as an extension + if ($type eq "SDR SDRAM") { + decode_intel_spec_freq(\@bytes); + } + + print "
\n" if $opt_html; + } +} +printl2 "\n\nNumber of SDRAM DIMMs detected and decoded", $dimm_count; + +print "\n" if ($opt_html && !$opt_bodyonly); diff --git a/eeprom/decode-dimms.pl b/eeprom/decode-dimms.pl deleted file mode 100755 index 39ea3cd..0000000 --- a/eeprom/decode-dimms.pl +++ /dev/null @@ -1,1402 +0,0 @@ -#!/usr/bin/perl -w -# -# EEPROM data decoder for SDRAM DIMM modules -# -# Copyright 1998, 1999 Philip Edelbrock -# modified by Christian Zuckschwerdt -# modified by Burkart Lingner -# Copyright (C) 2005-2008 Jean Delvare -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# The eeprom driver must be loaded (unless option -x is used). For kernels -# older than 2.6.0, the eeprom driver can be found in the lm-sensors package. -# -# References: -# PC SDRAM Serial Presence -# Detect (SPD) Specification, Intel, -# 1997,1999, Rev 1.2B -# -# Jedec Standards 4.1.x & 4.5.x -# http://www.jedec.org -# - -require 5.004; - -use strict; -use POSIX; -use Fcntl qw(:DEFAULT :seek); -use vars qw($opt_html $opt_bodyonly $opt_igncheck $use_sysfs $use_hexdump - @vendors %decode_callback $revision @dimm_list %hexdump_cache); - -$revision = '$Revision$ ($Date$)'; -$revision =~ s/\$\w+: (.*?) \$/$1/g; -$revision =~ s/ \([^()]*\)//; - -@vendors = ( -["AMD", "AMI", "Fairchild", "Fujitsu", - "GTE", "Harris", "Hitachi", "Inmos", - "Intel", "I.T.T.", "Intersil", "Monolithic Memories", - "Mostek", "Freescale (former Motorola)", "National", "NEC", - "RCA", "Raytheon", "Conexant (Rockwell)", "Seeq", - "NXP (former Signetics, Philips Semi.)", "Synertek", "Texas Instruments", "Toshiba", - "Xicor", "Zilog", "Eurotechnique", "Mitsubishi", - "Lucent (AT&T)", "Exel", "Atmel", "SGS/Thomson", - "Lattice Semi.", "NCR", "Wafer Scale Integration", "IBM", - "Tristar", "Visic", "Intl. CMOS Technology", "SSSI", - "MicrochipTechnology", "Ricoh Ltd.", "VLSI", "Micron Technology", - "Hyundai Electronics", "OKI Semiconductor", "ACTEL", "Sharp", - "Catalyst", "Panasonic", "IDT", "Cypress", - "DEC", "LSI Logic", "Zarlink (former Plessey)", "UTMC", - "Thinking Machine", "Thomson CSF", "Integrated CMOS (Vertex)", "Honeywell", - "Tektronix", "Sun Microsystems", "SST", "ProMos/Mosel Vitelic", - "Infineon (former Siemens)", "Macronix", "Xerox", "Plus Logic", - "SunDisk", "Elan Circuit Tech.", "European Silicon Str.", "Apple Computer", - "Xilinx", "Compaq", "Protocol Engines", "SCI", - "Seiko Instruments", "Samsung", "I3 Design System", "Klic", - "Crosspoint Solutions", "Alliance Semiconductor", "Tandem", "Hewlett-Packard", - "Intg. Silicon Solutions", "Brooktree", "New Media", "MHS Electronic", - "Performance Semi.", "Winbond Electronic", "Kawasaki Steel", "Bright Micro", - "TECMAR", "Exar", "PCMCIA", "LG Semi (former Goldstar)", - "Northern Telecom", "Sanyo", "Array Microsystems", "Crystal Semiconductor", - "Analog Devices", "PMC-Sierra", "Asparix", "Convex Computer", - "Quality Semiconductor", "Nimbus Technology", "Transwitch", "Micronas (ITT Intermetall)", - "Cannon", "Altera", "NEXCOM", "QUALCOMM", - "Sony", "Cray Research", "AMS(Austria Micro)", "Vitesse", - "Aster Electronics", "Bay Networks (Synoptic)", "Zentrum or ZMD", "TRW", - "Thesys", "Solbourne Computer", "Allied-Signal", "Dialog", - "Media Vision", "Level One Communication"], -["Cirrus Logic", "National Instruments", "ILC Data Device", "Alcatel Mietec", - "Micro Linear", "Univ. of NC", "JTAG Technologies", "BAE Systems", - "Nchip", "Galileo Tech", "Bestlink Systems", "Graychip", - "GENNUM", "VideoLogic", "Robert Bosch", "Chip Express", - "DATARAM", "United Microelec Corp.", "TCSI", "Smart Modular", - "Hughes Aircraft", "Lanstar Semiconductor", "Qlogic", "Kingston", - "Music Semi", "Ericsson Components", "SpaSE", "Eon Silicon Devices", - "Programmable Micro Corp", "DoD", "Integ. Memories Tech.", "Corollary Inc.", - "Dallas Semiconductor", "Omnivision", "EIV(Switzerland)", "Novatel Wireless", - "Zarlink (former Mitel)", "Clearpoint", "Cabletron", "STEC (former Silicon Technology)", - "Vanguard", "Hagiwara Sys-Com", "Vantis", "Celestica", - "Century", "Hal Computers", "Rohm Company Ltd.", "Juniper Networks", - "Libit Signal Processing", "Mushkin Enhanced Memory", "Tundra Semiconductor", "Adaptec Inc.", - "LightSpeed Semi.", "ZSP Corp.", "AMIC Technology", "Adobe Systems", - "Dynachip", "PNY Electronics", "Newport Digital", "MMC Networks", - "T Square", "Seiko Epson", "Broadcom", "Viking Components", - "V3 Semiconductor", "Flextronics (former Orbit)", "Suwa Electronics", "Transmeta", - "Micron CMS", "American Computer & Digital Components Inc", "Enhance 3000 Inc", "Tower Semiconductor", - "CPU Design", "Price Point", "Maxim Integrated Product", "Tellabs", - "Centaur Technology", "Unigen Corporation", "Transcend Information", "Memory Card Technology", - "CKD Corporation Ltd.", "Capital Instruments, Inc.", "Aica Kogyo, Ltd.", "Linvex Technology", - "MSC Vertriebs GmbH", "AKM Company, Ltd.", "Dynamem, Inc.", "NERA ASA", - "GSI Technology", "Dane-Elec (C Memory)", "Acorn Computers", "Lara Technology", - "Oak Technology, Inc.", "Itec Memory", "Tanisys Technology", "Truevision", - "Wintec Industries", "Super PC Memory", "MGV Memory", "Galvantech", - "Gadzoox Nteworks", "Multi Dimensional Cons.", "GateField", "Integrated Memory System", - "Triscend", "XaQti", "Goldenram", "Clear Logic", - "Cimaron Communications", "Nippon Steel Semi. Corp.", "Advantage Memory", "AMCC", - "LeCroy", "Yamaha Corporation", "Digital Microwave", "NetLogic Microsystems", - "MIMOS Semiconductor", "Advanced Fibre", "BF Goodrich Data.", "Epigram", - "Acbel Polytech Inc.", "Apacer Technology", "Admor Memory", "FOXCONN", - "Quadratics Superconductor", "3COM"], -["Camintonn Corporation", "ISOA Incorporated", "Agate Semiconductor", "ADMtek Incorporated", - "HYPERTEC", "Adhoc Technologies", "MOSAID Technologies", "Ardent Technologies", - "Switchcore", "Cisco Systems, Inc.", "Allayer Technologies", "WorkX AG", - "Oasis Semiconductor", "Novanet Semiconductor", "E-M Solutions", "Power General", - "Advanced Hardware Arch.", "Inova Semiconductors GmbH", "Telocity", "Delkin Devices", - "Symagery Microsystems", "C-Port Corporation", "SiberCore Technologies", "Southland Microsystems", - "Malleable Technologies", "Kendin Communications", "Great Technology Microcomputer", "Sanmina Corporation", - "HADCO Corporation", "Corsair", "Actrans System Inc.", "ALPHA Technologies", - "Silicon Laboratories, Inc. (Cygnal)", "Artesyn Technologies", "Align Manufacturing", "Peregrine Semiconductor", - "Chameleon Systems", "Aplus Flash Technology", "MIPS Technologies", "Chrysalis ITS", - "ADTEC Corporation", "Kentron Technologies", "Win Technologies", "Tachyon Semiconductor (former ASIC Designs Inc.)", - "Extreme Packet Devices", "RF Micro Devices", "Siemens AG", "Sarnoff Corporation", - "Itautec Philco SA", "Radiata Inc.", "Benchmark Elect. (AVEX)", "Legend", - "SpecTek Incorporated", "Hi/fn", "Enikia Incorporated", "SwitchOn Networks", - "AANetcom Incorporated", "Micro Memory Bank", "ESS Technology", "Virata Corporation", - "Excess Bandwidth", "West Bay Semiconductor", "DSP Group", "Newport Communications", - "Chip2Chip Incorporated", "Phobos Corporation", "Intellitech Corporation", "Nordic VLSI ASA", - "Ishoni Networks", "Silicon Spice", "Alchemy Semiconductor", "Agilent Technologies", - "Centillium Communications", "W.L. Gore", "HanBit Electronics", "GlobeSpan", - "Element 14", "Pycon", "Saifun Semiconductors", "Sibyte, Incorporated", - "MetaLink Technologies", "Feiya Technology", "I & C Technology", "Shikatronics", - "Elektrobit", "Megic", "Com-Tier", "Malaysia Micro Solutions", - "Hyperchip", "Gemstone Communications", "Anadigm (former Anadyne)", "3ParData", - "Mellanox Technologies", "Tenx Technologies", "Helix AG", "Domosys", - "Skyup Technology", "HiNT Corporation", "Chiaro", "MDT Technologies GmbH (former MCI Computer GMBH)", - "Exbit Technology A/S", "Integrated Technology Express", "AVED Memory", "Legerity", - "Jasmine Networks", "Caspian Networks", "nCUBE", "Silicon Access Networks", - "FDK Corporation", "High Bandwidth Access", "MultiLink Technology", "BRECIS", - "World Wide Packets", "APW", "Chicory Systems", "Xstream Logic", - "Fast-Chip", "Zucotto Wireless", "Realchip", "Galaxy Power", - "eSilicon", "Morphics Technology", "Accelerant Networks", "Silicon Wave", - "SandCraft", "Elpida"], -["Solectron", "Optosys Technologies", "Buffalo (former Melco)", "TriMedia Technologies", - "Cyan Technologies", "Global Locate", "Optillion", "Terago Communications", - "Ikanos Communications", "Princeton Technology", "Nanya Technology", "Elite Flash Storage", - "Mysticom", "LightSand Communications", "ATI Technologies", "Agere Systems", - "NeoMagic", "AuroraNetics", "Golden Empire", "Mushkin", - "Tioga Technologies", "Netlist", "TeraLogic", "Cicada Semiconductor", - "Centon Electronics", "Tyco Electronics", "Magis Works", "Zettacom", - "Cogency Semiconductor", "Chipcon AS", "Aspex Technology", "F5 Networks", - "Programmable Silicon Solutions", "ChipWrights", "Acorn Networks", "Quicklogic", - "Kingmax Semiconductor", "BOPS", "Flasys", "BitBlitz Communications", - "eMemory Technology", "Procket Networks", "Purple Ray", "Trebia Networks", - "Delta Electronics", "Onex Communications", "Ample Communications", "Memory Experts Intl", - "Astute Networks", "Azanda Network Devices", "Dibcom", "Tekmos", - "API NetWorks", "Bay Microsystems", "Firecron Ltd", "Resonext Communications", - "Tachys Technologies", "Equator Technology", "Concept Computer", "SILCOM", - "3Dlabs", "c't Magazine", "Sanera Systems", "Silicon Packets", - "Viasystems Group", "Simtek", "Semicon Devices Singapore", "Satron Handelsges", - "Improv Systems", "INDUSYS GmbH", "Corrent", "Infrant Technologies", - "Ritek Corp", "empowerTel Networks", "Hypertec", "Cavium Networks", - "PLX Technology", "Massana Design", "Intrinsity", "Valence Semiconductor", - "Terawave Communications", "IceFyre Semiconductor", "Primarion", "Picochip Designs Ltd", - "Silverback Systems", "Jade Star Technologies", "Pijnenburg Securealink", - "TakeMS International AG", "Cambridge Silicon Radio", - "Swissbit", "Nazomi Communications", "eWave System", - "Rockwell Collins", "Picocel Co., Ltd.", "Alphamosaic Ltd", "Sandburst", - "SiCon Video", "NanoAmp Solutions", "Ericsson Technology", "PrairieComm", - "Mitac International", "Layer N Networks", "MtekVision", "Allegro Networks", - "Marvell Semiconductors", "Netergy Microelectronic", "NVIDIA", "Internet Machines", - "Peak Electronics", "Litchfield Communication", "Accton Technology", "Teradiant Networks", - "Europe Technologies", "Cortina Systems", "RAM Components", "Raqia Networks", - "ClearSpeed", "Matsushita Battery", "Xelerated", "SimpleTech", - "Utron Technology", "Astec International", "AVM gmbH", "Redux Communications", - "Dot Hill Systems", "TeraChip"], -["T-RAM Incorporated", "Innovics Wireless", "Teknovus", "KeyEye Communications", - "Runcom Technologies", "RedSwitch", "Dotcast", "Silicon Mountain Memory", - "Signia Technologies", "Pixim", "Galazar Networks", "White Electronic Designs", - "Patriot Scientific", "Neoaxiom Corporation", "3Y Power Technology", "Europe Technologies", - "Potentia Power Systems", "C-guys Incorporated", "Digital Communications Technology Incorporated", "Silicon-Based Technology", - "Fulcrum Microsystems", "Positivo Informatica Ltd", "XIOtech Corporation", "PortalPlayer", - "Zhiying Software", "Direct2Data", "Phonex Broadband", "Skyworks Solutions", - "Entropic Communications", "Pacific Force Technology", "Zensys A/S", "Legend Silicon Corp.", - "sci-worx GmbH", "SMSC (former Oasis Silicon Systems)", "Renesas Technology", "Raza Microelectronics", - "Phyworks", "MediaTek", "Non-cents Productions", "US Modular", - "Wintegra Ltd", "Mathstar", "StarCore", "Oplus Technologies", - "Mindspeed", "Just Young Computer", "Radia Communications", "OCZ", - "Emuzed", "LOGIC Devices", "Inphi Corporation", "Quake Technologies", - "Vixel", "SolusTek", "Kongsberg Maritime", "Faraday Technology", - "Altium Ltd.", "Insyte", "ARM Ltd.", "DigiVision", - "Vativ Technologies", "Endicott Interconnect Technologies", "Pericom", "Bandspeed", - "LeWiz Communications", "CPU Technology", "Ramaxel Technology", "DSP Group", - "Axis Communications", "Legacy Electronics", "Chrontel", "Powerchip Semiconductor", - "MobilEye Technologies", "Excel Semiconductor", "A-DATA Technology", "VirtualDigm", - "G Skill Intl", "Quanta Computer", "Yield Microelectronics", "Afa Technologies", - "KINGBOX Technology Co. Ltd.", "Ceva", "iStor Networks", "Advance Modules", - "Microsoft", "Open-Silicon", "Goal Semiconductor", "ARC International", - "Simmtec", "Metanoia", "Key Stream", "Lowrance Electronics", - "Adimos", "SiGe Semiconductor", "Fodus Communications", "Credence Systems Corp.", - "Genesis Microchip Inc.", "Vihana, Inc.", "WIS Technologies", "GateChange Technologies", - "High Density Devices AS", "Synopsys", "Gigaram", "Enigma Semiconductor Inc.", - "Century Micro Inc.", "Icera Semiconductor", "Mediaworks Integrated Systems", "O'Neil Product Development", - "Supreme Top Technology Ltd.", "MicroDisplay Corporation", "Team Group Inc.", "Sinett Corporation", - "Toshiba Corporation", "Tensilica", "SiRF Technology", "Bacoc Inc.", - "SMaL Camera Technologies", "Thomson SC", "Airgo Networks", "Wisair Ltd.", - "SigmaTel", "Arkados", "Compete IT gmbH Co. KG", "Eudar Technology Inc.", - "Focus Enhancements", "Xyratex"], -["Specular Networks", "Patriot Memory", "U-Chip Technology Corp.", "Silicon Optix", - "Greenfield Networks", "CompuRAM GmbH", "Stargen, Inc.", "NetCell Corporation", - "Excalibrus Technologies Ltd", "SCM Microsystems", "Xsigo Systems, Inc.", "CHIPS & Systems Inc", - "Tier 1 Multichip Solutions", "CWRL Labs", "Teradici", "Gigaram, Inc.", - "g2 Microsystems", "PowerFlash Semiconductor", "P.A. Semi, Inc.", "NovaTech Solutions, S.A.", - "c2 Microsystems, Inc.", "Level5 Networks", "COS Memory AG", "Innovasic Semiconductor", - "02IC Co. Ltd", "Tabula, Inc.", "Crucial Technology", "Chelsio Communications", - "Solarflare Communications", "Xambala Inc.", "EADS Astrium", "ATO Semicon Co. Ltd.", - "Imaging Works, Inc.", "Astute Networks, Inc.", "Tzero", "Emulex", - "Power-One", "Pulse~LINK Inc.", "Hon Hai Precision Industry", "White Rock Networks Inc.", - "Telegent Systems USA, Inc.", "Atrua Technologies, Inc.", "Acbel Polytech Inc.", - "eRide Inc.","ULi Electronics Inc.", "Magnum Semiconductor Inc.", "neoOne Technology, Inc.", - "Connex Technology, Inc.", "Stream Processors, Inc.", "Focus Enhancements", "Telecis Wireless, Inc.", - "uNav Microelectronics", "Tarari, Inc.", "Ambric, Inc.", "Newport Media, Inc.", "VMTS", - "Enuclia Semiconductor, Inc.", "Virtium Technology Inc.", "Solid State System Co., Ltd.", "Kian Tech LLC", - "Artimi", "Power Quotient International", "Avago Technologies", "ADTechnology", "Sigma Designs", - "SiCortex, Inc.", "Ventura Technology Group", "eASIC", "M.H.S. SAS", "Micro Star International", - "Rapport Inc.", "Makway International", "Broad Reach Engineering Co.", - "Semiconductor Mfg Intl Corp", "SiConnect", "FCI USA Inc.", "Validity Sensors", - "Coney Technology Co. Ltd.", "Spans Logic", "Neterion Inc.", "Qimonda", - "New Japan Radio Co. Ltd.", "Velogix", "Montalvo Systems", "iVivity Inc.", "Walton Chaintech", - "AENEON", "Lorom Industrial Co. Ltd.", "Radiospire Networks", "Sensio Technologies, Inc.", - "Nethra Imaging", "Hexon Technology Pte Ltd", "CompuStocx (CSX)", "Methode Electronics, Inc.", - "Connect One Ltd.", "Opulan Technologies", "Septentrio NV", "Goldenmars Technology Inc.", - "Kreton Corporation", "Cochlear Ltd.", "Altair Semiconductor", "NetEffect, Inc.", - "Spansion, Inc.", "Taiwan Semiconductor Mfg", "Emphany Systems Inc.", - "ApaceWave Technologies", "Mobilygen Corporation", "Tego", "Cswitch Corporation", - "Haier (Beijing) IC Design Co.", "MetaRAM", "Axel Electronics Co. Ltd.", "Tilera Corporation", - "Aquantia", "Vivace Semiconductor", "Redpine Signals", "Octalica", "InterDigital Communications", - "Avant Technology", "Asrock, Inc.", "Availink", "Quartics, Inc.", "Element CXI", - "Innovaciones Microelectronicas", "VeriSilicon Microelectronics", "W5 Networks"], -["MOVEKING", "Mavrix Technology, Inc.", "CellGuide Ltd.", "Faraday Technology", - "Diablo Technologies, Inc.", "Jennic", "Octasic", "Molex Incorporated", "3Leaf Networks", - "Bright Micron Technology", "Netxen", "NextWave Broadband Inc.", "DisplayLink", "ZMOS Technology", - "Tec-Hill", "Multigig, Inc.", "Amimon", "Euphonic Technologies, Inc.", "BRN Phoenix", - "InSilica", "Ember Corporation", "Avexir Technologies Corporation", "Echelon Corporation", - "Edgewater Computer Systems", "XMOS Semiconductor Ltd.", "GENUSION, Inc.", "Memory Corp NV", - "SiliconBlue Technologies", "Rambus Inc."]); - -$use_sysfs = -d '/sys/bus'; - -# We consider that no data was written to this area of the SPD EEPROM if -# all bytes read 0x00 or all bytes read 0xff -sub spd_written(@) -{ - my $all_00 = 1; - my $all_ff = 1; - - foreach my $b (@_) { - $all_00 = 0 unless $b == 0x00; - $all_ff = 0 unless $b == 0xff; - return 1 unless $all_00 or $all_ff; - } - - return 0; -} - -sub parity($) -{ - my $n = shift; - my $parity = 0; - - while ($n) { - $parity++ if ($n & 1); - $n >>= 1; - } - - return ($parity & 1); -} - -sub manufacturer(@) -{ - my @bytes = @_; - my $ai = 0; - my $first; - - return ("Undefined", []) unless spd_written(@bytes); - - while (defined($first = shift(@bytes)) && $first == 0x7F) { - $ai++; - } - - return ("Invalid", []) unless defined $first; - return ("Invalid", [$first, @bytes]) if parity($first) != 1; - return ("Unknown", \@bytes) unless (($first & 0x7F) - 1 <= $vendors[$ai]); - - return ($vendors[$ai][($first & 0x7F) - 1], \@bytes); -} - -sub manufacturer_data(@) -{ - my $hex = ""; - my $asc = ""; - - return unless spd_written(@_); - - foreach my $byte (@_) { - $hex .= sprintf("\%02X ", $byte); - $asc .= ($byte >= 32 && $byte < 127) ? chr($byte) : '?'; - } - - return "$hex(\"$asc\")"; -} - -sub part_number(@) -{ - my $asc = ""; - my $byte; - - while (defined ($byte = shift) && $byte >= 32 && $byte < 127) { - $asc .= chr($byte); - } - - return ($asc eq "") ? "Undefined" : $asc; -} - -sub cas_latencies(@) -{ - return "None" unless @_; - return join ', ', map("${_}T", sort { $b <=> $a } @_); -} - -sub printl($$) # print a line w/ label and value -{ - my ($label, $value) = @_; - if ($opt_html) { - $label =~ s//\>/sg; - $label =~ s/\n/
\n/sg; - $value =~ s//\>/sg; - $value =~ s/\n/
\n/sg; - print "$label$value\n"; - } else { - my @values = split /\n/, $value; - printf "%-47s %s\n", $label, shift @values; - printf "%-47s %s\n", "", $_ foreach (@values); - } -} - -sub printl2($$) # print a line w/ label and value (outside a table) -{ - my ($label, $value) = @_; - if ($opt_html) { - $label =~ s//\>/sg; - $label =~ s/\n/
\n/sg; - $value =~ s//\>/sg; - $value =~ s/\n/
\n/sg; - } - print "$label: $value\n"; -} - -sub prints($) # print seperator w/ given text -{ - my ($label) = @_; - if ($opt_html) { - $label =~ s//\>/sg; - $label =~ s/\n/
\n/sg; - print "$label\n"; - } else { - print "\n---=== $label ===---\n"; - } -} - -sub printh($$) # print header w/ given text -{ - my ($header, $sub) = @_; - if ($opt_html) { - $header =~ s//\>/sg; - $header =~ s/\n/
\n/sg; - $sub =~ s//\>/sg; - $sub =~ s/\n/
\n/sg; - print "

$header

\n"; - print "

$sub

\n"; - } else { - print "\n$header\n$sub\n"; - } -} - -sub printc($) # print comment -{ - my ($comment) = @_; - if ($opt_html) { - $comment =~ s//\>/sg; - $comment =~ s/\n/
\n/sg; - print "\n"; - } else { - print "# $comment\n"; - } -} - -sub tns($) # print a time in ns -{ - return sprintf("%3.2f ns", $_[0]); -} - -# Parameter: bytes 0-63 -sub decode_sdr_sdram($) -{ - my $bytes = shift; - my ($l, $temp); - -# SPD revision - printl "SPD Revision", $bytes->[62]; - -#size computation - - prints "Memory Characteristics"; - - my $k = 0; - my $ii = 0; - - $ii = ($bytes->[3] & 0x0f) + ($bytes->[4] & 0x0f) - 17; - if (($bytes->[5] <= 8) && ($bytes->[17] <= 8)) { - $k = $bytes->[5] * $bytes->[17]; - } - - if ($ii > 0 && $ii <= 12 && $k > 0) { - printl "Size", ((1 << $ii) * $k) . " MB"; - } else { - printl "INVALID SIZE", $bytes->[3] . "," . $bytes->[4] . "," . - $bytes->[5] . "," . $bytes->[17]; - } - - my @cas; - for ($ii = 0; $ii < 7; $ii++) { - push(@cas, $ii + 1) if ($bytes->[18] & (1 << $ii)); - } - - my $trcd; - my $trp; - my $tras; - my $ctime = ($bytes->[9] >> 4) + ($bytes->[9] & 0xf) * 0.1; - - $trcd = $bytes->[29]; - $trp = $bytes->[27];; - $tras = $bytes->[30]; - - printl "tCL-tRCD-tRP-tRAS", - $cas[$#cas] . "-" . - ceil($trcd/$ctime) . "-" . - ceil($trp/$ctime) . "-" . - ceil($tras/$ctime); - - $l = "Number of Row Address Bits"; - if ($bytes->[3] == 0) { printl $l, "Undefined!"; } - elsif ($bytes->[3] == 1) { printl $l, "1/16"; } - elsif ($bytes->[3] == 2) { printl $l, "2/17"; } - elsif ($bytes->[3] == 3) { printl $l, "3/18"; } - else { printl $l, $bytes->[3]; } - - $l = "Number of Col Address Bits"; - if ($bytes->[4] == 0) { printl $l, "Undefined!"; } - elsif ($bytes->[4] == 1) { printl $l, "1/16"; } - elsif ($bytes->[4] == 2) { printl $l, "2/17"; } - elsif ($bytes->[4] == 3) { printl $l, "3/18"; } - else { printl $l, $bytes->[4]; } - - $l = "Number of Module Rows"; - if ($bytes->[5] == 0 ) { printl $l, "Undefined!"; } - else { printl $l, $bytes->[5]; } - - $l = "Data Width"; - if ($bytes->[7] > 1) { - printl $l, "Undefined!" - } else { - $temp = ($bytes->[7] * 256) + $bytes->[6]; - printl $l, $temp; - } - - $l = "Module Interface Signal Levels"; - if ($bytes->[8] == 0) { printl $l, "5.0 Volt/TTL"; } - elsif ($bytes->[8] == 1) { printl $l, "LVTTL"; } - elsif ($bytes->[8] == 2) { printl $l, "HSTL 1.5"; } - elsif ($bytes->[8] == 3) { printl $l, "SSTL 3.3"; } - elsif ($bytes->[8] == 4) { printl $l, "SSTL 2.5"; } - elsif ($bytes->[8] == 255) { printl $l, "New Table"; } - else { printl $l, "Undefined!"; } - - $l = "Module Configuration Type"; - if ($bytes->[11] == 0) { printl $l, "No Parity"; } - elsif ($bytes->[11] == 1) { printl $l, "Parity"; } - elsif ($bytes->[11] == 2) { printl $l, "ECC"; } - else { printl $l, "Undefined!"; } - - $l = "Refresh Type"; - if ($bytes->[12] > 126) { printl $l, "Self Refreshing"; } - else { printl $l, "Not Self Refreshing"; } - - $l = "Refresh Rate"; - $temp = $bytes->[12] & 0x7f; - if ($temp == 0) { printl $l, "Normal (15.625 us)"; } - elsif ($temp == 1) { printl $l, "Reduced (3.9 us)"; } - elsif ($temp == 2) { printl $l, "Reduced (7.8 us)"; } - elsif ($temp == 3) { printl $l, "Extended (31.3 us)"; } - elsif ($temp == 4) { printl $l, "Extended (62.5 us)"; } - elsif ($temp == 5) { printl $l, "Extended (125 us)"; } - else { printl $l, "Undefined!"; } - - $l = "Primary SDRAM Component Bank Config"; - if ($bytes->[13] > 126) { printl $l, "Bank2 = 2 x Bank1"; } - else { printl $l, "No Bank2 OR Bank2 = Bank1 width"; } - - $l = "Primary SDRAM Component Widths"; - $temp = $bytes->[13] & 0x7f; - if ($temp == 0) { printl $l, "Undefined!\n"; } - else { printl $l, $temp; } - - $l = "Error Checking SDRAM Component Bank Config"; - if ($bytes->[14] > 126) { printl $l, "Bank2 = 2 x Bank1"; } - else { printl $l, "No Bank2 OR Bank2 = Bank1 width"; } - - $l = "Error Checking SDRAM Component Widths"; - $temp = $bytes->[14] & 0x7f; - if ($temp == 0) { printl $l, "Undefined!"; } - else { printl $l, $temp; } - - $l = "Min Clock Delay for Back to Back Random Access"; - if ($bytes->[15] == 0) { printl $l, "Undefined!"; } - else { printl $l, $bytes->[15]; } - - $l = "Supported Burst Lengths"; - my @array; - for ($ii = 0; $ii < 4; $ii++) { - push(@array, 1 << $ii) if ($bytes->[16] & (1 << $ii)); - } - push(@array, "Page") if ($bytes->[16] & 128); - if (@array) { $temp = join ', ', @array; } - else { $temp = "None"; } - printl $l, $temp; - - $l = "Number of Device Banks"; - if ($bytes->[17] == 0) { printl $l, "Undefined/Reserved!"; } - else { printl $l, $bytes->[17]; } - - $l = "Supported CAS Latencies"; - printl $l, cas_latencies(@cas); - - $l = "Supported CS Latencies"; - @array = (); - for ($ii = 0; $ii < 7; $ii++) { - push(@array, $ii) if ($bytes->[19] & (1 << $ii)); - } - if (@array) { $temp = join ', ', @array; } - else { $temp = "None"; } - printl $l, $temp; - - $l = "Supported WE Latencies"; - @array = (); - for ($ii = 0; $ii < 7; $ii++) { - push(@array, $ii) if ($bytes->[20] & (1 << $ii)); - } - if (@array) { $temp = join ', ', @array; } - else { $temp = "None"; } - printl $l, $temp; - - if (@cas >= 1) { - $l = "Cycle Time at CAS ".$cas[$#cas]; - printl $l, "$ctime ns"; - - $l = "Access Time at CAS ".$cas[$#cas]; - $temp = ($bytes->[10] >> 4) + ($bytes->[10] & 0xf) * 0.1; - printl $l, "$temp ns"; - } - - if (@cas >= 2 && spd_written(@$bytes[23..24])) { - $l = "Cycle Time at CAS ".$cas[$#cas-1]; - $temp = $bytes->[23] >> 4; - if ($temp == 0) { printl $l, "Undefined!"; } - else { - if ($temp < 4 ) { $temp += 15; } - printl $l, $temp + (($bytes->[23] & 0xf) * 0.1) . " ns"; - } - - $l = "Access Time at CAS ".$cas[$#cas-1]; - $temp = $bytes->[24] >> 4; - if ($temp == 0) { printl $l, "Undefined!"; } - else { - if ($temp < 4 ) { $temp += 15; } - printl $l, $temp + (($bytes->[24] & 0xf) * 0.1) . " ns"; - } - } - - if (@cas >= 3 && spd_written(@$bytes[25..26])) { - $l = "Cycle Time at CAS ".$cas[$#cas-2]; - $temp = $bytes->[25] >> 2; - if ($temp == 0) { printl $l, "Undefined!"; } - else { printl $l, $temp + ($bytes->[25] & 0x3) * 0.25 . " ns"; } - - $l = "Access Time at CAS ".$cas[$#cas-2]; - $temp = $bytes->[26] >> 2; - if ($temp == 0) { printl $l, "Undefined!"; } - else { printl $l, $temp + ($bytes->[26] & 0x3) * 0.25 . " ns"; } - } - - $l = "SDRAM Module Attributes"; - $temp = ""; - if ($bytes->[21] & 1) { $temp .= "Buffered Address/Control Inputs\n"; } - if ($bytes->[21] & 2) { $temp .= "Registered Address/Control Inputs\n"; } - if ($bytes->[21] & 4) { $temp .= "On card PLL (clock)\n"; } - if ($bytes->[21] & 8) { $temp .= "Buffered DQMB Inputs\n"; } - if ($bytes->[21] & 16) { $temp .= "Registered DQMB Inputs\n"; } - if ($bytes->[21] & 32) { $temp .= "Differential Clock Input\n"; } - if ($bytes->[21] & 64) { $temp .= "Redundant Row Address\n"; } - if ($bytes->[21] & 128) { $temp .= "Undefined (bit 7)\n"; } - if ($bytes->[21] == 0) { $temp .= "(None Reported)\n"; } - printl $l, $temp; - - $l = "SDRAM Device Attributes (General)"; - $temp = ""; - if ($bytes->[22] & 1) { $temp .= "Supports Early RAS# Recharge\n"; } - if ($bytes->[22] & 2) { $temp .= "Supports Auto-Precharge\n"; } - if ($bytes->[22] & 4) { $temp .= "Supports Precharge All\n"; } - if ($bytes->[22] & 8) { $temp .= "Supports Write1/Read Burst\n"; } - if ($bytes->[22] & 16) { $temp .= "Lower VCC Tolerance: 5%\n"; } - else { $temp .= "Lower VCC Tolerance: 10%\n"; } - if ($bytes->[22] & 32) { $temp .= "Upper VCC Tolerance: 5%\n"; } - else { $temp .= "Upper VCC Tolerance: 10%\n"; } - if ($bytes->[22] & 64) { $temp .= "Undefined (bit 6)\n"; } - if ($bytes->[22] & 128) { $temp .= "Undefined (bit 7)\n"; } - printl $l, $temp; - - $l = "Minimum Row Precharge Time"; - if ($bytes->[27] == 0) { printl $l, "Undefined!"; } - else { printl $l, "$bytes->[27] ns"; } - - $l = "Row Active to Row Active Min"; - if ($bytes->[28] == 0) { printl $l, "Undefined!"; } - else { printl $l, "$bytes->[28] ns"; } - - $l = "RAS to CAS Delay"; - if ($bytes->[29] == 0) { printl $l, "Undefined!"; } - else { printl $l, "$bytes->[29] ns"; } - - $l = "Min RAS Pulse Width"; - if ($bytes->[30] == 0) { printl $l, "Undefined!"; } - else { printl $l, "$bytes->[30] ns"; } - - $l = "Row Densities"; - $temp = ""; - if ($bytes->[31] & 1) { $temp .= "4 MByte\n"; } - if ($bytes->[31] & 2) { $temp .= "8 MByte\n"; } - if ($bytes->[31] & 4) { $temp .= "16 MByte\n"; } - if ($bytes->[31] & 8) { $temp .= "32 MByte\n"; } - if ($bytes->[31] & 16) { $temp .= "64 MByte\n"; } - if ($bytes->[31] & 32) { $temp .= "128 MByte\n"; } - if ($bytes->[31] & 64) { $temp .= "256 MByte\n"; } - if ($bytes->[31] & 128) { $temp .= "512 MByte\n"; } - if ($bytes->[31] == 0) { $temp .= "(Undefined! -- None Reported!)\n"; } - printl $l, $temp; - - if (($bytes->[32] & 0xf) <= 9) { - $l = "Command and Address Signal Setup Time"; - $temp = (($bytes->[32] & 0x7f) >> 4) + ($bytes->[32] & 0xf) * 0.1; - printl $l, (($bytes->[32] >> 7) ? -$temp : $temp) . " ns"; - } - - if (($bytes->[33] & 0xf) <= 9) { - $l = "Command and Address Signal Hold Time"; - $temp = (($bytes->[33] & 0x7f) >> 4) + ($bytes->[33] & 0xf) * 0.1; - printl $l, (($bytes->[33] >> 7) ? -$temp : $temp) . " ns"; - } - - if (($bytes->[34] & 0xf) <= 9) { - $l = "Data Signal Setup Time"; - $temp = (($bytes->[34] & 0x7f) >> 4) + ($bytes->[34] & 0xf) * 0.1; - printl $l, (($bytes->[34] >> 7) ? -$temp : $temp) . " ns"; - } - - if (($bytes->[35] & 0xf) <= 9) { - $l = "Data Signal Hold Time"; - $temp = (($bytes->[35] & 0x7f) >> 4) + ($bytes->[35] & 0xf) * 0.1; - printl $l, (($bytes->[35] >> 7) ? -$temp : $temp) . " ns"; - } -} - -# Parameter: bytes 0-63 -sub decode_ddr_sdram($) -{ - my $bytes = shift; - my ($l, $temp); - -# SPD revision - if ($bytes->[62] != 0xff) { - printl "SPD Revision", ($bytes->[62] >> 4) . "." . - ($bytes->[62] & 0xf); - } - -# speed - prints "Memory Characteristics"; - - $l = "Maximum module speed"; - $temp = ($bytes->[9] >> 4) + ($bytes->[9] & 0xf) * 0.1; - my $ddrclk = 2 * (1000 / $temp); - my $tbits = ($bytes->[7] * 256) + $bytes->[6]; - if (($bytes->[11] == 2) || ($bytes->[11] == 1)) { $tbits = $tbits - 8; } - my $pcclk = int ($ddrclk * $tbits / 8); - $pcclk += 100 if ($pcclk % 100) >= 50; # Round properly - $pcclk = $pcclk - ($pcclk % 100); - $ddrclk = int ($ddrclk); - printl $l, "${ddrclk}MHz (PC${pcclk})"; - -#size computation - my $k = 0; - my $ii = 0; - - $ii = ($bytes->[3] & 0x0f) + ($bytes->[4] & 0x0f) - 17; - if (($bytes->[5] <= 8) && ($bytes->[17] <= 8)) { - $k = $bytes->[5] * $bytes->[17]; - } - - if ($ii > 0 && $ii <= 12 && $k > 0) { - printl "Size", ((1 << $ii) * $k) . " MB"; - } else { - printl "INVALID SIZE", $bytes->[3] . ", " . $bytes->[4] . ", " . - $bytes->[5] . ", " . $bytes->[17]; - } - - my $highestCAS = 0; - my %cas; - for ($ii = 0; $ii < 7; $ii++) { - if ($bytes->[18] & (1 << $ii)) { - $highestCAS = 1+$ii*0.5; - $cas{$highestCAS}++; - } - } - - my $trcd; - my $trp; - my $tras; - my $ctime = ($bytes->[9] >> 4) + ($bytes->[9] & 0xf) * 0.1; - - $trcd = ($bytes->[29] >> 2) + (($bytes->[29] & 3) * 0.25); - $trp = ($bytes->[27] >> 2) + (($bytes->[27] & 3) * 0.25); - $tras = $bytes->[30]; - - printl "tCL-tRCD-tRP-tRAS", - $highestCAS . "-" . - ceil($trcd/$ctime) . "-" . - ceil($trp/$ctime) . "-" . - ceil($tras/$ctime); - -# latencies - printl "Supported CAS Latencies", cas_latencies(keys %cas); - - my @array; - for ($ii = 0; $ii < 7; $ii++) { - push(@array, $ii) if ($bytes->[19] & (1 << $ii)); - } - if (@array) { $temp = join ', ', @array; } - else { $temp = "None"; } - printl "Supported CS Latencies", $temp; - - @array = (); - for ($ii = 0; $ii < 7; $ii++) { - push(@array, $ii) if ($bytes->[20] & (1 << $ii)); - } - if (@array) { $temp = join ', ', @array; } - else { $temp = "None"; } - printl "Supported WE Latencies", $temp; - -# timings - if (exists $cas{$highestCAS}) { - printl "Minimum Cycle Time at CAS $highestCAS", - "$ctime ns"; - - printl "Maximum Access Time at CAS $highestCAS", - (($bytes->[10] >> 4) * 0.1 + ($bytes->[10] & 0xf) * 0.01) . " ns"; - } - - if (exists $cas{$highestCAS-0.5} && spd_written(@$bytes[23..24])) { - printl "Minimum Cycle Time at CAS ".($highestCAS-0.5), - (($bytes->[23] >> 4) + ($bytes->[23] & 0xf) * 0.1) . " ns"; - - printl "Maximum Access Time at CAS ".($highestCAS-0.5), - (($bytes->[24] >> 4) * 0.1 + ($bytes->[24] & 0xf) * 0.01) . " ns"; - } - - if (exists $cas{$highestCAS-1} && spd_written(@$bytes[25..26])) { - printl "Minimum Cycle Time at CAS ".($highestCAS-1), - (($bytes->[25] >> 4) + ($bytes->[25] & 0xf) * 0.1) . " ns"; - - printl "Maximum Access Time at CAS ".($highestCAS-1), - (($bytes->[26] >> 4) * 0.1 + ($bytes->[26] & 0xf) * 0.01) . " ns"; - } - -# module attributes - if ($bytes->[47] & 0x03) { - if (($bytes->[47] & 0x03) == 0x01) { $temp = "1.125\" to 1.25\""; } - elsif (($bytes->[47] & 0x03) == 0x02) { $temp = "1.7\""; } - elsif (($bytes->[47] & 0x03) == 0x03) { $temp = "Other"; } - printl "Module Height", $temp; - } -} - -sub ddr2_sdram_ctime($) -{ - my $byte = shift; - my $ctime; - - $ctime = $byte >> 4; - if (($byte & 0xf) <= 9) { $ctime += ($byte & 0xf) * 0.1; } - elsif (($byte & 0xf) == 10) { $ctime += 0.25; } - elsif (($byte & 0xf) == 11) { $ctime += 0.33; } - elsif (($byte & 0xf) == 12) { $ctime += 0.66; } - elsif (($byte & 0xf) == 13) { $ctime += 0.75; } - - return $ctime; -} - -sub ddr2_sdram_atime($) -{ - my $byte = shift; - my $atime; - - $atime = ($byte >> 4) * 0.1 + ($byte & 0xf) * 0.01; - - return $atime; -} - -# Base, high-bit, 3-bit fraction code -sub ddr2_sdram_rtime($$$) -{ - my ($rtime, $msb, $ext) = @_; - my @table = (0, .25, .33, .50, .66, .75); - - return $rtime + $msb * 256 + $table[$ext]; -} - -sub ddr2_module_types($) -{ - my $byte = shift; - my @types = qw(RDIMM UDIMM SO-DIMM Micro-DIMM Mini-RDIMM Mini-UDIMM); - my @widths = (133.35, 133.25, 67.6, 45.5, 82.0, 82.0); - my @suptypes; - local $_; - - foreach (0..5) { - push @suptypes, "$types[$_] ($widths[$_] mm)" - if ($byte & (1 << $_)); - } - - return @suptypes; -} - -sub ddr2_refresh_rate($) -{ - my $byte = shift; - my @refresh = qw(Normal Reduced Reduced Extended Extended Extended); - my @refresht = (15.625, 3.9, 7.8, 31.3, 62.5, 125); - - return "$refresh[$byte & 0x7f] ($refresht[$byte & 0x7f] us)". - ($byte & 0x80 ? " - Self Refresh" : ""); -} - -# Parameter: bytes 0-63 -sub decode_ddr2_sdram($) -{ - my $bytes = shift; - my ($l, $temp); - my $ctime; - -# SPD revision - if ($bytes->[62] != 0xff) { - printl "SPD Revision", ($bytes->[62] >> 4) . "." . - ($bytes->[62] & 0xf); - } - -# speed - prints "Memory Characteristics"; - - $l = "Maximum module speed"; - $ctime = ddr2_sdram_ctime($bytes->[9]); - my $ddrclk = 2 * (1000 / $ctime); - my $tbits = ($bytes->[7] * 256) + $bytes->[6]; - if ($bytes->[11] & 0x03) { $tbits = $tbits - 8; } - my $pcclk = int ($ddrclk * $tbits / 8); - # Round down to comply with Jedec - $pcclk = $pcclk - ($pcclk % 100); - $ddrclk = int ($ddrclk); - printl $l, "${ddrclk}MHz (PC2-${pcclk})"; - -#size computation - my $k = 0; - my $ii = 0; - - $ii = ($bytes->[3] & 0x0f) + ($bytes->[4] & 0x0f) - 17; - $k = (($bytes->[5] & 0x7) + 1) * $bytes->[17]; - - if($ii > 0 && $ii <= 12 && $k > 0) { - printl "Size", ((1 << $ii) * $k) . " MB"; - } else { - printl "INVALID SIZE", $bytes->[3] . "," . $bytes->[4] . "," . - $bytes->[5] . "," . $bytes->[17]; - } - - printl "Banks x Rows x Columns x Bits", - join(' x ', $bytes->[17], $bytes->[3], $bytes->[4], $bytes->[6]); - printl "Ranks", ($bytes->[5] & 7) + 1; - - printl "SDRAM Device Width", $bytes->[13]." bits"; - - my @heights = ('< 25.4', '25.4', '25.4 - 30.0', '30.0', '30.5', '> 30.5'); - printl "Module Height", $heights[$bytes->[5] >> 5]." mm"; - - my @suptypes = ddr2_module_types($bytes->[20]); - printl "Module Type".(@suptypes > 1 ? 's' : ''), join(', ', @suptypes); - - printl "DRAM Package", $bytes->[5] & 0x10 ? "Stack" : "Planar"; - - my @volts = ("TTL (5V Tolerant)", "LVTTL", "HSTL 1.5V", - "SSTL 3.3V", "SSTL 2.5V", "SSTL 1.8V", "TBD"); - printl "Voltage Interface Level", $volts[$bytes->[8]]; - - printl "Refresh Rate", ddr2_refresh_rate($bytes->[12]); - - my @burst; - push @burst, 4 if ($bytes->[16] & 4); - push @burst, 8 if ($bytes->[16] & 8); - $burst[0] = 'None' if !@burst; - printl "Supported Burst Lengths", join(', ', @burst); - - my $highestCAS = 0; - my %cas; - for ($ii = 2; $ii < 7; $ii++) { - if ($bytes->[18] & (1 << $ii)) { - $highestCAS = $ii; - $cas{$highestCAS}++; - } - } - - my $trcd; - my $trp; - my $tras; - - $trcd = ($bytes->[29] >> 2) + (($bytes->[29] & 3) * 0.25); - $trp = ($bytes->[27] >> 2) + (($bytes->[27] & 3) * 0.25); - $tras = $bytes->[30]; - - printl "tCL-tRCD-tRP-tRAS", - $highestCAS . "-" . - ceil($trcd/$ctime) . "-" . - ceil($trp/$ctime) . "-" . - ceil($tras/$ctime); - -# latencies - printl "Supported CAS Latencies (tCL)", cas_latencies(keys %cas); - -# timings - if (exists $cas{$highestCAS}) { - printl "Minimum Cycle Time at CAS $highestCAS (tCK min)", - tns($ctime); - printl "Maximum Access Time at CAS $highestCAS (tAC)", - tns(ddr2_sdram_atime($bytes->[10])); - } - - if (exists $cas{$highestCAS-1} && spd_written(@$bytes[23..24])) { - printl "Minimum Cycle Time at CAS ".($highestCAS-1), - tns(ddr2_sdram_ctime($bytes->[23])); - printl "Maximum Access Time at CAS ".($highestCAS-1), - tns(ddr2_sdram_atime($bytes->[24])); - } - - if (exists $cas{$highestCAS-2} && spd_written(@$bytes[25..26])) { - printl "Minimum Cycle Time at CAS ".($highestCAS-2), - tns(ddr2_sdram_ctime($bytes->[25])); - printl "Maximum Access Time at CAS ".($highestCAS-2), - tns(ddr2_sdram_atime($bytes->[26])); - } - printl "Maximum Cycle Time (tCK max)", - tns(ddr2_sdram_ctime($bytes->[43])); - -# more timing information - prints("Timing Parameters"); - printl "Address/Command Setup Time Before Clock (tIS)", - tns(ddr2_sdram_atime($bytes->[32])); - printl "Address/Command Hold Time After Clock (tIH)", - tns(ddr2_sdram_atime($bytes->[33])); - printl "Data Input Setup Time Before Strobe (tDS)", - tns(ddr2_sdram_atime($bytes->[34])); - printl "Data Input Hold Time After Strobe (tDH)", - tns(ddr2_sdram_atime($bytes->[35])); - printl "Minimum Row Precharge Delay (tRP)", tns($trp); - printl "Minimum Row Active to Row Active Delay (tRRD)", - tns($bytes->[28]/4); - printl "Minimum RAS# to CAS# Delay (tRCD)", tns($trcd); - printl "Minimum RAS# Pulse Width (tRAS)", tns($tras); - printl "Write Recovery Time (tWR)", tns($bytes->[36]/4); - printl "Minimum Write to Read CMD Delay (tWTR)", tns($bytes->[37]/4); - printl "Minimum Read to Pre-charge CMD Delay (tRTP)", tns($bytes->[38]/4); - printl "Minimum Active to Auto-refresh Delay (tRC)", - tns(ddr2_sdram_rtime($bytes->[41], 0, ($bytes->[40] >> 4) & 7)); - printl "Minimum Recovery Delay (tRFC)", - tns(ddr2_sdram_rtime($bytes->[42], $bytes->[40] & 1, - ($bytes->[40] >> 1) & 7)); - printl "Maximum DQS to DQ Skew (tDQSQ)", tns($bytes->[44]/100); - printl "Maximum Read Data Hold Skew (tQHS)", tns($bytes->[45]/100); - printl "PLL Relock Time", $bytes->[46] . " us" if ($bytes->[46]); -} - -# Parameter: bytes 0-63 -sub decode_direct_rambus($) -{ - my $bytes = shift; - -#size computation - prints "Memory Characteristics"; - - my $ii; - - $ii = ($bytes->[4] & 0x0f) + ($bytes->[4] >> 4) + ($bytes->[5] & 0x07) - 13; - - if ($ii > 0 && $ii < 16) { - printl "Size", (1 << $ii) . " MB"; - } else { - printl "INVALID SIZE", sprintf("0x%02x, 0x%02x", - $bytes->[4], $bytes->[5]); - } -} - -# Parameter: bytes 0-63 -sub decode_rambus($) -{ - my $bytes = shift; - -#size computation - prints "Memory Characteristics"; - - my $ii; - - $ii = ($bytes->[3] & 0x0f) + ($bytes->[3] >> 4) + ($bytes->[5] & 0x07) - 13; - - if ($ii > 0 && $ii < 16) { - printl "Size", (1 << $ii) . " MB"; - } else { - printl "INVALID SIZE", sprintf("0x%02x, 0x%02x", - $bytes->[3], $bytes->[5]); - } -} - -%decode_callback = ( - "SDR SDRAM" => \&decode_sdr_sdram, - "DDR SDRAM" => \&decode_ddr_sdram, - "DDR2 SDRAM" => \&decode_ddr2_sdram, - "Direct Rambus" => \&decode_direct_rambus, - "Rambus" => \&decode_rambus, -); - -# Parameter: bytes 64-127 -sub decode_intel_spec_freq($) -{ - my $bytes = shift; - my ($l, $temp); - - prints "Intel Specification"; - - $l = "Frequency"; - if ($bytes->[62] == 0x66) { $temp = "66MHz\n"; } - elsif ($bytes->[62] == 100) { $temp = "100MHz or 133MHz\n"; } - elsif ($bytes->[62] == 133) { $temp = "133MHz\n"; } - else { $temp = "Undefined!\n"; } - printl $l, $temp; - - $l = "Details for 100MHz Support"; - $temp = ""; - if ($bytes->[63] & 1) { $temp .= "Intel Concurrent Auto-precharge\n"; } - if ($bytes->[63] & 2) { $temp .= "CAS Latency = 2\n"; } - if ($bytes->[63] & 4) { $temp .= "CAS Latency = 3\n"; } - if ($bytes->[63] & 8) { $temp .= "Junction Temp A (100 degrees C)\n"; } - else { $temp .= "Junction Temp B (90 degrees C)\n"; } - if ($bytes->[63] & 16) { $temp .= "CLK 3 Connected\n"; } - if ($bytes->[63] & 32) { $temp .= "CLK 2 Connected\n"; } - if ($bytes->[63] & 64) { $temp .= "CLK 1 Connected\n"; } - if ($bytes->[63] & 128) { $temp .= "CLK 0 Connected\n"; } - if (($bytes->[63] & 192) == 192) { $temp .= "Double-sided DIMM\n"; } - elsif (($bytes->[63] & 192) != 0) { $temp .= "Single-sided DIMM\n"; } - printl $l, $temp; -} - -# Read various hex dump style formats: hexdump, hexdump -C, i2cdump, eeprog -# note that normal 'hexdump' format on a little-endian system byte-swaps -# words, using hexdump -C is better. -sub read_hexdump($) -{ - my $addr = 0; - my $repstart = 0; - my @bytes; - my $header = 1; - my $word = 0; - - # Look in the cache first - return @{$hexdump_cache{$_[0]}} if exists $hexdump_cache{$_[0]}; - - open F, '<', $_[0] or die "Unable to open: $_[0]"; - while () { - chomp; - if (/^\*$/) { - $repstart = $addr; - next; - } - /^(?:0000 )?([a-f\d]{2,8}):?\s+((:?[a-f\d]{4}\s*){8}|(:?[a-f\d]{2}\s*){16})/i || - /^(?:0000 )?([a-f\d]{2,8}):?\s*$/i; - next if (!defined $1 && $header); # skip leading unparsed lines - - defined $1 or die "Unable to parse input"; - $header = 0; - - $addr = hex $1; - if ($repstart) { - @bytes[$repstart .. ($addr-1)] = - (@bytes[($repstart-16)..($repstart-1)]) x (($addr-$repstart)/16); - $repstart = 0; - } - last unless defined $2; - foreach (split(/\s+/, $2)) { - if (/^(..)(..)$/) { - $word |= 1; - $bytes[$addr++] = hex($1); - $bytes[$addr++] = hex($2); - } else { - $bytes[$addr++] = hex($_); - } - } - } - close F; - $header and die "Unable to parse any data from hexdump '$_[0]'"; - $word and printc "Warning: Assuming big-endian order 16-bit hex dump"; - - # Cache the data for later use - $hexdump_cache{$_[0]} = \@bytes; - return @bytes; -} - -sub readspd64($$) # reads 64 bytes from SPD-EEPROM -{ - my ($offset, $dimm_i) = @_; - my @bytes; - if ($use_hexdump) { - @bytes = read_hexdump($dimm_i); - return @bytes[$offset..($offset+63)]; - } elsif ($use_sysfs) { - # Kernel 2.6 with sysfs - sysopen(HANDLE, "/sys/bus/i2c/drivers/eeprom/$dimm_i/eeprom", O_RDONLY) - or die "Cannot open /sys/bus/i2c/drivers/eeprom/$dimm_i/eeprom"; - binmode HANDLE; - sysseek(HANDLE, $offset, SEEK_SET); - sysread(HANDLE, my $eeprom, 64); - close HANDLE; - @bytes = unpack("C64", $eeprom); - } else { - # Kernel 2.4 with procfs - for my $i (0 .. 3) { - my $hexoff = sprintf('%02x', $offset + $i * 16); - push @bytes, split(" ", `cat /proc/sys/dev/sensors/$dimm_i/$hexoff`); - } - } - return @bytes; -} - -# Parse command-line -foreach (@ARGV) { - if ($_ eq '-h' || $_ eq '--help') { - print "Usage: $0 [-c] [-f [-b]] [-x file [files..]]\n", - " $0 -h\n\n", - " -f, --format Print nice html output\n", - " -b, --bodyonly Don't print html header\n", - " (useful for postprocessing the output)\n", - " -c, --checksum Decode completely even if checksum fails\n", - " -x, Read data from hexdump files\n", - " -h, --help Display this usage summary\n"; - print <<"EOF"; - -Hexdumps can be the output from hexdump, hexdump -C, i2cdump, eeprog and -likely many other progams producing hex dumps of one kind or another. Note -that the default output of "hexdump" will be byte-swapped on little-endian -systems and will therefore not be parsed correctly. It is better to use -"hexdump -C", which is not ambiguous. -EOF - exit; - } - - if ($_ eq '-f' || $_ eq '--format') { - $opt_html = 1; - next; - } - if ($_ eq '-b' || $_ eq '--bodyonly') { - $opt_bodyonly = 1; - next; - } - if ($_ eq '-c' || $_ eq '--checksum') { - $opt_igncheck = 1; - next; - } - if ($_ eq '-x') { - $use_hexdump = 1; - next; - } - - if (m/^-/) { - print STDERR "Unrecognized option $_\n"; - exit; - } - - push @dimm_list, $_ if $use_hexdump; -} - -if ($opt_html && !$opt_bodyonly) { - print "\n", - "\n", - "\t\n", - "\tPC DIMM Serial Presence Detect Tester/Decoder Output\n", - "\n"; -} - -printc "decode-dimms version $revision"; -printh 'Memory Serial Presence Detect Decoder', -'By Philip Edelbrock, Christian Zuckschwerdt, Burkart Lingner, -Jean Delvare, Trent Piepho and others'; - - -my $dimm_count = 0; -my $dir; -if (!$use_hexdump) { - if ($use_sysfs) { $dir = '/sys/bus/i2c/drivers/eeprom'; } - else { $dir = '/proc/sys/dev/sensors'; } - if (-d $dir) { - @dimm_list = split(/\s+/, `ls $dir`); - } elsif (! -d '/sys/module/eeprom') { - print "No EEPROM found, are you sure the eeprom module is loaded?\n"; - exit; - } -} - -for my $i ( 0 .. $#dimm_list ) { - $_ = $dimm_list[$i]; - if (($use_sysfs && /^\d+-\d+$/) - || (!$use_sysfs && /^eeprom-/) - || $use_hexdump) { - my @bytes = readspd64(0, $dimm_list[$i]); - my $dimm_checksum = 0; - $dimm_checksum += $bytes[$_] foreach (0 .. 62); - $dimm_checksum &= 0xff; - - next unless $bytes[63] == $dimm_checksum || $opt_igncheck; - $dimm_count++; - - print "" if $opt_html; - printl2 "\n\nDecoding EEPROM", - $use_hexdump ? $dimm_list[$i] : ($use_sysfs ? - "/sys/bus/i2c/drivers/eeprom/$dimm_list[$i]" : - "/proc/sys/dev/sensors/$dimm_list[$i]"); - print "" if $opt_html; - print "\n" if $opt_html; - if (!$use_hexdump) { - if (($use_sysfs && /^[^-]+-([^-]+)$/) - || (!$use_sysfs && /^[^-]+-[^-]+-[^-]+-([^-]+)$/)) { - my $dimm_num = $1 - 49; - printl "Guessing DIMM is in", "bank $dimm_num"; - } - } - -# Decode first 3 bytes (0-2) - prints "SPD EEPROM Information"; - - my $l = "EEPROM Checksum of bytes 0-62"; - printl $l, ($bytes[63] == $dimm_checksum ? - sprintf("OK (0x%.2X)", $bytes[63]): - sprintf("Bad\n(found 0x%.2X, calculated 0x%.2X)\n", - $bytes[63], $dimm_checksum)); - - # Simple heuristic to detect Rambus - my $is_rambus = $bytes[0] < 4; - my $temp; - if ($is_rambus) { - if ($bytes[0] == 1) { $temp = "0.7"; } - elsif ($bytes[0] == 2) { $temp = "1.0"; } - elsif ($bytes[0] == 0 || $bytes[0] == 255) { $temp = "Invalid"; } - else { $temp = "Reserved"; } - printl "SPD Revision", $temp; - } else { - printl "# of bytes written to SDRAM EEPROM", - $bytes[0]; - } - - $l = "Total number of bytes in EEPROM"; - if ($bytes[1] <= 14) { - printl $l, 2**$bytes[1]; - } elsif ($bytes[1] == 0) { - printl $l, "RFU"; - } else { printl $l, "ERROR!"; } - - $l = "Fundamental Memory type"; - my $type = "Unknown"; - if ($is_rambus) { - if ($bytes[2] == 1) { $type = "Direct Rambus"; } - elsif ($bytes[2] == 17) { $type = "Rambus"; } - } else { - if ($bytes[2] == 1) { $type = "FPM DRAM"; } - elsif ($bytes[2] == 2) { $type = "EDO"; } - elsif ($bytes[2] == 3) { $type = "Pipelined Nibble"; } - elsif ($bytes[2] == 4) { $type = "SDR SDRAM"; } - elsif ($bytes[2] == 5) { $type = "Multiplexed ROM"; } - elsif ($bytes[2] == 6) { $type = "DDR SGRAM"; } - elsif ($bytes[2] == 7) { $type = "DDR SDRAM"; } - elsif ($bytes[2] == 8) { $type = "DDR2 SDRAM"; } - } - printl $l, $type; - -# Decode next 61 bytes (3-63, depend on memory type) - $decode_callback{$type}->(\@bytes) - if exists $decode_callback{$type}; - -# Decode next 35 bytes (64-98, common to all memory types) - prints "Manufacturing Information"; - - @bytes = readspd64(64, $dimm_list[$i]); - - $l = "Manufacturer"; - # $extra is a reference to an array containing up to - # 7 extra bytes from the Manufacturer field. Sometimes - # these bytes are filled with interesting data. - ($temp, my $extra) = manufacturer(@bytes[0..7]); - printl $l, $temp; - $l = "Custom Manufacturer Data"; - $temp = manufacturer_data(@{$extra}); - printl $l, $temp if defined $temp; - - if (spd_written($bytes[8])) { - # Try the location code as ASCII first, as earlier specifications - # suggested this. As newer specifications don't mention it anymore, - # we still fall back to binary. - $l = "Manufacturing Location Code"; - $temp = (chr($bytes[8]) =~ m/^[\w\d]$/) ? chr($bytes[8]) - : sprintf("0x%.2X", $bytes[8]); - printl $l, $temp; - } - - $l = "Part Number"; - $temp = part_number(@bytes[9..26]); - printl $l, $temp; - - if (spd_written(@bytes[27..28])) { - $l = "Revision Code"; - $temp = sprintf("0x%02X%02X\n", @bytes[27..28]); - printl $l, $temp; - } - - if (spd_written(@bytes[29..30])) { - $l = "Manufacturing Date"; - # In theory the year and week are in BCD format, but - # this is not always true in practice :( - if (($bytes[29] & 0xf0) <= 0x90 - && ($bytes[29] & 0x0f) <= 0x09 - && ($bytes[30] & 0xf0) <= 0x90 - && ($bytes[30] & 0x0f) <= 0x09) { - # Note that this heuristic will break in year 2080 - $temp = sprintf("%d%02X-W%02X\n", - $bytes[29] >= 0x80 ? 19 : 20, - @bytes[29..30]); - } else { - $temp = sprintf("0x%02X%02X\n", - @bytes[29..30]); - } - printl $l, $temp; - } - - if (spd_written(@bytes[31..34])) { - $l = "Assembly Serial Number"; - $temp = sprintf("0x%02X%02X%02X%02X\n", - @bytes[31..34]); - printl $l, $temp; - } - -# Next 27 bytes (99-125) are manufacturer specific, can't decode - -# Last 2 bytes (126-127) are reserved, Intel used them as an extension - if ($type eq "SDR SDRAM") { - decode_intel_spec_freq(\@bytes); - } - - print "
\n" if $opt_html; - } -} -printl2 "\n\nNumber of SDRAM DIMMs detected and decoded", $dimm_count; - -print "\n" if ($opt_html && !$opt_bodyonly); diff --git a/eeprom/decode-edid b/eeprom/decode-edid new file mode 100755 index 0000000..e7a8ada --- /dev/null +++ b/eeprom/decode-edid @@ -0,0 +1,224 @@ +#!/usr/bin/perl -w +# +# Copyright (C) 2003-2006 Jean Delvare +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# Version 0.1 2003-07-17 Jean Delvare +# Version 0.2 2003-07-22 Jean Delvare +# Use print instead of syswrite. +# Version 0.3 2003-08-24 Jean Delvare +# Fix data block length (128 bytes instead of 256). +# Version 1.0 2004-02-08 Jean Delvare +# Added support for Linux 2.5/2.6 (i.e. sysfs). +# Version 1.1 2006-09-01 Jean Delvare +# Append /usr/sbin or /usr/local/sbin to $PATH if needed. +# +# EEPROM data decoding for EDID. EDID (Extended Display Identification +# Data) is a VESA standard which allows storing (on manufacturer's side) +# and retrieving (on user's side) of configuration information about +# displays, such as manufacturer, serial number, physical dimensions and +# allowed horizontal and vertical refresh rates. +# +# Using the eeprom kernel driver, you have two possibilities to +# make use of these data: +# 1* The ddcmon script. +# 2* This script. +# Both solutions will return a different kind of information. The first +# method will report user-interesting information, such as the model number +# or the year of manufacturing. The second method will report video-card- +# interesting information, such as video modes and refresh rates. +# +# Note that this script does almost nothing by itself. It simply converts +# what it finds in /proc to binary data to feed the parse-edid program. +# The parse-edid program was written by John Fremlin and is available at +# the following address: +# http://john.fremlin.de/programs/linux/read-edid/ + +use strict; +use Fcntl qw(:DEFAULT :seek); +use vars qw($bus $address); +use constant PROCFS => 1; +use constant SYSFS => 2; + +# parse-edid will typically be installed in /usr/sbin or /usr/local/sbin +# even though regular users can run it +$ENV{PATH} .= ':/usr/local/sbin' + if $ENV{PATH} !~ m,(^|:)/usr/local/sbin/?(:|$), + && -x '/usr/local/sbin/parse-edid'; +$ENV{PATH} .= ':/usr/sbin' + if $ENV{PATH} !~ m,(^|:)/usr/sbin/?(:|$), + && -x '/usr/sbin/parse-edid'; + +sub edid_valid_procfs +{ + my ($bus, $addr) = @_; + + open EEDATA, "/proc/sys/dev/sensors/eeprom-i2c-$bus-$addr/00"; + my $line = ; + close EEDATA; + return 1 + if $line =~ m/^0 255 255 255 255 255 255 0 /; + return 0; +} + +# Only used for sysfs +sub rawread +{ + my ($filename, $length, $offset) = @_; + my $bytes = ''; + + sysopen(FH, $filename, O_RDONLY) + or die "Can't open $filename"; + if ($offset) + { + sysseek(FH, $offset, SEEK_SET) + or die "Can't seek in $filename"; + } + + $offset = 0; + while ($length) + { + my $r = sysread(FH, $bytes, $length, $offset); + die "Can't read $filename" + unless defined($r); + die "Unexpected EOF in $filename" + unless $r; + $offset += $r; + $length -= $r; + } + close(FH); + + return $bytes; +} + +sub edid_valid_sysfs +{ + my ($bus, $addr) = @_; + my $bytes = rawread("/sys/bus/i2c/devices/$bus-00$addr/eeprom", 8, 0); + + return 1 + if $bytes eq "\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00"; + return 0; +} + +sub bus_detect +{ + my $max = shift; + + for (my $i=0; $i<$max; $i++) + { + if (-r "/proc/sys/dev/sensors/eeprom-i2c-$i-50/00") + { + if (edid_valid_procfs($i, '50')) + { + print STDERR + "decode-edid: using bus $i (autodetected)\n"; + return $i; + } + } + elsif (-r "/sys/bus/i2c/devices/$i-0050/eeprom") + { + if (edid_valid_sysfs($i, '50')) + { + print STDERR + "decode-edid: using bus $i (autodetected)\n"; + return $i; + } + } + } + + return; # default +} + +sub edid_decode +{ + my ($bus, $addr, $mode) = @_; + + # Make sure it is an EDID EEPROM. + + unless (($mode == PROCFS && edid_valid_procfs ($bus, $addr)) + || ($mode == SYSFS && edid_valid_sysfs ($bus, $addr))) + { + print STDERR + "decode-edid: not an EDID EEPROM at $bus-$addr\n"; + return; + } + + $SIG{__WARN__} = sub { }; + open PIPE, "| parse-edid" + or die "Can't open parse-edid. Please install read-edid.\n"; + delete $SIG{__WARN__}; + binmode PIPE; + + if ($mode == PROCFS) + { + for (my $i=0; $i<=0x70; $i+=0x10) + { + my $file = sprintf '%02x', $i; + my $output = ''; + open EEDATA, "/proc/sys/dev/sensors/eeprom-i2c-$bus-$addr/$file" + or die "Can't read /proc/sys/dev/sensors/eeprom-i2c-$bus-$addr/$file"; + while() + { + foreach my $item (split) + { + $output .= pack "C", $item; + } + } + close EEDATA; + print PIPE $output; + } + } + elsif ($mode == SYSFS) + { + print PIPE rawread("/sys/bus/i2c/devices/$bus-00$address/eeprom", 128, 0); + } + + close PIPE; +} + +# Get the address. Default to 0x50 if not given. +$address = $ARGV[1] || 0x50; +# Convert to decimal, whatever the value. +$address = oct $address if $address =~ m/^0/; +# Convert to an hexadecimal string. +$address = sprintf '%02x', $address; + +# Get the bus. Try to autodetect if not given. +$bus = $ARGV[0] if defined $ARGV[0]; +$bus = bus_detect(8) unless defined $bus; + +if(defined $bus) +{ + print STDERR + "decode-edid: decode-edid version 1.1\n"; + if (-r "/proc/sys/dev/sensors/eeprom-i2c-$bus-$address") + { + edid_decode ($bus, $address, PROCFS); + exit 0; + } + elsif (-r "/sys/bus/i2c/devices/$bus-00$address") + { + edid_decode ($bus, $address, SYSFS); + exit 0; + } +} + +print STDERR + "EDID EEPROM not found. Please make sure that the eeprom module is loaded.\n"; +print STDERR + "Maybe your EDID EEPROM is on another bus. Try \"decode-edid ".($bus+1)."\".\n" + if defined $bus; diff --git a/eeprom/decode-edid.pl b/eeprom/decode-edid.pl deleted file mode 100755 index e7a8ada..0000000 --- a/eeprom/decode-edid.pl +++ /dev/null @@ -1,224 +0,0 @@ -#!/usr/bin/perl -w -# -# Copyright (C) 2003-2006 Jean Delvare -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Version 0.1 2003-07-17 Jean Delvare -# Version 0.2 2003-07-22 Jean Delvare -# Use print instead of syswrite. -# Version 0.3 2003-08-24 Jean Delvare -# Fix data block length (128 bytes instead of 256). -# Version 1.0 2004-02-08 Jean Delvare -# Added support for Linux 2.5/2.6 (i.e. sysfs). -# Version 1.1 2006-09-01 Jean Delvare -# Append /usr/sbin or /usr/local/sbin to $PATH if needed. -# -# EEPROM data decoding for EDID. EDID (Extended Display Identification -# Data) is a VESA standard which allows storing (on manufacturer's side) -# and retrieving (on user's side) of configuration information about -# displays, such as manufacturer, serial number, physical dimensions and -# allowed horizontal and vertical refresh rates. -# -# Using the eeprom kernel driver, you have two possibilities to -# make use of these data: -# 1* The ddcmon script. -# 2* This script. -# Both solutions will return a different kind of information. The first -# method will report user-interesting information, such as the model number -# or the year of manufacturing. The second method will report video-card- -# interesting information, such as video modes and refresh rates. -# -# Note that this script does almost nothing by itself. It simply converts -# what it finds in /proc to binary data to feed the parse-edid program. -# The parse-edid program was written by John Fremlin and is available at -# the following address: -# http://john.fremlin.de/programs/linux/read-edid/ - -use strict; -use Fcntl qw(:DEFAULT :seek); -use vars qw($bus $address); -use constant PROCFS => 1; -use constant SYSFS => 2; - -# parse-edid will typically be installed in /usr/sbin or /usr/local/sbin -# even though regular users can run it -$ENV{PATH} .= ':/usr/local/sbin' - if $ENV{PATH} !~ m,(^|:)/usr/local/sbin/?(:|$), - && -x '/usr/local/sbin/parse-edid'; -$ENV{PATH} .= ':/usr/sbin' - if $ENV{PATH} !~ m,(^|:)/usr/sbin/?(:|$), - && -x '/usr/sbin/parse-edid'; - -sub edid_valid_procfs -{ - my ($bus, $addr) = @_; - - open EEDATA, "/proc/sys/dev/sensors/eeprom-i2c-$bus-$addr/00"; - my $line = ; - close EEDATA; - return 1 - if $line =~ m/^0 255 255 255 255 255 255 0 /; - return 0; -} - -# Only used for sysfs -sub rawread -{ - my ($filename, $length, $offset) = @_; - my $bytes = ''; - - sysopen(FH, $filename, O_RDONLY) - or die "Can't open $filename"; - if ($offset) - { - sysseek(FH, $offset, SEEK_SET) - or die "Can't seek in $filename"; - } - - $offset = 0; - while ($length) - { - my $r = sysread(FH, $bytes, $length, $offset); - die "Can't read $filename" - unless defined($r); - die "Unexpected EOF in $filename" - unless $r; - $offset += $r; - $length -= $r; - } - close(FH); - - return $bytes; -} - -sub edid_valid_sysfs -{ - my ($bus, $addr) = @_; - my $bytes = rawread("/sys/bus/i2c/devices/$bus-00$addr/eeprom", 8, 0); - - return 1 - if $bytes eq "\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00"; - return 0; -} - -sub bus_detect -{ - my $max = shift; - - for (my $i=0; $i<$max; $i++) - { - if (-r "/proc/sys/dev/sensors/eeprom-i2c-$i-50/00") - { - if (edid_valid_procfs($i, '50')) - { - print STDERR - "decode-edid: using bus $i (autodetected)\n"; - return $i; - } - } - elsif (-r "/sys/bus/i2c/devices/$i-0050/eeprom") - { - if (edid_valid_sysfs($i, '50')) - { - print STDERR - "decode-edid: using bus $i (autodetected)\n"; - return $i; - } - } - } - - return; # default -} - -sub edid_decode -{ - my ($bus, $addr, $mode) = @_; - - # Make sure it is an EDID EEPROM. - - unless (($mode == PROCFS && edid_valid_procfs ($bus, $addr)) - || ($mode == SYSFS && edid_valid_sysfs ($bus, $addr))) - { - print STDERR - "decode-edid: not an EDID EEPROM at $bus-$addr\n"; - return; - } - - $SIG{__WARN__} = sub { }; - open PIPE, "| parse-edid" - or die "Can't open parse-edid. Please install read-edid.\n"; - delete $SIG{__WARN__}; - binmode PIPE; - - if ($mode == PROCFS) - { - for (my $i=0; $i<=0x70; $i+=0x10) - { - my $file = sprintf '%02x', $i; - my $output = ''; - open EEDATA, "/proc/sys/dev/sensors/eeprom-i2c-$bus-$addr/$file" - or die "Can't read /proc/sys/dev/sensors/eeprom-i2c-$bus-$addr/$file"; - while() - { - foreach my $item (split) - { - $output .= pack "C", $item; - } - } - close EEDATA; - print PIPE $output; - } - } - elsif ($mode == SYSFS) - { - print PIPE rawread("/sys/bus/i2c/devices/$bus-00$address/eeprom", 128, 0); - } - - close PIPE; -} - -# Get the address. Default to 0x50 if not given. -$address = $ARGV[1] || 0x50; -# Convert to decimal, whatever the value. -$address = oct $address if $address =~ m/^0/; -# Convert to an hexadecimal string. -$address = sprintf '%02x', $address; - -# Get the bus. Try to autodetect if not given. -$bus = $ARGV[0] if defined $ARGV[0]; -$bus = bus_detect(8) unless defined $bus; - -if(defined $bus) -{ - print STDERR - "decode-edid: decode-edid version 1.1\n"; - if (-r "/proc/sys/dev/sensors/eeprom-i2c-$bus-$address") - { - edid_decode ($bus, $address, PROCFS); - exit 0; - } - elsif (-r "/sys/bus/i2c/devices/$bus-00$address") - { - edid_decode ($bus, $address, SYSFS); - exit 0; - } -} - -print STDERR - "EDID EEPROM not found. Please make sure that the eeprom module is loaded.\n"; -print STDERR - "Maybe your EDID EEPROM is on another bus. Try \"decode-edid ".($bus+1)."\".\n" - if defined $bus; diff --git a/eeprom/decode-vaio b/eeprom/decode-vaio new file mode 100755 index 0000000..1a91487 --- /dev/null +++ b/eeprom/decode-vaio @@ -0,0 +1,272 @@ +#!/usr/bin/perl -w +# +# Copyright (C) 2002-2007 Jean Delvare +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# Version 0.1 2002-02-06 Jean Delvare +# Version 0.2 2002-02-16 Jean Delvare +# Fixed to work with the new, simplified /proc interface names of the eeprom +# driver (lm_sensors 2.6.3 and greater). +# Shifted data display by 4 columns left. +# Version 0.3 2002-02-17 Jean Delvare +# Added UUID field at 0x10 (added decode_uuid). +# Merged decode_string and decode_string32. +# Added unknown field at 0x20. +# Moved header and footer to BEGIN and END, respectively. +# Reformated history to match those of the other decode scripts. +# Deleted decode_char (made useless by decode_string). +# Reordered field display, changed some labels. +# Added old /proc interface check. +# Version 1.0 2002-11-15 Jean Delvare +# Gave the label "OEM Data" to the field at 0x20. +# Gave the label "Timestamp" to the field at 0xE0. +# Renamed "Model Number" to "Model Name". +# Added some documentation. +# Version 1.1 2004-01-17 Jean Delvare +# Added support for Linux 2.5/2.6 (i.e. sysfs). +# Version 1.2 2004-11-28 Jean Delvare +# Support bus number 0 to 4 instead of only 0. +# Version 1.3 2005-01-18 Jean Delvare +# Revision might be a Service Tag. +# Version 1.4 2006-09-20 Jean Delvare +# Detect and skip false positives (e.g. EDID EEPROMs). +# Version 1.5 2007-11-19 Jean Delvare +# UUID and serial number might be hidden +# The model name is actually the first half of the asset tag +# The timestamp is only 18-byte long +# +# EEPROM data decoding for Sony Vaio laptops. +# +# The eeprom driver must be loaded. For kernels older than 2.6.0, the +# eeprom driver can be found in the lm-sensors package. +# +# Please note that this is a guess-only work. Sony support refused to help +# me, so if someone can provide information, please contact me. +# My knowledge is summarized on this page: +# http://khali.linux-fr.org/vaio/eeprom.html +# +# It seems that if present, the EEPROM is always at 0x57. +# +# Models tested so far: +# PCG-F403 : No EEPROM +# PCG-F707 : No EEPROM +# PCG-GR114EK : OK +# PCG-GR114SK : OK +# PCG-GR214EP : OK +# PCG-GRT955MP : OK +# PCG-GRX316G : OK +# PCG-GRX570 : OK +# PCG-GRX600K : OK +# PCG-U1 : OK +# PCG-Z600LEK : No EEPROM +# PCG-Z600NE : No EEPROM +# VGN-S260 : OK +# VGN-S4M/S : OK +# VGN-TZ11MN/N : OK +# Any feedback appreciated anyway. +# +# Thanks to Werner Heuser, Carsten Blume, Christian Gennerat, Joe Wreschnig, +# Xavier Roche, Sebastien Lefevre, Lars Heer, Steve Dobson, Kent Hunt, +# Timo Hoenig and others for their precious help. + + +use strict; +use Fcntl qw(:DEFAULT :seek); +use vars qw($sysfs $found); + +use constant ONLYROOT => "Readable only by root"; + +sub print_item +{ + my ($label,$value) = @_; + + printf("\%16s : \%s\n",$label,$value); +} + +# Abstract reads so that other functions don't have to care wether +# we need to use procfs or sysfs +sub read_eeprom_bytes +{ + my ($bus, $addr, $offset, $length) = @_; + my $filename; + + if ($sysfs) + { + $filename = "/sys/bus/i2c/devices/$bus-00$addr/eeprom"; + sysopen(FH, $filename, O_RDONLY) + or die "Can't open $filename"; + sysseek(FH, $offset, SEEK_SET) + or die "Can't seek in $filename"; + + my ($r, $bytes); + $bytes = ''; + $offset = 0; + while($length) + { + $r = sysread(FH, $bytes, $length, $offset); + die "Can't read $filename" + unless defined($r); + die "Unexpected EOF in $filename" + unless $r; + $offset += $r; + $length -= $r; + } + close(FH); + + return $bytes; + } + else + { + my $base = $offset & 0xf0; + $offset -= $base; + my $values = ''; + my $remains = $length + $offset; + + # Get all lines in a single string + while ($remains > 0) + { + $filename = "/proc/sys/dev/sensors/eeprom-i2c-$bus-$addr/" + . sprintf('%02x', $base); + open(FH, $filename) + or die "Can't open $filename"; + $values .= ; + close(FH); + $remains -= 16; + $base += 16; + } + + # Store the useful part in an array + my @bytes = split(/[ \n]/, $values); + @bytes = @bytes[$offset..$offset+$length-1]; + + # Back to a binary string + return pack('C*', @bytes); + } +} + +sub decode_string +{ + my ($bus, $addr, $offset, $length) = @_; + + my $string = read_eeprom_bytes($bus, $addr, $offset, $length); + $string =~ s/\x00.*$//; + + return($string); +} + +sub decode_hexa +{ + my ($bus, $addr, $offset, $length) = @_; + + my @bytes = unpack('C*', read_eeprom_bytes($bus, $addr, $offset, $length)); + my $string=''; + + for(my $i=0;$i<$length;$i++) + { + $string.=sprintf('%02X', shift(@bytes)); + } + + return($string); +} + +sub decode_uuid +{ + my ($bus,$addr,$base) = @_; + + my @bytes = unpack('C16', read_eeprom_bytes($bus, $addr, $base, 16)); + my $string=''; + + for(my $i=0;$i<16;$i++) + { + $string.=sprintf('%02x',shift(@bytes)); + if(($i==3)||($i==5)||($i==7)||($i==9)) + { + $string.='-'; + } + } + + if ($string eq '00000000-0000-0000-0000-000000000000') + { + return(ONLYROOT); + } + else + { + return($string); + } +} + +sub vaio_decode +{ + my ($bus,$addr) = @_; + + my $name = decode_string($bus, $addr, 128, 32); + # Simple heuristic to skip false positives + return 0 unless $name =~ m/^[A-Z-]{4}/; + + print_item('Machine Name', $name); + my $serial = decode_string($bus, $addr, 192, 32); + print_item('Serial Number', $serial ? $serial : ONLYROOT); + print_item('UUID', decode_uuid($bus, $addr, 16)); + my $revision = decode_string($bus, $addr, 160, 10); + print_item(length($revision) > 2 ? 'Service Tag' : 'Revision', + $revision); + print_item('Asset Tag', decode_string($bus, $addr, 170, 4). + decode_hexa($bus, $addr, 174, 12)); + print_item('OEM Data', decode_string($bus, $addr, 32, 16)); + print_item('Timestamp', decode_string($bus, $addr, 224, 18)); + return 1; +} + +BEGIN +{ + print("Sony Vaio EEPROM Decoder\n"); + print("Copyright (C) 2002-2007 Jean Delvare\n"); + print("Version 1.5\n\n"); +} + +END +{ + print("\n"); +} + +for (my $i = 0, $found=0; $i <= 4 && !$found; $i++) +{ + if (-r "/sys/bus/i2c/devices/$i-0057/eeprom") + { + $sysfs = 1; + $found += vaio_decode($i, '57'); + } + elsif (-r "/proc/sys/dev/sensors/eeprom-i2c-$i-57") + { + if (-r "/proc/sys/dev/sensors/eeprom-i2c-$i-57/data0-15") + { + print("Deprecated old interface found. Please upgrade to lm_sensors 2.6.3 or greater."); + exit; + } + else + { + $sysfs = 0; + $found += vaio_decode($i, '57'); + } + } +} + +if (!$found) +{ + print("Vaio EEPROM not found. Please make sure that the eeprom module is loaded.\n"); + print("If you believe this is an error, please contact me \n"); + print("so that we may see how to fix the problem.\n"); +} diff --git a/eeprom/decode-vaio.pl b/eeprom/decode-vaio.pl deleted file mode 100755 index 1a91487..0000000 --- a/eeprom/decode-vaio.pl +++ /dev/null @@ -1,272 +0,0 @@ -#!/usr/bin/perl -w -# -# Copyright (C) 2002-2007 Jean Delvare -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Version 0.1 2002-02-06 Jean Delvare -# Version 0.2 2002-02-16 Jean Delvare -# Fixed to work with the new, simplified /proc interface names of the eeprom -# driver (lm_sensors 2.6.3 and greater). -# Shifted data display by 4 columns left. -# Version 0.3 2002-02-17 Jean Delvare -# Added UUID field at 0x10 (added decode_uuid). -# Merged decode_string and decode_string32. -# Added unknown field at 0x20. -# Moved header and footer to BEGIN and END, respectively. -# Reformated history to match those of the other decode scripts. -# Deleted decode_char (made useless by decode_string). -# Reordered field display, changed some labels. -# Added old /proc interface check. -# Version 1.0 2002-11-15 Jean Delvare -# Gave the label "OEM Data" to the field at 0x20. -# Gave the label "Timestamp" to the field at 0xE0. -# Renamed "Model Number" to "Model Name". -# Added some documentation. -# Version 1.1 2004-01-17 Jean Delvare -# Added support for Linux 2.5/2.6 (i.e. sysfs). -# Version 1.2 2004-11-28 Jean Delvare -# Support bus number 0 to 4 instead of only 0. -# Version 1.3 2005-01-18 Jean Delvare -# Revision might be a Service Tag. -# Version 1.4 2006-09-20 Jean Delvare -# Detect and skip false positives (e.g. EDID EEPROMs). -# Version 1.5 2007-11-19 Jean Delvare -# UUID and serial number might be hidden -# The model name is actually the first half of the asset tag -# The timestamp is only 18-byte long -# -# EEPROM data decoding for Sony Vaio laptops. -# -# The eeprom driver must be loaded. For kernels older than 2.6.0, the -# eeprom driver can be found in the lm-sensors package. -# -# Please note that this is a guess-only work. Sony support refused to help -# me, so if someone can provide information, please contact me. -# My knowledge is summarized on this page: -# http://khali.linux-fr.org/vaio/eeprom.html -# -# It seems that if present, the EEPROM is always at 0x57. -# -# Models tested so far: -# PCG-F403 : No EEPROM -# PCG-F707 : No EEPROM -# PCG-GR114EK : OK -# PCG-GR114SK : OK -# PCG-GR214EP : OK -# PCG-GRT955MP : OK -# PCG-GRX316G : OK -# PCG-GRX570 : OK -# PCG-GRX600K : OK -# PCG-U1 : OK -# PCG-Z600LEK : No EEPROM -# PCG-Z600NE : No EEPROM -# VGN-S260 : OK -# VGN-S4M/S : OK -# VGN-TZ11MN/N : OK -# Any feedback appreciated anyway. -# -# Thanks to Werner Heuser, Carsten Blume, Christian Gennerat, Joe Wreschnig, -# Xavier Roche, Sebastien Lefevre, Lars Heer, Steve Dobson, Kent Hunt, -# Timo Hoenig and others for their precious help. - - -use strict; -use Fcntl qw(:DEFAULT :seek); -use vars qw($sysfs $found); - -use constant ONLYROOT => "Readable only by root"; - -sub print_item -{ - my ($label,$value) = @_; - - printf("\%16s : \%s\n",$label,$value); -} - -# Abstract reads so that other functions don't have to care wether -# we need to use procfs or sysfs -sub read_eeprom_bytes -{ - my ($bus, $addr, $offset, $length) = @_; - my $filename; - - if ($sysfs) - { - $filename = "/sys/bus/i2c/devices/$bus-00$addr/eeprom"; - sysopen(FH, $filename, O_RDONLY) - or die "Can't open $filename"; - sysseek(FH, $offset, SEEK_SET) - or die "Can't seek in $filename"; - - my ($r, $bytes); - $bytes = ''; - $offset = 0; - while($length) - { - $r = sysread(FH, $bytes, $length, $offset); - die "Can't read $filename" - unless defined($r); - die "Unexpected EOF in $filename" - unless $r; - $offset += $r; - $length -= $r; - } - close(FH); - - return $bytes; - } - else - { - my $base = $offset & 0xf0; - $offset -= $base; - my $values = ''; - my $remains = $length + $offset; - - # Get all lines in a single string - while ($remains > 0) - { - $filename = "/proc/sys/dev/sensors/eeprom-i2c-$bus-$addr/" - . sprintf('%02x', $base); - open(FH, $filename) - or die "Can't open $filename"; - $values .= ; - close(FH); - $remains -= 16; - $base += 16; - } - - # Store the useful part in an array - my @bytes = split(/[ \n]/, $values); - @bytes = @bytes[$offset..$offset+$length-1]; - - # Back to a binary string - return pack('C*', @bytes); - } -} - -sub decode_string -{ - my ($bus, $addr, $offset, $length) = @_; - - my $string = read_eeprom_bytes($bus, $addr, $offset, $length); - $string =~ s/\x00.*$//; - - return($string); -} - -sub decode_hexa -{ - my ($bus, $addr, $offset, $length) = @_; - - my @bytes = unpack('C*', read_eeprom_bytes($bus, $addr, $offset, $length)); - my $string=''; - - for(my $i=0;$i<$length;$i++) - { - $string.=sprintf('%02X', shift(@bytes)); - } - - return($string); -} - -sub decode_uuid -{ - my ($bus,$addr,$base) = @_; - - my @bytes = unpack('C16', read_eeprom_bytes($bus, $addr, $base, 16)); - my $string=''; - - for(my $i=0;$i<16;$i++) - { - $string.=sprintf('%02x',shift(@bytes)); - if(($i==3)||($i==5)||($i==7)||($i==9)) - { - $string.='-'; - } - } - - if ($string eq '00000000-0000-0000-0000-000000000000') - { - return(ONLYROOT); - } - else - { - return($string); - } -} - -sub vaio_decode -{ - my ($bus,$addr) = @_; - - my $name = decode_string($bus, $addr, 128, 32); - # Simple heuristic to skip false positives - return 0 unless $name =~ m/^[A-Z-]{4}/; - - print_item('Machine Name', $name); - my $serial = decode_string($bus, $addr, 192, 32); - print_item('Serial Number', $serial ? $serial : ONLYROOT); - print_item('UUID', decode_uuid($bus, $addr, 16)); - my $revision = decode_string($bus, $addr, 160, 10); - print_item(length($revision) > 2 ? 'Service Tag' : 'Revision', - $revision); - print_item('Asset Tag', decode_string($bus, $addr, 170, 4). - decode_hexa($bus, $addr, 174, 12)); - print_item('OEM Data', decode_string($bus, $addr, 32, 16)); - print_item('Timestamp', decode_string($bus, $addr, 224, 18)); - return 1; -} - -BEGIN -{ - print("Sony Vaio EEPROM Decoder\n"); - print("Copyright (C) 2002-2007 Jean Delvare\n"); - print("Version 1.5\n\n"); -} - -END -{ - print("\n"); -} - -for (my $i = 0, $found=0; $i <= 4 && !$found; $i++) -{ - if (-r "/sys/bus/i2c/devices/$i-0057/eeprom") - { - $sysfs = 1; - $found += vaio_decode($i, '57'); - } - elsif (-r "/proc/sys/dev/sensors/eeprom-i2c-$i-57") - { - if (-r "/proc/sys/dev/sensors/eeprom-i2c-$i-57/data0-15") - { - print("Deprecated old interface found. Please upgrade to lm_sensors 2.6.3 or greater."); - exit; - } - else - { - $sysfs = 0; - $found += vaio_decode($i, '57'); - } - } -} - -if (!$found) -{ - print("Vaio EEPROM not found. Please make sure that the eeprom module is loaded.\n"); - print("If you believe this is an error, please contact me \n"); - print("so that we may see how to fix the problem.\n"); -} diff --git a/eeprom/decode-xeon b/eeprom/decode-xeon new file mode 100755 index 0000000..8a400b9 --- /dev/null +++ b/eeprom/decode-xeon @@ -0,0 +1,197 @@ +#!/usr/bin/perl +# +# Copyright 1998, 1999 Philip Edelbrock +# and Mark Studebaker +# +# Version 0.1 +# +# +# ID ROM data decoding for Xeon processors. +# Each Xeon processor contains two memories: +# - A scratch EEPROM at an even location 0x50, 52, 54, or 56; +# - An ID ROM at an odd location 0x51, 53, 55, or 57. +# This program decodes the ID ROM's only. +# The scratch EEPROMs have no prescribed format. +# If the output of this program makes no sense for a particular device, +# it is probably decoding a DIMM Serial Presence Detect (SPD) EEPROM. +# See decode-dimms to decode those devices. +# +# +# The eeprom driver must be loaded. For kernels older than 2.6.0, the +# eeprom driver can be found in the lm-sensors package. +# +# To do: +# Calculate and check checksums for each section +# Decode flags in byte 0x7B (cartridge feature flags) +# +# References: +# "Pentium II Xeon Processor at 400 and 450 MHz" Data Sheet +# Intel +# +# +# + +print "Xeon Processor Information ROM Decoder\n"; +print "Written by Philip Edelbrock and Mark Studebaker. Copyright 1998, 1999.\n"; +print "Version 2.6.3\n\n"; + +$dimm_count=0; +$_=`ls /proc/sys/dev/sensors/`; +@dimm_list=split(); + +for $i ( 0 .. $#dimm_list ) { + $_=$dimm_list[$i]; + if ((/^eeprom-/) && (/-51$/ || /-53$/ || /-55$/ || /-57$/)) { + $dimm_count=$dimm_count + 1; + + print "\nDecoding Xeon ROM: /proc/sys/dev/sensors/$dimm_list[$i]\n"; + if (/^[^-]+-[^-]+-[^-]+-([^-]+)$/) { + $dimm_num=($1 - 49) / 2; + print "Guessing Xeon is number $dimm_num\n"; + } +# Decode first 16 bytes + print "\t\t----=== Xeon ROM Header Data ===----\n"; + + $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/00`; + @bytes=split(" "); + + printf("\tData Format Revision: \t\t\t\t0x%.4X\n", $bytes[0]); + + print "\tTotal number of bytes in EEPROM:\t\t"; + print ($bytes[1] << 4) + $bytes[2]; + print "\n"; + + printf("\tProcessor Data Address:\t\t\t\t0x%.2X\n", $bytes[3]); + printf("\tProcessor Core Data Address:\t\t\t0x%.2X\n", $bytes[4]); + printf("\tL2 Cache Data Address:\t\t\t\t0x%.2X\n", $bytes[5]); + printf("\tSEC Cartridge Data Address:\t\t\t0x%.2X\n", $bytes[6]); + printf("\tPart Number Data Address:\t\t\t0x%.2X\n", $bytes[7]); + printf("\tThermal Reference Data Address:\t\t\t0x%.2X\n", $bytes[8]); + printf("\tFeature Data Address:\t\t\t\t0x%.2X\n", $bytes[9]); + printf("\tOther Data Address:\t\t\t\t0x%.2X\n", $bytes[10]); + + print "\t\t----=== Xeon ROM Processor Data ===----\n"; + +# Decode next 16 bytes + $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/10`; + @bbytes=split(" "); + print "\tS-spec/QDF Number:\t\t\t\t\""; + print pack("cccccc",$bytes[14],$bytes[15],$bbytes[0], + $bbytes[1],$bbytes[2],$bbytes[3]); + print "\"\n"; + $tmp = $bbytes[4] & 0xC0 >> 6; + printf("\tSample / Production:\t\t\t\t0x%.2X", $tmp); + if($tmp) { + print " (Production)\n"; + } else { + print " (Sample)\n"; + } + + print "\t\t----=== Xeon ROM Core Data ===----\n"; + + printf("\tProcessor Core Type:\t\t\t\t0x%.2X\n", + ($bbytes[6] & 0xC0) >> 6); + printf("\tProcessor Core Family:\t\t\t\t0x%.2X\n", + ($bbytes[6] & 0x3C) >> 2); + printf("\tProcessor Core Model:\t\t\t\t0x%.2X\n", + (($bbytes[6] & 0x03) << 2) + (($bbytes[7] & 0xC0) >> 6)); + printf("\tProcessor Core Stepping:\t\t\t0x%.2X\n", + ($bbytes[7] & 0x30) >> 4); + print "\tMaximum Core Frequency (Mhz):\t\t\t"; + print ($bbytes[13] << 4) + $bbytes[14]; + print "\n"; + +# Decode next 16 bytes (32-47) + $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/20`; + @bytes=split(" "); + print "\tCore Voltage ID (mV):\t\t\t\t"; + print ($bbytes[15] << 4) + $bytes[0]; + print "\n"; + print "\tCore Voltage Tolerance, High (mV):\t\t"; + print $bytes[1]; + print "\n"; + print "\tCore Voltage Tolerance, Low (mV):\t\t"; + print $bytes[2]; + print "\n"; + + print "\t\t----=== Xeon ROM L2 Cache Data ===----\n"; + + print "\tL2 Cache Size (KB):\t\t\t\t"; + print ($bytes[9] << 4) + $bytes[10]; + print "\n"; + printf("\tNumber of SRAM Components:\t\t\t%d\n", + ($bytes[11] & 0xF0) >> 4); + print "\tL2 Cache Voltage ID (mV):\t\t\t"; + print ($bytes[12] << 4) + $bytes[13]; + print "\n"; + print "\tL2 Cache Voltage Tolerance, High (mV):\t\t"; + print $bytes[14]; + print "\n"; + print "\tL2 Cache Voltage Tolerance, Low (mV):\t\t"; + print $bytes[15]; + print "\n"; + +# Decode next 16 bytes (48-63) + $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/30`; + @bytes=split(" "); + + printf("\tCache/Tag Stepping ID:\t\t\t\t0x%.2X\n", + ($bytes[0] & 0xF0) >> 4); + + print "\t\t----=== Xeon ROM Cartridge Data ===----\n"; + + print "\tCartridge Revision:\t\t\t\t\""; + print pack("cccc",$bytes[2],$bytes[3],$bytes[4],$bytes[5]); + print "\"\n"; + printf("\tSubstrate Rev. Software ID:\t\t\t0x%.2X\n", + ($bbytes[6] & 0xC0) >> 6); + + print "\t\t----=== Xeon ROM Part Number Data ===----\n"; + + print "\tProcessor Part Number:\t\t\t\t\""; + print pack("ccccccc",$bytes[8],$bytes[9],$bytes[10], + $bytes[11],$bytes[12],$bytes[13],$bytes[14]); + print "\"\n"; + $byte15=$byte[15]; + +# Decode next 16 bytes (64-79) + $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/40`; + @bytes=split(" "); + + print "\tProcessor BOM ID:\t\t\t\t\""; + print pack("cccccccccccccc",$byte15,$bytes[0],$bytes[1], + $bytes[2],$bytes[3],$bytes[4],$bytes[5],$bytes[6], + $bytes[7],$bytes[8],$bytes[9],$bytes[10],$bytes[11], + $bytes[12]); + print "\"\n"; + +# Decode next 16 bytes (80-95) + $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/50`; + @bbytes=split(" "); + printf("\tProcessor Electronic Signature: \t\t0x%.2X%.2X%.2X%.2X%.2X%.2X%.2X%.2X\n", + $bytes[13],$bytes[14],$bytes[15],$bbytes[0], + $bbytes[1],$bbytes[2],$bbytes[3],$bbytes[4]); + +# Decode next 16 bytes (96-111) +# Not used... + +# Decode next 16 bytes (112-127) + $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/70`; + @bytes=split(" "); + + print "\t\t----=== Xeon Thermal Reference Data ===----\n"; + + printf("\tThermal Reference Byte: \t\t\t0x%.2X\n", $bytes[0]); + + print "\t\t----=== Xeon ROM Feature Data ===----\n"; + + printf("\tProcessor Core Feature Flags: \t\t\t0x%.2X%.2X%.2X%.2X\n", + $bytes[4],$bytes[5],$bytes[6],$bytes[7]); + printf("\tCartridge Feature Flags: \t\t\t0x%.2X%.2X%.2X%.2X\n", + $bytes[8],$bytes[9],$bytes[10],$bytes[11]); + printf("\tNumber of Devices in TAP Chain:\t\t\t%d\n", + ($bytes[12] & 0xF0) >> 4); + + } +} +print "\n\nNumber of Xeon ROMs detected and decoded: $dimm_count\n"; diff --git a/eeprom/decode-xeon.pl b/eeprom/decode-xeon.pl deleted file mode 100755 index 95d8daa..0000000 --- a/eeprom/decode-xeon.pl +++ /dev/null @@ -1,197 +0,0 @@ -#!/usr/bin/perl -# -# Copyright 1998, 1999 Philip Edelbrock -# and Mark Studebaker -# -# Version 0.1 -# -# -# ID ROM data decoding for Xeon processors. -# Each Xeon processor contains two memories: -# - A scratch EEPROM at an even location 0x50, 52, 54, or 56; -# - An ID ROM at an odd location 0x51, 53, 55, or 57. -# This program decodes the ID ROM's only. -# The scratch EEPROMs have no prescribed format. -# If the output of this program makes no sense for a particular device, -# it is probably decoding a DIMM Serial Presence Detect (SPD) EEPROM. -# See ../eeprom/decode-dimms.pl to decode those devices. -# -# -# The eeprom driver must be loaded. For kernels older than 2.6.0, the -# eeprom driver can be found in the lm-sensors package. -# -# To do: -# Calculate and check checksums for each section -# Decode flags in byte 0x7B (cartridge feature flags) -# -# References: -# "Pentium II Xeon Processor at 400 and 450 MHz" Data Sheet -# Intel -# -# -# - -print "Xeon Processor Information ROM Decoder\n"; -print "Written by Philip Edelbrock and Mark Studebaker. Copyright 1998, 1999.\n"; -print "Version 2.6.3\n\n"; - -$dimm_count=0; -$_=`ls /proc/sys/dev/sensors/`; -@dimm_list=split(); - -for $i ( 0 .. $#dimm_list ) { - $_=$dimm_list[$i]; - if ((/^eeprom-/) && (/-51$/ || /-53$/ || /-55$/ || /-57$/)) { - $dimm_count=$dimm_count + 1; - - print "\nDecoding Xeon ROM: /proc/sys/dev/sensors/$dimm_list[$i]\n"; - if (/^[^-]+-[^-]+-[^-]+-([^-]+)$/) { - $dimm_num=($1 - 49) / 2; - print "Guessing Xeon is number $dimm_num\n"; - } -# Decode first 16 bytes - print "\t\t----=== Xeon ROM Header Data ===----\n"; - - $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/00`; - @bytes=split(" "); - - printf("\tData Format Revision: \t\t\t\t0x%.4X\n", $bytes[0]); - - print "\tTotal number of bytes in EEPROM:\t\t"; - print ($bytes[1] << 4) + $bytes[2]; - print "\n"; - - printf("\tProcessor Data Address:\t\t\t\t0x%.2X\n", $bytes[3]); - printf("\tProcessor Core Data Address:\t\t\t0x%.2X\n", $bytes[4]); - printf("\tL2 Cache Data Address:\t\t\t\t0x%.2X\n", $bytes[5]); - printf("\tSEC Cartridge Data Address:\t\t\t0x%.2X\n", $bytes[6]); - printf("\tPart Number Data Address:\t\t\t0x%.2X\n", $bytes[7]); - printf("\tThermal Reference Data Address:\t\t\t0x%.2X\n", $bytes[8]); - printf("\tFeature Data Address:\t\t\t\t0x%.2X\n", $bytes[9]); - printf("\tOther Data Address:\t\t\t\t0x%.2X\n", $bytes[10]); - - print "\t\t----=== Xeon ROM Processor Data ===----\n"; - -# Decode next 16 bytes - $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/10`; - @bbytes=split(" "); - print "\tS-spec/QDF Number:\t\t\t\t\""; - print pack("cccccc",$bytes[14],$bytes[15],$bbytes[0], - $bbytes[1],$bbytes[2],$bbytes[3]); - print "\"\n"; - $tmp = $bbytes[4] & 0xC0 >> 6; - printf("\tSample / Production:\t\t\t\t0x%.2X", $tmp); - if($tmp) { - print " (Production)\n"; - } else { - print " (Sample)\n"; - } - - print "\t\t----=== Xeon ROM Core Data ===----\n"; - - printf("\tProcessor Core Type:\t\t\t\t0x%.2X\n", - ($bbytes[6] & 0xC0) >> 6); - printf("\tProcessor Core Family:\t\t\t\t0x%.2X\n", - ($bbytes[6] & 0x3C) >> 2); - printf("\tProcessor Core Model:\t\t\t\t0x%.2X\n", - (($bbytes[6] & 0x03) << 2) + (($bbytes[7] & 0xC0) >> 6)); - printf("\tProcessor Core Stepping:\t\t\t0x%.2X\n", - ($bbytes[7] & 0x30) >> 4); - print "\tMaximum Core Frequency (Mhz):\t\t\t"; - print ($bbytes[13] << 4) + $bbytes[14]; - print "\n"; - -# Decode next 16 bytes (32-47) - $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/20`; - @bytes=split(" "); - print "\tCore Voltage ID (mV):\t\t\t\t"; - print ($bbytes[15] << 4) + $bytes[0]; - print "\n"; - print "\tCore Voltage Tolerance, High (mV):\t\t"; - print $bytes[1]; - print "\n"; - print "\tCore Voltage Tolerance, Low (mV):\t\t"; - print $bytes[2]; - print "\n"; - - print "\t\t----=== Xeon ROM L2 Cache Data ===----\n"; - - print "\tL2 Cache Size (KB):\t\t\t\t"; - print ($bytes[9] << 4) + $bytes[10]; - print "\n"; - printf("\tNumber of SRAM Components:\t\t\t%d\n", - ($bytes[11] & 0xF0) >> 4); - print "\tL2 Cache Voltage ID (mV):\t\t\t"; - print ($bytes[12] << 4) + $bytes[13]; - print "\n"; - print "\tL2 Cache Voltage Tolerance, High (mV):\t\t"; - print $bytes[14]; - print "\n"; - print "\tL2 Cache Voltage Tolerance, Low (mV):\t\t"; - print $bytes[15]; - print "\n"; - -# Decode next 16 bytes (48-63) - $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/30`; - @bytes=split(" "); - - printf("\tCache/Tag Stepping ID:\t\t\t\t0x%.2X\n", - ($bytes[0] & 0xF0) >> 4); - - print "\t\t----=== Xeon ROM Cartridge Data ===----\n"; - - print "\tCartridge Revision:\t\t\t\t\""; - print pack("cccc",$bytes[2],$bytes[3],$bytes[4],$bytes[5]); - print "\"\n"; - printf("\tSubstrate Rev. Software ID:\t\t\t0x%.2X\n", - ($bbytes[6] & 0xC0) >> 6); - - print "\t\t----=== Xeon ROM Part Number Data ===----\n"; - - print "\tProcessor Part Number:\t\t\t\t\""; - print pack("ccccccc",$bytes[8],$bytes[9],$bytes[10], - $bytes[11],$bytes[12],$bytes[13],$bytes[14]); - print "\"\n"; - $byte15=$byte[15]; - -# Decode next 16 bytes (64-79) - $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/40`; - @bytes=split(" "); - - print "\tProcessor BOM ID:\t\t\t\t\""; - print pack("cccccccccccccc",$byte15,$bytes[0],$bytes[1], - $bytes[2],$bytes[3],$bytes[4],$bytes[5],$bytes[6], - $bytes[7],$bytes[8],$bytes[9],$bytes[10],$bytes[11], - $bytes[12]); - print "\"\n"; - -# Decode next 16 bytes (80-95) - $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/50`; - @bbytes=split(" "); - printf("\tProcessor Electronic Signature: \t\t0x%.2X%.2X%.2X%.2X%.2X%.2X%.2X%.2X\n", - $bytes[13],$bytes[14],$bytes[15],$bbytes[0], - $bbytes[1],$bbytes[2],$bbytes[3],$bbytes[4]); - -# Decode next 16 bytes (96-111) -# Not used... - -# Decode next 16 bytes (112-127) - $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/70`; - @bytes=split(" "); - - print "\t\t----=== Xeon Thermal Reference Data ===----\n"; - - printf("\tThermal Reference Byte: \t\t\t0x%.2X\n", $bytes[0]); - - print "\t\t----=== Xeon ROM Feature Data ===----\n"; - - printf("\tProcessor Core Feature Flags: \t\t\t0x%.2X%.2X%.2X%.2X\n", - $bytes[4],$bytes[5],$bytes[6],$bytes[7]); - printf("\tCartridge Feature Flags: \t\t\t0x%.2X%.2X%.2X%.2X\n", - $bytes[8],$bytes[9],$bytes[10],$bytes[11]); - printf("\tNumber of Devices in TAP Chain:\t\t\t%d\n", - ($bytes[12] & 0xF0) >> 4); - - } -} -print "\n\nNumber of Xeon ROMs detected and decoded: $dimm_count\n";