Deleted Added
full compact
cap.c (212326) cap.c (212369)
1/*-
2 * Copyright (c) 2007 Yahoo!, Inc.
3 * All rights reserved.
4 * Written by: John Baldwin <jhb@FreeBSD.org>
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 16 unchanged lines hidden (view full) ---

25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31#ifndef lint
32static const char rcsid[] =
1/*-
2 * Copyright (c) 2007 Yahoo!, Inc.
3 * All rights reserved.
4 * Written by: John Baldwin <jhb@FreeBSD.org>
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 16 unchanged lines hidden (view full) ---

25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31#ifndef lint
32static const char rcsid[] =
33 "$FreeBSD: head/usr.sbin/pciconf/cap.c 212326 2010-09-08 17:53:34Z jhb $";
33 "$FreeBSD: head/usr.sbin/pciconf/cap.c 212369 2010-09-09 18:29:48Z jhb $";
34#endif /* not lint */
35
36#include <sys/types.h>
37
38#include <err.h>
39#include <stdio.h>
40#include <sys/agpio.h>
41#include <sys/pciio.h>

--- 413 unchanged lines hidden (view full) ---

455 printf("PCI Advanced Features:%s%s",
456 cap & PCIM_PCIAFCAP_FLR ? " FLR" : "",
457 cap & PCIM_PCIAFCAP_TP ? " TP" : "");
458}
459
460void
461list_caps(int fd, struct pci_conf *p)
462{
34#endif /* not lint */
35
36#include <sys/types.h>
37
38#include <err.h>
39#include <stdio.h>
40#include <sys/agpio.h>
41#include <sys/pciio.h>

--- 413 unchanged lines hidden (view full) ---

455 printf("PCI Advanced Features:%s%s",
456 cap & PCIM_PCIAFCAP_FLR ? " FLR" : "",
457 cap & PCIM_PCIAFCAP_TP ? " TP" : "");
458}
459
460void
461list_caps(int fd, struct pci_conf *p)
462{
463 uint16_t cmd;
463 uint16_t sta;
464 uint8_t ptr, cap;
465
466 /* Are capabilities present for this device? */
464 uint8_t ptr, cap;
465
466 /* Are capabilities present for this device? */
467 cmd = read_config(fd, &p->pc_sel, PCIR_STATUS, 2);
468 if (!(cmd & PCIM_STATUS_CAPPRESENT))
467 sta = read_config(fd, &p->pc_sel, PCIR_STATUS, 2);
468 if (!(sta & PCIM_STATUS_CAPPRESENT))
469 return;
470
471 switch (p->pc_hdr & PCIM_HDRTYPE) {
469 return;
470
471 switch (p->pc_hdr & PCIM_HDRTYPE) {
472 case 0:
473 case 1:
472 case PCIM_HDRTYPE_NORMAL:
473 case PCIM_HDRTYPE_BRIDGE:
474 ptr = PCIR_CAP_PTR;
475 break;
474 ptr = PCIR_CAP_PTR;
475 break;
476 case 2:
476 case PCIM_HDRTYPE_CARDBUS:
477 ptr = PCIR_CAP_PTR_2;
478 break;
479 default:
480 errx(1, "list_caps: bad header type");
481 }
482
483 /* Walk the capability list. */
484 ptr = read_config(fd, &p->pc_sel, ptr, 1);

--- 144 unchanged lines hidden ---
477 ptr = PCIR_CAP_PTR_2;
478 break;
479 default:
480 errx(1, "list_caps: bad header type");
481 }
482
483 /* Walk the capability list. */
484 ptr = read_config(fd, &p->pc_sel, ptr, 1);

--- 144 unchanged lines hidden ---