Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 1306 → Rev 1307

//uspace/trunk/pci/libpci/i386-ports.c
79,8 → 79,7
d.func = 0;
for (d.dev = 0; d.dev < 32; d.dev++) {
u16 class, vendor;
if (m->
read(&d, PCI_CLASS_DEVICE, (byte *) & class,
if (m->read(&d, PCI_CLASS_DEVICE, (byte *) & class,
sizeof(class))
&& (class == cpu_to_le16(PCI_CLASS_BRIDGE_HOST)
|| class == cpu_to_le16(PCI_CLASS_DISPLAY_VGA))
178,7 → 177,6
static int conf2_detect(struct pci_access *a)
{
/* This is ugly and tends to produce false positives. Beware. */
 
outb(0x00, 0xCFB);
outb(0x00, 0xCF8);
outb(0x00, 0xCFA);
226,8 → 224,7
return 0;
 
if (d->dev >= 16)
d->access->
error("conf2_write: only first 16 devices exist.");
d->access->error("conf2_write: only first 16 devices exist.");
outb((d->func << 1) | 0xf0, 0xcf8);
outb(d->bus, 0xcfa);
switch (len) {
//uspace/trunk/pci/libpci/access.c
25,6 → 25,9
struct pci_access *a = malloc(sizeof(struct pci_access));
int i;
 
if (!a)
return NULL;
bzero(a, sizeof(*a));
for (i = 0; i < PCI_ACCESS_MAX; i++)
if (pci_methods[i] && pci_methods[i]->config)
37,8 → 40,7
void *x = malloc(size);
 
if (!x)
a->error("Out of memory (allocation of %d bytes failed)",
size);
a->error("Out of memory (allocation of %d bytes failed)", size);
return x;
}
 
218,8 → 220,7
pci_write_data(struct pci_dev *d, void *buf, int pos, int len)
{
if (pos & (len - 1))
d->access->error("Unaligned write: pos=%02x,len=%d", pos,
len);
d->access->error("Unaligned write: pos=%02x,len=%d", pos, len);
if (pos + len <= d->cache_len)
memcpy(d->cache + pos, buf, len);
return d->methods->write(d, pos, buf, len);
245,9 → 246,7
int pci_write_block(struct pci_dev *d, int pos, byte * buf, int len)
{
if (pos < d->cache_len) {
int l =
(pos + len >=
d->cache_len) ? (d->cache_len - pos) : len;
int l = (pos + len >= d->cache_len) ? (d->cache_len - pos) : len;
memcpy(d->cache + pos, buf, l);
}
return d->methods->write(d, pos, buf, len);
260,8 → 259,7
d->known_fields = 0;
}
if (flags & ~d->known_fields)
d->known_fields |=
d->methods->fill_info(d, flags & ~d->known_fields);
d->known_fields |= d->methods->fill_info(d, flags & ~d->known_fields);
return d->known_fields;
}