/* * Copyright (c) 2012 cparm . All rights reserved. * */ #include "libsaio.h" #include "bootstruct.h" #include "xml.h" #include "gfx_helper.h" #include "pci.h" #include "nvidia.h" /* NVIDIA and ATI card injection usage e.g (to be placed in the boot.plist): NVIDIA Chipset Name Quadro FX 380 IOPCIPrimaryMatch 0x10DE0658 VRam Size 256 Chipset Name YOUR_CARD_NAME IOPCIPrimaryMatch YOUR_CARD_ID IOPCISubDevId YOUR_CARD_SUB_ID(if necessary) VRam Size YOUR_CARD_VRAM_SIZE Chipset Name YOUR_SECOND_CARD_NAME IOPCIPrimaryMatch YOUR_SECOND_CARD_ID IOPCISubDevId YOUR_SECOND_CARD_SUB_ID(if necessary) VRam Size YOUR_SECOND_CARD_VRAM_SIZE . . . . ATI Chipset Name ATI RADEON HD6670 IOPCIPrimaryMatch 0x10026758 VRam Size 2048 */ cardList_t *cardList = NULL; void add_card(char *model, uint32_t id, uint32_t subid, uint64_t videoRam) { cardList_t *new_card = malloc(sizeof(cardList_t)); if (new_card) { new_card->next = cardList; cardList = new_card; new_card->id = id; new_card->subid = subid; new_card->videoRam = videoRam; new_card->model = model; } } cardList_t *FindCardWithIds(uint32_t id, uint32_t subid) { cardList_t *entry = cardList; while(entry) { if((entry->id == id) && (entry->subid == subid)) { return entry; } else { entry = entry->next; } } // LET A SECOND CHANCE by seaching only for the device-id entry = cardList; while(entry) { if(entry->id == id) { return entry; } else { entry = entry->next; } } return NULL; } void fill_card_list(void) { unsigned int i, count; TagPtr NVDIATag; TagPtr ATITag; char *model_name = NULL; char *match_id = NULL; char *sub_id = NULL; char *vram_size = NULL; uint32_t dev_id = 0; uint32_t subdev_id = 0; uint64_t VramSize = 0; if ((NVDIATag = XMLCastArray(XMLGetProperty(bootInfo->chameleonConfig.dictionary, (const char *)"NVIDIA")))) { count = XMLTagCount(NVDIATag); for (i=0; ichameleonConfig.dictionary, (const char *)"ATI")))) { count = XMLTagCount(ATITag); for (i=0; i