Comments (7)
Hmm, very strange. Tho only place I can see that returns EBADMSG is in the kernel where it checks the status returned by the device to be valid:
Do you know what kind of hardware and firmware version you have?
My guess is the hardware/firmware are responding improperly to the MRPC_I2C_TWI_PING command (possibly it is too old?) and thus we don't fall back to the gen3 return and it returns an error instead.
from switchtec-user.
Thanks for your response!
Hmm, very strange. Tho only place I can see that returns EBADMSG is in the kernel where it checks the status returned by the device to be valid:
I will check this part. Thanks. However, I am curious to understand. Is not the return value 0 here ? I may be wrong.
(gdb) x /12x buf
0x7fffffffde70: 0x00000000 0x63592f39 0x00179ec8 0x00000000
0x7fffffffde80: 0xffffdf28 0x00007fff 0xf7fe76c0 0x00007fff
0x7fffffffde90: 0xffffdec0 0x00007fff 0x00000008 0x00000000
Do you know what kind of hardware and firmware version you have?
# cat /sys/class/switchtec/switchtec0/fw_version
01090063
# cat /sys/class/switchtec/switchtec0/vendor_id
MICROSEM
My guess is the hardware/firmware are responding improperly to the MRPC_I2C_TWI_PING command (possibly it is too old?) >and thus we don't fall back to the gen3 return and it returns an error instead.
This is what I saw a while back when debugging. I thought I should share it here. It looks to recognize "GEN3" correctly. I am not sure if this is what you are mentioning here.
(gdb) p ldev
$5 = (struct switchtec_linux *) 0x648330
(gdb) p *ldev
$6 = {dev = {device_id = 34098, gen = SWITCHTEC_GEN3, var = SWITCHTEC_PFX, pax_id = -1, local_pax_id = -1, partition = 0, partition_count = 1,
boot_phase = SWITCHTEC_BOOT_PHASE_FW, name = "/dev/switchtec0", '\000' <repeats 4080 times>, gas_map = 0x0, gas_map_size = 0, ops = 0x644080 <linux_ops>}, fd = 3}
from switchtec-user.
The return value in the buffer is zero. But it's not likely valid if the status is the wrong value.
Is your hardware indeed GEN3? The switchtec_dev stuff you are printing may not be correct given the switchtec_get_device_info() call failed.
What is in:
/sys/class/switchtec/switchtec0/component_id
from switchtec-user.
What is in:
/sys/class/switchtec/switchtec0/component_id
# cat /sys/class/switchtec/switchtec0/component_id
PM8532
Is your hardware indeed GEN3? The switchtec_dev stuff you are printing may not be correct given the switchtec_get_device_info() call failed.
I thought the switchtec_get_device_info() is already populated before calling switchtec_cmd()/linux_cmd(). I will revisit my understanding again.
from switchtec-user.
Yup, this is definitely GEN3 hardware. Perhaps a patch such as this will fix the issue:
diff --git a/lib/switchtec.c b/lib/switchtec.c
index 23b570fc8d30..4640532f5f00 100644
--- a/lib/switchtec.c
+++ b/lib/switchtec.c
@@ -1755,7 +1755,7 @@ int switchtec_get_device_info(struct switchtec_dev *dev,
*rev = (dev_info >> 8) & 0x0f;
if (gen)
*gen = map_to_gen((dev_info >> 12) & 0x0f);
- } else if (ERRNO_MRPC(errno) == ERR_CMD_INVALID) {
+ } else if (errno == EBADMSG || ERRNO_MRPC(errno) == ERR_CMD_INVALID) {
if (phase)
*phase = SWITCHTEC_BOOT_PHASE_FW;
if (gen)
from switchtec-user.
Yup, this is definitely GEN3 hardware. Perhaps a patch such as this will fix the issue:
diff --git a/lib/switchtec.c b/lib/switchtec.c index 23b570fc8d30..4640532f5f00 100644 --- a/lib/switchtec.c +++ b/lib/switchtec.c @@ -1755,7 +1755,7 @@ int switchtec_get_device_info(struct switchtec_dev *dev, *rev = (dev_info >> 8) & 0x0f; if (gen) *gen = map_to_gen((dev_info >> 12) & 0x0f); - } else if (ERRNO_MRPC(errno) == ERR_CMD_INVALID) { + } else if (errno == EBADMSG || ERRNO_MRPC(errno) == ERR_CMD_INVALID) { if (phase) *phase = SWITCHTEC_BOOT_PHASE_FW; if (gen)
@lsgunth , Thanks for the patch. I will try out and let you know.
from switchtec-user.
Your patch worked. Thanks @lsgunth !
# ./switchtec info /dev/switchtec0
/dev/switchtec0:
Generation: GEN3
HW Revision: Unknown
Variant: PFX
Device ID: 0x8532
FW Version: 1.09 B063
This issue can be closed.
from switchtec-user.
Related Issues (20)
- "Unknown Error (16)" on fw-update command HOT 1
- redefinition of i2c objects in linux. HOT 1
- NVME admin commands for EPs
- Failed to specify device by a PCI b:d.f HOT 2
- user space tool does not support smbus, but only i2c messaging HOT 3
- how to get the log-def file HOT 1
- Switchtec user gas read fails on 5.8.15-301.fc33.x86_64 kernel (Fedora 33) HOT 3
- gas write/read over serial/mmapped interface not working as expected with PAX 42100 HOT 4
- i2c fw-update not supported HOT 7
- Please make release tags HOT 2
- How to configure PM8576 switch to access same endpoint device by multiple host root complex?
- PM8576B Hot Plug feature test
- seeing crashes with "switchtec status" command HOT 1
- version.h: No such file or directory HOT 2
- events command returning "Invalid argument" HOT 4
- New release? HOT 3
- switchtech fw-update /dev/switchtech0 switchtec_pfx.pmc is giving Input Ouput error
- --prefix does not work in configure script
- TWI Recovery in WSL2 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from switchtec-user.