Added do_del_acl. More detailed debug output for the secure device capability.

This commit is contained in:
Philip Homburg 2007-04-23 14:54:51 +00:00
parent 0bd4c5ee7d
commit a3c8619923
2 changed files with 61 additions and 11 deletions

View file

@ -33,7 +33,8 @@ FORWARD _PROTOTYPE( void do_dev_name, (message *mp) );
FORWARD _PROTOTYPE( void do_dev_name_s, (message *mp) );
FORWARD _PROTOTYPE( void do_slot_name, (message *mp) );
FORWARD _PROTOTYPE( void do_slot_name_s, (message *mp) );
FORWARD _PROTOTYPE( void do_acl, (message *mp) );
FORWARD _PROTOTYPE( void do_set_acl, (message *mp) );
FORWARD _PROTOTYPE( void do_del_acl, (message *mp) );
FORWARD _PROTOTYPE( void do_reserve, (message *mp) );
FORWARD _PROTOTYPE( void do_attr_r8, (message *mp) );
FORWARD _PROTOTYPE( void do_attr_r16, (message *mp) );
@ -84,7 +85,8 @@ int main(void)
case BUSC_PCI_RESCAN: do_rescan_bus(&m); break;
case BUSC_PCI_DEV_NAME_S: do_dev_name_s(&m); break;
case BUSC_PCI_SLOT_NAME_S: do_slot_name_s(&m); break;
case BUSC_PCI_ACL: do_acl(&m); break;
case BUSC_PCI_SET_ACL: do_set_acl(&m); break;
case BUSC_PCI_DEL_ACL: do_del_acl(&m); break;
case PROC_EVENT: do_sig_handler(); break;
default:
printf("PCI: got message from %d, type %d\n",
@ -379,14 +381,14 @@ message *mp;
}
}
PRIVATE void do_acl(mp)
PRIVATE void do_set_acl(mp)
message *mp;
{
int i, r, gid;
if (mp->m_source != RS_PROC_NR)
{
printf("PCI: do_acl: not from RS\n");
printf("PCI: do_set_acl: not from RS\n");
reply(mp, EPERM);
return;
}
@ -398,7 +400,7 @@ message *mp;
}
if (i >= NR_DRIVERS)
{
printf("PCI: do_acl: table is full\n");
printf("PCI: do_set_acl: table is full\n");
reply(mp, ENOMEM);
return;
}
@ -409,7 +411,7 @@ message *mp;
sizeof(acl[i].acl), D);
if (r != OK)
{
printf("PCI: do_acl: safecopyfrom failed\n");
printf("PCI: do_set_acl: safecopyfrom failed\n");
reply(mp, r);
return;
}
@ -422,6 +424,42 @@ message *mp;
reply(mp, OK);
}
PRIVATE void do_del_acl(mp)
message *mp;
{
int i, r, proc_nr;
if (mp->m_source != RS_PROC_NR)
{
printf("do_del_acl: not from RS\n");
reply(mp, EPERM);
return;
}
proc_nr= mp->m1_i1;
for (i= 0; i<NR_DRIVERS; i++)
{
if (!acl[i].inuse)
continue;
if (acl[i].acl.rsp_endpoint == proc_nr)
break;
}
if (i >= NR_DRIVERS)
{
printf("do_del_acl: nothing found for %d\n", proc_nr);
reply(mp, EINVAL);
return;
}
acl[i].inuse= 0;
printf("do_acl: deleting ACL for %d ('%s') at entry %d\n",
acl[i].acl.rsp_endpoint, acl[i].acl.rsp_label, i);
reply(mp, OK);
}
PRIVATE void do_reserve(mp)
message *mp;
{

View file

@ -715,7 +715,7 @@ printf("probe_bus(%d)\n", busind);
vid, did, headt, sts);
#endif
if (vid == NO_VID)
if (vid == NO_VID && did == NO_VID)
{
if (func == 0)
break; /* Nothing here */
@ -2420,7 +2420,7 @@ u16_t value;
PRIVATE void print_capabilities(devind)
int devind;
{
u8_t status, capptr, type, next;
u8_t status, capptr, type, next, subtype;
char *str;
/* Check capabilities bit in the device status register */
@ -2442,12 +2442,24 @@ int devind;
case 5: str= "Message Signaled Interrupts"; break;
case 6: str= "CompactPCI Hot Swap"; break;
case 8: str= "AMD HyperTransport"; break;
case 0xf: str= "AMD I/O MMU"; break;
defuault: str= "(unknown type)"; break;
case 0xf: str= "Secure Device"; break;
default: str= "(unknown type)"; break;
}
printf(" @0x%x: capability type 0x%x: %s\n",
printf(" @0x%x: capability type 0x%x: %s",
capptr, type, str);
if (type == 0x0f)
{
subtype= (pci_attr_r8(devind, capptr+2) & 0x07);
switch(subtype)
{
case 2: str= "Device Exclusion Vector"; break;
case 3: str= "IOMMU"; break;
default: str= "(unknown type)"; break;
}
printf(", sub type 0%o: %s", subtype, str);
}
printf("\n");
capptr= next;
}
}