Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 1307 → Rev 1306

//uspace/trunk/pci/libpci/i386-ports.c
79,7 → 79,8
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))
177,6 → 178,7
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);
224,7 → 226,8
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,9 → 25,6
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)
40,7 → 37,8
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;
}
 
220,7 → 218,8
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);
246,7 → 245,9
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);
259,7 → 260,8
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;
}