| Zeile 246: | Zeile 246: | ||
uint pos = 0; | uint pos = 0; | ||
uint32_t mask = 0x00000001; | uint32_t mask = 0x00000001; | ||
| − | while( ( value & mask ) | + | while (!(value & mask)) |
{ ++pos; mask=mask<<1; } | { ++pos; mask=mask<<1; } | ||
return pos; | return pos; | ||
| Zeile 257: | Zeile 257: | ||
uint pos = 31; | uint pos = 31; | ||
uint32_t mask = 0x80000000; | uint32_t mask = 0x80000000; | ||
| − | while( ( value & mask ) | + | while (!(value & mask)) |
{ --pos; mask=mask>>1; } | { --pos; mask=mask>>1; } | ||
return pos; | return pos; | ||
| Zeile 283: | Zeile 283: | ||
if ( (pci_config_readd(addr,barOffset) & 0x1) == 0 ) | if ( (pci_config_readd(addr,barOffset) & 0x1) == 0 ) | ||
{ // Speicher-Ressource : | { // Speicher-Ressource : | ||
| − | static const char ptext_pref | + | static const char* ptext_pref = "prefetchable"; //Text für prefetchable |
| − | static const char ptext_nopr | + | static const char* ptext_nopr = "non-prefetchable"; //Text für non-prefetchable |
| − | const char* const ptext = (((pci_config_readd(addr,barOffset) >> 3) & 0x1) == 1) ? | + | const char* const ptext = (((pci_config_readd(addr,barOffset) >> 3) & 0x1) == 1) ? ptext_pref : ptext_nopr; |
switch(((pci_config_readd(addr,barOffset) >> 1) & 0x3)) // check Memory-BAR-Type | switch(((pci_config_readd(addr,barOffset) >> 1) & 0x3)) // check Memory-BAR-Type | ||
| Zeile 295: | Zeile 295: | ||
if (barValue == 0) // es muss mindestens ein Adressbit 1 (also beschreibbar) sein | if (barValue == 0) // es muss mindestens ein Adressbit 1 (also beschreibbar) sein | ||
{ | { | ||
| − | if (ptext != | + | if (ptext != ptext_nopr) // unbenutzte BARs müssen komplett 0 sein |
{ printf("FEHLER : 32Bit-Memory-BAR %u enthält keine beschreibbaren Adressbits!\n",bar); return; } | { printf("FEHLER : 32Bit-Memory-BAR %u enthält keine beschreibbaren Adressbits!\n",bar); return; } | ||