SayoriOS 0.3.3

vmware.c
См. документацию.
1
9 #include <io/ports.h>
10
11 uint8_t vmware_busnum, vmware_slot, vmware_func;
12
13 #define VMWARE_VENDORID 0x15AD
14 #define VMWARE_DEVICEID 0x0405
15
16 // Регистры VMware
17 #define SVGA_REG_ID 0x00
18 #define SVGA_REG_ENABLE 0x01
19 #define SVGA_REG_WIDTH 0x02
20 #define SVGA_REG_HEIGHT 0x03
21 #define SVGA_REG_MAX_WIDTH 0x04
22 #define SVGA_REG_MAX_HEIGHT 0x05
23 #define SVGA_REG_DEPTH 0x06
24 #define SVGA_REG_BPP 0x07
25 #define SVGA_REG_PSEUDOCOLOR 0x08
26 #define SVGA_REG_RED_MASK 0x09
27 #define SVGA_REG_GREEN_MASK 0x0A
28 #define SVGA_REG_BLUE_MASK 0x0B
29 #define SVGA_REG_BYTES_PER_LINE 0x0C
30 #define SVGA_REG_FB_START 0x0D
31 #define SVGA_REG_FB_OFFSET 0x0E
32 #define SVGA_REG_VRAM_SIZE 0x0F
33 #define SVGA_REG_FB_SIZE 0x10
34 #define SVGA_REG_CAPABILITIES 0x11
35 #define SVGA_REG_FIFO_START 0x12
36 #define SVGA_REG_FIFO_SIZE 0x13
37
38 void drv_video_vmware(){
39 qemu_log("vmware: init");
40
41 pci_find_device(VMWARE_VENDORID, VMWARE_DEVICEID, &vmware_busnum, &vmware_slot, &vmware_func);
42 const uint16_t devnum = pci_get_device(vmware_busnum, vmware_slot, vmware_func);
43
44 qemu_log("VMWARE ID: %d (%x)", devnum, devnum);
45
46 if(devnum == PCI_VENDOR_NO_DEVICE) {
47 qemu_log("VMWARE VideoID not connected!");
48 return;
49 }else{
50 qemu_log("Detected VMWARE VideoID");
51 }
52
53 }
pci_find_device
void pci_find_device(uint16_t vendor, uint16_t device, uint8_t *bus_ret, uint8_t *slot_ret, uint8_t *func_ret)
[PCI] Поиск устройства по ID-поставшика и устройства
Definition: pci.c:362
pci_get_device
uint16_t pci_get_device(uint8_t bus, uint8_t slot, uint8_t function)
[PCI] Получение ID-Устройства
Definition: pci.c:269