the diagram on page 8 of the G540 manual just shows home switches for 4 axis
G540 REV8 Manual.pdf
assuming your using mechanical micro switches not electronic proximity switches
you can add another normally closed switch to the switches shown in the G540 manual
note - the switches labeled home switches act as both home & limit switches
when homing mach 3 will not trigger an e-stop even though the same input is used
for both home and limit functions
John
PS
Homann designs wiring diagram on 2 PDF pages