2014年12月8日 星期一

cpu smbus access

B:X|D:15|F:0 config 0x188 and then 0x184 0x188 -> 31:28 1010 specifies EEPROM’s. 0x188 -> 27 1’ = Clock signal is released high, allowing normal operation of CMD. 0x184 -> 23:16 Offset. 0x184 -> 31 SMB_CMD_TRIGGERCMD trigger 0x184 -> 29 SMB_WORD_ACCESS (0:byte, 1:word) 0x184 -> 28:27 SMB_WRT_PNTR (00:read. 01:write) 0x184 -> 26:24 SMB_SA. slave address

struct mapping

__attribute__((packed)); need to be added otherwise it may cause memory alignment issue #include #include #include #include #include #include #include #include #include #include #include struct test { uint8_t sig[4]; uint8_t len; uint8_t mic_sig[5]; uint32_t vid; uint16_t did; uint16_t idxx; } __attribute__((packed)); int main(){ uint8_t test_string[]={'K','I','D','O',0x40,'M','i','T','A','C',0x86,0x80,0x02,0x3c,0x86,0x81,0x01,0x3c}; struct test *info=(struct test *)test_string; printf("sig=%.4s len=0x%x mic_sig=%.5s vid=0x%04x did=0x%04x idxx=0x%04x\n" ,info->sig, info->len, info->mic_sig, info->vid, info->did, info->idxx); return 0; }

2014年12月7日 星期日

map pci configure space to memory

1: seek for RSDP (SIG: "RSD PTR ") --  main BIOS area below 1 MB
2: seek for RSDT (SIG: "RSDT")
3: determine table amount. -- (RSDT len -header)/ sizeof(table type: 32/64bits)
4: find MCFG table and check 0x24 - 0x28 <-- address="" configuration="" nbsp="" p="">
http://wiki.osdev.org/PCI_Express
http://wiki.osdev.org/RSDP
http://wiki.osdev.org/RSDT

After determining the MMIO base address and the total number of busses in the address space, you can read from the extended configuration address space. To access a specific register, you must use the following formula: Address = MMIO_BASE + { bus number[27:20], device number[19:15], function number[14:12], extended register number[11:8], register number[7:2], offset [1:0] }.

display scsi device type


sg_map -x

 -x     after  each  active  sg  device  name  is  displayed  there  are  five digits:
http://en.wikipedia.org/wiki/SCSI_Peripheral_Device_Type

cat /proc/scsi/scsi