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_dev_name_s, (message *mp) );
FORWARD _PROTOTYPE( void do_slot_name, (message *mp) ); FORWARD _PROTOTYPE( void do_slot_name, (message *mp) );
FORWARD _PROTOTYPE( void do_slot_name_s, (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_reserve, (message *mp) );
FORWARD _PROTOTYPE( void do_attr_r8, (message *mp) ); FORWARD _PROTOTYPE( void do_attr_r8, (message *mp) );
FORWARD _PROTOTYPE( void do_attr_r16, (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_RESCAN: do_rescan_bus(&m); break;
case BUSC_PCI_DEV_NAME_S: do_dev_name_s(&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_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; case PROC_EVENT: do_sig_handler(); break;
default: default:
printf("PCI: got message from %d, type %d\n", 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; message *mp;
{ {
int i, r, gid; int i, r, gid;
if (mp->m_source != RS_PROC_NR) 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); reply(mp, EPERM);
return; return;
} }
@ -398,7 +400,7 @@ message *mp;
} }
if (i >= NR_DRIVERS) if (i >= NR_DRIVERS)
{ {
printf("PCI: do_acl: table is full\n"); printf("PCI: do_set_acl: table is full\n");
reply(mp, ENOMEM); reply(mp, ENOMEM);
return; return;
} }
@ -409,7 +411,7 @@ message *mp;
sizeof(acl[i].acl), D); sizeof(acl[i].acl), D);
if (r != OK) if (r != OK)
{ {
printf("PCI: do_acl: safecopyfrom failed\n"); printf("PCI: do_set_acl: safecopyfrom failed\n");
reply(mp, r); reply(mp, r);
return; return;
} }
@ -422,6 +424,42 @@ message *mp;
reply(mp, OK); 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) PRIVATE void do_reserve(mp)
message *mp; message *mp;
{ {

View file

@ -715,7 +715,7 @@ printf("probe_bus(%d)\n", busind);
vid, did, headt, sts); vid, did, headt, sts);
#endif #endif
if (vid == NO_VID) if (vid == NO_VID && did == NO_VID)
{ {
if (func == 0) if (func == 0)
break; /* Nothing here */ break; /* Nothing here */
@ -2420,7 +2420,7 @@ u16_t value;
PRIVATE void print_capabilities(devind) PRIVATE void print_capabilities(devind)
int devind; int devind;
{ {
u8_t status, capptr, type, next; u8_t status, capptr, type, next, subtype;
char *str; char *str;
/* Check capabilities bit in the device status register */ /* Check capabilities bit in the device status register */
@ -2442,12 +2442,24 @@ int devind;
case 5: str= "Message Signaled Interrupts"; break; case 5: str= "Message Signaled Interrupts"; break;
case 6: str= "CompactPCI Hot Swap"; break; case 6: str= "CompactPCI Hot Swap"; break;
case 8: str= "AMD HyperTransport"; break; case 8: str= "AMD HyperTransport"; break;
case 0xf: str= "AMD I/O MMU"; break; case 0xf: str= "Secure Device"; break;
defuault: str= "(unknown type)"; 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); 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; capptr= next;
} }
} }