mirror of
https://github.com/chipsec/chipsec
synced 2026-06-08 13:31:00 +00:00
Fix --no_driver option on macOS (#181)
This commit is contained in:
+13
-5
@@ -245,8 +245,8 @@ class Chipset:
|
||||
else:
|
||||
self.helper = helper
|
||||
|
||||
self.vid = 0
|
||||
self.did = 0
|
||||
self.vid = 0xFFFF
|
||||
self.did = 0xFFFF
|
||||
self.code = CHIPSET_CODE_UNKNOWN
|
||||
self.longname = "Unrecognized Platform"
|
||||
self.id = CHIPSET_ID_UNKNOWN
|
||||
@@ -279,6 +279,16 @@ class Chipset:
|
||||
# Iitialization
|
||||
#
|
||||
##################################################################################
|
||||
def detect_platform( self ):
|
||||
vid = 0xFFFF
|
||||
did = 0xFFFF
|
||||
try:
|
||||
vid_did = self.pci.read_dword(0, 0, 0, 0)
|
||||
vid = vid_did & 0xFFFF
|
||||
did = (vid_did >> 16) & 0xFFFF
|
||||
except:
|
||||
if logger().DEBUG: logger().error("pci.read_dword couldn't read platform VID/DID")
|
||||
return (vid, did)
|
||||
|
||||
def init( self, platform_code, start_driver, driver_exists=False ):
|
||||
|
||||
@@ -287,9 +297,7 @@ class Chipset:
|
||||
logger().log( '[CHIPSEC] API mode: %s' % ('using OS native API (not using CHIPSEC kernel module)' if self.use_native_api() else 'using CHIPSEC kernel module API') )
|
||||
|
||||
if platform_code is None:
|
||||
vid_did = self.pci.read_dword( 0, 0, 0, 0 )
|
||||
self.vid = vid_did & 0xFFFF
|
||||
self.did = (vid_did >> 16) & 0xFFFF
|
||||
self.vid, self.did = self.detect_platform()
|
||||
if VID_INTEL != self.vid:
|
||||
_unknown_platform = True
|
||||
else:
|
||||
|
||||
@@ -371,8 +371,6 @@ class LinuxHelper(Helper):
|
||||
|
||||
def read_pci_reg( self, bus, device, function, offset, size = 4 ):
|
||||
_PCI_DOM = 0 #Change PCI domain, if there is more than one.
|
||||
#if not self.driver_loaded:
|
||||
# return self.read_pci_reg_from_sys(bus, device, function, offset, size, domain=_PCI_DOM)
|
||||
d = struct.pack("5"+self._pack, ((_PCI_DOM << 16) | bus), ((device << 16) | function), offset, size, 0)
|
||||
try:
|
||||
ret = self.ioctl(IOCTL_RDPCI, d)
|
||||
|
||||
@@ -668,9 +668,6 @@ class RweHelper(Helper):
|
||||
return
|
||||
|
||||
def read_pci_reg( self, bus, device, function, address, size ):
|
||||
#raise UnimplementedNativeAPIError( "read_pci_reg" )
|
||||
if not self.driver_loaded:
|
||||
return 0xFFFF
|
||||
value = 0xFFFFFFFF
|
||||
bdf = PCI_BDF( bus&0xFFFF, device&0xFFFF, function&0xFFFF, address&0xFFFF )
|
||||
cfg_addr = bdf.cfg_address()
|
||||
@@ -679,7 +676,6 @@ class RweHelper(Helper):
|
||||
return value
|
||||
|
||||
def write_pci_reg( self, bus, device, function, address, value, size ):
|
||||
#raise UnimplementedNativeAPIError( "write_pci_reg" )
|
||||
bdf = PCI_BDF( bus&0xFFFF, device&0xFFFF, function&0xFFFF, address&0xFFFF )
|
||||
cfg_addr = bdf.cfg_address()
|
||||
self.write_io_port( 0xCF8, cfg_addr, 4 )
|
||||
|
||||
@@ -647,8 +647,6 @@ class Win32Helper(Helper):
|
||||
return
|
||||
|
||||
def read_pci_reg( self, bus, device, function, address, size ):
|
||||
if not self.driver_loaded:
|
||||
return 0xFFFF
|
||||
value = 0xFFFFFFFF
|
||||
bdf = PCI_BDF( bus&0xFFFF, device&0xFFFF, function&0xFFFF, address&0xFFFF )
|
||||
out_length = size
|
||||
|
||||
Reference in New Issue
Block a user