Changeset 42127 in vbox for trunk/src/VBox/Devices/PC
- Timestamp:
- Jul 12, 2012 3:21:46 PM (13 years ago)
- Location:
- trunk/src/VBox/Devices/PC/BIOS
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS/Makefile.kmk
r42075 r42127 75 75 system.c \ 76 76 timepci.c \ 77 pcibios.c \ 77 78 ps2mouse.c \ 78 79 parallel.c \ -
trunk/src/VBox/Devices/PC/BIOS/inlines.h
r39355 r42127 69 69 parm [es di] [dx si] [cx]; 70 70 71 #ifndef __386__ 72 71 73 char __far *rep_insb(char __far *buffer, unsigned nbytes, unsigned port); 72 74 #pragma aux rep_insb = ".286" "rep insb" parm [es di] [cx] [dx] value [es di] modify exact [cx di]; … … 96 98 "xchg ax, dx" \ 97 99 parm [dx ax] value [dx ax] modify exact [dx ax] nomemory; 100 101 #endif -
trunk/src/VBox/Devices/PC/BIOS/makefile
r39372 r42127 10 10 # 11 11 !ifdef __UNIX__ 12 Q UOTE=\"12 Q=\" 13 13 !else 14 Q UOTE="14 Q=" 15 15 !endif 16 CFLAGS = -q -0 -wx -zu -s -oas -d1+ -ms 17 DEFS = -DVBOX -DVBOX_LANBOOT_SEG=0xE200 -DVBOX_VERSION_STRING=$(QUOTE)0.9$(QUOTE) & 16 CFLAGS = -q -0 -wx -zu -s -oas -d1+ -ms 17 CFLAGS32 = -q -wx -zu -s -oas -d1+ -nt=BIOS32 -nd=BIOS32 18 19 DEFS = -DVBOX -DVBOX_LANBOOT_SEG=0xE200 -DVBOX_VERSION_STRING=$(Q)0.9$(Q) & 18 20 -DVBOX_WITH_SCSI -DVBOX_WITH_AHCI 19 21 20 22 AFLAGS = -q -0 -wx 21 23 22 INCLS = -I$(Q UOTE)../../../../../include$(QUOTE)24 INCLS = -I$(Q)../../../../../include$(Q) 23 25 24 26 .c.obj : .autodepend … … 31 33 keyboard.obj disk.obj serial.obj system.obj timepci.obj & 32 34 ps2mouse.obj parallel.obj logo.obj scsi.obj ahci.obj & 33 pci util.obj vds.obj pcibio32.obj orgs.obj35 pcibios.obj pciutil.obj vds.obj pcibio32.obj pci32.obj orgs.obj 34 36 35 37 vbxbios.rom : vbxbios.bin … … 43 45 clname CODE & 44 46 segment _TEXT segaddr=0xF000 offset=0x1600 & 45 segment BIOS32 segaddr=0xF000 offset=0xD E00 &47 segment BIOS32 segaddr=0xF000 offset=0xDB00 & 46 48 segment BIOSSEG segaddr=0xF000 offset=0xE000 & 47 49 file { $(OBJS) } & … … 52 54 wcc -fo=.obj $(INCLS) $(CFLAGS) $(DEFS) -DVBOX_PC_BIOS $< 53 55 56 pci32.obj : pci32.c .autodepend 57 wcc386 -fo=.obj $(INCLS) $(DEFS) $(CFLAGS32) $< 58 54 59 clean : .symbolic 55 60 @rm -f *.obj *.err -
trunk/src/VBox/Devices/PC/BIOS/orgs.asm
r41655 r42127 111 111 extrn _int1a_function:near 112 112 extrn _int1a_function_pci:near 113 extrn _pci16_function:near 113 114 extrn _int70_function:near 114 115 extrn _int74_function:near … … 1645 1646 jne int1a_normal 1646 1647 1648 if 0 1647 1649 call pcibios_real 1648 1650 jc pcibios_error … … 1660 1662 popa 1661 1663 iret 1664 else 1665 push es 1666 push ds 1667 C_SETUP 1668 .386 1669 pushad 1670 call _pci16_function 1671 popad 1672 .286 1673 pop ds 1674 pop es 1675 iret 1676 endif 1662 1677 1663 1678 int1a_normal: -
trunk/src/VBox/Devices/PC/BIOS/pcibio32.asm
r41991 r42127 108 108 align 16 109 109 pcibios_protected: 110 if 1 111 ;; The old implementation of pcibios_protected will eventually go, 112 ;; replaced by C code. 113 else 114 115 extrn _pci32_function:near 116 117 pushfd 118 pushad 119 call _pci32_function 120 popad 121 popfd 122 retf 123 endif 110 124 pushfd 111 125 cli -
trunk/src/VBox/Devices/PC/BIOS/pcibios.c
r42030 r42127 63 63 #define BP r.gr.u.r16.bp 64 64 #define SP r.gr.u.r16.sp 65 #define FLAGS r.ra.flags.u.r16.flags66 65 #define EAX r.gr.u.r32.eax 67 66 #define EBX r.gr.u.r32.ebx … … 90 89 #define PCI_CFG_ADDR 0xCF8 91 90 #define PCI_CFG_DATA 0xCFC 91 92 #ifdef __386__ 93 94 #define PCIxx(x) pci32_##x 95 96 /* The stack layout is different in 32-bit mode. */ 97 typedef struct { 98 pushad_regs_t gr; 99 uint32_t flags; 100 } pci_regs_t; 101 102 #define FLAGS r.flags 103 104 /* In 32-bit mode, don't do any output; not technically impossible but needs 105 * a lot of extra code. 106 */ 107 #undef BX_INFO 108 #define BX_INFO(...) 109 #undef BX_DEBUG_PCI 110 #define BX_DEBUG_PCI(...) 111 112 #else 113 114 #define PCIxx(x) pci16_##x 115 116 typedef struct { 117 pushad_regs_t gr; 118 uint16_t es; 119 uint16_t ds; 120 iret_addr_t ra; 121 } pci_regs_t; 122 123 #define FLAGS r.ra.flags.u.r16.flags 124 125 #endif 126 127 #ifdef __386__ 128 129 /* 32-bit code can just use the compiler intrinsics. */ 130 extern unsigned inpd(unsigned port); 131 extern unsigned outpd(unsigned port, unsigned value); 132 #pragma intrinsic(inpd,outpd) 133 134 #else 92 135 93 136 //@todo: merge with AHCI code … … 113 156 parm [dx] [cx ax] modify nomemory; 114 157 158 #endif 159 115 160 /* Write the CONFIG_ADDRESS register to prepare for data access. Requires 116 161 * the register offset to be DWORD aligned (low two bits clear). Warning: … … 131 176 * This is largely a wrapper to avoid excessive inlining. 132 177 */ 133 void pci16_select_reg(uint16_t bus_dev_fn, uint16_t ofs)178 void PCIxx(select_reg)(uint16_t bus_dev_fn, uint16_t ofs) 134 179 { 135 180 pci16_w_addr(bus_dev_fn, ofs & ~3, PCI_CFG_ADDR); 136 181 } 137 182 183 /* Selected configuration space offsets. */ 138 184 #define PCI_VEN_ID 0x00 139 185 #define PCI_DEV_ID 0x02 … … 141 187 #define PCI_CLASS_CODE 0x09 142 188 #define PCI_HEADER_TYPE 0x0E 143 189 #define PCI_BRIDGE_SUBORD 0x1A 190 191 /* To avoid problems with 16-bit code, we reserve the last possible 192 * bus/dev/fn combination (65,535). Upon reaching this location, the 193 * probing will end. 194 */ 195 #define INDEX_NOT_FOUND 0xFFFF 144 196 145 197 /* Find a specified PCI device, either by vendor+device ID or class. … … 151 203 * non-present devices. 152 204 */ 153 uint16_t pci16_find_device(uint32_t search_item, uint16_t index, int search_class)205 uint16_t PCIxx(find_device)(uint32_t search_item, uint16_t index, int search_class) 154 206 { 155 207 uint32_t data; … … 157 209 uint8_t max_bus; 158 210 uint8_t hdr_type; 211 uint8_t subordinate; 159 212 int step; 160 213 int found; … … 179 232 */ 180 233 if ((bus_dev_fn & 7) == 0) { 181 pci16_select_reg(bus_dev_fn, PCI_HEADER_TYPE);234 PCIxx(select_reg)(bus_dev_fn, PCI_HEADER_TYPE); 182 235 hdr_type = inp(PCI_CFG_DATA + (PCI_HEADER_TYPE & 3)); 183 236 if (hdr_type == 0xFF) { … … 196 249 * there will be only the primary bus (i.e. bus 0) and we can avoid 197 250 * looking at the remaining 255 theoretically present buses. This check 198 * only needs to be done on the primary bus (bridges must report all199 * bridges behind them).251 * only needs to be done on the primary bus, since bridges must report 252 * all bridges potentially behind them. 200 253 */ 201 254 if ((hdr_type & 7) == 1 && (bus_dev_fn >> 8) == 0) { 255 /* Read the subordinate (last) bridge number. */ 256 PCIxx(select_reg)(bus_dev_fn, PCI_BRIDGE_SUBORD); 257 subordinate = inp(PCI_CFG_DATA + (PCI_BRIDGE_SUBORD & 3)); 258 if (subordinate > max_bus) 259 max_bus = subordinate; 202 260 } 203 261 204 262 /* Select the appropriate register. */ 205 pci16_select_reg(bus_dev_fn, search_class ? PCI_REV_ID : PCI_VEN_ID);263 PCIxx(select_reg)(bus_dev_fn, search_class ? PCI_REV_ID : PCI_VEN_ID); 206 264 data = inpd(PCI_CFG_DATA); 207 265 found = 0; … … 226 284 } while ((bus_dev_fn >> 8) <= max_bus); 227 285 228 if (index == ~0)286 if (index == INDEX_NOT_FOUND) 229 287 BX_DEBUG_PCI("PCI: Device found (%02X:%%02X:%01X)\n", bus_dev_fn >> 8, 230 288 bus_dev_fn >> 3 & 31, bus_dev_fn & 7); 231 289 232 return index == ~0 ? bus_dev_fn : ~0;290 return index == INDEX_NOT_FOUND ? bus_dev_fn : INDEX_NOT_FOUND; 233 291 } 234 292 235 void BIOSCALL pci16_function(volatile pci_regs_t r)293 void BIOSCALL PCIxx(function)(volatile pci_regs_t r) 236 294 { 237 295 uint16_t device; … … 254 312 * be easily detected. 255 313 */ 256 if (DX == ~0) {314 if (DX == 0xFFFF) { 257 315 SET_AH(BAD_VENDOR_ID); 258 316 SET_CF(); 259 317 } else { 260 device = pci16_find_device(DX | (uint32_t)CX << 16, SI, 0);261 if (device == ~0) {318 device = PCIxx(find_device)(DX | (uint32_t)CX << 16, SI, 0); 319 if (device == INDEX_NOT_FOUND) { 262 320 SET_AH(DEVICE_NOT_FOUND); 263 321 SET_CF(); … … 268 326 break; 269 327 case FIND_PCI_CLASS_CODE: 270 device = pci16_find_device(ECX, SI, 1);271 if (device == ~0) {328 device = PCIxx(find_device)(ECX, SI, 1); 329 if (device == INDEX_NOT_FOUND) { 272 330 SET_AH(DEVICE_NOT_FOUND); 273 331 SET_CF(); … … 286 344 SET_CF(); 287 345 } else { 288 pci16_select_reg(BX, DI);346 PCIxx(select_reg)(BX, DI); 289 347 switch (GET_AL()) { 290 348 case READ_CONFIG_BYTE:
Note:
See TracChangeset
for help on using the changeset viewer.