Changeset 70774 in vbox for trunk/src/VBox
- Timestamp:
- Jan 28, 2018 9:46:57 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Serial/DevSerial.cpp
r70097 r70774 1144 1144 1145 1145 /** 1146 * @interface_method_impl{PDMDEVREG,pfnAttach} 1147 */ 1148 static DECLCALLBACK(int) serialR3Attach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags) 1149 { 1150 RT_NOREF(iLUN, fFlags); 1151 PDEVSERIAL pThis = PDMINS_2_DATA(pDevIns, PDEVSERIAL); 1152 1153 int rc = PDMDevHlpDriverAttach(pDevIns, 0, &pThis->IBase, &pThis->pDrvBase, "Serial Char"); 1154 if (RT_SUCCESS(rc)) 1155 { 1156 pThis->pDrvChar = PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMICHARCONNECTOR); 1157 if (!pThis->pDrvChar) 1158 { 1159 AssertLogRelMsgFailed(("Configuration error: instance %d has no char interface!\n", pDevIns->iInstance)); 1160 return VERR_PDM_MISSING_INTERFACE; 1161 } 1162 } 1163 else if (rc == VERR_PDM_NO_ATTACHED_DRIVER) 1164 { 1165 pThis->pDrvBase = NULL; 1166 pThis->pDrvChar = NULL; 1167 rc = VINF_SUCCESS; 1168 LogRel(("Serial%d: no unit\n", pDevIns->iInstance)); 1169 } 1170 else /* Don't call VMSetError here as we assume that the driver already set an appropriate error */ 1171 LogRel(("Serial%d: Failed to attach to char driver. rc=%Rrc\n", pDevIns->iInstance, rc)); 1172 1173 return rc; 1174 } 1175 1176 1177 /** 1178 * @interface_method_impl{PDMDEVREG,pfnDetach} 1179 */ 1180 static DECLCALLBACK(void) serialR3Detach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags) 1181 { 1182 RT_NOREF(iLUN, fFlags); 1183 PDEVSERIAL pThis = PDMINS_2_DATA(pDevIns, PDEVSERIAL); 1184 1185 /* Zero out important members. */ 1186 pThis->pDrvBase = NULL; 1187 pThis->pDrvChar = NULL; 1188 } 1189 1190 1191 /** 1146 1192 * @interface_method_impl{PDMDEVREG,pfnDestruct} 1147 1193 */ … … 1362 1408 /* 1363 1409 * Attach the char driver and get the interfaces. 1364 * For now no run-time changes are supported.1365 1410 */ 1366 1411 rc = PDMDevHlpDriverAttach(pDevIns, 0, &pThis->IBase, &pThis->pDrvBase, "Serial Char"); … … 1433 1478 NULL, 1434 1479 /* pfnAttach */ 1435 NULL,1480 serialR3Attach, 1436 1481 /* pfnDetach */ 1437 NULL,1482 serialR3Detach, 1438 1483 /* pfnQueryInterface. */ 1439 1484 NULL,
Note:
See TracChangeset
for help on using the changeset viewer.