AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Memory Information?

Ein Thema von Razor · begonnen am 31. Jul 2007 · letzter Beitrag vom 22. Dez 2013
Antwort Antwort
Seite 3 von 5     123 45      
Razor
(Gast)

n/a Beiträge
 
#21

Re: Memory Information?

  Alt 5. Aug 2007, 15:21
Maybe this can help?
Delphi-Quellcode:

unit VIAProHosts;

interface

{$define OMCDrv}
//{$define ATTDrv}

uses
  i2c_h, i2c_dev,
  {$ifdef OMCDrv}
    OMCDrv,
  {$endif}
  {$ifdef ATTDrv}
    ATTDrv,
  {$endif}
  hPCI,
  Windows,
  SysUtils;

function VIAPro_access (var SMBusHost: tSMBusHost; addr, flags: Word; read_write: Byte;
                           command: Byte; size: DWord; var data: i2c_smbus_data): LongInt;
function VIAProGetHost(var SMBInterfaces: tSMBInterfaces; var HostsNum: Byte; HostDevice: tPCIDevice): boolean;
function VIAProFillHostIds: tHostIDs;

implementation

const
  SMBBA1 = $90;
  SMBBA2 = $80;
  SMBBA3 = $D0;

  //Other settings
  MAX_TIMEOUT   = 500;
  ENABLE_INT9   = 0;

  //VT82C596 constants
  VT596_QUICK = $00;
  VT596_BYTE = $04;
  VT596_BYTE_DATA = $08;
  VT596_WORD_DATA = $0C;
  VT596_BLOCK_DATA = $14;

  PCI_VENDOR_ID_VIA = $1106;

  PCI_DEVICE_ID_VIA_82C596_3 = $3050;
  PCI_DEVICE_ID_VIA_82C596B_3   = $3051;
  PCI_DEVICE_ID_VIA_82C686_4   = $3057;
  PCI_DEVICE_ID_VIA_8231_4    = $8235;
  PCI_DEVICE_ID_VIA_8233_0    = $3074;
  PCI_DEVICE_ID_VIA_8233A    = $3147;
  PCI_DEVICE_ID_VIA_8235    = $3177;
  PCI_DEVICE_ID_VIA_8237    = $3227;

var
  viapro_ids: array[0..7] of tHostID =
  (
     (VendorID: PCI_VENDOR_ID_VIA; DeviceID: PCI_DEVICE_ID_VIA_82C596_3),
     (VendorID: PCI_VENDOR_ID_VIA; DeviceID: PCI_DEVICE_ID_VIA_82C596B_3),
     (VendorID: PCI_VENDOR_ID_VIA; DeviceID: PCI_DEVICE_ID_VIA_82C686_4),
     (VendorID: PCI_VENDOR_ID_VIA; DeviceID: PCI_DEVICE_ID_VIA_8231_4),
     (VendorID: PCI_VENDOR_ID_VIA; DeviceID: PCI_DEVICE_ID_VIA_8233_0),
     (VendorID: PCI_VENDOR_ID_VIA; DeviceID: PCI_DEVICE_ID_VIA_8233A),
     (VendorID: PCI_VENDOR_ID_VIA; DeviceID: PCI_DEVICE_ID_VIA_8235),
     (VendorID: PCI_VENDOR_ID_VIA; DeviceID: PCI_DEVICE_ID_VIA_8237)
   );

  //PCI Address Constants

  //SMBus data in configuration space can be found in two places,
  //We try to select the better one

  smb_cf_hstcfg: Word;

function SMBHSTCFG(smb_cf_hstcfg: Word): Word;
begin
  result:=smb_cf_hstcfg;
end;

function SMBSLVC(smb_cf_hstcfg: Word): Word;
begin
  result:=smb_cf_hstcfg + 1;
end;

function SMBSHDW1(smb_cf_hstcfg: Word): Word;
begin
  result:=smb_cf_hstcfg + 2;
end;

function SMBSHDW2(smb_cf_hstcfg: Word): Word;
begin
  result:=smb_cf_hstcfg + 3;
end;

function SMBREV(smb_cf_hstcfg: Word): Word;
begin
  result:=smb_cf_hstcfg + 4;
end;

//SMBus address offsets
function SMBHSTSTS(base: Word): DWord;
begin
  result:=base+0;
end;

function SMBHSLVSTS(base: Word): DWord;
begin
  result:=base+1;
end;

function SMBHSTCNT(base: Word): DWord;
begin
  result:=base+2;
end;

function SMBHSTCMD(base: Word): DWord;
begin
  result:=base+3;
end;

function SMBHSTADD(base: Word): DWord;
begin
  result:=base+4;
end;

function SMBHSTDAT0(base: Word): DWord;
begin
  result:=base+5;
end;

function SMBHSTDAT1(base: Word): DWord;
begin
  result:=base+6;
end;

function SMBBLKDAT(base: Word): DWord;
begin
  result:=base+7;
end;

function SMBSLVCNT(base: Word): DWord;
begin
  result:=base+8;
end;

function SMBSHDWCMD(base: Word): DWord;
begin
  result:=base+9;
end;

function SMBSLVEVT(base: Word): DWord;
begin
  result:=base+$A;
end;

function SMBSLVDAT(base: Word): DWord;
begin
  result:=base+$C;
end;

function vt596_transaction(Base: Word): LongInt;
var
  tmp: Byte;
  temp, res, timeout: integer;
begin
  res:=0;
  timeout:=0;

  tmp:=GetInstance.IPortIORef.B[SMBHSTCNT(Base)];
  tmp:=GetInstance.IPortIORef.B[SMBHSTCMD(Base)];
  tmp:=GetInstance.IPortIORef.B[SMBHSTADD(Base)];
  tmp:=GetInstance.IPortIORef.B[SMBHSTDAT0(Base)];
  tmp:=GetInstance.IPortIORef.B[SMBHSTDAT1(Base)];
  tmp:=0;

   //Make sure the SMBus host is ready to start transmitting
  temp:=GetInstance.IPortIORef.B[SMBHSTSTS(Base)];
  //ShowMessage(format('%x', [temp]));
   if (temp and $1F) <> 0 then
  begin
    //ShowMessage('Here');
    GetInstance.IPortIORef.B[SMBHSTSTS(Base)]:=temp;
    temp:=GetInstance.IPortIORef.B[SMBHSTSTS(Base)];
      if (temp and $1F) <> 0 then
    begin
         result:=-1;
         exit;
      end;
   end;

  //start the transaction by setting bit 6
  tmp:=GetInstance.IPortIORef.B[SMBHSTCNT(Base)];
  GetInstance.IPortIORef.B[SMBHSTCNT(Base)]:=tmp or $40;

  //We will always wait for a fraction of a second!
  //I don't know if VIA needs this, Intel did
  repeat
    sleep(1);
    temp:=GetInstance.IPortIORef.B[SMBHSTSTS(Base)];
    inc(timeout);
  until not(((temp and $01)<>0) and (timeout < MAX_TIMEOUT));

   //If the SMBus is still busy, we give up */
   if (timeout >= MAX_TIMEOUT) then res:=-1;

  if (temp and $10) <> 0 then res:=-1;
   if (temp and $08) <>0 then res:=-1; //Clock stops and slave is stuck in mid-transmission
   if (temp and $04) <> 0 then res:=-1;


  temp:=GetInstance.IPortIORef.B[SMBHSTSTS(Base)];
  if (temp and $1F) <> 0 then
  begin
    GetInstance.IPortIORef.B[SMBHSTSTS(Base)]:=temp;
    temp:=GetInstance.IPortIORef.B[SMBHSTSTS(Base)];
  end;

  tmp:=GetInstance.IPortIORef.B[SMBHSTCNT(Base)];
  tmp:=GetInstance.IPortIORef.B[SMBHSTCMD(Base)];
  tmp:=GetInstance.IPortIORef.B[SMBHSTADD(Base)];
  tmp:=GetInstance.IPortIORef.B[SMBHSTDAT0(Base)];
  tmp:=GetInstance.IPortIORef.B[SMBHSTDAT1(Base)];
  
  result:=res;
end;

function VIAPro_access(var SMBusHost: tSMBusHost; addr, flags: Word; read_write: Byte;
                           command: Byte; size: DWord; var data: i2c_smbus_data): LongInt;
begin

  case size of

    I2C_SMBUS_QUICK: begin
      GetInstance.IPortIORef.B[SMBHSTADD(SMBusHost.base)]:=((addr and $7f) shl 1) or (read_write and $01);
        size:=VT596_QUICK;
    end;
     I2C_SMBUS_BYTE: begin
      GetInstance.IPortIORef.B[SMBHSTADD(SMBusHost.base)]:=((addr and $7f) shl 1) or (read_write and $01);
        if (read_write = I2C_SMBUS_WRITE) then GetInstance.IPortIORef.B[SMBHSTCMD(SMBusHost.base)]:=command;
        size:=VT596_BYTE;
      end;
     I2C_SMBUS_BYTE_DATA: begin
      GetInstance.IPortIORef.B[SMBHSTADD(SMBusHost.base)]:=((addr and $7f) shl 1) or (read_write and $01);
      GetInstance.IPortIORef.B[SMBHSTCMD(SMBusHost.base)]:=command;
        if (read_write = I2C_SMBUS_WRITE) then GetInstance.IPortIORef.B[SMBHSTDAT0(SMBusHost.base)]:=data.ByteData;
        size:=VT596_BYTE_DATA;
      end;
     I2C_SMBUS_WORD_DATA: begin
      GetInstance.IPortIORef.B[SMBHSTADD(SMBusHost.base)]:=((addr and $7f) shl 1) or (read_write and $01);
      GetInstance.IPortIORef.B[SMBHSTCMD(SMBusHost.base)]:=command;
        if (read_write = I2C_SMBUS_WRITE) then
      begin
        GetInstance.IPortIORef.B[SMBHSTDAT0(SMBusHost.base)]:=data.WordData and $ff;
        GetInstance.IPortIORef.B[SMBHSTDAT1(SMBusHost.base)]:=(data.WordData and $ff00) shr 8;
        end;
        size:=VT596_WORD_DATA;
      end;
  end;

  GetInstance.IPortIORef.B[SMBHSTCNT(SMBusHost.base)]:=(size and $1C) + (ENABLE_INT9 and 1);

  if vt596_transaction(SMBusHost.base)=-1 then
  begin
    result:=-1;
    exit;
  end;

  if ((read_write = I2C_SMBUS_WRITE) or (size = VT596_QUICK)) then
  begin
    result:=0;
    exit;
  end;

  case size of
    VT596_BYTE: begin
        //Where is the result put? I assume here it is in
        //SMBHSTDAT0 but it might just as well be in the
        //SMBHSTCMD. No clue in the docs
      data.ByteData:=GetInstance.IPortIORef.B[SMBHSTDAT0(SMBusHost.base)];
      end;
     VT596_BYTE_DATA: begin
      data.ByteData:=GetInstance.IPortIORef.B[SMBHSTDAT0(SMBusHost.base)];
    end;
     VT596_WORD_DATA: begin
      data.WordData:=GetInstance.IPortIORef.B[SMBHSTDAT0(SMBusHost.base)]+(GetInstance.IPortIORef.B[SMBHSTDAT1(SMBusHost.base)] shl 8);
    end;
  end;

end;

function VIAProGetHost(var SMBInterfaces: tSMBInterfaces; var HostsNum: Byte; HostDevice: tPCIDevice): boolean;
var
  DeviceID, wdata: Word;
  pdata: DWord;
  BaseAddr: Byte;
  CurrentHost: DWord;
begin
  inc(HostsNum);
  SetLength(SMBInterfaces, HostsNum);
  CurrentHost:=HostsNum-1;
  
  GetInstance.IPCIIORef.GetPCIRDWord(HostDevice.DevRegs.dwBus, HostDevice.DevRegs.dwDev, HostDevice.DevRegs.dwFunc, 0, pdata);
  DeviceID:=Word(pdata shr 16);
  case DeviceID of
       PCI_DEVICE_ID_VIA_82C596_3: BaseAddr:=SMBBA1;
      PCI_DEVICE_ID_VIA_82C596B_3: BaseAddr:=SMBBA1;
      PCI_DEVICE_ID_VIA_82C686_4:    BaseAddr:=SMBBA1;
      PCI_DEVICE_ID_VIA_8233_0: BaseAddr:=SMBBA3;
      PCI_DEVICE_ID_VIA_8233A: BaseAddr:=SMBBA3;
      PCI_DEVICE_ID_VIA_8235:    BaseAddr:=SMBBA3;
      PCI_DEVICE_ID_VIA_8237:    BaseAddr:=SMBBA3;
      PCI_DEVICE_ID_VIA_8231_4:    BaseAddr:=SMBBA1;
  end;

  GetInstance.IPCIIORef.GetPCIRWord(HostDevice.DevRegs.dwBus, HostDevice.DevRegs.dwDev, HostDevice.DevRegs.dwFunc, BaseAddr, wdata);
  //if not (wdata and 1) <> 0) then

  wdata:=wdata and $fff0;

  SMBInterfaces[CurrentHost].SMBusHosts.base:=wdata;

  //ShowMessage(format('%x', [wdata]));
end;

function VIAProFillHostIds: tHostIDs;
var
  i: byte;
begin
  for i:=Low(viapro_ids) to High(viapro_ids) do
    begin
      SetLength(result, i+1);
      result[i].VendorID := viapro_ids[i].VendorID;
      result[i].DeviceID := viapro_ids[i].DeviceID;
    end;
end;

end.
  Mit Zitat antworten Zitat
Muetze1
(Gast)

n/a Beiträge
 
#22

Re: Memory Information?

  Alt 6. Aug 2007, 01:18
Nice, this should help. Now search for code to access the PCI configuration space to evaluate the SMBus controllers. This you need to gather the I/O port for the SMBus register. After this, access the SMBus as shown in the code above.

Nearly finished: no time to waste, just copy and paste...
  Mit Zitat antworten Zitat
Razor
(Gast)

n/a Beiträge
 
#23

Re: Memory Information?

  Alt 6. Aug 2007, 10:36
Gotcha,make sure you test this Muetze1

Delphi-Quellcode:
unit PCI;

interface

uses OMCDrv, CmnTnC, hPCI;

type
  DWord = LongWord;

  tPCIDevices = record
    DevRegs: tDevRegs;
    ClassDescr, DeviceDescr: string[80];
    DeviceDump: array[0..$FF] of byte;
    Detected: boolean;
  end;

type
  cPCIInfo = class
  private
    DatFileName: string;

    procedure GetClassDescr;
    procedure GetDeviceDescr;

    function GetFileFromResource: string;
    function ReadFromDatFile(Section, Ident, DefValue: string): string;
  public
    PCIDevices: array of tPCIDevices;
    DevCount: byte;
    Scanned: boolean;
    NorthBridge, SouthBridge: tPCIDevices;

    procedure ScanPCIBus;

    constructor Create;
    destructor Destroy;
  end;

function GetPciInfoInstance(): cPCIInfo;

implementation

uses SysUtils, Classes, Windows, Dialogs;

var
  this_: cPCIInfo;

function GetPciInfoInstance(): cPCIInfo;
begin
  if (not Assigned(this_)) then this_ := cPCIInfo.Create;
  result := this_;
end;

{$I DevClass.inc}
{$R PCIInfoData.res}

constructor cPCIInfo.Create;
begin
  inherited Create;
  Scanned := false;
  ScanPCIBus;
end;

procedure cPCIInfo.ScanPCIBus;
var
  dwBus, dwDev, dwFunc: byte;
  pdata: DWord;
  bdata, DevInd, i: byte;
begin
  if not GetInstance.isLoad then exit;
  DevCount:=0;
  SetLength(PCIDevices,DevCount);
  for dwBus:=0 to 255 do
    for dwDev:=0 to 31 do
      begin
        if not GetInstance.IPCIIORef.ProbeDevice(dwBus, dwDev) then continue;
        for dwFunc:=0 to 7 do
          begin
            GetInstance.IPCIIORef.GetPCIRDWord(dwBus, dwDev, dwFunc, 0, pdata);
            if pdata=$FFFFFFFF then continue;
            if dwFunc=0 then DevInd:=DevCount;
            GetInstance.IPCIIORef.GetPCIRDWord(dwBus, dwDev, dwFunc, 8, pdata);
            if DevInd>=1 then
              begin
                pdata:=(pdata shr 8);
                if pdata=PCIDevices[DevInd].DevRegs.ClassCode then continue;
              end;
            inc(DevCount);
            SetLength(PCIDevices,DevCount);

            PCIDevices[DevCount-1].DevRegs.dwBus:=dwBus;
            PCIDevices[DevCount-1].DevRegs.dwDev:=dwDev;
            PCIDevices[DevCount-1].DevRegs.dwFunc:=dwFunc;

            GetInstance.IPCIIORef.GetPCIRDWord(dwBus, dwDev, dwFunc, 0, pdata);
            PCIDevices[DevCount-1].DevRegs.VendorID:=Word(pdata);
            PCIDevices[DevCount-1].DevRegs.DeviceID:=Word(pdata shr 16);

            GetInstance.IPCIIORef.GetPCIRDWord(dwBus, dwDev, dwFunc, 8, pdata);
            PCIDevices[DevCount-1].DevRegs.RID := Byte(pdata);
            PCIDevices[DevCount-1].DevRegs.ClassCode:=pdata shr 8;

            GetInstance.IPCIIORef.GetPCIRDWord(dwBus, dwDev, dwFunc, $2C, pdata);
            PCIDevices[DevCount-1].DevRegs.SVID := Word(pdata);
            PCIDevices[DevCount-1].DevRegs.SID := Word(pdata shr 16);
            
            for i:=0 to $FF do
              begin
                GetInstance.IPCIIORef.GetPCIRByte(dwBus, dwDev, dwFunc, i, bdata);
                PCIDevices[DevCount-1].DeviceDump[i]:=bdata;
              end;
          end;
      end;
  GetClassDescr;
  DatFileName:=GetFileFromResource;
  GetDeviceDescr;
  Scanned := true;
end;

procedure cPCIInfo.GetClassDescr;
var
  i, j: byte;
begin
  for i:=Low(PCIDevices) to High(PCIDevices) do
    begin
      for j:=Low(fDevClassTable) to High (fDevClassTable) do
        begin
          if PCIDevices[i].DevRegs.ClassCode = fDevClassTable[j].DevClass then
            begin
              PCIDevices[i].ClassDescr:=fDevClassTable[j].ClassDescr;
              break;
            end;
        end;
    end;
end;

procedure cPCIInfo.GetDeviceDescr;
  function IntToHexForm(val: integer; index: byte): string;
  var
    i: byte;
  begin
    result:=(format('%x',[val]));
    for i:=1 to index-Length(result) do
      insert('0', result, 0);
  end;
var
  i, j: byte;
  ident: string;
begin
  for i:=Low(PCIDevices) to High(PCIDevices) do
    begin
      ident:=IntToHexForm(PCIDevices[i].DevRegs.VendorID, 4)+IntToHexForm(PCIDevices[i].DevRegs.DeviceID, 4);
      case PCIDevices[i].DevRegs.ClassCode of
        $060000: begin
          PCIDevices[i].DeviceDescr:=ReadFromDatFile('NorthBridge', ident, 'Unknown device');
          if NorthBridge.Detected then continue;
          NorthBridge.DevRegs.VendorID:=PCIDevices[i].DevRegs.VendorID;
          NorthBridge.DevRegs.DeviceID:=PCIDevices[i].DevRegs.DeviceID;
          NorthBridge.DevRegs.ClassCode:=PCIDevices[i].DevRegs.ClassCode;
          NorthBridge.DevRegs.dwBus:=PCIDevices[i].DevRegs.dwBus;
          NorthBridge.DevRegs.dwDev:=PCIDevices[i].DevRegs.dwDev;
          NorthBridge.DevRegs.dwFunc:=PCIDevices[i].DevRegs.dwFunc;
          NorthBridge.DeviceDescr:=PCIDevices[i].DeviceDescr;
          NorthBridge.Detected:=true;
        end;
        $060100, $060200: begin
          PCIDevices[i].DeviceDescr:=ReadFromDatFile('SouthBridge', ident, 'Unknown device');
          if SouthBridge.Detected then continue;
          SouthBridge.DevRegs.VendorID:=PCIDevices[i].DevRegs.VendorID;
          SouthBridge.DevRegs.DeviceID:=PCIDevices[i].DevRegs.DeviceID;
          SouthBridge.DevRegs.ClassCode:=PCIDevices[i].DevRegs.ClassCode;
          SouthBridge.DevRegs.dwBus:=PCIDevices[i].DevRegs.dwBus;
          SouthBridge.DevRegs.dwDev:=PCIDevices[i].DevRegs.dwDev;
          SouthBridge.DevRegs.dwFunc:=PCIDevices[i].DevRegs.dwFunc;
          SouthBridge.DeviceDescr:=PCIDevices[i].DeviceDescr;
          SouthBridge.Detected:=true;
        end;
      end;
    end;
end;

function cPCIInfo.GetFileFromResource: string;
var
  TR:TResourceStream;
  lpBuffer: array[0..255] of Char;
begin
  GetWindowsDirectory(lpBuffer, 255);
  result:=StrPas(lpBuffer)+'\PCIinfo.dat';
  try
    DeleteFile(PAnsiChar(result));
  except
  end;
  if FileExists(result) then exit;
  TR:=TResourceStream.Create(0, 'PCIINFODATA', RT_RCDATA);
  TR.SaveToFile(result);
  TR.Free;
end;

function cPCIInfo.ReadFromDatFile(Section, Ident, DefValue: string): string;
var
  DatFile: TextFile;
  TmpStr, TmpStr2: string;
  i: DWord;
begin
  try
  //ShowMessage(Ident); //debug message
  AssignFile(DatFile, DatFileName);
  Reset(DatFile);
  result:=DefValue;
  //Finding proper section
  while not eof(DatFile) do
    begin
      readln(DatFile, TmpStr);
      if TmpStr<>'then
      if TmpStr[1]='[then
        begin
          Delete(TmpStr, 1, 1); Delete(TmpStr, length(TmpStr), 1);
          if TmpStr=Section then
            begin
              while not eof(DatFile) do
                begin
                  readln(DatFile, TmpStr);
                  if TmpStr<>'then
                  if TmpStr[1]<>';then
                    begin
                      if TmpStr[1]='[then exit;
                      TmpStr2:=Copy(TmpStr, 1, 8);
                      if TmpStr2=Ident then
                                         begin
                                           result:=Copy(TmpStr, 10, length(TmpStr)-10+1);
                                           exit;
                                         end;
                    end;
                end;
            end;
        end;
    end;
  CloseFile(DatFile);
  except
    result:=DefValue;
  end;
end;

destructor cPCIInfo.Destroy;
begin
  DevCount:=0;
  SetLength(PCIDevices,DevCount);
  try
    DeleteFile(PAnsiChar(DatFileName));
  except
  end;
  inherited Destroy;
end;

initialization
  this_ := nil;

finalization
  if (Assigned(this_)) then this_.Destroy;

end.
  Mit Zitat antworten Zitat
Muetze1
(Gast)

n/a Beiträge
 
#24

Re: Memory Information?

  Alt 6. Aug 2007, 12:03
Zitat von Razor:
Gotcha,make sure you test this Muetze1
I won't do anything. You've collected all needed sources in this thread. You have to combine all to a running application and your base problem is solved...
  Mit Zitat antworten Zitat
Razor
(Gast)

n/a Beiträge
 
#25

Re: Memory Information?

  Alt 6. Aug 2007, 12:10
Okay where do i put base address in?
  Mit Zitat antworten Zitat
Muetze1
(Gast)

n/a Beiträge
 
#26

Re: Memory Information?

  Alt 6. Aug 2007, 14:16
Zitat von Razor:
Okay where do i put base address in?
The base address is available in the port configuration values of the SMBus controller from the PCI information. Your PCI code example only cares about the north/southbridge but not really about the different devices of them. Take a look at Craig's PCI32 program
  Mit Zitat antworten Zitat
Razor
(Gast)

n/a Beiträge
 
#27

Re: Memory Information?

  Alt 6. Aug 2007, 14:37
Ok i tested this monster can i somehow convert this to a normal project?I want to display the info in a listbox?Or maybe memo..
  Mit Zitat antworten Zitat
Razor
(Gast)

n/a Beiträge
 
#28

Re: Memory Information?

  Alt 9. Aug 2007, 20:19
spd bus specification http://www.rambus.com/assets/documen...40-SPDSpec.pdf



Delphi-Quellcode:
unit Memory;

interface



type
  DWord = LongWord;

  tCtrl_Info = packed record
    index, poll, cap, mode: integer;
    dwBus, dwDev, dwFunc: DWord;
  end;

  tTimings = packed record
    CAS, RCD, RP, RAS: single;
  end;

  tgRAMInfo = packed record
    DRAMClock: double;
    RamSize: DWord;
    DRAMCoef, DRAMCnls, DRAMType, DRAMAccel: string;
  end;

  tGetFSBMethod = procedure (lCPUClock, FSB: double; Mult: single; var GRAMInfo: tGRAMInfo);
  tGetTmngsMethod = procedure (var Timings: tTimings; var gRAMInfo: tGRAMInfo);
  tSetupECCMethod = procedure;

  Memory_Controller = packed record
     VendorID, DeviceID: Word;
     name: string;
     tested: integer;
    GetFSBMethod: tGetFSBMethod;
    GetTmngsMethod: tGetTmngsMethod;
    SetupECCMethod: tSetupECCMethod;
  end;

  cMemory = class
  private
  public
    fCtrl_Info: tCtrl_Info;
    fTimings: tTimings;
    fgRAMInfo: tgRAMInfo;

    constructor Create;
    destructor Destroy; override;

    procedure DetectMemCtrl;
    function GetPhysMemSize: DWord;
    procedure FillMemCtrlInfo(lCPUClock, FSB: double; Mult: single);
  end;

var
  MemInfo: cMemory;

implementation

uses SysUtils, Windows, Dialogs;

//nVidia nForce 2 Methods
procedure poll_fsb_nf2(lCPUClock, FSB: double; Mult: single; var gRAMInfo: tGRAMInfo);
var
  mempll: DWord;
  mem_m, mem_n: byte;
begin
  //Get the coef (COEF = N/M) - Here is for Crush17
  GetInstance.IPCIIORef.GetPCIRDWord(0, 0, 3, $70, mempll);
   mem_m:=mempll and $0F;
   mem_n:=(mempll shr 4) and $0F;

  //ShowMessage(format('%x', [oHWIO.MemReadLong($5620)]));


  //If something goes wrong, the chipset is probably a Crush18
   if (mem_m = 0) or (mem_n = 0) then
  begin
      GetInstance.IPCIIORef.GetPCIRDWord(0, 0, 3, $7C, mempll);
      mem_m:=mempll and $0F;
      mem_n:=(mempll shr 4) and $0F;
   end;

  //Computing DRAM Frequency
  gRAMInfo.DRAMClock:=FSB*(mem_n/mem_m);

  //Forming DRAM : FSB Divider
  if (mem_n = mem_m) then gRAMInfo.DRAMCoef:='1:1'
                     else gRAMInfo.DRAMCoef:=IntToStr(mem_m)+':'+IntToStr(mem_n);
end;

procedure poll_timings_nf2(var Timings: tTimings; var gRAMInfo: tGRAMInfo);
var
  dramtlr, dramtlr2, dramtlr3, temp: DWord;
   dimm1p, dimm2p, dimm3p: DWord;
begin
  GetInstance.IPCIIORef.GetPCIRDWord(0, 0, 1, $90, dramtlr);
  GetInstance.IPCIIORef.GetPCIRDWord(0, 0, 1, $A0, dramtlr2);
  GetInstance.IPCIIORef.GetPCIRDWord(0, 0, 1, $84, dramtlr3);
  GetInstance.IPCIIORef.GetPCIRDWord(0, 0, 2, $40, dimm1p);
  GetInstance.IPCIIORef.GetPCIRDWord(0, 0, 2, $44, dimm2p);
  GetInstance.IPCIIORef.GetPCIRDWord(0, 0, 2, $48, dimm3p);

  //CAS Latency (tCAS)
   temp:=(dramtlr2 shr 4) and $7;
  if (temp = $2) then Timings.CAS:=2
  else if (temp = $6) then Timings.CAS:=2.5
  else if (temp = $3) then Timings.CAS:=3;

   //RAS-To-CAS (tRCD)
   Timings.RCD:=(dramtlr shr 20) and $F;

   //RAS Precharge (tRP)
   Timings.RP:=(dramtlr shr 28) and $F;

   //RAS Active to precharge (tRAS)
   Timings.RAS:=(dramtlr shr 15) and $F;

   //Print 64 or 128 bits mode
   //If DIMM1 & DIMM3 or DIMM1 & DIMM2 populated, than Dual Channel.

   if (((dimm3p and 1)+(dimm2p and 1) = 2) or ((dimm3p and 1)+(dimm1p and 1) = 2)) then gRAMInfo.DRAMCnls:='Dual'
  else gRAMInfo.DRAMCnls:='Single';

  gRAMInfo.DRAMType:='DDR-SDRAM'
end;

//AMD64 Methods
procedure poll_fsb_amd64(lCPUClock, FSB: double; Mult: single; var gRAMInfo: tGRAMInfo);
var
  dramchr, temp: DWord;
  clockratio: single;
begin
  GetInstance.IPCIIORef.GetPCIRDWord(0, 24, 2, $94, dramchr);
  temp:=(dramchr shr 20) and $7;
   clockratio:=Mult;

  case temp of
    $0:   clockratio:=trunc(Mult*2.0);
      $2:   clockratio:=trunc((Mult*3.0/2.0)+0.81);
      $4: clockratio:=trunc((Mult*4.0/3.0)+0.81);
      $5: clockratio:=trunc((Mult*6.0/5.0)+0.81);
      $6: clockratio:=trunc((Mult*10.0/9.0)+0.81);
      $7: clockratio:=trunc(Mult+0.81);
  end;

  gRAMInfo.DRAMClock:=lCPUClock/clockratio;

  gRAMInfo.DRAMCoef:='CPU/'+IntToStr(trunc(clockratio));
end;

procedure poll_timings_amd64(var Timings: tTimings; var gRAMInfo: tGRAMInfo);
var
  dramtlr, dramclr, temp: DWord;
begin
  GetInstance.IPCIIORef.GetPCIRDWord(0, 24, 2, $88, dramtlr);
   GetInstance.IPCIIORef.GetPCIRDWord(0, 24, 2, $90, dramclr);

  //CAS Latency (tCAS)
   temp:=dramtlr and $7;
  if (temp = $1) then Timings.CAS:=2
  else if (temp = $2) then Timings.CAS:=3
  else if (temp = $5) then Timings.CAS:=2.5;

   //RAS-To-CAS (tRCD)
   Timings.RCD:=(dramtlr shr 12) and $7;

   //RAS Precharge (tRP)
   Timings.RP:=(dramtlr shr 24) and $7;

   //RAS Active to precharge (tRAS)
   Timings.RAS:=(dramtlr shr 20) and $F;

   if (((dramclr shr 16) and 1) = 1) then gRAMInfo.DRAMCnls:='Dual'
  else gRAMInfo.DRAMCnls:='Single';

  gRAMInfo.DRAMType:='DDR-SDRAM'
end;

//nVidia nForce 4 SLI Intel Edition
procedure poll_fsb_nf4ie(lCPUClock, FSB: double; Mult: single; var gRAMInfo: tGRAMInfo);
var
   mratio, nratio: byte;
   reg60: DWord;
  reg74: Word;
  DRAMRatio: double;
begin

   //Find dramratio
   GetInstance.IPCIIORef.GetPCIRWord(0, 0, 2, $74, reg74);
   GetInstance.IPCIIORef.GetPCIRDWord(0, 0, 2, $60, reg60);
   mratio:=reg74 and $F;
   nratio:=(reg74 shr 4) and $F;

   //If M or N = 0, then M or N = 16
   if (mratio = 0) then mratio:=16;
   if (nratio = 0) then nratio:=16;

   //Check if synchro or pseudo-synchro mode
   if (((reg60 shr 22) and 1) = 1) then DRAMRatio:=1
  else DRAMRatio:=nratio/mratio;

  gRAMInfo.DRAMClock:=FSB*DRAMRatio;

  if (DRAMRatio = 1) then gRAMInfo.DRAMCoef:='1:1'
  else gRAMInfo.DRAMCoef:=IntToStr(mratio)+':'+IntToStr(nratio);
end;

procedure poll_timings_nf4ie(var Timings: tTimings; var gRAMInfo: tGRAMInfo);
var
  regd0, reg8c, reg9c: DWord;
  reg80: byte;
begin
   //Now, read Registers
   GetInstance.IPCIIORef.GetPCIRDWord( 0, 1, 1, $D0, regd0);
   GetInstance.IPCIIORef.GetPCIRByte( 0, 1, 1, $80, reg80);
   GetInstance.IPCIIORef.GetPCIRDWord( 0, 1, 0, $8C, reg8c);
   GetInstance.IPCIIORef.GetPCIRDWord( 0, 1, 0, $9C, reg9c);

  //Then, detect timings
   Timings.CAS:=(regd0 shr 4) and $7;
   Timings.RCD:=(reg8c shr 24) and $F;
   Timings.RP:=(reg9c shr 8) and $F;
   Timings.RAS:=(reg8c shr 16) and $3F;

   if ((reg80 and $3) <> 0) then gRAMInfo.DRAMCnls:='Dual'
  else gRAMInfo.DRAMCnls:='Single';

  gRAMInfo.DRAMType:='DDRII-SDRAM'
end;


//Intel i875 Methods

procedure poll_fsb_i875(lCPUClock, FSB: double; Mult: single; var gRAMInfo: tGRAMInfo);

var

  smfs: DWord;

  mchcfg: Word;

  DRAMRatio: single;

begin

   GetInstance.IPCIIORef.GetPCIRWord(0, 0, 0, $C6, mchcfg);

   smfs:=(mchcfg shr 10) and 3;


  DRAMRatio:=1;

  gRAMInfo.DRAMCoef:='1:1';

  if ((mchcfg and 3) = 3) then begin DRAMRatio:=1; gRAMInfo.DRAMCoef:='1:1'; end;

   if ((mchcfg and 3) = 2) then

  begin

      if (smfs = 2) then begin DRAMRatio:=1; gRAMInfo.DRAMCoef:='1:1'; end;
      if (smfs = 1) then begin DRAMRatio:=1.25; gRAMInfo.DRAMCoef:='5:4'; end;
      if (smfs = 0) then begin DRAMRatio:=1.5; gRAMInfo.DRAMCoef:='3:2'; end;
   end;

  if ((mchcfg and 3) = 1) then

  begin

    if (smfs = 2) then begin DRAMRatio:=0.6666666666; gRAMInfo.DRAMCoef:='2:3'; end;
      if (smfs = 1) then begin DRAMRatio:=0.8; gRAMInfo.DRAMCoef:='4:5'; end;
      if (smfs = 0) then begin DRAMRatio:=1; gRAMInfo.DRAMCoef:='1:1'; end;
   end;
   if ((mchcfg and 3) = 0) then begin DRAMRatio:=0.75; gRAMInfo.DRAMCoef:='3:4'; end;


  gRAMInfo.DRAMClock:=FSB/DRAMRatio;

end;


procedure poll_timings_i875(var Timings: tTimings; var gRAMInfo: tGRAMInfo);

var

  dev6, dev62, temp: DWord;

  tmp1, tmp2: DWord;

begin

   //Read the MMR Base Address & Define the pointer

   GetInstance.IPCIIORef.GetPCIRDWord(0, 6, 0, $10, dev6);


   //Now, the PAT ritual ! (Kant and Luciano will love this)

   GetInstance.IPCIIORef.GetPCIRDWord(0, 6, 0, $40, dev62);

  tmp2:=GetInstance.MemReadLong(dev6+$68);
  tmp1:=GetInstance.MemReadLong(dev6+$60);

  if (((dev62 and $3) = 0) and (((tmp2 shr 14) and 1) = 1)) then gRAMInfo.DRAMAccel:='Enabled'
  else gRAMInfo.DRAMAccel:='Disabled';


   //CAS Latency (tCAS)

   temp:=(tmp1 shr 5) and $3;
   if (temp = $0) then Timings.CAS:=2.5
  else if (temp = $1) then Timings.CAS:=2
  else Timings.CAS:=3;

   //RAS-To-CAS (tRCD)
   temp:=(tmp1 shr 2) and $3;
   if (temp = $0) then Timings.RCD:=4
  else if (temp = $1) then Timings.RCD:=3
  else Timings.RCD:= 2;

   //RAS Precharge (tRP)
   temp:=tmp1 and $3;
   if (temp = $0) then Timings.RP:=4
  else if (temp = $1) then Timings.RP:=3
  else Timings.RP:=2;

   //RAS Active to precharge (tRAS)
   temp:=(tmp1 shr 7) and $7;
   Timings.RAS:=10-temp;


  //64 or 128 bits mode

   if (((tmp2 shr 21) and 3) > 0) then gRAMInfo.DRAMCnls:='Dual'

  else gRAMInfo.DRAMCnls:='Single';

  gRAMInfo.DRAMType:='DDR-SDRAM'
end;

//Intel i925 Methods
procedure poll_fsb_i925(lCPUClock, FSB: double; Mult: single; var gRAMInfo: tGRAMInfo);
var
  mchcfg, mchcfg2, dev0, drc, idetect, tmp: DWord;
  DRAMRatio: single;
begin
   GetInstance.IPCIIORef.GetPCIRDWord(0, 0, 0, $02, idetect);
  idetect:=(idetect shr 16) and $FFFF;

   //Find dramratio
   GetInstance.IPCIIORef.GetPCIRDWord(0, 0, 0, $44, dev0);
   dev0:=dev0 and $FFFFC000;
  tmp:=GetInstance.MemReadLong(dev0+$C00);
   mchcfg:=tmp and $FFFF;
  tmp:=GetInstance.MemReadLong(dev0+$120);
   drc:=tmp and $FFFF;
   DRAMRatio:=1;
  gRAMInfo.DRAMCoef:='1:1';

  mchcfg2:=(mchcfg shr 4) and 3;

   if ((drc and 3) <> 2) then
  begin
      // We are in DDR1 Mode
      if (mchcfg2 = 1) then begin DRAMRatio:=0.8; gRAMInfo.DRAMCoef:='5:4'; end
    else begin DRAMRatio:=1; gRAMInfo.DRAMCoef:='1:1'; end;
  end
  else begin
      // We are in DDR2 Mode
      if (((mchcfg shr 2) and 1) = 1) then
    begin
         // We are in FSB1066 Mode
         if (mchcfg2 = 2) then begin DRAMRatio:=0.75; gRAMInfo.DRAMCoef:='4:3'; end
      else begin DRAMRatio:=1; gRAMInfo.DRAMCoef:='1:1'; end;
    end
    else
         case mchcfg2 of
        1: begin DRAMRatio:=0.66667; gRAMInfo.DRAMCoef:='3:2'; end;
            2: if (idetect<>$2590) then begin DRAMRatio:=1; gRAMInfo.DRAMCoef:='1:1'; end
           else begin DRAMRatio:=1.5; gRAMInfo.DRAMCoef:='2:3'; end;
            3: begin
                  // Checking for FSB533 Mode & Alviso
                  if ((mchcfg and 1) = 0) then begin DRAMRatio:=1.33334; gRAMInfo.DRAMCoef:='3:4'; end
                  else if (idetect = $2590) then begin DRAMRatio:=2; gRAMInfo.DRAMCoef:='2:1'; end
                  else begin DRAMRatio:=1.5; gRAMInfo.DRAMCoef:='2:3'; end;
        end;
        end
  end;
  gRAMInfo.DRAMClock:=FSB*DRAMRatio;
end;

procedure poll_timings_i925(var Timings: tTimings; var gRAMInfo: tGRAMInfo);
var
  dev0, drt, drc, dcc, idetect, temp, tmp: DWord;
begin
   //Now, read MMR Base Address
   GetInstance.IPCIIORef.GetPCIRDWord(0, 0, 0, $44, dev0);
   GetInstance.IPCIIORef.GetPCIRDWord(0, 0, 0, $02, idetect);
  idetect:=(idetect shr 16) and $FFFF;
   dev0:=dev0 and $FFFFC000;

   //Set pointer for DRT
  tmp:=GetInstance.MemReadLong(dev0+$114);
   drt:=tmp and $FFFFFFFF;

   //Set pointer for DRC
  tmp:=GetInstance.MemReadLong(dev0+$120);
   drc:=tmp and $FFFFFFFF;

   //Set pointer for DCC
  tmp:=GetInstance.MemReadLong(dev0+$200);
   dcc:=tmp and $FFFFFFFF;

   //CAS Latency (tCAS)
   temp:=(drt shr 8) and $3;

  if ((drc and 3) = 2) then
  begin
      // Timings DDR-II
    gRAMInfo.DRAMType:='DDRII-SDRAM';
      if (temp = $0) then Timings.CAS:=5
      else if (temp = $1) then Timings.CAS:=4
      else Timings.CAS:=3;
  end
  else begin
      // Timings DDR-I
    gRAMInfo.DRAMType:='DDR-SDRAM';
      if (temp = $0) then Timings.CAS:=3
      else if (temp = $1) then Timings.CAS:=2.5
      else Timings.CAS:=2;
   end;

   //RAS-To-CAS (tRCD)
  Timings.RCD:=((drt shr 4) and $3)+2;

   //RAS Precharge (tRP)
  Timings.RP:=(drt and $3)+2;

   //RAS Active to precharge (tRAS)
   //If Lakeport, than change tRAS computation (Thanks to CDH, again)
   if (idetect = $2770) or (idetect = $2774) then Timings.RAS:=(drt shr 19) and $1F
   else Timings.RAS:=(drt shr 20) and $F;

   temp:=dcc and $3;
   if (temp = 1) then gRAMInfo.DRAMCnls:='Dual'
   else if (temp = 2) then gRAMInfo.DRAMCnls:='Dual'
   else gRAMInfo.DRAMCnls:='Single';
end;

//Intel i945 Methods
procedure poll_fsb_i945(lCPUClock, FSB: double; Mult: single; var gRAMInfo: tGRAMInfo);
var
   mchcfg, dev0, tmp: DWord;
  DRAMRation: single;
begin
   //Find dramratio
   GetInstance.IPCIIORef.GetPCIRDWord(0, 0, 0, $44, dev0);
  dev0:=dev0 and $FFFFC000;
  tmp:=GetInstance.MemReadLong(dev0+$C00);
   mchcfg:=tmp and $FFFF;
  DRAMRation:=1;

  case ((mchcfg shr 4) and 7) of
    1: begin DRAMRation:=1; gRAMInfo.DRAMCoef:='1:1'; end;
      2: begin DRAMRation:=1.33334; gRAMInfo.DRAMCoef:='3:4'; end;
      3: begin DRAMRation:=1.66667; gRAMInfo.DRAMCoef:='3:5'; end;
      4: begin DRAMRation:=2; gRAMInfo.DRAMCoef:='1:2'; end;
  end;

  gRAMInfo.DRAMClock:=FSB*DRAMRation;
end;

//KT266 Methods
procedure poll_fsb_kt266(lCPUClock, FSB: double; Mult: single; var gRAMInfo: tGRAMInfo);
var
  reg69: Byte;
begin
  GetInstance.IPCIIORef.GetPCIRByte(0, 0, 0, $69, reg69);
  reg69:=(reg69 shr 6) and $3;

  case reg69 of
    0: begin gRAMInfo.DRAMCoef:='1:1'; gRAMInfo.DRAMClock:=FSB; end;
    1: begin gRAMInfo.DRAMCoef:='FSB+33'; gRAMInfo.DRAMClock:=FSB+33; end;
    2: begin gRAMInfo.DRAMCoef:='FSB-33'; gRAMInfo.DRAMClock:=FSB-33; end;
    3: begin gRAMInfo.DRAMCoef:='FSB+66'; gRAMInfo.DRAMClock:=FSB+66; end;
  end;
end;

procedure poll_timings_kt266(var Timings: tTimings; var gRAMInfo: tGRAMInfo);
var
  reg60, reg64: Byte;
begin
  GetInstance.IPCIIORef.GetPCIRByte(0, 0, 0, $60, reg60);
  GetInstance.IPCIIORef.GetPCIRByte(0, 0, 0, $64, reg64);

  //CAS Latency (tCAS)
  reg60:=reg60 and $F;
  if (reg60 = 0) then //SDR-SDRAM
  begin
    gRAMInfo.DRAMType:='SDR-SDRAM';
    case ((reg64 shr 4) and $3) of
      0: Timings.CAS:=1;
      1: Timings.CAS:=2;
      2: Timings.CAS:=3;
    end;
  end
  else begin //DDR-SDRAM
    gRAMInfo.DRAMType:='DDR-SDRAM';
    case ((reg64 shr 4) and $3) of
      1: Timings.CAS:=2;
      2: Timings.CAS:=2.5;
      3: Timings.CAS:=3;
    end;
  end;

    //RAS-To-CAS (tRCD)
  if ((reg64 shr 2) and $1) = 1 then Timings.RCD:=3
  else Timings.RCD:=2;

   //RAS Precharge (tRP)
  if ((reg64 shr 7) and $1) = 1 then Timings.RP:=3
  else Timings.RP:=2;

  //RAS Active to precharge (tRAS)
   if ((reg64 shr 6) and $1) = 1 then Timings.RAS:=6
  else Timings.RAS:=5;
end;

//CN333 Methods
procedure poll_fsb_cn333(lCPUClock, FSB: double; Mult: single; var gRAMInfo: tGRAMInfo);
var
  reg68: Byte;
begin
  GetInstance.IPCIIORef.GetPCIRByte(0, 0, 3, $68, reg68);
  reg68:=reg68 and $F;

  case reg68 of
    0: begin gRAMInfo.DRAMCoef:='1:1'; gRAMInfo.DRAMClock:=FSB; end;
    1: begin gRAMInfo.DRAMCoef:='FSB+33'; gRAMInfo.DRAMClock:=FSB+33; end;
    5: begin gRAMInfo.DRAMCoef:='FSB+66'; gRAMInfo.DRAMClock:=FSB+66; end;
  end;
end;

procedure poll_timings_cn333(var Timings: tTimings; var gRAMInfo: tGRAMInfo);
var
  reg56: Byte;
begin
  GetInstance.IPCIIORef.GetPCIRByte(0, 0, 3, $56, reg56);

  //CAS Latency (tCAS)
  Timings.CAS:=(((reg56 shr 4) and 3)+3)/2;

  //RAS-To-CAS (tRCD)
  Timings.RCD:=((reg56 shr 2) and 3)+2;

  //RAS Precharge (tRP)
  Timings.RP:=(reg56 and 3)+2;

  //RAS Active to precharge (tRAS)
  Timings.RAS:=((reg56 shr 6) and 3)+6;
end;

const
  KnownControllers = 27;
  
var
  Controllers: array[1..KnownControllers] of Memory_Controller =
  (
    //AMD
    (VendorID: $1022; DeviceID: $1100; name: 'AMD 8000'; tested: 0; GetFSBMethod: poll_fsb_amd64; GetTmngsMethod: poll_timings_amd64; SetupECCMethod: nil),
    (VendorID: $1022; DeviceID: $7454; name: 'AMD 8000'; tested: 0; GetFSBMethod: poll_fsb_amd64; GetTmngsMethod: poll_timings_amd64; SetupECCMethod: nil),
    //ALI
    (VendorID: $10b9; DeviceID: $1687; name: 'ALI M1687'; tested: 0; GetFSBMethod: poll_fsb_amd64; GetTmngsMethod: poll_timings_amd64; SetupECCMethod: nil),
    (VendorID: $10b9; DeviceID: $1689; name: 'ALI M1689'; tested: 0; GetFSBMethod: poll_fsb_amd64; GetTmngsMethod: poll_timings_amd64; SetupECCMethod: nil),
    (VendorID: $10b9; DeviceID: $1695; name: 'ALI M1695'; tested: 0; GetFSBMethod: poll_fsb_amd64; GetTmngsMethod: poll_timings_amd64; SetupECCMethod: nil),
    //ATI
    (VendorID: $1002; DeviceID: $5950; name: 'ATI RS482'; tested: 0; GetFSBMethod: poll_fsb_amd64; GetTmngsMethod: poll_timings_amd64; SetupECCMethod: nil),
    //nVidia
    (VendorID: $10de; DeviceID: $01A4; name: 'nVidia nForce'; tested: 0; GetFSBMethod: nil; GetTmngsMethod: nil; SetupECCMethod: nil),
    (VendorID: $10de; DeviceID: $01E0; name: 'nVidia nForce2 SPP'; tested: 0; GetFSBMethod: poll_fsb_nf2; GetTmngsMethod: poll_timings_nf2; SetupECCMethod: nil),
    (VendorID: $10de; DeviceID: $00D1; name: 'nVidia nForce3'; tested: 0; GetFSBMethod: poll_fsb_amd64; GetTmngsMethod: poll_timings_amd64; SetupECCMethod: nil),
    (VendorID: $10de; DeviceID: $00E1; name: 'nVidia nForce3 250'; tested: 0; GetFSBMethod: poll_fsb_amd64; GetTmngsMethod: poll_timings_amd64; SetupECCMethod: nil),
    (VendorID: $10de; DeviceID: $005E; name: 'nVidia nForce4'; tested: 0; GetFSBMethod: poll_fsb_amd64; GetTmngsMethod: poll_timings_amd64; SetupECCMethod: nil),
    (VendorID: $10de; DeviceID: $0071; name: 'nForce4 SLI Intel Edition'; tested: 0; GetFSBMethod: poll_fsb_nf4ie; GetTmngsMethod: poll_timings_nf4ie; SetupECCMethod: nil),
    //VIA
    (VendorID: $1106; DeviceID: $3099; name: 'VIA KT266(A)/KT333'; tested: 0; GetFSBMethod: poll_fsb_kt266; GetTmngsMethod: poll_timings_kt266; SetupECCMethod: nil),
    (VendorID: $1106; DeviceID: $3123; name: 'VIA CLE266'; tested: 0; GetFSBMethod: poll_fsb_kt266; GetTmngsMethod: poll_timings_kt266; SetupECCMethod: nil),
    (VendorID: $1106; DeviceID: $0259; name: 'VIA CN333'; tested: 0; GetFSBMethod: poll_fsb_cn333; GetTmngsMethod: poll_timings_cn333; SetupECCMethod: nil),
    (VendorID: $1106; DeviceID: $3188; name: 'VIA K8T800'; tested: 0; GetFSBMethod: poll_fsb_amd64; GetTmngsMethod: poll_timings_amd64; SetupECCMethod: nil),
    (VendorID: $1106; DeviceID: $0282; name: 'VIA K8T800Pro'; tested: 0; GetFSBMethod: poll_fsb_amd64; GetTmngsMethod: poll_timings_amd64; SetupECCMethod: nil),
    (VendorID: $1106; DeviceID: $3238; name: 'VIA K8T890'; tested: 0; GetFSBMethod: poll_fsb_amd64; GetTmngsMethod: poll_timings_amd64; SetupECCMethod: nil),
    //Intel
    (VendorID: $8086; DeviceID: $2588; name: 'Intel E7221'; tested: 0; GetFSBMethod: nil{poll_fsb_i925}; GetTmngsMethod: nil{poll_timings_i925}; SetupECCMethod: nil),
    (VendorID: $8086; DeviceID: $2570; name: 'Intel i848/i865'; tested: 0; GetFSBMethod: nil{poll_fsb_i875}; GetTmngsMethod: nil{poll_timings_i875}; SetupECCMethod: nil),
    (VendorID: $8086; DeviceID: $2578; name: 'Intel i875P'; tested: 0; GetFSBMethod: nil{poll_fsb_i875}; GetTmngsMethod: nil{poll_timings_i875}; SetupECCMethod: nil),
    (VendorID: $8086; DeviceID: $3340; name: 'Intel i855PM'; tested: 0; GetFSBMethod: nil; GetTmngsMethod: nil; SetupECCMethod: nil),
    (VendorID: $8086; DeviceID: $2580; name: 'Intel i915P/G'; tested: 0; GetFSBMethod: nil{poll_fsb_i925}; GetTmngsMethod: nil{poll_timings_i925}; SetupECCMethod: nil),
    (VendorID: $8086; DeviceID: $2590; name: 'Intel i915PM/GM'; tested: 0; GetFSBMethod: nil{poll_fsb_i925}; GetTmngsMethod: nil{poll_timings_i925}; SetupECCMethod: nil),
    (VendorID: $8086; DeviceID: $2584; name: 'Intel i925X/XE'; tested: 0; GetFSBMethod: nil{poll_fsb_i925}; GetTmngsMethod: nil{poll_timings_i925}; SetupECCMethod: nil),
    (VendorID: $8086; DeviceID: $2770; name: 'Intel i945P/G'; tested: 0; GetFSBMethod: nil{poll_fsb_i945}; GetTmngsMethod: nil{poll_timings_i925}; SetupECCMethod: nil),
    (VendorID: $8086; DeviceID: $2774; name: 'Intel i955X'; tested: 0; GetFSBMethod: nil{poll_fsb_i945}; GetTmngsMethod: nil{poll_timings_i925}; SetupECCMethod: nil)
  );


constructor cMemory.Create;
begin
  inherited Create;
  fCtrl_Info.index:=0;

  fCtrl_Info.dwBus:=0;
  fCtrl_Info.dwDev:=0;
  fCtrl_Info.dwFunc:=0;

  DetectMemCtrl;
end;

procedure cMemory.DetectMemCtrl;
var
  VendorID, DeviceID: DWord;
  pdata: DWord;
  i: byte;
begin
  GetInstance.IPCIIORef.GetPCIRDWord(fCtrl_Info.dwBus, fCtrl_Info.dwDev, fCtrl_Info.dwFunc, 0, pdata);
  VendorID:=Word(pdata);
  DeviceID:=Word(pdata shr 16);

  for i:=Low(Controllers) to High(Controllers) do
    if ((Controllers[i].VendorID = VendorID) and (Controllers[i].DeviceID = DeviceID)) then
    begin
      fCtrl_Info.index:=i;
      break;
    end;
end;

function cMemory.GetPhysMemSize: DWord;
var
 memStatus: TMemoryStatus;
begin
  memStatus.dwLength:=sizeOf(memStatus);
  GlobalMemoryStatus(memStatus);
  result:=trunc(memStatus.dwTotalPhys/1048576)+1;
end;


procedure cMemory.FillMemCtrlInfo(lCPUClock, FSB: double; Mult: single);
begin
  if fCtrl_Info.index<=0 then exit;

  fgRAMInfo.RamSize:=GetPhysMemSize;

  if Assigned(Controllers[fCtrl_Info.index].GetFSBMethod) then
        Controllers[fCtrl_Info.index].GetFSBMethod(lCPUClock, FSB, Mult, fgRAMInfo);

  if Assigned(Controllers[fCtrl_Info.index].GetTmngsMethod) then
        Controllers[fCtrl_Info.index].GetTmngsMethod(fTimings, fgRAMInfo);

  //ShowMessage(format('%x', [oHWIO.MemReadLong($20)]));
  //oHWIO.MemReadLong($5)
end;

destructor cMemory.Destroy;
begin
  inherited Destroy;
end;

end.

Report for Muetze1 from pci 32 program,is this usefull?

[delphi] Address 1 is a Memory Address (anywhere in 0-4Gb) : FFEFF400h
System IRQ 11, INT# A
Expansion ROM of 64Kb decoded by this card (Currently disabled)
New Capabilities List Present:
Power Management Capability, Version 1.1
Supports low power State D1
Supports low power State D2
Supports PME# signalling from mode(s) D1, D2, D3hot, D3cold
PME# signalling is currently enabled
Current Power State : D0 (Device operational, no power saving)
3.3v AUX Current required : 375mA

Bus 0 (PCI), Device Number 15, Device Function 0
Vendor 1106h VIA Technologies Inc
Device 3149h VIA SATA RAID Controller
Command 0007h (I/O Access, Memory Access, BusMaster)
Status 0290h (Has Capabilities List, Supports Back-To-Back Trans., Medium Timin
g)
Revision 80h, Header Type 80h, Bus Latency Timer 20h
Self test 00h (Self test not supported)
PCI Class Storage, type RAID
Subsystem ID 31491849h Unknown
Subsystem Vendor 1849h ASRock Inc
Address 0 is an I/O Port : 0000EC00h
Address 1 is an I/O Port : 0000E800h
Address 2 is an I/O Port : 0000E400h
Address 3 is an I/O Port : 0000E000h
Address 4 is an I/O Port : 0000DC00h
Address 5 is an I/O Port : 0000D800h
System IRQ 10, INT# B
New Capabilities List Present:
Power Management Capability, Version 1.1
Does not support low power State D1 or D2
Does not support PME# signalling
Current Power State : D0 (Device operational, no power saving)

Bus 0 (PCI), Device Number 15, Device Function 1
Vendor 1106h VIA Technologies Inc
Device 0571h VT82xxxx EIDE Controller (All VIA Chipsets)
Command 0007h (I/O Access, Memory Access, BusMaster)
Status 0290h (Has Capabilities List, Supports Back-To-Back Trans., Medium Timin
g)
Revision 06h, Header Type 00h, Bus Latency Timer 20h
Self test 00h (Self test not supported)
PCI Class Storage, type IDE (ATA)
PCI EIDE Controller Features :
BusMaster EIDE is supported
Primary Channel is at I/O Port 01F0h and IRQ 14
Secondary Channel is at I/O Port 0170h and IRQ 15
Subsystem ID 05711849h Unknown
Subsystem Vendor 1849h ASRock Inc
Address 4 is an I/O Port : 0000FC00h
New Capabilities List Present:
Power Management Capability, Version 1.1
Does not support low power State D1 or D2
Does not support PME# signalling
Current Power State : D0 (Device operational, no power saving)

Bus 0 (PCI), Device Number 16, Device Function 0
Vendor 1106h VIA Technologies Inc
Device 3038h VT82xxxxx UHCI USB 1.1 Controller (All VIA Chipsets)
Command 0017h (I/O Access, Memory Access, BusMaster, MemWrite+Invalidate)
Status 0210h (Has Capabilities List, Medium Timing)
Revision 81h, Header Type 80h, Bus Latency Timer 20h
Self test 00h (Self test not supported)
Cache line size 32 Bytes (8 DWords)
PCI Class Serial, type USB (UHCI)
Subsystem ID 30381849h Unknown
Subsystem Vendor 1849h ASRock Inc
Address 4 is an I/O Port : 0000C000h
System IRQ 11, INT# A
New Capabilities List Present:
Power Management Capability, Version 1.1
Supports low power State D1
Supports low power State D2
Supports PME# signalling from mode(s) D0, D1, D2, D3hot, D3cold
PME# signalling is currently disabled
Current Power State : D0 (Device operational, no power saving)
3.3v AUX Current required : 375mA

Bus 0 (PCI), Device Number 16, Device Function 1
Vendor 1106h VIA Technologies Inc
Device 3038h VT82xxxxx UHCI USB 1.1 Controller (All VIA Chipsets)
Command 0017h (I/O Access, Memory Access, BusMaster, MemWrite+Invalidate)
Status 0210h (Has Capabilities List, Medium Timing)
Revision 81h, Header Type 80h, Bus Latency Timer 20h
Self test 00h (Self test not supported)
Cache line size 32 Bytes (8 DWords)
PCI Class Serial, type USB (UHCI)
Subsystem ID 30381849h Unknown
Subsystem Vendor 1849h ASRock Inc
Address 4 is an I/O Port : 0000C400h
System IRQ 11, INT# A
New Capabilities List Present:
Power Management Capability, Version 1.1
Supports low power State D1
Supports low power State D2
Supports PME# signalling from mode(s) D0, D1, D2, D3hot, D3cold
PME# signalling is currently disabled
Current Power State : D0 (Device operational, no power saving)
3.3v AUX Current required : 375mA

Bus 0 (PCI), Device Number 16, Device Function 2
Vendor 1106h VIA Technologies Inc
Device 3038h VT82xxxxx UHCI USB 1.1 Controller (All VIA Chipsets)
Command 0017h (I/O Access, Memory Access, BusMaster, MemWrite+Invalidate)
Status 0210h (Has Capabilities List, Medium Timing)
Revision 81h, Header Type 80h, Bus Latency Timer 20h
Self test 00h (Self test not supported)
Cache line size 32 Bytes (8 DWords)
PCI Class Serial, type USB (UHCI)
Subsystem ID 30381849h Unknown
Subsystem Vendor 1849h ASRock Inc
Address 4 is an I/O Port : 0000C800h
System IRQ 10, INT# B
New Capabilities List Present:
Power Management Capability, Version 1.1
Supports low power State D1
Supports low power State D2
Supports PME# signalling from mode(s) D0, D1, D2, D3hot, D3cold
PME# signalling is currently disabled
Current Power State : D0 (Device operational, no power saving)
3.3v AUX Current required : 375mA

Bus 0 (PCI), Device Number 16, Device Function 3
Vendor 1106h VIA Technologies Inc
Device 3038h VT82xxxxx UHCI USB 1.1 Controller (All VIA Chipsets)
Command 0017h (I/O Access, Memory Access, BusMaster, MemWrite+Invalidate)
Status 0210h (Has Capabilities List, Medium Timing)
Revision 81h, Header Type 80h, Bus Latency Timer 20h
Self test 00h (Self test not supported)
Cache line size 32 Bytes (8 DWords)
PCI Class Serial, type USB (UHCI)
Subsystem ID 30381849h Unknown
Subsystem Vendor 1849h ASRock Inc
Address 4 is an I/O Port : 0000CC00h
System IRQ 10, INT# B
New Capabilities List Present:
Power Management Capability, Version 1.1
Supports low power State D1
Supports low power State D2
Supports PME# signalling from mode(s) D0, D1, D2, D3hot, D3cold
PME# signalling is currently disabled
Current Power State : D0 (Device operational, no power saving)
3.3v AUX Current required : 375mA

Bus 0 (PCI), Device Number 16, Device Function 4
Vendor 1106h VIA Technologies Inc
Device 3104h VT6202/12 USB 2.0 Enhanced Host Controller
Command 0017h (I/O Access, Memory Access, BusMaster, MemWrite+Invalidate)
Status 0210h (Has Capabilities List, Medium Timing)
Revision 86h, Header Type 80h, Bus Latency Timer 20h
Self test 00h (Self test not supported)
Cache line size 32 Bytes (8 DWords)
PCI Class Serial, type USB 2.0 (EHCI)
Subsystem ID 31041849h Unknown
Subsystem Vendor 1849h ASRock Inc
Address 0 is a Memory Address (anywhere in 0-4Gb) : FFEFF800h
System IRQ 5, INT# C
New Capabilities List Present:
Power Management Capability, Version 1.1
Supports low power State D1
Supports low power State D2
Supports PME# signalling from mode(s) D0, D1, D2, D3hot, D3cold
PME# signalling is currently disabled
Current Power State : D0 (Device operational, no power saving)
3.3v AUX Current required : 375mA

Bus 0 (PCI), Device Number 17, Device Function 0
Vendor 1106h VIA Technologies Inc
Device 3227h VT8237 PCI to ISA Bridge
Command 0087h (I/O Access, Memory Access, BusMaster, Wait Cycles)
Status 0210h (Has Capabilities List, Medium Timing)
Revision 00h, Header Type 80h, Bus Latency Timer 00h
Self test 00h (Self test not supported)
PCI Class Bridge, type PCI to ISA
Subsystem ID 32271849h Unknown
Subsystem Vendor 1849h ASRock Inc
New Capabilities List Present:
Power Management Capability, Version 1.1
Does not support low power State D1 or D2
Does not support PME# signalling
Current Power State : D0 (Device operational, no power saving)

Bus 0 (PCI), Device Number 17, Device Function 5
Vendor 1106h VIA Technologies Inc
Device 3059h VT8233/A AC'97 Enhanced Audio Controller
Command 0001h (I/O Access)
Status 0210h (Has Capabilities List, Medium Timing)
Revision 60h, Header Type 00h, Bus Latency Timer 00h
Self test 00h (Self test not supported)
PCI Class Multimedia, type Audio
Subsystem ID 97611849h VT8233 AC'97 Enhanced Audio Controller (Guess Only!)
Subsystem Vendor 1849h ASRock Inc
Address 0 is an I/O Port : 0000D000h
System IRQ 5, INT# C
New Capabilities List Present:
Power Management Capability, Version 1.1
Supports low power State D1
Supports low power State D2
Does not support PME# signalling
Current Power State : D0 (Device operational, no power saving)

Bus 0 (PCI), Device Number 18, Device Function 0
Vendor 1106h VIA Technologies Inc
Device 3065h VT6102 Rhine II Fast Ethernet Adapter
Command 0117h (I/O Access, Memory Access, BusMaster, MemWrite+Invalidate, Syste
m Errors)
Status 0210h (Has Capabilities List, Medium Timing)
Revision 78h, Header Type 00h, Bus Latency Timer 20h
Minimum Bus Grant 03h, Maximum Bus Latency 08h
Self test 00h (Self test not supported)
Cache line size 32 Bytes (8 DWords)
PCI Class Network, type Ethernet
Subsystem ID 30651849h Unknown
Subsystem Vendor 1849h ASRock Inc
Address 0 is an I/O Port : 0000D400h
Address 1 is a Memory Address (anywhere in 0-4Gb) : FFEFFC00h
System IRQ 11, INT# A
New Capabilities List Present:
Power Management Capability, Version 1.1
Supports low power State D1
Supports low power State D2
Supports PME# signalling from mode(s) D0, D1, D2, D3hot, D3cold
PME# signalling is currently enabled
Current Power State : D0 (Device operational, no power saving)
3.3v AUX Current required : 0mA (Self powered)

Bus 1 (AGP), Device Number 0, Device Function 0
Vendor 1002h ATI Technologies Inc
Device 7280h Unknown
Command 0107h (I/O Access, Memory Access, BusMaster, System Errors)
Status 02B0h (Has Capabilities List, Supports 66MHz, Supports Back-To-Back Tran
s., Medium Timing)
Revision 9Ah, Header Type 80h, Bus Latency Timer FFh
Minimum Bus Grant 08h, Maximum Bus Latency 00h
Self test 00h (Self test not supported)
Cache line size 32 Bytes (8 DWords)
PCI Class Display, type VGA
Subsystem ID E190174Bh Unknown
Subsystem Vendor 174Bh PC Partner Ltd
Address 0 is a Memory Address (anywhere in 0-4Gb, Prefetchable) : C0000000h
Address 1 is an I/O Port : 0000A800h
Address 2 is a Memory Address (anywhere in 0-4Gb) : FFDF0000h
System IRQ 11, INT# A
Expansion ROM of 128Kb decoded by this card (Currently disabled)
New Capabilities List Present:
Power Management Capability, Version 1.1
Supports low power State D1
Supports low power State D2
Does not support PME# signalling
Current Power State : D0 (Device operational, no power saving)
AGP Capability, Version 3.0 (AGP 8x and 4x, core register support)
AGP Speed(s) Supported : 4x 8x
FW Transfers Supported : Yes
>4Gb Address Space Supported : No
Sideband Addressing Supported : Yes
AGP v3.0 Operation Mode Available : Yes
Isosynchronous Transactions Supported : No
Maximum Command Queue Length : 256 bytes
AGP Speed Selected : 8x
FW Transfers Enabled : Yes
>4Gb Address Space Enabled : No
AGP Enabled : Yes
Sideband Addressing Enabled : Yes
AGP v3.0 Operation Mode : Enabled
Current Command Queue Length : 32 bytes
Message Signalled Interrupt Capability
MSI is disabled
MSI function can generate 64-bit addresses

Bus 1 (AGP), Device Number 0, Device Function 1
Vendor 1002h ATI Technologies Inc
Device 72A0h Unknown
Command 0007h (I/O Access, Memory Access, BusMaster)
Status 02B0h (Has Capabilities List, Supports 66MHz, Supports Back-To-Back Tran
s., Medium Timing)
Revision 9Ah, Header Type 00h, Bus Latency Timer 20h
Minimum Bus Grant 08h, Maximum Bus Latency 00h
Self test 00h (Self test not supported)
Cache line size 32 Bytes (8 DWords)
PCI Class Display, type Other
Subsystem ID E191174Bh Unknown
Subsystem Vendor 174Bh PC Partner Ltd
Address 0 is a Memory Address (anywhere in 0-4Gb) : FFDE0000h
New Capabilities List Present:
Power Management Capability, Version 1.1
Supports low power State D1
Supports low power State D2
Does not support PME# signalling
Current Power State : D0 (Device operational, no power saving)


IRQ Summary: IRQs 5,10,11,14,15 are used by PCI devices
Shared IRQs: IRQ 5 is shared by 2 PCI Devices
IRQ 10 is shared by 3 PCI Devices
IRQ 11 is shared by 5 PCI Devices


[delphi]
  Mit Zitat antworten Zitat
EarthQuaker

Registriert seit: 14. Apr 2007
Ort: Pirna
50 Beiträge
 
Delphi 7 Enterprise
 
#29

Re: Memory Information?

  Alt 11. Aug 2007, 04:59
@ Razor

Hello...

Error Message:

[Fehler] Memory.pas(67): Undefinierter Bezeichner: 'GetInstance'
[Fehler] Memory.pas(67): Operator oder Semikolon fehlt
[Fehler] Memory.pas(77): Operator oder Semikolon fehlt
[Fehler] Memory.pas(95): Undefinierter Bezeichner: 'GetInstance'
[Fehler] Memory.pas(95): Operator oder Semikolon fehlt
[Fehler] Memory.pas(96): Operator oder Semikolon fehlt
[Fehler] Memory.pas(97): Operator oder Semikolon fehlt
[Fehler] Memory.pas(98): Operator oder Semikolon fehlt
[Fehler] Memory.pas(99): Operator oder Semikolon fehlt
[Fehler] Memory.pas(100): Operator oder Semikolon fehlt
[Fehler] Memory.pas(132): Undefinierter Bezeichner: 'GetInstance'
[Fehler] Memory.pas(132): Operator oder Semikolon fehlt
[Fehler] Memory.pas(154): Undefinierter Bezeichner: 'GetInstance'
[Fehler] Memory.pas(154): Operator oder Semikolon fehlt
[Fehler] Memory.pas(155): Operator oder Semikolon fehlt
[Fehler] Memory.pas(188): Undefinierter Bezeichner: 'GetInstance'
[Fehler] Memory.pas(188): Operator oder Semikolon fehlt
[Fehler] Memory.pas(189): Operator oder Semikolon fehlt
[Fehler] Memory.pas(213): Undefinierter Bezeichner: 'GetInstance'
[Fehler] Memory.pas(213): Operator oder Semikolon fehlt
[Fehler] Memory.pas(214): Operator oder Semikolon fehlt
[Fehler] Memory.pas(215): Operator oder Semikolon fehlt
[Fehler] Memory.pas(216): Operator oder Semikolon fehlt
[Fehler] Memory.pas(245): Undefinierter Bezeichner: 'GetInstance'
[Fehler] Memory.pas(245): Operator oder Semikolon fehlt
[Fehler] Memory.pas(293): Undefinierter Bezeichner: 'GetInstance'
[Fehler] Memory.pas(293): Operator oder Semikolon fehlt
[Fehler] Memory.pas(298): Operator oder Semikolon fehlt
[Fehler] Memory.pas(300): Operator oder Semikolon fehlt
[Fehler] Memory.pas(301): Operator oder Semikolon fehlt
[Fehler] Memory.pas(346): Undefinierter Bezeichner: 'GetInstance'
[Fehler] Memory.pas(346): Operator oder Semikolon fehlt
[Fehler] Memory.pas(350): Operator oder Semikolon fehlt
[Fehler] Memory.pas(352): Operator oder Semikolon fehlt
[Fehler] Memory.pas(354): Operator oder Semikolon fehlt
[Fehler] Memory.pas(396): Undefinierter Bezeichner: 'GetInstance'
[Fehler] Memory.pas(396): Operator oder Semikolon fehlt
[Fehler] Memory.pas(397): Operator oder Semikolon fehlt
[Fehler] Memory.pas(402): Operator oder Semikolon fehlt
[Fehler] Memory.pas(406): Operator oder Semikolon fehlt
[Fehler] Memory.pas(410): Operator oder Semikolon fehlt
[Fehler] Memory.pas(456): Undefinierter Bezeichner: 'GetInstance'
[Fehler] Memory.pas(456): Operator oder Semikolon fehlt
[Fehler] Memory.pas(458): Operator oder Semikolon fehlt
[Fehler] Memory.pas(477): Undefinierter Bezeichner: 'GetInstance'
[Fehler] Memory.pas(477): Operator oder Semikolon fehlt
  Mit Zitat antworten Zitat
Razor
(Gast)

n/a Beiträge
 
#30

Re: Memory Information?

  Alt 29. Aug 2007, 12:31
The memory information could be got via SMBus read and write byte....But for Smbus read word i dont know what that does..
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 3 von 5     123 45      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:00 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz