* Revision 1.36 2002/11/14 15:16:56 gheinig
* Added const specifier to key and buf parameters for VpdPara, VpdRead
* and VpdWrite for Diag 7 GUI
* Revision 1.36 2002/11/14 15:16:56 gheinig
* Added const specifier to key and buf parameters for VpdPara, VpdRead
* and VpdWrite for Diag 7 GUI
* Revision 1.32 2002/10/14 16:04:29 rschmidt
* Added saving of VPD ROM Size from PCI_OUR_REG_2
* Avoid reading of PCI_OUR_REG_2 in VpdTransferBlock()
* Editorial changes
* Revision 1.32 2002/10/14 16:04:29 rschmidt
* Added saving of VPD ROM Size from PCI_OUR_REG_2
* Avoid reading of PCI_OUR_REG_2 in VpdTransferBlock()
* Editorial changes
* Revision 1.31 2002/09/10 09:21:32 mkarl
* Replaced all if(GIChipId == CHIP_ID_GENESIS) with new entry GIGenesis
* Revision 1.31 2002/09/10 09:21:32 mkarl
* Replaced all if(GIChipId == CHIP_ID_GENESIS) with new entry GIGenesis
* Revision 1.30 2002/09/09 14:43:03 mkarl
* changes for diagnostics in order to read VPD data before the adapter
* has been initialized
* editorial changes
* Revision 1.30 2002/09/09 14:43:03 mkarl
* changes for diagnostics in order to read VPD data before the adapter
* has been initialized
* editorial changes
* Revision 1.27 2000/08/10 11:29:06 rassmann
* Editorial changes.
* Preserving 32-bit alignment in structs for the adapter context.
* Removed unused function VpdWriteDword() (#if 0).
* Made VpdReadKeyword() available for SKDIAG only.
* Revision 1.27 2000/08/10 11:29:06 rassmann
* Editorial changes.
* Preserving 32-bit alignment in structs for the adapter context.
* Removed unused function VpdWriteDword() (#if 0).
* Made VpdReadKeyword() available for SKDIAG only.
* Revision 1.26 2000/06/13 08:00:01 mkarl
* additional cast to avoid compile problems in 64 bit environment
* Revision 1.26 2000/06/13 08:00:01 mkarl
* additional cast to avoid compile problems in 64 bit environment
* Revision 1.19 1998/10/28 15:56:11 gklug
* fix: Return len at end of ReadStream
* fix: Write even less than 4 bytes correctly
* Revision 1.19 1998/10/28 15:56:11 gklug
* fix: Return len at end of ReadStream
* fix: Write even less than 4 bytes correctly
* Revision 1.14 1998/10/28 07:20:38 gklug
* chg: Interface functions to use IoC as parameter as well
* fix: VpdRead/WriteDWord now returns SK_U32
* Revision 1.14 1998/10/28 07:20:38 gklug
* chg: Interface functions to use IoC as parameter as well
* fix: VpdRead/WriteDWord now returns SK_U32
* add: VpdRead/Write Stream functions to r/w a stream of data
* fix: VpdTransferBlock swapped illegal
* add: VpdMayWrite
* add: VpdRead/Write Stream functions to r/w a stream of data
* fix: VpdTransferBlock swapped illegal
* add: VpdMayWrite
* Revision 1.9 1998/09/16 07:33:52 malthoff
* replace memcmp() by SK_MEMCMP and
* memcpy() by SK_MEMCPY() to be
* independent from the 'C' Standard Library.
* Revision 1.9 1998/09/16 07:33:52 malthoff
* replace memcmp() by SK_MEMCMP and
* memcpy() by SK_MEMCPY() to be
* independent from the 'C' Standard Library.
* Revision 1.7 1998/08/19 08:14:01 gklug
* fix: remove struct keyword as much as possible from the C-code (see CCC)
* Revision 1.7 1998/08/19 08:14:01 gklug
* fix: remove struct keyword as much as possible from the C-code (see CCC)
* Revision 1.5 1998/08/18 08:17:29 malthoff
* Ensure we issue a VPD read in vpd_read_dword().
* Discard all VPD keywords other than Vx or Yx, where
* x is '0..9' or 'A..Z'.
* Revision 1.5 1998/08/18 08:17:29 malthoff
* Ensure we issue a VPD read in vpd_read_dword().
* Discard all VPD keywords other than Vx or Yx, where
* x is '0..9' or 'A..Z'.
* Revision 1.4 1998/07/03 14:52:19 malthoff
* Add category SK_DBGCAT_FATAL to some debug macros.
* bug fix: correct the keyword name check in vpd_write().
* Revision 1.4 1998/07/03 14:52:19 malthoff
* Add category SK_DBGCAT_FATAL to some debug macros.
* bug fix: correct the keyword name check in vpd_write().
* Revision 1.1 1998/06/19 14:11:08 malthoff
* Created, Tests with AIX were performed successfully
* Revision 1.1 1998/06/19 14:11:08 malthoff
* Created, Tests with AIX were performed successfully
VPD_IN16(pAC, IoC, PCI_VPD_ADR_REG, &state);
VPD_IN16(pAC, IoC, PCI_VPD_ADR_REG, &state);
SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_CTRL,
("state = %x, event %x\n",state,event));
} while((int)(state & PCI_VPD_FLAG) == event);
SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_CTRL,
("state = %x, event %x\n",state,event));
} while((int)(state & PCI_VPD_FLAG) == event);
Rtv = 0;
VPD_IN32(pAC, IoC, PCI_VPD_DAT_REG, &Rtv);
Rtv = 0;
VPD_IN32(pAC, IoC, PCI_VPD_DAT_REG, &Rtv);
SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_CTRL,
("VPD read dword data = 0x%x\n",Rtv));
return(Rtv);
SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_CTRL,
("VPD read dword data = 0x%x\n",Rtv));
return(Rtv);
VPD_IN8(pAC, IoC, PCI_VPD_DAT_REG + j, &Data);
VPD_IN8(pAC, IoC, PCI_VPD_DAT_REG + j, &Data);
if (Data != *pComp) {
/* Verify Error */
SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR,
if (Data != *pComp) {
/* Verify Error */
SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR,
if (addr > vpd_rom_size - 4) {
SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR | SK_DBGCAT_FATAL,
("Address error: 0x%x, exp. < 0x%x\n",
addr, vpd_rom_size - 4));
return(0);
}
if (addr > vpd_rom_size - 4) {
SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR | SK_DBGCAT_FATAL,
("Address error: 0x%x, exp. < 0x%x\n",
addr, vpd_rom_size - 4));
return(0);
}
if (addr + len > vpd_rom_size) {
len = vpd_rom_size - addr;
SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR,
if (addr + len > vpd_rom_size) {
len = vpd_rom_size - addr;
SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR,
SK_U32 our_reg2;
SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_INIT, ("VpdInit .. "));
SK_U32 our_reg2;
SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_INIT, ("VpdInit .. "));
VPD_IN16(pAC, IoC, PCI_DEVICE_ID, &dev_id);
VPD_IN16(pAC, IoC, PCI_DEVICE_ID, &dev_id);
VPD_IN32(pAC, IoC, PCI_OUR_REG_2, &our_reg2);
VPD_IN32(pAC, IoC, PCI_OUR_REG_2, &our_reg2);
/*
* this function might get used before the hardware is initialized
* therefore we cannot always trust in GIChipId
/*
* this function might get used before the hardware is initialized
* therefore we cannot always trust in GIChipId
if (r->p_val + r->p_len > pAC->vpd.vpd_buf + vpd_size/2) {
SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL,
("Encoding Error: Invalid VPD struct size\n"));
if (r->p_val + r->p_len > pAC->vpd.vpd_buf + vpd_size/2) {
SK_DBG_MSG(pAC,SK_DBGMOD_VPD,SK_DBGCAT_ERR | SK_DBGCAT_FATAL,
("Encoding Error: Invalid VPD struct size\n"));
for (i = 0, x = 0; (unsigned)i <= (unsigned)vpd_size/2 - r->p_len; i++) {
x += pAC->vpd.vpd_buf[i];
}
for (i = 0, x = 0; (unsigned)i <= (unsigned)vpd_size/2 - r->p_len; i++) {
x += pAC->vpd.vpd_buf[i];
}
if (x != 0) {
/* checksum error */
SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR | SK_DBGCAT_FATAL,
if (x != 0) {
/* checksum error */
SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR | SK_DBGCAT_FATAL,
if (r->p_val < pAC->vpd.vpd_buf + vpd_size/2) {
SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR | SK_DBGCAT_FATAL,
("Encoding Error: Invalid VPD struct size\n"));
if (r->p_val < pAC->vpd.vpd_buf + vpd_size/2) {
SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR | SK_DBGCAT_FATAL,
("Encoding Error: Invalid VPD struct size\n"));
SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_CTRL,
("VPD setup para key = %s, val = %s\n",key,buf));
SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_CTRL,
("VPD setup para key = %s, val = %s\n",key,buf));
/*
* Read the contents of the VPD EEPROM and copy it to the VPD buffer
* if not already done. If the keyword "VF" is not present it will be
/*
* Read the contents of the VPD EEPROM and copy it to the VPD buffer
* if not already done. If the keyword "VF" is not present it will be