Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/pci/pci.c
Show First 20 Lines • Show All 3,347 Lines • ▼ Show 20 Lines | |||||
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) | #if defined(NEW_PCIB) && defined(PCI_RES_BUS) | ||||
static void | static void | ||||
pci_reserve_secbus(device_t bus, device_t dev, pcicfgregs *cfg, | pci_reserve_secbus(device_t bus, device_t dev, pcicfgregs *cfg, | ||||
struct resource_list *rl) | struct resource_list *rl) | ||||
{ | { | ||||
struct resource *res; | struct resource *res; | ||||
char *cp; | char *cp; | ||||
u_long start, end, count; | rman_res_t start, end, count; | ||||
int rid, sec_bus, sec_reg, sub_bus, sub_reg, sup_bus; | int rid, sec_bus, sec_reg, sub_bus, sub_reg, sup_bus; | ||||
switch (cfg->hdrtype & PCIM_HDRTYPE) { | switch (cfg->hdrtype & PCIM_HDRTYPE) { | ||||
case PCIM_HDRTYPE_BRIDGE: | case PCIM_HDRTYPE_BRIDGE: | ||||
sec_reg = PCIR_SECBUS_1; | sec_reg = PCIR_SECBUS_1; | ||||
sub_reg = PCIR_SUBBUS_1; | sub_reg = PCIR_SUBBUS_1; | ||||
break; | break; | ||||
case PCIM_HDRTYPE_CARDBUS: | case PCIM_HDRTYPE_CARDBUS: | ||||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | pci_reserve_secbus(device_t bus, device_t dev, pcicfgregs *cfg, | ||||
} | } | ||||
clear: | clear: | ||||
PCI_WRITE_CONFIG(bus, dev, sec_reg, 0, 1); | PCI_WRITE_CONFIG(bus, dev, sec_reg, 0, 1); | ||||
PCI_WRITE_CONFIG(bus, dev, sub_reg, 0, 1); | PCI_WRITE_CONFIG(bus, dev, sub_reg, 0, 1); | ||||
} | } | ||||
static struct resource * | static struct resource * | ||||
pci_alloc_secbus(device_t dev, device_t child, int *rid, u_long start, | pci_alloc_secbus(device_t dev, device_t child, int *rid, rman_res_t start, | ||||
u_long end, u_long count, u_int flags) | rman_res_t end, rman_res_t count, u_int flags) | ||||
{ | { | ||||
struct pci_devinfo *dinfo; | struct pci_devinfo *dinfo; | ||||
pcicfgregs *cfg; | pcicfgregs *cfg; | ||||
struct resource_list *rl; | struct resource_list *rl; | ||||
struct resource *res; | struct resource *res; | ||||
int sec_reg, sub_reg; | int sec_reg, sub_reg; | ||||
dinfo = device_get_ivars(child); | dinfo = device_get_ivars(child); | ||||
▲ Show 20 Lines • Show All 1,147 Lines • ▼ Show 20 Lines | db_printf("%s%d@pci%d:%d:%d:%d:\tclass=0x%06x card=0x%08x " | ||||
(p->pc_device << 16) | p->pc_vendor, | (p->pc_device << 16) | p->pc_vendor, | ||||
p->pc_revid, p->pc_hdr); | p->pc_revid, p->pc_hdr); | ||||
} | } | ||||
} | } | ||||
#endif /* DDB */ | #endif /* DDB */ | ||||
static struct resource * | static struct resource * | ||||
pci_reserve_map(device_t dev, device_t child, int type, int *rid, | pci_reserve_map(device_t dev, device_t child, int type, int *rid, | ||||
u_long start, u_long end, u_long count, u_int num, u_int flags) | rman_res_t start, rman_res_t end, rman_res_t count, u_int num, | ||||
u_int flags) | |||||
{ | { | ||||
struct pci_devinfo *dinfo = device_get_ivars(child); | struct pci_devinfo *dinfo = device_get_ivars(child); | ||||
struct resource_list *rl = &dinfo->resources; | struct resource_list *rl = &dinfo->resources; | ||||
struct resource *res; | struct resource *res; | ||||
struct pci_map *pm; | struct pci_map *pm; | ||||
pci_addr_t map, testval; | pci_addr_t map, testval; | ||||
int mapsize; | int mapsize; | ||||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | pci_reserve_map(device_t dev, device_t child, int type, int *rid, | ||||
map = rman_get_start(res); | map = rman_get_start(res); | ||||
pci_write_bar(child, pm, map); | pci_write_bar(child, pm, map); | ||||
out: | out: | ||||
return (res); | return (res); | ||||
} | } | ||||
struct resource * | struct resource * | ||||
pci_alloc_multi_resource(device_t dev, device_t child, int type, int *rid, | pci_alloc_multi_resource(device_t dev, device_t child, int type, int *rid, | ||||
u_long start, u_long end, u_long count, u_long num, u_int flags) | rman_res_t start, rman_res_t end, rman_res_t count, u_long num, | ||||
u_int flags) | |||||
{ | { | ||||
struct pci_devinfo *dinfo; | struct pci_devinfo *dinfo; | ||||
struct resource_list *rl; | struct resource_list *rl; | ||||
struct resource_list_entry *rle; | struct resource_list_entry *rle; | ||||
struct resource *res; | struct resource *res; | ||||
pcicfgregs *cfg; | pcicfgregs *cfg; | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | #endif | ||||
} | } | ||||
} | } | ||||
return (resource_list_alloc(rl, dev, child, type, rid, | return (resource_list_alloc(rl, dev, child, type, rid, | ||||
start, end, count, flags)); | start, end, count, flags)); | ||||
} | } | ||||
struct resource * | struct resource * | ||||
pci_alloc_resource(device_t dev, device_t child, int type, int *rid, | pci_alloc_resource(device_t dev, device_t child, int type, int *rid, | ||||
u_long start, u_long end, u_long count, u_int flags) | rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | ||||
{ | { | ||||
#ifdef PCI_IOV | #ifdef PCI_IOV | ||||
struct pci_devinfo *dinfo; | struct pci_devinfo *dinfo; | ||||
#endif | #endif | ||||
if (device_get_parent(child) != dev) | if (device_get_parent(child) != dev) | ||||
return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child, | return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child, | ||||
type, rid, start, end, count, flags)); | type, rid, start, end, count, flags)); | ||||
▲ Show 20 Lines • Show All 696 Lines • Show Last 20 Lines |