If I remember correctly, ZGL split his forces into two (actually three, one led by ZhaoYun) because his main force faced a Wei general (can't remember his name) in Chen Chuang? which was a stalemale. ZGL send Ma Su to Jieting to protect Shu army's supply depot. Sima Yi wasn't in charge of the Wei army at all. It was Zhang He, who commanded the whole campaign. Zhang He defeated Ma Su in Jieting and threatened to cut off Shu army's supply. ZGL was forced to retreat.
On a side note, Liu Bei strongly opposed to put Ma Su on important post but ZGL ignored his advice. Liu Bei wanted ZGL to use Wei Yan but for some reason ZGL just hated Wei Yan. The reaction of ZGL toward Ma Su's war plan was also questionable (sending little troops as reinforcement for example).
If you are interested in the battle of Jieting I would recommend a website for you to check. I hope that it is still alive and it has maps to show the marching routes of ZGL's northern campaigns. Probably tomorrow if i have time.