Chameleon

Chameleon Commit Details

Date:2012-07-20 03:53:02 (6 years 11 months ago)
Author:ErmaC
Commit:2023
Parents: 2022
Message:Ooops. Missed 2 file. (Ported the nvidia plist helper)
Changes:
M/branches/ErmaC/Trunk/i386/libsaio/nvidia.c
M/branches/ErmaC/Trunk/i386/libsaio/Makefile

File differences

branches/ErmaC/Trunk/i386/libsaio/Makefile
3838
3939
4040
41
41
4242
4343
4444
smbios.o smbios_getters.o smbios_decode.o \
fake_efi.o ext2fs.o \
hpet.o dram_controllers.o spd.o usb.o pci_setup.o \
device_inject.o nvidia.o ati.o gma.o pci_root.o \
device_inject.o nvidia_helper.o nvidia.o ati.o gma.o pci_root.o \
convert.o aml_generator.o console.o exfat.o
SAIO_OBJS := $(addprefix $(OBJROOT)/, $(SAIO_OBJS))
branches/ErmaC/Trunk/i386/libsaio/nvidia.c
5353
5454
5555
56
5657
5758
5859
......
756757
757758
758759
759
760
760761
761762
762763
......
25902591
25912592
25922593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
25932605
25942606
25952607
......
26032615
26042616
26052617
2606
2618
26072619
26082620
26092621
......
26962708
26972709
26982710
2699
2711
27002712
27012713
27022714
2703
2715
2716
2717
27042718
2705
2706
2719
2720
2721
2722
2723
2724
27072725
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2726
2727
27212728
27222729
27232730
......
27422749
27432750
27442751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
27452772
27462773
27472774
......
27712798
27722799
27732800
2801
2802
27742803
27752804
27762805
......
27782807
27792808
27802809
2781
2782
27832810
27842811
2785
2786
2787
2788
2789
2812
2813
27902814
27912815
27922816
......
28722896
28732897
28742898
2899
2900
2901
2902
28752903
28762904
28772905
......
28792907
28802908
28812909
2910
2911
2912
2913
2914
2915
28822916
28832917
28842918
#include "platform.h"
#include "device_inject.h"
#include "nvidia.h"
#include "nvidia_helper.h"
#ifndef DEBUG_NVIDIA
#define DEBUG_NVIDIA 0
{ 0x10DE0A28,0x1179FF16,"Toshiba GeForce GT 230" },
{ 0x10DE0A28,0x1179FF50,"Toshiba GeForce GT 230" },
{ 0x10DE0A28,0x144DC064,"Samsung GeForce GT 230" },
{ 0x10DE0A28,0x152D0815, "Quanta GeForce GT 230" },
{ 0x10DE0A28,0x152D0815,"Quanta GeForce GT 230" },
{ 0x10DE0A28,0x18540807,"LG GeForce GT 230" },
{ 0x10DE0A28,0x1B0A903B,"Pegatron GeForce GT 230" },
// 0A30 - 0A3F
static char *get_nvidia_model(uint32_t device_id, uint32_t subsys_id)
{
int i;
// First check in the plist, (for e.g this can override any hardcoded devices)
cardList_t * nvcard = FindCardWithIds(device_id, subsys_id);
if (nvcard)
{
if (nvcard->model)
{
return nvcard->model;
}
}
for (i = 1; i < (sizeof(nvidia_cards) / sizeof(nvidia_cards[0])); i++) // size of nvidia_cards array for-loop
{
if ((nvidia_cards[i].device == device_id) && (nvidia_cards[i].subdev == subsys_id))
break;
}
}
return nvidia_cards[0].name_model;
return nvidia_cards[0].name_model;
}
static uint32_t load_nvidia_bios_file(const char *filename, uint8_t *buf, int bufsize)
return 0;
}
unsigned long long mem_detect(volatile uint8_t *regs, uint8_t nvCardType, pci_dt_t *nvda_dev)
unsigned long long mem_detect(volatile uint8_t *regs, uint8_t nvCardType, pci_dt_t *nvda_dev, uint32_t device_id, uint32_t subsys_id)
{
unsigned long long vram_size = 0;
if (nvCardType < NV_ARCH_50)
// First check if any value exist in the plist
cardList_t * nvcard = FindCardWithIds(device_id, subsys_id);
if (nvcard)
{
vram_size = REG32(NV04_PFB_FIFO_DATA);
vram_size &= NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_MASK;
if (nvcard->videoRam > 0)
{
vram_size = nvcard->videoRam * 1024 * 1024;
return vram_size;
}
}
else if (nvCardType < NV_ARCH_C0)
{
vram_size = REG32(NV04_PFB_FIFO_DATA);
vram_size |= (vram_size & 0xff) << 32;
vram_size &= 0xffffffff00ll;
}
else // >= NV_ARCH_C0
{
vram_size = REG32(NVC0_MEM_CTRLR_RAM_AMOUNT) << 20;
vram_size *= REG32(NVC0_MEM_CTRLR_COUNT);
}
// Workaround for 9600M GT, GT 210/420/430/440/525M/540M & GTX 560M
// Then, Workaround for 9600M GT, GT 210/420/430/440/525M/540M & GTX 560M
switch (nvda_dev->device_id)
{
case 0x0647: // 9600M GT 0647
break;
}
if (!vram_size)
{ // Finally, if vram_size still not set do the calculation with our own method
if (nvCardType < NV_ARCH_50)
{
vram_size = REG32(NV04_PFB_FIFO_DATA);
vram_size &= NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_MASK;
}
else if (nvCardType < NV_ARCH_C0)
{
vram_size = REG32(NV04_PFB_FIFO_DATA);
vram_size |= (vram_size & 0xff) << 32;
vram_size &= 0xffffffff00ll;
}
else // >= NV_ARCH_C0
{
vram_size = REG32(NVC0_MEM_CTRLR_RAM_AMOUNT) << 20;
vram_size *= REG32(NVC0_MEM_CTRLR_COUNT);
}
}
return vram_size;
}
const char*value;
booldoit;
fill_card_list();
devicepath = get_pci_dev_path(nvda_dev);
bar[0] = pci_config_read32(nvda_dev->dev.addr, 0x10 );
regs = (uint8_t *) (bar[0] & ~0x0f);
// get card type
nvCardType = (REG32(0) >> 20) & 0x1ff;
// Amount of VRAM in kilobytes
videoRam = mem_detect(regs, nvCardType, nvda_dev);
model = get_nvidia_model(((nvda_dev->vendor_id << 16) | nvda_dev->device_id),((nvda_dev->subsys_id.subsys.vendor_id << 16) | nvda_dev->subsys_id.subsys.device_id));
verbose("%s %dMB NV%02x [%04x:%04x]-[%04x:%04x] :: %s device number: %d\n",
model, (uint32_t)(videoRam / 1024 / 1024),
(REG32(0) >> 20) & 0x1ff, nvda_dev->vendor_id, nvda_dev->device_id,
nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id,
devicepath, devices_number);
// Amount of VRAM in kilobytes
videoRam = mem_detect(regs, nvCardType, nvda_dev,((nvda_dev->vendor_id << 16) | nvda_dev->device_id),((nvda_dev->subsys_id.subsys.vendor_id << 16) | nvda_dev->subsys_id.subsys.device_id) );
rom = malloc(NVIDIA_ROM_SIZE);
sprintf(nvFilename, "/Extra/%04x_%04x.rom", (uint16_t)nvda_dev->vendor_id,
{
// Get Model from the OpROM
model = get_nvidia_model(((rom_pci_header->vendor_id << 16) | rom_pci_header->device_id), NV_SUB_IDS);
// Get VRAM again
videoRam = mem_detect(regs, nvCardType, nvda_dev,((rom_pci_header->vendor_id << 16) | rom_pci_header->device_id), NV_SUB_IDS );
}
else
{
}
}
verbose("%s %dMB NV%02x [%04x:%04x]-[%04x:%04x] :: %s device number: %d\n",
model, (uint32_t)(videoRam / 1024 / 1024),
(REG32(0) >> 20) & 0x1ff, nvda_dev->vendor_id, nvda_dev->device_id,
nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id,
devicepath, devices_number);
if (!string) {
string = devprop_create_string();
}

Archive Download the corresponding diff file

Revision: 2023