Skip to content

Commit

Permalink
Move files to library folder
Browse files Browse the repository at this point in the history
  • Loading branch information
dscott90 authored and Sae86 committed Mar 22, 2024
1 parent a933b13 commit 0e8192c
Show file tree
Hide file tree
Showing 128 changed files with 365 additions and 369 deletions.
8 changes: 4 additions & 4 deletions chipsec/chipset.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
"""
import errno
import traceback
from typing import Tuple, Union
from typing import Tuple

from chipsec.helper.oshelper import helper as os_helper
from chipsec.helper.basehelper import Helper
from chipsec.helper.nonehelper import NoneHelper
from chipsec.hal import cpu, io, iobar, mmio, msgbus, msr, pci, physmem, ucode, igd, cpuid
from chipsec.exceptions import UnknownChipsetError, OsHelperError
from chipsec.library.exceptions import UnknownChipsetError, OsHelperError

from chipsec.logger import logger
from chipsec.library.logger import logger
from chipsec.library.defines import ARCH_VID
from chipsec.library.register import Register
from chipsec.library.lock import Lock
Expand Down Expand Up @@ -70,7 +70,7 @@ def __init__(self):
self.using_return_codes = False
self.consistency_checking = False
self.lock = Lock(self)
self.register :Register = Register(self)
self.register = Register(self)
self.control = Control(self)
self.device = Device(self)

Expand Down
2 changes: 1 addition & 1 deletion chipsec/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from enum import Enum
import traceback

from chipsec.logger import logger
from chipsec.library.logger import logger
from chipsec.testcase import ExitCode

class BaseCommand:
Expand Down
6 changes: 3 additions & 3 deletions chipsec/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import os
import xml.etree.ElementTree as ET
from chipsec.library.defines import is_hex
from chipsec.exceptions import CSConfigError
from chipsec.file import get_main_dir
from chipsec.logger import logger
from chipsec.library.exceptions import CSConfigError
from chipsec.library.file import get_main_dir
from chipsec.library.logger import logger
from chipsec.parsers import Stage
from chipsec.parsers import stage_info, config_data

Expand Down
6 changes: 3 additions & 3 deletions chipsec/hal/acpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
from collections import namedtuple

from chipsec.library.defines import bytestostring
from chipsec.exceptions import UnimplementedAPIError
from chipsec.file import read_file
from chipsec.library.exceptions import UnimplementedAPIError
from chipsec.library.file import read_file
from chipsec.hal import acpi_tables
from chipsec.hal.hal_base import HALBase
from chipsec.hal.uefi import UEFI
from chipsec.logger import logger, print_buffer_bytes
from chipsec.library.logger import logger, print_buffer_bytes
from chipsec.hal.acpi_tables import ACPI_TABLE

# ACPI Table Header Format
Expand Down
2 changes: 1 addition & 1 deletion chipsec/hal/acpi_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from collections import namedtuple
from uuid import UUID
from typing import List, Optional, Tuple
from chipsec.logger import logger, dump_buffer_bytes
from chipsec.library.logger import logger, dump_buffer_bytes
from chipsec.hal.uefi_common import EFI_GUID_FMT, EFI_GUID_STR


Expand Down
6 changes: 3 additions & 3 deletions chipsec/hal/cmos.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"""
from typing import List
from chipsec.hal import hal_base
import chipsec.logger
import chipsec.library.logger

CMOS_ADDR_PORT_LOW = 0x70
CMOS_DATA_PORT_LOW = 0x71
Expand Down Expand Up @@ -85,6 +85,6 @@ def dump_high(self) -> List[int]:

def dump(self) -> None:
self.logger.log("Low CMOS memory contents:")
chipsec.logger.pretty_print_hex_buffer(self.dump_low())
chipsec.library.logger.pretty_print_hex_buffer(self.dump_low())
self.logger.log("\nHigh CMOS memory contents:")
chipsec.logger.pretty_print_hex_buffer(self.dump_high())
chipsec.library.logger.pretty_print_hex_buffer(self.dump_high())
2 changes: 1 addition & 1 deletion chipsec/hal/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"""
from typing import Dict, List, Tuple, Optional
from chipsec.hal import acpi, hal_base, paging
from chipsec.logger import logger
from chipsec.library.logger import logger

VMM_NONE = 0
VMM_XEN = 0x1
Expand Down
2 changes: 1 addition & 1 deletion chipsec/hal/cpuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

from typing import Tuple
from chipsec.hal import hal_base
from chipsec.logger import logger
from chipsec.library.logger import logger


class CpuID(hal_base.HALBase):
Expand Down
2 changes: 1 addition & 1 deletion chipsec/hal/ec.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"""
from typing import List, Optional
from chipsec.hal import hal_base
from chipsec.logger import print_buffer_bytes
from chipsec.library.logger import print_buffer_bytes

#
# Embedded Controller ACPI ports
Expand Down
4 changes: 2 additions & 2 deletions chipsec/hal/hal_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
Base for HAL Components
"""

import chipsec.logger
import chipsec.library.logger


class HALBase:
def __init__(self, cs):
self.cs = cs
self.logger = chipsec.logger.logger()
self.logger = chipsec.library.logger.logger()
2 changes: 1 addition & 1 deletion chipsec/hal/igd.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

from typing import Optional, Tuple
from chipsec.hal import hal_base
from chipsec.logger import print_buffer_bytes
from chipsec.library.logger import print_buffer_bytes


class IGD(hal_base.HALBase):
Expand Down
2 changes: 1 addition & 1 deletion chipsec/hal/interrupts.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import uuid
from typing import Optional, Tuple
from chipsec.hal import hal_base
from chipsec.logger import logger, print_buffer_bytes
from chipsec.library.logger import logger, print_buffer_bytes
from chipsec.hal.acpi import ACPI
from chipsec.hal.acpi_tables import UEFI_TABLE, GAS
from chipsec.library.defines import bytestostring
Expand Down
2 changes: 1 addition & 1 deletion chipsec/hal/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"""

from typing import List
from chipsec.logger import logger
from chipsec.library.logger import logger


class PortIO:
Expand Down
6 changes: 3 additions & 3 deletions chipsec/hal/iobar.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
"""
from typing import Tuple, List
from chipsec.hal import hal_base
from chipsec.logger import logger
from chipsec.exceptions import IOBARNotFoundError
from chipsec.exceptions import CSReadError
from chipsec.library.logger import logger
from chipsec.library.exceptions import IOBARNotFoundError
from chipsec.library.exceptions import CSReadError

DEFAULT_IO_BAR_SIZE = 0x100

Expand Down
2 changes: 1 addition & 1 deletion chipsec/hal/iommu.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"""

from chipsec.hal import hal_base, mmio, paging
from chipsec.exceptions import IOMMUError
from chipsec.library.exceptions import IOMMUError

IOMMU_ENGINE_DEFAULT = 'VTD'
IOMMU_ENGINE_GFX = 'GFXVTD'
Expand Down
2 changes: 1 addition & 1 deletion chipsec/hal/locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from typing import List, Optional
from chipsec.library.defines import bit, is_set
from chipsec.hal.hal_base import HALBase
from chipsec.exceptions import CSReadError, HWAccessViolationError
from chipsec.library.exceptions import CSReadError, HWAccessViolationError


class LockResult:
Expand Down
4 changes: 2 additions & 2 deletions chipsec/hal/mmio.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"""
from typing import List, Optional, Tuple
from chipsec.hal import hal_base
from chipsec.exceptions import CSReadError
from chipsec.logger import logger
from chipsec.library.exceptions import CSReadError
from chipsec.library.logger import logger
from chipsec.library.defines import get_bits

DEFAULT_MMIO_BAR_SIZE = 0x1000
Expand Down
2 changes: 1 addition & 1 deletion chipsec/hal/msgbus.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

from typing import Optional
from chipsec.hal import hal_base
from chipsec.exceptions import RegisterNotFoundError
from chipsec.library.exceptions import RegisterNotFoundError


#
Expand Down
2 changes: 1 addition & 1 deletion chipsec/hal/msr.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"""

from typing import Dict, Tuple, Optional
from chipsec.logger import logger, print_buffer_bytes
from chipsec.library.logger import logger, print_buffer_bytes


DESCRIPTOR_TABLE_CODE_IDTR = 0
Expand Down
4 changes: 2 additions & 2 deletions chipsec/hal/paging.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import struct
from typing import Dict, List, Optional, Any
import chipsec.library.defines as defines
from chipsec.logger import logger
from chipsec.exceptions import InvalidMemoryAddress
from chipsec.library.logger import logger
from chipsec.library.exceptions import InvalidMemoryAddress

ADDR_MASK = defines.MASK_64b
MAXPHYADDR = 0x000FFFFFFFFFF000
Expand Down
6 changes: 3 additions & 3 deletions chipsec/hal/pci.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
from collections import namedtuple
import itertools
from typing import List, Tuple, Optional
from chipsec.logger import logger, pretty_print_hex_buffer
from chipsec.file import write_file
from chipsec.library.logger import logger, pretty_print_hex_buffer
from chipsec.library.file import write_file
from chipsec.hal.pcidb import VENDORS, DEVICES
from chipsec.exceptions import OsHelperError
from chipsec.library.exceptions import OsHelperError
from chipsec.library.defines import is_all_ones, MASK_16b, MASK_32b, MASK_64b, BOUNDARY_4KB

#
Expand Down
2 changes: 1 addition & 1 deletion chipsec/hal/physmem.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from struct import unpack, pack
from typing import Tuple, Optional
from chipsec.hal.hal_base import HALBase
from chipsec.logger import print_buffer_bytes
from chipsec.library.logger import print_buffer_bytes


class Memory(HALBase):
Expand Down
2 changes: 1 addition & 1 deletion chipsec/hal/smbios.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from typing import Dict, List, Optional, Tuple, Any, Union, Type
from chipsec.library.defines import BOUNDARY_1MB, bytestostring
from chipsec.hal import hal_base, uefi
from chipsec.logger import logger
from chipsec.library.logger import logger

SCAN_LOW_LIMIT = 0xF0000
SCAN_SIZE = 0x10000
Expand Down
2 changes: 1 addition & 1 deletion chipsec/hal/smbus.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"""
from typing import List
from chipsec.hal import iobar, hal_base
from chipsec.exceptions import IOBARNotFoundError, RegisterNotFoundError
from chipsec.library.exceptions import IOBARNotFoundError, RegisterNotFoundError

SMBUS_COMMAND_QUICK = 0
SMBUS_COMMAND_BYTE = 1
Expand Down
2 changes: 1 addition & 1 deletion chipsec/hal/spd.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from typing import Any, List
from collections import namedtuple

from chipsec.logger import logger, print_buffer_bytes
from chipsec.library.logger import logger, print_buffer_bytes

SPD_SMBUS_ADDRESS = 0xA0 # A2, A4, A6, A8, AA, AC, AE
SPD_SMBUS_ADDRESS_DIMM0 = SPD_SMBUS_ADDRESS
Expand Down
6 changes: 3 additions & 3 deletions chipsec/hal/spi.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
import time
from typing import Dict, Tuple, Optional
from chipsec.library.defines import ALIGNED_4KB, BIT0, BIT1, BIT2, BIT5
from chipsec.file import write_file, read_file
from chipsec.logger import print_buffer_bytes
from chipsec.library.file import write_file, read_file
from chipsec.library.logger import print_buffer_bytes
from chipsec.hal import hal_base, mmio
from chipsec.hal.spi_jedec_ids import JEDEC_ID
from chipsec.exceptions import SpiRuntimeError, UnimplementedAPIError
from chipsec.library.exceptions import SpiRuntimeError, UnimplementedAPIError

SPI_READ_WRITE_MAX_DBC = 64
SPI_READ_WRITE_DEF_DBC = 4
Expand Down
2 changes: 1 addition & 1 deletion chipsec/hal/spi_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import struct
from typing import Dict, List, Optional, Tuple
from chipsec.logger import logger, print_buffer_bytes
from chipsec.library.logger import logger, print_buffer_bytes
from chipsec.hal import spi

SPI_FLASH_DESCRIPTOR_SIGNATURE = struct.pack('=I', 0x0FF0A55A)
Expand Down
4 changes: 2 additions & 2 deletions chipsec/hal/spi_uefi.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
from typing import Dict, List, Optional, Union, Any, Callable, TYPE_CHECKING
if TYPE_CHECKING:
from chipsec.hal.uefi_fv import EFI_MODULE
from chipsec.logger import logger
from chipsec.file import write_file, read_file
from chipsec.library.logger import logger
from chipsec.library.file import write_file, read_file
from chipsec.hal.uefi_compression import COMPRESSION_TYPE_LZMA, COMPRESSION_TYPE_EFI_STANDARD, COMPRESSION_TYPES_ALGORITHMS, COMPRESSION_TYPE_UNKNOWN, COMPRESSION_TYPE_LZMAF86
from chipsec.hal.uefi_common import bit_set, EFI_GUID_SIZE, EFI_GUID_FMT
from chipsec.hal.uefi_platform import FWType, fw_types, EFI_NVRAM_GUIDS, EFI_PLATFORM_FS_GUIDS, NVAR_NVRAM_FS_FILE
Expand Down
2 changes: 1 addition & 1 deletion chipsec/hal/tpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from collections import namedtuple
from typing import Dict, Tuple, Callable

from chipsec.logger import print_buffer_bytes
from chipsec.library.logger import print_buffer_bytes
from chipsec.hal import hal_base
import chipsec.hal.tpm12_commands

Expand Down
2 changes: 1 addition & 1 deletion chipsec/hal/tpm12_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import struct
from typing import Dict, Tuple
from chipsec.logger import logger
from chipsec.library.logger import logger

COMMAND_FORMAT = "=HIIIII"

Expand Down
2 changes: 1 addition & 1 deletion chipsec/hal/tpm_eventlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import struct

from typing import Any, Dict, BinaryIO, Optional, Type, TypeVar
from chipsec.logger import logger
from chipsec.library.logger import logger

EventType = TypeVar('EventType', bound='TcgPcrEvent')

Expand Down
4 changes: 2 additions & 2 deletions chipsec/hal/ucode.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import struct
import os
from typing import AnyStr
from chipsec.logger import logger
from chipsec.file import read_file
from chipsec.library.logger import logger
from chipsec.library.file import read_file

IA32_MSR_BIOS_UPDT_TRIG = 0x79
IA32_MSR_BIOS_SIGN_ID = 0x8B
Expand Down
4 changes: 2 additions & 2 deletions chipsec/hal/uefi.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
from chipsec.hal.uefi_common import EFI_VARIABLE_BOOTSERVICE_ACCESS, EFI_VARIABLE_RUNTIME_ACCESS, EFI_VARIABLE_HARDWARE_ERROR_RECORD, SECURE_BOOT_SIG_VAR
from chipsec.hal.uefi_common import IS_VARIABLE_ATTRIBUTE, EFI_TABLE_HEADER_FMT, EFI_SYSTEM_TABLE_SIGNATURE, EFI_RUNTIME_SERVICES_SIGNATURE, EFI_BOOT_SERVICES_SIGNATURE
from chipsec.hal.uefi_common import EFI_DXE_SERVICES_TABLE_SIGNATURE, EFI_CONFIGURATION_TABLE, ACPI_VARIABLE_SET_STRUCT_SIZE
from chipsec.logger import logger, print_buffer_bytes
from chipsec.file import write_file, read_file
from chipsec.library.logger import logger, print_buffer_bytes
from chipsec.library.file import write_file, read_file
from chipsec.library.defines import bytestostring
from chipsec.helper.oshelper import OsHelperError

Expand Down
6 changes: 3 additions & 3 deletions chipsec/hal/uefi_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
from uuid import UUID
from typing import Dict, List, Tuple, Optional, Any, Callable

from chipsec.file import read_file, write_file
from chipsec.logger import logger, dump_buffer, dump_buffer_bytes
from chipsec.library.file import read_file, write_file
from chipsec.library.logger import logger, dump_buffer, dump_buffer_bytes
from chipsec.library.defines import bytestostring

# from chipsec.helper.oshelper import helper
Expand Down Expand Up @@ -438,7 +438,7 @@ def parse_auth_var(db: bytes, decode_dir: str) -> List[bytes]:
var_name = codecs.decode(db[tof:tof + name_size], 'utf-16')
except UnicodeDecodeError:
logger().log_warning(f'Unable to decode {db[tof:tof + name_size]}')
var_name = "chipsec.exceptions!"
var_name = "chipsec.library.exceptions!"
tof += name_size
sig_data = db[tof:tof + cert_data_size]
entries.append(sig_data)
Expand Down
2 changes: 1 addition & 1 deletion chipsec/hal/uefi_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
has_eficomp = False

from typing import List, Any
from chipsec.logger import logger
from chipsec.library.logger import logger

#
# Compression Types
Expand Down
Loading

0 comments on commit 0e8192c

Please sign in to comment.