master/slave.c
changeset 266 0234b0c26c52
parent 264 76cba93ba122
child 269 a03be9a6fed6
equal deleted inserted replaced
265:fb965f033bb3 266:0234b0c26c52
    67 EC_SYSFS_READ_ATTR(product_name);
    67 EC_SYSFS_READ_ATTR(product_name);
    68 EC_SYSFS_READ_ATTR(product_desc);
    68 EC_SYSFS_READ_ATTR(product_desc);
    69 EC_SYSFS_READ_ATTR(sii_name);
    69 EC_SYSFS_READ_ATTR(sii_name);
    70 EC_SYSFS_READ_ATTR(type);
    70 EC_SYSFS_READ_ATTR(type);
    71 EC_SYSFS_READ_WRITE_ATTR(state);
    71 EC_SYSFS_READ_WRITE_ATTR(state);
       
    72 EC_SYSFS_READ_ATTR(eeprom);
    72 
    73 
    73 static struct attribute *def_attrs[] = {
    74 static struct attribute *def_attrs[] = {
    74     &attr_ring_position,
    75     &attr_ring_position,
    75     &attr_coupler_address,
    76     &attr_coupler_address,
    76     &attr_vendor_name,
    77     &attr_vendor_name,
    77     &attr_product_name,
    78     &attr_product_name,
    78     &attr_product_desc,
    79     &attr_product_desc,
    79     &attr_sii_name,
    80     &attr_sii_name,
    80     &attr_type,
    81     &attr_type,
    81     &attr_state,
    82     &attr_state,
       
    83     &attr_eeprom,
    82     NULL,
    84     NULL,
    83 };
    85 };
    84 
    86 
    85 static struct sysfs_ops sysfs_ops = {
    87 static struct sysfs_ops sysfs_ops = {
    86     .show = ec_show_slave_attribute,
    88     .show = ec_show_slave_attribute,
   143     slave->sii_tx_mailbox_size = 0;
   145     slave->sii_tx_mailbox_size = 0;
   144     slave->sii_mailbox_protocols = 0;
   146     slave->sii_mailbox_protocols = 0;
   145     slave->type = NULL;
   147     slave->type = NULL;
   146     slave->registered = 0;
   148     slave->registered = 0;
   147     slave->fmmu_count = 0;
   149     slave->fmmu_count = 0;
       
   150     slave->eeprom_data = NULL;
       
   151     slave->eeprom_size = 0;
   148     slave->eeprom_group = NULL;
   152     slave->eeprom_group = NULL;
   149     slave->eeprom_image = NULL;
   153     slave->eeprom_image = NULL;
   150     slave->eeprom_order = NULL;
   154     slave->eeprom_order = NULL;
   151     slave->eeprom_name = NULL;
   155     slave->eeprom_name = NULL;
   152     slave->requested_state = EC_SLAVE_STATE_UNKNOWN;
   156     slave->requested_state = EC_SLAVE_STATE_UNKNOWN;
   231             list_del(&en->list);
   235             list_del(&en->list);
   232             kfree(en);
   236             kfree(en);
   233         }
   237         }
   234         kfree(sdo);
   238         kfree(sdo);
   235     }
   239     }
       
   240 
       
   241     if (slave->eeprom_data) kfree(slave->eeprom_data);
   236 
   242 
   237     ec_command_clear(&slave->mbox_command);
   243     ec_command_clear(&slave->mbox_command);
   238 }
   244 }
   239 
   245 
   240 /*****************************************************************************/
   246 /*****************************************************************************/
  1119         printk("\n");
  1125         printk("\n");
  1120     }
  1126     }
  1121 
  1127 
  1122     EC_INFO("  EEPROM data:\n");
  1128     EC_INFO("  EEPROM data:\n");
  1123 
  1129 
       
  1130     EC_INFO("    EEPROM content size: %i Bytes\n", slave->eeprom_size);
       
  1131 
  1124     if (slave->sii_alias)
  1132     if (slave->sii_alias)
  1125         EC_INFO("    Configured station alias: 0x%04X (%i)\n",
  1133         EC_INFO("    Configured station alias: 0x%04X (%i)\n",
  1126                 slave->sii_alias, slave->sii_alias);
  1134                 slave->sii_alias, slave->sii_alias);
  1127 
  1135 
  1128     EC_INFO("    Vendor-ID: 0x%08X, Product code: 0x%08X\n",
  1136     EC_INFO("    Vendor-ID: 0x%08X, Product code: 0x%08X\n",
  1293                 return sprintf(buffer, "OP\n");
  1301                 return sprintf(buffer, "OP\n");
  1294             default:
  1302             default:
  1295                 return sprintf(buffer, "UNKNOWN\n");
  1303                 return sprintf(buffer, "UNKNOWN\n");
  1296         }
  1304         }
  1297     }
  1305     }
       
  1306     else if (attr == &attr_eeprom) {
       
  1307         if (slave->eeprom_data) {
       
  1308             if (slave->eeprom_size > PAGE_SIZE) {
       
  1309                 EC_ERR("EEPROM contents of slave %i exceed 1 page (%i/%i).\n",
       
  1310                        slave->ring_position, slave->eeprom_size,
       
  1311                        (int) PAGE_SIZE);
       
  1312             }
       
  1313             else {
       
  1314                 memcpy(buffer, slave->eeprom_data, slave->eeprom_size);
       
  1315                 return slave->eeprom_size;
       
  1316             }
       
  1317         }
       
  1318     }
  1298 
  1319 
  1299     return 0;
  1320     return 0;
  1300 }
  1321 }
  1301 
  1322 
  1302 /*****************************************************************************/
  1323 /*****************************************************************************/