Back to index

lshw  02.16
Classes | Defines | Enumerations | Functions | Variables
parisc.cc File Reference
#include "version.h"
#include "device-tree.h"
#include "osutils.h"
#include "heuristics.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <dirent.h>

Go to the source code of this file.

Classes

struct  parisc_device
struct  hp_cpu_type_mask

Defines

#define DEVICESPARISC   "/sys/devices/parisc"
#define TP_NPROC   0x00
#define TP_MEMORY   0x01
#define TP_B_DMA   0x02
#define TP_OBSOLETE   0x03
#define TP_A_DMA   0x04
#define TP_A_DIRECT   0x05
#define TP_OTHER   0x06
#define TP_BCPORT   0x07
#define TP_CIO   0x08
#define TP_CONSOLE   0x09
#define TP_FIO   0x0a
#define TP_BA   0x0b
#define TP_IOA   0x0c
#define TP_BRIDGE   0x0d
#define TP_FABRIC   0x0e
#define TP_MC   0x0f
#define TP_FAULTY   0x1f

Enumerations

enum  cpu_type {
  pcx = 0, pcxs = 1, pcxt = 2, pcxt_ = 3,
  pcxl = 4, pcxl2 = 5, pcxu = 6, pcxu_ = 7,
  pcxw = 8, pcxw_ = 9, pcxw2 = 10, mako = 11
}

Functions

 __ID ("@(#) $Id: parisc.cc 2433 2012-01-10 22:01:30Z lyonel $")
static long get_long (const string &path)
static string cpubusinfo (int cpu)
enum cpu_type parisc_get_cpu_type (long hversion)
static hwNode get_device (long hw_type, long sversion, long hversion)
static bool scan_device (hwNode &node, string name="")
bool scan_parisc (hwNode &node)

Variables

static struct parisc_device []
static struct hp_cpu_type_mask hp_cpu_type_mask_list []
static const char * cpu_name_version [][2]
static int currentcpu = 0

Class Documentation

struct parisc_device

Definition at line 47 of file parisc.cc.

Class Members
const char * description
hwClass device_class
const char * id
long sversion
struct hp_cpu_type_mask

Definition at line 130 of file parisc.cc.

Class Members
unsigned short mask
unsigned short model

Define Documentation

#define DEVICESPARISC   "/sys/devices/parisc"

Definition at line 27 of file parisc.cc.

#define TP_A_DIRECT   0x05

Definition at line 34 of file parisc.cc.

#define TP_A_DMA   0x04

Definition at line 33 of file parisc.cc.

#define TP_B_DMA   0x02

Definition at line 31 of file parisc.cc.

#define TP_BA   0x0b

Definition at line 40 of file parisc.cc.

#define TP_BCPORT   0x07

Definition at line 36 of file parisc.cc.

#define TP_BRIDGE   0x0d

Definition at line 42 of file parisc.cc.

#define TP_CIO   0x08

Definition at line 37 of file parisc.cc.

#define TP_CONSOLE   0x09

Definition at line 38 of file parisc.cc.

#define TP_FABRIC   0x0e

Definition at line 43 of file parisc.cc.

#define TP_FAULTY   0x1f

Definition at line 45 of file parisc.cc.

#define TP_FIO   0x0a

Definition at line 39 of file parisc.cc.

#define TP_IOA   0x0c

Definition at line 41 of file parisc.cc.

#define TP_MC   0x0f

Definition at line 44 of file parisc.cc.

#define TP_MEMORY   0x01

Definition at line 30 of file parisc.cc.

#define TP_NPROC   0x00

Definition at line 29 of file parisc.cc.

#define TP_OBSOLETE   0x03

Definition at line 32 of file parisc.cc.

#define TP_OTHER   0x06

Definition at line 35 of file parisc.cc.


Enumeration Type Documentation

enum cpu_type
Enumerator:
pcx 
pcxs 
pcxt 
pcxt_ 
pcxl 
pcxl2 
pcxu 
pcxu_ 
pcxw 
pcxw_ 
pcxw2 
mako 

Definition at line 114 of file parisc.cc.

{
  pcx     = 0,                                    /* pa7000          pa 1.0  */
  pcxs    = 1,                                    /* pa7000          pa 1.1a */
  pcxt    = 2,                                    /* pa7100          pa 1.1b */
  pcxt_   = 3,                                    /* pa7200  (t')    pa 1.1c */
  pcxl    = 4,                                    /* pa7100lc        pa 1.1d */
  pcxl2   = 5,                                    /* pa7300lc        pa 1.1e */
  pcxu    = 6,                                    /* pa8000          pa 2.0  */
  pcxu_   = 7,                                    /* pa8200  (u+)    pa 2.0  */
  pcxw    = 8,                                    /* pa8500          pa 2.0  */
  pcxw_   = 9,                                    /* pa8600  (w+)    pa 2.0  */
  pcxw2   = 10,                                   /* pa8700         pa 2.0  */
  mako    = 11                                    /* pa8800         pa 2.0  */
};

Function Documentation

__ID ( "@(#) $Id: parisc.cc 2433 2012-01-10 22:01:30Z lyonel $"  )
static string cpubusinfo ( int  cpu) [static]

Definition at line 403 of file parisc.cc.

{
  char buffer[10];

  snprintf(buffer, sizeof(buffer), "cpu@%d", cpu);

  return string(buffer);
}

Here is the caller graph for this function:

static hwNode get_device ( long  hw_type,
long  sversion,
long  hversion 
) [static]

Definition at line 429 of file parisc.cc.

{
  hwNode newnode("generic");

  for(unsigned i=0; parisc_device_list[i].description!=NULL; i++)
  {
    if(sversion == parisc_device_list[i].sversion)
    {
      newnode = hwNode(parisc_device_list[i].id, parisc_device_list[i].device_class);
      newnode.setDescription(parisc_device_list[i].description);
      if(hw_type == TP_NPROC)
      {
        enum cpu_type cpu = parisc_get_cpu_type(hversion);
        newnode.setBusInfo(cpubusinfo(currentcpu++));
        newnode.setProduct(cpu_name_version[cpu][0]);
        newnode.setVersion(cpu_name_version[cpu][1]);
      }

      return newnode;
    }
  }

  switch(hw_type)
  {
    case TP_NPROC:
      newnode = hwNode("cpu", hw::processor);
      newnode.setDescription("Processor");
      newnode.setBusInfo(cpubusinfo(currentcpu++));
      break;
    case TP_MEMORY:
      newnode = hwNode("memory", hw::memory);
      newnode.setDescription("Memory");
      break;
    case TP_B_DMA:
      newnode.addCapability("b-dma", "Type B DMA I/O");
      break;
    case TP_A_DMA:
      newnode.addCapability("a-dma", "Type A DMA I/O");
      break;
    case TP_A_DIRECT:
      switch (sversion)
      {
        case 0x0D:
          newnode = hwNode("serial", hw::communication);
          newnode.setDescription("MUX port");
          break;
        case 0x0E:
          newnode = hwNode("serial", hw::communication);
          newnode.setDescription("RS-232 port");
          break;
      }

      newnode.addCapability("a-direct", "Type A Direct I/O");
      break;
    case TP_BCPORT:
      newnode = hwNode("busconverter", hw::bridge);
      newnode.setDescription("Bus converter port");
      break;
    case TP_CIO:
      newnode.setDescription("HP-CIO adapter");
      break;
    case TP_CONSOLE:
      newnode = hwNode("console", hw::input);
      newnode.setDescription("Console");
      break;
    case TP_FIO:
      newnode.setDescription("Foreign I/O module");
      break;
    case TP_BA:
      newnode = hwNode("bus", hw::bus);
      newnode.setDescription("Bus adapter");
      break;
    case TP_IOA:
      newnode.setDescription("I/O adapter");
      break;
    case TP_BRIDGE:
      newnode = hwNode("bridge", hw::bridge);
      newnode.setDescription("Bus bridge to foreign bus");
      break;
    case TP_FABRIC:
      newnode.setDescription("Fabric ASIC");
      break;
    case TP_FAULTY:
      newnode.disable();
      newnode.setDescription("Faulty module");
      break;
  }

  return newnode;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static long get_long ( const string &  path) [static]

Definition at line 387 of file parisc.cc.

{
  long result = -1;
  FILE * in = fopen(path.c_str(), "r");

  if (in)
  {
    if(fscanf(in, "%lx", &result) != 1)
      result = -1;
    fclose(in);
  }

  return result;
}

Here is the caller graph for this function:

enum cpu_type parisc_get_cpu_type ( long  hversion)

Definition at line 413 of file parisc.cc.

{
  struct hp_cpu_type_mask *ptr;

  for (ptr = hp_cpu_type_mask_list; 0 != ptr->mask; ptr++)
  {
    if (ptr->model == (hversion & ptr->mask))
      return ptr->cpu;
  }

  return pcx;                                     /* not reached: */
}

Here is the caller graph for this function:

static bool scan_device ( hwNode node,
string  name = "" 
) [static]

Definition at line 521 of file parisc.cc.

{
  struct dirent **namelist;
  int n;
  hwNode * curnode = NULL;

  if(name != "")
  {
    size_t colon = name.rfind(":");
    long hw_type = get_long("hw_type");
    long sversion = get_long("sversion");
    long hversion = get_long("hversion");
    long rev = get_long("rev");
    hwNode newnode = get_device(hw_type, sversion, hversion);

    if((rev>0) && (newnode.getVersion() == ""))
    {
      char buffer[20];
      snprintf(buffer, sizeof(buffer), "%ld", rev);
      newnode.setVersion(buffer);
    }
    if(newnode.getBusInfo()=="")
      newnode.setBusInfo(guessBusInfo(name));
    if(exists("driver"))
    {
      string driver = readlink("driver");
      size_t slash = driver.rfind("/");
      newnode.setConfig("driver", driver.substr(slash==driver.npos?0:slash+1));
      newnode.claim();
    }
    if(colon!=name.npos)
      newnode.setPhysId(name.substr(colon+1));
    else
      newnode.setPhysId(name);
    curnode = node.addChild(newnode);
  }

  n = scandir(".", &namelist, selectdir, alphasort);
  if (n < 0)
    return false;
  else
  {
    for (int i = 0; i < n; i++)
      if(matches(namelist[i]->d_name, "^[0-9]+(:[0-9]+)*$"))
    {
      pushd(namelist[i]->d_name);
      scan_device(curnode?*curnode:node, namelist[i]->d_name);
      popd();
      free(namelist[i]);
    }
    free(namelist);
  }

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool scan_parisc ( hwNode node)

Definition at line 578 of file parisc.cc.

{
  hwNode *core = node.getChild("core");

  currentcpu = 0;

  if (!core)
  {
    core = node.addChild(hwNode("core", hw::bus));
  }

  if (!core)
    return false;

  if(core->getDescription()=="")
    core->setDescription("Motherboard");
  pushd(DEVICESPARISC);
  scan_device(*core);
  popd();

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

const char* cpu_name_version[][2] [static]
Initial value:
{
  { "PA7000 (PCX)",     "1.0" },
  { "PA7000 (PCX-S)",   "1.1a" },
  { "PA7100 (PCX-T)",   "1.1b" },
  { "PA7200 (PCX-T')",  "1.1c" },
  { "PA7100LC (PCX-L)", "1.1d" },
  { "PA7300LC (PCX-L2)",        "1.1e" },
  { "PA8000 (PCX-U)",   "2.0" },
  { "PA8200 (PCX-U+)",  "2.0" },
  { "PA8500 (PCX-W)",   "2.0" },
  { "PA8600 (PCX-W+)",  "2.0" },
  { "PA8700 (PCX-W2)",  "2.0" },
  { "PA8800 (Mako)",    "2.0" }
}

Definition at line 371 of file parisc.cc.

int currentcpu = 0 [static]

Definition at line 427 of file parisc.cc.

struct parisc_device[] [static]

Definition at line 55 of file parisc.cc.