Changeset 2020

Show
Ignore:
Timestamp:
04/02/09 21:21:33 (3 years ago)
Author:
mwhitworth
Message:

Add PciDisableDevice function, rework PCI resource code.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/trunk/devices/pci/pci_lib.c

    r1886 r2020  
    110110SYMBOL_EXPORT(PciEnableDevice); 
    111111 
     112int PciDisableDevice(struct PciDevice* device) 
     113{ 
     114        /* Disable BARs */ 
     115        WORD command; 
     116         
     117        if (PciReadConfigWord(device, PCI_COMMAND, &command)) 
     118                return -EIO; 
     119                 
     120        command &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEM); 
     121         
     122        return PciWriteConfigWord(device, PCI_COMMAND, command); 
     123} 
     124 
     125SYMBOL_EXPORT(PciDisableDevice); 
     126 
    112127int PciSetMaster(struct PciDevice* device) 
    113128{ 
     
    124139SYMBOL_EXPORT(PciSetMaster); 
    125140 
    126 int PciRegisterDriver(struct PciDriver* pciDriver) 
     141int PciRegisterDriverMod(struct Module* module, struct PciDriver* pciDriver) 
    127142{ 
    128143        /* Add it to the global list of PCI drivers, after checking that it 
     
    137152 
    138153        ListAddTail(&pciDriver->next, &pciDriverList); 
     154 
     155        pciDriver->module = module; 
    139156         
    140157        extern struct ListHead pciBusList; 
     
    146163} 
    147164 
    148 SYMBOL_EXPORT(PciRegisterDriver); 
    149  
    150 unsigned long PciResourceStart(struct PciDevice* device, int index) 
    151 { 
    152         if (index < 0 || index >= 6) 
    153                 return -EINVAL; 
    154  
    155         return PCI_RES_BEGIN_MASK(device->spaces[index]); 
    156 } 
    157  
    158 SYMBOL_EXPORT(PciResourceStart); 
     165SYMBOL_EXPORT(PciRegisterDriverMod);