Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/pci_ahci.c
Show First 20 Lines • Show All 2,416 Lines • ▼ Show 20 Lines | pci_ahci_hd_legacy_config(nvlist_t *nvl, const char *opts) | ||||
ports_nvl = create_relative_config_node(nvl, "port"); | ports_nvl = create_relative_config_node(nvl, "port"); | ||||
return (pci_ahci_legacy_config_port(ports_nvl, 0, "hd", opts)); | return (pci_ahci_legacy_config_port(ports_nvl, 0, "hd", opts)); | ||||
} | } | ||||
static int | static int | ||||
pci_ahci_init(struct vmctx *ctx __unused, struct pci_devinst *pi, nvlist_t *nvl) | pci_ahci_init(struct vmctx *ctx __unused, struct pci_devinst *pi, nvlist_t *nvl) | ||||
{ | { | ||||
char bident[sizeof("XX:XX:XX")]; | char bident[sizeof("XXX:XXX:XXX")]; | ||||
char node_name[sizeof("XX")]; | char node_name[sizeof("XX")]; | ||||
struct blockif_ctxt *bctxt; | struct blockif_ctxt *bctxt; | ||||
struct pci_ahci_softc *sc; | struct pci_ahci_softc *sc; | ||||
int atapi, ret, slots, p; | int atapi, ret, slots, p; | ||||
MD5_CTX mdctx; | MD5_CTX mdctx; | ||||
u_char digest[16]; | u_char digest[16]; | ||||
const char *path, *type, *value; | const char *path, *type, *value; | ||||
nvlist_t *ports_nvl, *port_nvl; | nvlist_t *ports_nvl, *port_nvl; | ||||
Show All 30 Lines | if (strcmp(type, "hd") == 0) | ||||
atapi = 0; | atapi = 0; | ||||
else | else | ||||
atapi = 1; | atapi = 1; | ||||
/* | /* | ||||
* Attempt to open the backing image. Use the PCI slot/func | * Attempt to open the backing image. Use the PCI slot/func | ||||
* and the port number for the identifier string. | * and the port number for the identifier string. | ||||
*/ | */ | ||||
snprintf(bident, sizeof(bident), "%d:%d:%d", pi->pi_slot, | snprintf(bident, sizeof(bident), "%u:%u:%u", pi->pi_slot, | ||||
pi->pi_func, p); | pi->pi_func, p); | ||||
bctxt = blockif_open(port_nvl, bident); | bctxt = blockif_open(port_nvl, bident); | ||||
if (bctxt == NULL) { | if (bctxt == NULL) { | ||||
sc->ports = p; | sc->ports = p; | ||||
ret = 1; | ret = 1; | ||||
goto open_fail; | goto open_fail; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 260 Lines • Show Last 20 Lines |