c5d0507224
Add new Nokia build target and establish an arm64 build: Platform: arm64-nokia_ixs7215_52xb-r0 HwSKU: Nokia-7215-A1 ASIC: marvell Port Config: 48x1G + 4x10G How I did it - Change make files for saiserver and syncd to use Bulleseye kernel - Change Marvell SAI version to 1.11.0-1 - Add Prestera make files to build kernel, Flattened Device Tree blob and ramdisk for arm64 platforms - Provide device and platform related files for new platform support (arm64-nokia_ixs7215_52xb-r0).
50 lines
1.3 KiB
Python
50 lines
1.3 KiB
Python
|
|
import os
|
|
|
|
# pylint: disable=import-error
|
|
from sonic_platform_base.sonic_ssd.ssd_base import SsdBase
|
|
from sonic_platform_base.sonic_ssd.ssd_generic import SsdUtil as SsdUtilDefault
|
|
|
|
class EmmcUtil(SsdBase):
|
|
def __init__(self, diskdev):
|
|
self.diskdev = diskdev
|
|
self.path = os.path.join('/sys/block', os.path.basename(diskdev))
|
|
|
|
def _readDeviceEntry(self, entry, default=None):
|
|
path = os.path.join(self.path, 'device', entry)
|
|
try:
|
|
with open(path, encoding='utf8') as f:
|
|
return f.read().rstrip()
|
|
except OSError:
|
|
return default
|
|
|
|
def _isSlc(self):
|
|
return bool(self._readDeviceEntry('enhanced_area_offset'))
|
|
|
|
def get_health(self):
|
|
data = self._readDeviceEntry('life_time')
|
|
if data is None:
|
|
raise NotImplementedError
|
|
value = int(data.split()[0 if self._isSlc() else 1], 0)
|
|
return float(100 - (10 * (value - 1)))
|
|
|
|
def get_temperature(self):
|
|
return 'N/A'
|
|
|
|
def get_model(self):
|
|
return self._readDeviceEntry('name')
|
|
|
|
def get_firmware(self):
|
|
return self._readDeviceEntry('fwrev')
|
|
|
|
def get_serial(self):
|
|
return self._readDeviceEntry('serial')
|
|
|
|
def get_vendor_output(self):
|
|
return ''
|
|
|
|
def SsdUtil(diskdev):
|
|
if os.path.basename(diskdev).startswith('mmcblk'):
|
|
return EmmcUtil(diskdev)
|
|
return SsdUtilDefault(diskdev)
|