-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[devices]: Fix configurations for 7050QX-32S-S4Q31 (#2119)
- Correct lane map in broadcom configuration - Add writes to txdisable bits for SFPs in hwsku-init - Add correct hwsku-init implementation for 201803 branch
- Loading branch information
Showing
2 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
53 changes: 52 additions & 1 deletion
53
device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/hwsku-init
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,52 @@ | ||
echo 1 > /sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/mux | ||
#!/usr/bin/python | ||
from __future__ import print_function | ||
|
||
import mmap | ||
import os | ||
import sys | ||
from struct import pack, unpack | ||
|
||
class MmapResource( object ): | ||
"""Resource implementation for a directly-mapped memory region.""" | ||
def __init__( self, path ): | ||
try: | ||
fd = os.open( path, os.O_RDWR ) | ||
except EnvironmentError: | ||
print( "FAIL can not open scd memory-map resource file" ) | ||
print( "FAIL are you running on the proper platform?" ) | ||
sys.exit( 1 ) | ||
try: | ||
size = os.fstat( fd ).st_size | ||
except EnvironmentError: | ||
print( "FAIL can not fstat scd memory-map resource file" ) | ||
print( "FAIL are you running on the proper platform?" ) | ||
sys.exit( 1 ) | ||
try: | ||
self.mmap_ = mmap.mmap( fd, size, mmap.MAP_SHARED, | ||
mmap.PROT_READ | mmap.PROT_WRITE ) | ||
except EnvironmentError: | ||
print( "FAIL can not map scd memory-map file" ) | ||
print( "FAIL are you running on the proper platform?" ) | ||
sys.exit( 1 ) | ||
finally: | ||
try: | ||
# Note that closing the file descriptor has no effect on the memory map | ||
os.close( fd ) | ||
except EnvironmentError: | ||
print( "FAIL failed to close scd memory-map file" ) | ||
sys.exit( 1 ) | ||
def read32( self, addr ): | ||
return unpack( '<L', self.mmap_[ addr : addr + 4 ] )[ 0 ] | ||
def write32( self, addr, value ): | ||
self.mmap_[ addr: addr + 4 ] = pack( '<L', value ) | ||
|
||
m = MmapResource( '/sys/bus/pci/devices/0000:02:00.0/resource0' ) | ||
for addr in range( 0x5210, 0x5250, 0x10 ): | ||
v = m.read32( addr ) | ||
m.write32( addr, v & ~( 1 << 6 ) ) | ||
print( "orig=%04x new=%04x" % ( v, m.read32( addr ) ) ) | ||
|
||
with open( "/sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/mux_sfp_qsfp/direction", "w" ) as fdir: | ||
fdir.write( "out" ) | ||
with open( "/sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/mux_sfp_qsfp/value", "w" ) as fval: | ||
fval.write( "1" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters